mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-22 03:26:09 +03:00
more web cleanup
This commit is contained in:
parent
6742c77378
commit
b60c36054f
@ -20,7 +20,6 @@ export { FileProvider } from './fileProvider'
|
||||
export { AppService } from '../services/app.service'
|
||||
export { ConfigService } from '../services/config.service'
|
||||
export { DockingService, Screen } from '../services/docking.service'
|
||||
export { ElectronService } from '../services/electron.service'
|
||||
export { Logger, ConsoleLogger, LogService } from '../services/log.service'
|
||||
export { HomeBaseService } from '../services/homeBase.service'
|
||||
export { HotkeysService } from '../services/hotkeys.service'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { PlatformService, LogService, UpdaterService, DockingService, HostAppService, ThemesService, Platform, AppService, ConfigService, ElectronService, WIN_BUILD_FLUENT_BG_SUPPORTED, isWindowsBuild, HostWindowService, HotkeyProvider, ConfigProvider, FileProvider } from 'terminus-core'
|
||||
import { PlatformService, LogService, UpdaterService, DockingService, HostAppService, ThemesService, Platform, AppService, ConfigService, WIN_BUILD_FLUENT_BG_SUPPORTED, isWindowsBuild, HostWindowService, HotkeyProvider, ConfigProvider, FileProvider } from 'terminus-core'
|
||||
import { TerminalColorSchemeProvider } from 'terminus-terminal'
|
||||
|
||||
import { HyperColorSchemes } from './colorSchemes'
|
||||
@ -11,6 +11,7 @@ import { ElectronDockingService } from './services/docking.service'
|
||||
import { ElectronHostWindow } from './services/hostWindow.service'
|
||||
import { ElectronFileProvider } from './services/fileProvider.service'
|
||||
import { ElectronHostAppService } from './services/hostApp.service'
|
||||
import { ElectronService } from './services/electron.service'
|
||||
import { ElectronHotkeyProvider } from './hotkeys'
|
||||
import { ElectronConfigProvider } from './config'
|
||||
|
||||
@ -116,4 +117,4 @@ export default class ElectronModule {
|
||||
}
|
||||
}
|
||||
|
||||
export { ElectronHostWindow, ElectronHostAppService }
|
||||
export { ElectronHostWindow, ElectronHostAppService, ElectronService }
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Injectable, NgZone } from '@angular/core'
|
||||
import type { Display } from 'electron'
|
||||
import { ConfigService, ElectronService, DockingService, Screen, PlatformService } from 'terminus-core'
|
||||
import { ConfigService, DockingService, Screen, PlatformService } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
import { ElectronHostWindow, Bounds } from './hostWindow.service'
|
||||
|
||||
@Injectable()
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { promises as fs } from 'fs'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ElectronService, FileProvider } from 'terminus-core'
|
||||
import { FileProvider } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
import { ElectronHostWindow } from './hostWindow.service'
|
||||
|
||||
@Injectable()
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Injectable, NgZone, Injector } from '@angular/core'
|
||||
import { ElectronService, isWindowsBuild, WIN_BUILD_FLUENT_BG_SUPPORTED, HostAppService, Platform, CLIHandler } from 'terminus-core'
|
||||
import { isWindowsBuild, WIN_BUILD_FLUENT_BG_SUPPORTED, HostAppService, Platform, CLIHandler } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { BrowserWindow, TouchBar } from 'electron'
|
||||
import { Injectable, Inject, NgZone } from '@angular/core'
|
||||
import { BootstrapData, BOOTSTRAP_DATA, ElectronService, HostWindowService } from 'terminus-core'
|
||||
import { BootstrapData, BOOTSTRAP_DATA, HostWindowService } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
|
||||
export interface Bounds {
|
||||
x: number
|
||||
|
@ -2,7 +2,8 @@ import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as winston from 'winston'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ConsoleLogger, Logger, ElectronService } from 'terminus-core'
|
||||
import { ConsoleLogger, Logger } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
|
||||
const initializeWinston = (electron: ElectronService) => {
|
||||
const logDirectory = electron.app.getPath('userData')
|
||||
|
@ -5,7 +5,8 @@ import * as os from 'os'
|
||||
import promiseIpc from 'electron-promise-ipc'
|
||||
import { execFile } from 'mz/child_process'
|
||||
import { Injectable, NgZone } from '@angular/core'
|
||||
import { PlatformService, ClipboardContent, HostAppService, Platform, ElectronService, MenuItemOptions, MessageBoxOptions, MessageBoxResult, FileUpload, FileDownload, FileUploadOptions, wrapPromise } from 'terminus-core'
|
||||
import { PlatformService, ClipboardContent, HostAppService, Platform, MenuItemOptions, MessageBoxOptions, MessageBoxResult, FileUpload, FileDownload, FileUploadOptions, wrapPromise } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
import { ElectronHostWindow } from './hostWindow.service'
|
||||
const fontManager = require('fontmanager-redux') // eslint-disable-line
|
||||
|
||||
|
@ -2,7 +2,8 @@ import * as path from 'path'
|
||||
import * as fs from 'mz/fs'
|
||||
import { exec } from 'mz/child_process'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ElectronService, HostAppService, Platform } from 'terminus-core'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
|
||||
/* eslint-disable block-scoped-var */
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { SegmentedControlSegment, TouchBarSegmentedControl } from 'electron'
|
||||
import { Injectable, NgZone } from '@angular/core'
|
||||
import { AppService, HostAppService, Platform, ElectronService } from 'terminus-core'
|
||||
import { AppService, HostAppService, Platform } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
import { ElectronHostWindow } from './hostWindow.service'
|
||||
|
||||
/** @hidden */
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import axios from 'axios'
|
||||
|
||||
import { Logger, LogService, ElectronService, ConfigService, UpdaterService, PlatformService } from 'terminus-core'
|
||||
import { Logger, LogService, ConfigService, UpdaterService, PlatformService } from 'terminus-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
|
||||
const UPDATES_URL = 'https://api.github.com/repos/eugeny/terminus/releases/latest'
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ToolbarButtonProvider, ToolbarButton, ElectronService, ConfigService, SelectorOption, AppService } from 'terminus-core'
|
||||
import { ToolbarButtonProvider, ToolbarButton, ConfigService, SelectorOption, AppService } from 'terminus-core'
|
||||
import { ElectronService } from 'terminus-electron'
|
||||
|
||||
import { TerminalService } from './services/terminal.service'
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { ConfigService, ElectronService, HostAppService, Platform, WIN_BUILD_CONPTY_SUPPORTED, WIN_BUILD_CONPTY_STABLE, isWindowsBuild } from 'terminus-core'
|
||||
import { ElectronHostWindow } from 'terminus-electron'
|
||||
import { ConfigService, HostAppService, Platform, WIN_BUILD_CONPTY_SUPPORTED, WIN_BUILD_CONPTY_STABLE, isWindowsBuild } from 'terminus-core'
|
||||
import { ElectronService, ElectronHostWindow } from 'terminus-electron'
|
||||
import { EditProfileModalComponent } from './editProfileModal.component'
|
||||
import { Shell, Profile } from '../api'
|
||||
import { TerminalService } from '../services/terminal.service'
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { NgZone, Injectable } from '@angular/core'
|
||||
import { ElectronService, ConfigService, HostAppService, Platform } from 'terminus-core'
|
||||
import { ConfigService, HostAppService, Platform } from 'terminus-core'
|
||||
import { ElectronService } from 'terminus-electron'
|
||||
import { TerminalService } from './terminal.service'
|
||||
|
||||
/** @hidden */
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ElectronService, WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from 'terminus-core'
|
||||
import { WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from 'terminus-core'
|
||||
import { ElectronService } from 'terminus-electron'
|
||||
import { SessionOptions } from '../api'
|
||||
|
||||
/** @hidden */
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform, ElectronService } from 'terminus-core'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
import { ElectronService } from 'terminus-electron'
|
||||
|
||||
import { ShellProvider, Shell } from '../api'
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
input(type='radio', ngbButton, [value]='"publicKey"')
|
||||
i.fas.fa-key
|
||||
.m-0 Key
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
label.btn.btn-secondary(ngbButtonLabel, ng:if='hostApp.platform !== Platform.Web')
|
||||
input(type='radio', ngbButton, [value]='"agent"')
|
||||
i.fas.fa-user-secret
|
||||
.m-0 Agent
|
||||
@ -117,12 +117,12 @@
|
||||
option(value='') None
|
||||
option([ngValue]='x.name', *ngFor='let x of config.store.ssh.connections') {{x.name}}
|
||||
|
||||
.form-line
|
||||
.form-line(ng:if='hostApp.platform !== Platform.Web')
|
||||
.header
|
||||
.title X11 forwarding
|
||||
toggle([(ngModel)]='connection.x11')
|
||||
|
||||
.form-line
|
||||
.form-line(ng:if='hostApp.platform !== Platform.Web')
|
||||
.header
|
||||
.title Agent forwarding
|
||||
toggle([(ngModel)]='connection.agentForward')
|
||||
@ -176,7 +176,7 @@
|
||||
[(ngModel)]='connection.readyTimeout',
|
||||
)
|
||||
|
||||
.form-line(*ngIf='!connection.jumpHost')
|
||||
.form-line(*ngIf='!connection.jumpHost && hostApp.platform !== Platform.Web')
|
||||
.header
|
||||
.title Use a proxy command
|
||||
.description Command's stdin/stdout is used instead of a network connection
|
||||
|
@ -4,7 +4,7 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Observable } from 'rxjs'
|
||||
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators'
|
||||
|
||||
import { ConfigService, PlatformService, FileProvidersService } from 'terminus-core'
|
||||
import { ConfigService, PlatformService, FileProvidersService, Platform, HostAppService } from 'terminus-core'
|
||||
import { PasswordStorageService } from '../services/passwordStorage.service'
|
||||
import { SSHConnection, LoginScript, ForwardedPortConfig, SSHAlgorithmType, ALGORITHM_BLACKLIST } from '../api'
|
||||
import { PromptModalComponent } from './promptModal.component'
|
||||
@ -15,6 +15,7 @@ import * as ALGORITHMS from 'ssh2/lib/protocol/constants'
|
||||
template: require('./editConnectionModal.component.pug'),
|
||||
})
|
||||
export class EditConnectionModalComponent {
|
||||
Platform = Platform
|
||||
connection: SSHConnection
|
||||
hasSavedPassword: boolean
|
||||
useProxyCommand: boolean
|
||||
@ -27,6 +28,7 @@ export class EditConnectionModalComponent {
|
||||
|
||||
constructor (
|
||||
public config: ConfigService,
|
||||
public hostApp: HostAppService,
|
||||
private modalInstance: NgbActiveModal,
|
||||
private platform: PlatformService,
|
||||
private passwordStorage: PasswordStorageService,
|
||||
|
@ -15,7 +15,10 @@
|
||||
i.fas.fa-flask
|
||||
span Experimental
|
||||
|
||||
button.btn.btn-secondary((click)='showPortForwarding()', *ngIf='session && session.open')
|
||||
button.btn.btn-secondary(
|
||||
*ngIf='session && session.open && hostApp.platform !== Platform.Web',
|
||||
(click)='showPortForwarding()'
|
||||
)
|
||||
i.fas.fa-plug
|
||||
span Ports
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { Spinner } from 'cli-spinner'
|
||||
import { Component, Injector, HostListener } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { RecoveryToken } from 'terminus-core'
|
||||
import { Platform, RecoveryToken } from 'terminus-core'
|
||||
import { BaseTerminalTabComponent } from 'terminus-terminal'
|
||||
import { SSHService } from '../services/ssh.service'
|
||||
import { SSHConnection, SSHSession } from '../api'
|
||||
@ -18,6 +18,7 @@ import { SSHPortForwardingModalComponent } from './sshPortForwardingModal.compon
|
||||
animations: BaseTerminalTabComponent.animations,
|
||||
})
|
||||
export class SSHTabComponent extends BaseTerminalTabComponent {
|
||||
Platform = Platform
|
||||
connection?: SSHConnection
|
||||
session: SSHSession|null = null
|
||||
sftpPanelVisible = false
|
||||
|
@ -158,7 +158,7 @@ export class XTermFrontend extends Frontend {
|
||||
this.opened = true
|
||||
|
||||
// Work around font loading bugs
|
||||
await new Promise(resolve => setTimeout(resolve, process.env.XWEB ? 1000 : 0))
|
||||
await new Promise(resolve => setTimeout(resolve, this.hostApp.platform === Platform.Web ? 1000 : 0))
|
||||
|
||||
if (this.enableWebGL) {
|
||||
this.webGLAddon = new WebglAddon()
|
||||
|
@ -6,3 +6,6 @@ import '@fortawesome/fontawesome-free/css/regular.css'
|
||||
import '@fortawesome/fontawesome-free/css/fontawesome.css'
|
||||
import 'ngx-toastr/toastr.css'
|
||||
import '../app/src/preload.scss'
|
||||
|
||||
// Required before other imports
|
||||
import './polyfills.buffer'
|
||||
|
@ -234,3 +234,13 @@ export function hexSlice (start, end) {
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
import { Buffer } from 'buffer'
|
||||
|
||||
Buffer.prototype['latin1Slice'] = latin1Slice
|
||||
Buffer.prototype['utf8Slice'] = utf8Slice
|
||||
Buffer.prototype['base64Slice'] = base64Slice
|
||||
Buffer.prototype['utf8Write'] = utf8Write
|
||||
Buffer.prototype['hexSlice'] = hexSlice
|
||||
|
||||
window['Buffer'] = Buffer
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-extraneous-class */
|
||||
import * as angularCoreModule from '@angular/core'
|
||||
import * as angularCompilerModule from '@angular/compiler'
|
||||
import * as angularCommonModule from '@angular/common'
|
||||
@ -9,49 +11,53 @@ import * as angularAnimationsModule from '@angular/animations'
|
||||
import * as ngBootstrapModule from '@ng-bootstrap/ng-bootstrap'
|
||||
import * as ngxToastrModule from 'ngx-toastr'
|
||||
|
||||
import { Buffer } from 'buffer'
|
||||
import { base64Slice, hexSlice, latin1Slice, utf8Slice, utf8Write } from './polyfills.buffer'
|
||||
import './polyfills.buffer'
|
||||
import { Duplex } from 'stream-browserify'
|
||||
|
||||
|
||||
window['Buffer'] = Buffer
|
||||
export class SocketProxy extends Duplex {
|
||||
socket: any
|
||||
|
||||
Buffer.prototype['latin1Slice'] = latin1Slice
|
||||
Buffer.prototype['utf8Slice'] = utf8Slice
|
||||
Buffer.prototype['base64Slice'] = base64Slice
|
||||
Buffer.prototype['utf8Write'] = utf8Write
|
||||
Buffer.prototype['hexSlice'] = hexSlice
|
||||
constructor (...args) {
|
||||
super({
|
||||
allowHalfOpen: false,
|
||||
})
|
||||
this.socket = new window['__connector__'].Socket(...args)
|
||||
this.socket.connect$.subscribe(() => this['emit']('connect'))
|
||||
this.socket.data$.subscribe(data => this['emit']('data', Buffer.from(data)))
|
||||
}
|
||||
|
||||
connect (...args) {
|
||||
this.socket.connect(...args)
|
||||
}
|
||||
|
||||
setNoDelay () { }
|
||||
|
||||
setTimeout () { }
|
||||
|
||||
_read (_size: number): void { }
|
||||
|
||||
_write (chunk: Buffer, _encoding: string, callback: (error?: Error | null) => void): void {
|
||||
this.socket.write(chunk)
|
||||
callback()
|
||||
}
|
||||
|
||||
_destroy (error: Error|null, callback: (error: Error|null) => void): void {
|
||||
this.socket.close(error)
|
||||
callback(error)
|
||||
}
|
||||
}
|
||||
|
||||
const mocks = {
|
||||
fs: {
|
||||
// console.warn('mock realPathSync', path)
|
||||
// return path
|
||||
// },
|
||||
// existsSync: path => {
|
||||
// console.warn('mock existsSync', path)
|
||||
// return false
|
||||
// },
|
||||
realpathSync: () => null,
|
||||
readdir: () => null,
|
||||
stat: () => null,
|
||||
appendFile: () => null,
|
||||
// mkdir: path => {
|
||||
// console.warn('mock mkdir', path)
|
||||
// },
|
||||
// mkdirSync: path => {
|
||||
// console.warn('mock mkdirSync', path)
|
||||
// },
|
||||
// writeFileSync: () => null,
|
||||
// readFileSync: (path) => {
|
||||
// return ''
|
||||
// },
|
||||
// readFile: (path, enc, cb) => {
|
||||
// console.warn('mock readFile', path)
|
||||
// cb('UNKNOWN', null)
|
||||
// },
|
||||
constants: {},
|
||||
},
|
||||
buffer: {
|
||||
Buffer,
|
||||
Buffer: window['Buffer'],
|
||||
},
|
||||
crypto: {
|
||||
...require('crypto-browserify'),
|
||||
@ -81,6 +87,9 @@ const mocks = {
|
||||
url: {
|
||||
parse: () => null,
|
||||
},
|
||||
net: {
|
||||
Socket: SocketProxy,
|
||||
},
|
||||
http: {
|
||||
Agent: class {},
|
||||
request: {},
|
||||
@ -117,10 +126,13 @@ const mocks = {
|
||||
},
|
||||
},
|
||||
dns: {},
|
||||
socksv5: {},
|
||||
util: require('util/'),
|
||||
keytar: {
|
||||
getPassword: () => null,
|
||||
},
|
||||
'./crypto/build/Release/sshcrypto.node': {},
|
||||
'../build/Release/cpufeatures.node': {},
|
||||
}
|
||||
|
||||
const builtins = {
|
||||
@ -157,18 +169,17 @@ mockRequire['resolve'] = (() => null) as any
|
||||
|
||||
Object.assign(window, {
|
||||
require: mockRequire,
|
||||
module: {
|
||||
paths: [],
|
||||
},
|
||||
__dirname: '__dirname',
|
||||
setImmediate: setTimeout as any,
|
||||
})
|
||||
|
||||
window['require'].main = {
|
||||
paths: [],
|
||||
} as any
|
||||
|
||||
window['module'] = {
|
||||
paths: [],
|
||||
} as any
|
||||
|
||||
window['__dirname'] = '__dirname'
|
||||
window['setImmediate'] = setTimeout as any
|
||||
mocks.module['prototype'] = { require: window['require'] }
|
||||
mocks.assert.assertNotStrictEqual = () => true
|
||||
mocks.assert.notStrictEqual = () => true
|
||||
|
Loading…
Reference in New Issue
Block a user