Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
181c5230
T
Tabby
项目概览
后端镜像
/
Tabby
通知
31
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabby
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
181c5230
编写于
9月 18, 2019
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
strict null checks
上级
9b904856
变更
62
隐藏空白更改
内联
并排
Showing
62 changed file
with
202 addition
and
170 deletion
+202
-170
.eslintrc.yml
.eslintrc.yml
+1
-0
app/src/entry.ts
app/src/entry.ts
+1
-1
app/src/plugins.ts
app/src/plugins.ts
+3
-1
terminus-community-color-schemes/package.json
terminus-community-color-schemes/package.json
+1
-1
terminus-core/package.json
terminus-core/package.json
+1
-1
terminus-core/src/api/tabRecovery.ts
terminus-core/src/api/tabRecovery.ts
+1
-1
terminus-core/src/api/toolbarButtonProvider.ts
terminus-core/src/api/toolbarButtonProvider.ts
+1
-1
terminus-core/src/components/appRoot.component.ts
terminus-core/src/components/appRoot.component.ts
+2
-2
terminus-core/src/components/baseTab.component.ts
terminus-core/src/components/baseTab.component.ts
+5
-5
terminus-core/src/components/splitTab.component.ts
terminus-core/src/components/splitTab.component.ts
+29
-15
terminus-core/src/components/splitTabSpanner.component.ts
terminus-core/src/components/splitTabSpanner.component.ts
+4
-4
terminus-core/src/components/tabHeader.component.ts
terminus-core/src/components/tabHeader.component.ts
+2
-2
terminus-core/src/components/windowControls.component.ts
terminus-core/src/components/windowControls.component.ts
+3
-1
terminus-core/src/services/app.service.ts
terminus-core/src/services/app.service.ts
+5
-5
terminus-core/src/services/config.service.ts
terminus-core/src/services/config.service.ts
+2
-2
terminus-core/src/services/hostApp.service.ts
terminus-core/src/services/hostApp.service.ts
+1
-1
terminus-core/src/services/hotkeys.service.ts
terminus-core/src/services/hotkeys.service.ts
+2
-2
terminus-core/src/services/hotkeys.util.ts
terminus-core/src/services/hotkeys.util.ts
+1
-1
terminus-core/src/services/shellIntegration.service.ts
terminus-core/src/services/shellIntegration.service.ts
+1
-1
terminus-core/src/services/tabRecovery.service.ts
terminus-core/src/services/tabRecovery.service.ts
+1
-1
terminus-core/src/services/tabs.service.ts
terminus-core/src/services/tabs.service.ts
+1
-1
terminus-core/src/services/themes.service.ts
terminus-core/src/services/themes.service.ts
+6
-6
terminus-core/src/services/touchbar.service.ts
terminus-core/src/services/touchbar.service.ts
+6
-4
terminus-core/src/tabContextMenu.ts
terminus-core/src/tabContextMenu.ts
+2
-2
terminus-plugin-manager/package.json
terminus-plugin-manager/package.json
+1
-2
terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug
...n-manager/src/components/pluginsSettingsTab.component.pug
+7
-7
terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts
...in-manager/src/components/pluginsSettingsTab.component.ts
+8
-5
terminus-plugin-manager/src/index.ts
terminus-plugin-manager/src/index.ts
+0
-2
terminus-settings/package.json
terminus-settings/package.json
+4
-5
terminus-settings/src/components/hotkeyInputModal.component.ts
...nus-settings/src/components/hotkeyInputModal.component.ts
+3
-3
terminus-settings/src/components/settingsTab.component.pug
terminus-settings/src/components/settingsTab.component.pug
+19
-18
terminus-settings/src/index.ts
terminus-settings/src/index.ts
+0
-2
terminus-settings/src/recoveryProvider.ts
terminus-settings/src/recoveryProvider.ts
+1
-1
terminus-settings/yarn.lock
terminus-settings/yarn.lock
+3
-3
terminus-ssh/package.json
terminus-ssh/package.json
+1
-1
terminus-ssh/src/api.ts
terminus-ssh/src/api.ts
+3
-3
terminus-ssh/src/components/editConnectionModal.component.ts
terminus-ssh/src/components/editConnectionModal.component.ts
+12
-3
terminus-ssh/src/components/sshModal.component.ts
terminus-ssh/src/components/sshModal.component.ts
+4
-4
terminus-ssh/src/components/sshSettingsTab.component.ts
terminus-ssh/src/components/sshSettingsTab.component.ts
+4
-4
terminus-ssh/src/recoveryProvider.ts
terminus-ssh/src/recoveryProvider.ts
+1
-1
terminus-ssh/src/services/passwordStorage.service.ts
terminus-ssh/src/services/passwordStorage.service.ts
+1
-1
terminus-ssh/src/services/ssh.service.ts
terminus-ssh/src/services/ssh.service.ts
+12
-12
terminus-terminal/package.json
terminus-terminal/package.json
+1
-1
terminus-terminal/src/api/baseTerminalTab.component.ts
terminus-terminal/src/api/baseTerminalTab.component.ts
+1
-1
terminus-terminal/src/buttonProvider.ts
terminus-terminal/src/buttonProvider.ts
+1
-1
terminus-terminal/src/colorSchemes.ts
terminus-terminal/src/colorSchemes.ts
+1
-1
terminus-terminal/src/components/appearanceSettingsTab.component.ts
...erminal/src/components/appearanceSettingsTab.component.ts
+2
-2
terminus-terminal/src/components/shellSettingsTab.component.ts
...nus-terminal/src/components/shellSettingsTab.component.ts
+4
-1
terminus-terminal/src/components/terminalSettingsTab.component.ts
...-terminal/src/components/terminalSettingsTab.component.ts
+1
-1
terminus-terminal/src/components/terminalTab.component.ts
terminus-terminal/src/components/terminalTab.component.ts
+1
-1
terminus-terminal/src/frontends/hterm.ts
terminus-terminal/src/frontends/hterm.ts
+3
-3
terminus-terminal/src/frontends/htermFrontend.ts
terminus-terminal/src/frontends/htermFrontend.ts
+1
-1
terminus-terminal/src/frontends/xtermFrontend.ts
terminus-terminal/src/frontends/xtermFrontend.ts
+3
-3
terminus-terminal/src/index.ts
terminus-terminal/src/index.ts
+1
-1
terminus-terminal/src/pathDrop.ts
terminus-terminal/src/pathDrop.ts
+1
-1
terminus-terminal/src/recoveryProvider.ts
terminus-terminal/src/recoveryProvider.ts
+1
-1
terminus-terminal/src/services/dockMenu.service.ts
terminus-terminal/src/services/dockMenu.service.ts
+1
-1
terminus-terminal/src/services/sessions.service.ts
terminus-terminal/src/services/sessions.service.ts
+8
-8
terminus-terminal/src/services/terminal.service.ts
terminus-terminal/src/services/terminal.service.ts
+2
-2
terminus-terminal/src/services/terminalFrontend.service.ts
terminus-terminal/src/services/terminalFrontend.service.ts
+1
-1
terminus-terminal/src/shells/linuxDefault.ts
terminus-terminal/src/shells/linuxDefault.ts
+1
-1
tsconfig.json
tsconfig.json
+1
-0
未找到文件。
.eslintrc.yml
浏览文件 @
181c5230
...
...
@@ -92,3 +92,4 @@ rules:
-
error
-
single
-
allowTemplateLiterals
:
true
'
@typescript-eslint/no-non-null-assertion'
:
off
app/src/entry.ts
浏览文件 @
181c5230
...
...
@@ -19,7 +19,7 @@ location.hash = ''
;(
process
as
any
).
enablePromiseAPI
=
true
if
(
process
.
platform
===
'
win32
'
&&
!
(
'
HOME
'
in
process
.
env
))
{
process
.
env
.
HOME
=
process
.
env
.
HOMEDRIVE
+
process
.
env
.
HOMEPATH
process
.
env
.
HOME
=
`
${
process
.
env
.
HOMEDRIVE
}${
process
.
env
.
HOMEPATH
}
`
}
if
(
isDev
)
{
...
...
app/src/plugins.ts
浏览文件 @
181c5230
...
...
@@ -156,7 +156,9 @@ export async function findPlugins (): Promise<PluginInfo[]> {
}
}
(
window
as
any
).
installedPlugins
=
foundPlugins
foundPlugins
.
sort
((
a
,
b
)
=>
a
.
name
>
b
.
name
?
1
:
-
1
)
;(
window
as
any
).
installedPlugins
=
foundPlugins
return
foundPlugins
}
...
...
terminus-community-color-schemes/package.json
浏览文件 @
181c5230
{
"name"
:
"terminus-community-color-schemes"
,
"version"
:
"1.0.
83
-nightly.0"
,
"version"
:
"1.0.
92
-nightly.0"
,
"description"
:
"Community color schemes for Terminus"
,
"keywords"
:
[
"terminus-builtin-plugin"
...
...
terminus-core/package.json
浏览文件 @
181c5230
{
"name"
:
"terminus-core"
,
"version"
:
"1.0.
83-nightly.4
"
,
"version"
:
"1.0.
92-nightly.0
"
,
"description"
:
"Terminus core"
,
"keywords"
:
[
"terminus-builtin-plugin"
...
...
terminus-core/src/api/tabRecovery.ts
浏览文件 @
181c5230
...
...
@@ -34,5 +34,5 @@ export abstract class TabRecoveryProvider {
* @returns [[RecoveredTab]] descriptor containing tab type and component inputs
* or `null` if this token is from a different tab type or is not supported
*/
abstract
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
|
null
>
abstract
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
|
null
>
}
terminus-core/src/api/toolbarButtonProvider.ts
浏览文件 @
181c5230
...
...
@@ -5,7 +5,7 @@ export interface ToolbarButton {
/**
* Raw SVG icon code
*/
icon
:
string
icon
?
:
string
title
:
string
...
...
terminus-core/src/components/appRoot.component.ts
浏览文件 @
181c5230
...
...
@@ -144,7 +144,7 @@ export class AppRootComponent {
config
.
changed$
.
subscribe
(()
=>
this
.
updateVibrancy
())
this
.
updateVibrancy
()
let
lastProgress
=
null
let
lastProgress
:
number
|
null
=
null
this
.
app
.
tabOpened$
.
subscribe
(
tab
=>
{
this
.
unsortedTabs
.
push
(
tab
)
tab
.
progress$
.
subscribe
(
progress
=>
{
...
...
@@ -258,7 +258,7 @@ export class AppRootComponent {
buttons
=
buttons
.
concat
(
provider
.
provide
())
})
return
buttons
.
filter
(
button
=>
button
.
weight
>
0
===
aboveZero
)
.
filter
(
button
=>
(
button
.
weight
||
0
)
>
0
===
aboveZero
)
.
sort
((
a
:
ToolbarButton
,
b
:
ToolbarButton
)
=>
(
a
.
weight
||
0
)
-
(
b
.
weight
||
0
))
}
...
...
terminus-core/src/components/baseTab.component.ts
浏览文件 @
181c5230
...
...
@@ -36,7 +36,7 @@ export abstract class BaseTabComponent {
/**
* CSS color override for the tab's header
*/
color
:
string
=
null
color
:
string
|
null
=
null
protected
hasFocus
=
false
...
...
@@ -50,14 +50,14 @@ export abstract class BaseTabComponent {
private
titleChange
=
new
Subject
<
string
>
()
private
focused
=
new
Subject
<
void
>
()
private
blurred
=
new
Subject
<
void
>
()
private
progress
=
new
Subject
<
number
>
()
private
progress
=
new
Subject
<
number
|
null
>
()
private
activity
=
new
Subject
<
boolean
>
()
private
destroyed
=
new
Subject
<
void
>
()
get
focused$
():
Observable
<
void
>
{
return
this
.
focused
}
get
blurred$
():
Observable
<
void
>
{
return
this
.
blurred
}
get
titleChange$
():
Observable
<
string
>
{
return
this
.
titleChange
}
get
progress$
():
Observable
<
number
>
{
return
this
.
progress
}
get
progress$
():
Observable
<
number
|
null
>
{
return
this
.
progress
}
get
activity$
():
Observable
<
boolean
>
{
return
this
.
activity
}
get
destroyed$
():
Observable
<
void
>
{
return
this
.
destroyed
}
get
recoveryStateChangedHint$
():
Observable
<
void
>
{
return
this
.
recoveryStateChangedHint
}
...
...
@@ -83,7 +83,7 @@ export abstract class BaseTabComponent {
*
* @param {type} progress: value between 0 and 1, or `null` to remove
*/
setProgress
(
progress
:
number
)
{
setProgress
(
progress
:
number
|
null
)
{
this
.
progress
.
next
(
progress
)
if
(
progress
)
{
if
(
this
.
progressClearTimeout
)
{
...
...
@@ -125,7 +125,7 @@ export abstract class BaseTabComponent {
/**
* Override this to enable task completion notifications for the tab
*/
async
getCurrentProcess
():
Promise
<
BaseTabProcess
>
{
async
getCurrentProcess
():
Promise
<
BaseTabProcess
|
null
>
{
return
null
}
...
...
terminus-core/src/components/splitTab.component.ts
浏览文件 @
181c5230
...
...
@@ -33,8 +33,8 @@ export class SplitContainer {
/**
* @return Flat list of all tabs inside this container
*/
getAllTabs
()
{
let
r
=
[]
getAllTabs
()
:
BaseTabComponent
[]
{
let
r
:
BaseTabComponent
[]
=
[]
for
(
const
child
of
this
.
children
)
{
if
(
child
instanceof
SplitContainer
)
{
r
=
r
.
concat
(
child
.
getAllTabs
())
...
...
@@ -94,7 +94,7 @@ export class SplitContainer {
}
async
serialize
()
{
const
children
=
[]
const
children
:
any
[]
=
[]
for
(
const
child
of
this
.
children
)
{
if
(
child
instanceof
SplitContainer
)
{
children
.
push
(
await
child
.
serialize
())
...
...
@@ -292,9 +292,9 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
/**
* Inserts a new `tab` to the `side` of the `relative` tab
*/
addTab
(
tab
:
BaseTabComponent
,
relative
:
BaseTabComponent
,
side
:
SplitDirection
)
{
let
target
=
this
.
getParentOf
(
relative
)
||
this
.
root
let
insertIndex
=
target
.
children
.
indexOf
(
relative
)
addTab
(
tab
:
BaseTabComponent
,
relative
:
BaseTabComponent
|
null
,
side
:
SplitDirection
)
{
let
target
=
(
relative
?
this
.
getParentOf
(
relative
)
:
null
)
||
this
.
root
let
insertIndex
=
relative
?
target
.
children
.
indexOf
(
relative
)
:
-
1
if
(
target
.
orientation
===
'
v
'
&&
[
'
l
'
,
'
r
'
].
includes
(
side
)
||
...
...
@@ -302,7 +302,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
)
{
const
newContainer
=
new
SplitContainer
()
newContainer
.
orientation
=
target
.
orientation
===
'
v
'
?
'
h
'
:
'
v
'
newContainer
.
children
=
[
relative
]
newContainer
.
children
=
relative
?
[
relative
]
:
[
]
newContainer
.
ratios
=
[
1
]
target
.
children
[
insertIndex
]
=
newContainer
target
=
newContainer
...
...
@@ -333,6 +333,9 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
removeTab
(
tab
:
BaseTabComponent
)
{
const
parent
=
this
.
getParentOf
(
tab
)
if
(
!
parent
)
{
return
}
const
index
=
parent
.
children
.
indexOf
(
tab
)
parent
.
ratios
.
splice
(
index
,
1
)
parent
.
children
.
splice
(
index
,
1
)
...
...
@@ -356,11 +359,18 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
navigate
(
dir
:
SplitDirection
)
{
let
rel
:
BaseTabComponent
|
SplitContainer
=
this
.
focusedTab
let
parent
=
this
.
getParentOf
(
rel
)
if
(
!
parent
)
{
return
}
const
orientation
=
[
'
l
'
,
'
r
'
].
includes
(
dir
)
?
'
h
'
:
'
v
'
while
(
parent
!==
this
.
root
&&
parent
.
orientation
!==
orientation
)
{
rel
=
parent
parent
=
this
.
getParentOf
(
rel
)
if
(
!
parent
)
{
return
}
}
if
(
parent
.
orientation
!==
orientation
)
{
...
...
@@ -381,13 +391,15 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
async
splitTab
(
tab
:
BaseTabComponent
,
dir
:
SplitDirection
)
{
const
newTab
=
await
this
.
tabsService
.
duplicate
(
tab
)
this
.
addTab
(
newTab
,
tab
,
dir
)
if
(
newTab
)
{
this
.
addTab
(
newTab
,
tab
,
dir
)
}
}
/**
* @returns the immediate parent of `tab`
*/
getParentOf
(
tab
:
BaseTabComponent
|
SplitContainer
,
root
?:
SplitContainer
):
SplitContainer
{
getParentOf
(
tab
:
BaseTabComponent
|
SplitContainer
,
root
?:
SplitContainer
):
SplitContainer
|
null
{
root
=
root
||
this
.
root
for
(
const
child
of
root
.
children
)
{
if
(
child
instanceof
SplitContainer
)
{
...
...
@@ -414,8 +426,8 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
}
/** @hidden */
async
getCurrentProcess
():
Promise
<
BaseTabProcess
>
{
return
(
await
Promise
.
all
(
this
.
getAllTabs
().
map
(
x
=>
x
.
getCurrentProcess
()))).
find
(
x
=>
!!
x
)
async
getCurrentProcess
():
Promise
<
BaseTabProcess
|
null
>
{
return
(
await
Promise
.
all
(
this
.
getAllTabs
().
map
(
x
=>
x
.
getCurrentProcess
()))).
find
(
x
=>
!!
x
)
||
null
}
/** @hidden */
...
...
@@ -443,8 +455,10 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
private
detachTabView
(
tab
:
BaseTabComponent
)
{
const
ref
=
this
.
viewRefs
.
get
(
tab
)
this
.
viewRefs
.
delete
(
tab
)
this
.
viewContainer
.
remove
(
this
.
viewContainer
.
indexOf
(
ref
))
if
(
ref
)
{
this
.
viewRefs
.
delete
(
tab
)
this
.
viewContainer
.
remove
(
this
.
viewContainer
.
indexOf
(
ref
))
}
}
private
layout
()
{
...
...
@@ -471,7 +485,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
if
(
child
instanceof
SplitContainer
)
{
this
.
layoutInternal
(
child
,
childX
,
childY
,
childW
,
childH
)
}
else
{
const
element
=
this
.
viewRefs
.
get
(
child
).
rootNodes
[
0
]
const
element
=
this
.
viewRefs
.
get
(
child
)
!
.
rootNodes
[
0
]
element
.
style
.
position
=
'
absolute
'
element
.
style
.
left
=
`
${
childX
}
%`
element
.
style
.
top
=
`
${
childY
}
%`
...
...
@@ -518,7 +532,7 @@ export class SplitTabComponent extends BaseTabComponent implements OnInit, OnDes
/** @hidden */
@
Injectable
()
export
class
SplitTabRecoveryProvider
extends
TabRecoveryProvider
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
>
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
|
null
>
{
if
(
recoveryToken
&&
recoveryToken
.
type
===
'
app:split-tab
'
)
{
return
{
type
:
SplitTabComponent
,
...
...
terminus-core/src/components/splitTabSpanner.component.ts
浏览文件 @
181c5230
...
...
@@ -67,13 +67,13 @@ export class SplitTabSpannerComponent {
this
.
container
.
x
,
this
.
container
.
y
+
this
.
container
.
h
*
this
.
container
.
getOffsetRatio
(
this
.
index
),
this
.
container
.
w
,
null
0
)
}
else
{
this
.
setDimensions
(
this
.
container
.
x
+
this
.
container
.
w
*
this
.
container
.
getOffsetRatio
(
this
.
index
),
this
.
container
.
y
,
null
,
0
,
this
.
container
.
h
)
}
...
...
@@ -82,7 +82,7 @@ export class SplitTabSpannerComponent {
private
setDimensions
(
x
:
number
,
y
:
number
,
w
:
number
,
h
:
number
)
{
this
.
cssLeft
=
`
${
x
}
%`
this
.
cssTop
=
`
${
y
}
%`
this
.
cssWidth
=
w
?
`
${
w
}
%`
:
null
this
.
cssHeight
=
h
?
`
${
h
}
%`
:
null
this
.
cssWidth
=
w
?
`
${
w
}
%`
:
'
initial
'
this
.
cssHeight
=
h
?
`
${
h
}
%`
:
'
initial
'
}
}
terminus-core/src/components/tabHeader.component.ts
浏览文件 @
181c5230
...
...
@@ -25,7 +25,7 @@ export class TabHeaderComponent {
@
Input
()
@
HostBinding
(
'
class.active
'
)
active
:
boolean
@
Input
()
@
HostBinding
(
'
class.has-activity
'
)
hasActivity
:
boolean
@
Input
()
tab
:
BaseTabComponent
@
Input
()
progress
:
number
@
Input
()
progress
:
number
|
null
@
ViewChild
(
'
handle
'
)
handle
:
ElementRef
private
constructor
(
...
...
@@ -83,7 +83,7 @@ export class TabHeaderComponent {
this
.
app
.
closeTab
(
this
.
tab
,
true
)
}
if
(
$event
.
which
===
3
)
{
event
.
preventDefault
()
$
event
.
preventDefault
()
const
contextMenu
=
this
.
electron
.
remote
.
Menu
.
buildFromTemplate
(
await
this
.
buildContextMenu
())
...
...
terminus-core/src/components/windowControls.component.ts
浏览文件 @
181c5230
...
...
@@ -12,6 +12,8 @@ export class WindowControlsComponent {
constructor
(
public
hostApp
:
HostAppService
,
public
app
:
AppService
)
{
}
async
closeWindow
()
{
await
this
.
app
.
closeAllTabs
()
&&
this
.
hostApp
.
closeWindow
()
if
(
await
this
.
app
.
closeAllTabs
())
{
this
.
hostApp
.
closeWindow
()
}
}
}
terminus-core/src/services/app.service.ts
浏览文件 @
181c5230
...
...
@@ -25,14 +25,14 @@ class CompletionObserver {
async
tick
()
{
if
(
!
await
this
.
tab
.
getCurrentProcess
())
{
this
.
done
.
next
(
null
)
this
.
done
.
next
()
this
.
stop
()
}
}
stop
()
{
clearInterval
(
this
.
interval
)
this
.
destroyed
.
next
(
null
)
this
.
destroyed
.
next
()
this
.
destroyed
.
complete
()
this
.
done
.
complete
()
}
...
...
@@ -144,7 +144,7 @@ export class AppService {
if
(
this
.
tabs
.
includes
(
this
.
_activeTab
))
{
this
.
lastTabIndex
=
this
.
tabs
.
indexOf
(
this
.
_activeTab
)
}
else
{
this
.
lastTabIndex
=
null
this
.
lastTabIndex
=
0
}
if
(
this
.
_activeTab
)
{
this
.
_activeTab
.
clearActivity
()
...
...
@@ -229,7 +229,7 @@ export class AppService {
/** @hidden */
emitReady
()
{
this
.
ready
.
next
(
null
)
this
.
ready
.
next
()
this
.
ready
.
complete
()
this
.
hostApp
.
emitReady
()
}
...
...
@@ -246,7 +246,7 @@ export class AppService {
})
this
.
completionObservers
.
set
(
tab
,
observer
)
}
return
this
.
completionObservers
.
get
(
tab
).
done$
return
this
.
completionObservers
.
get
(
tab
)
!
.
done$
}
stopObservingTabCompletion
(
tab
:
BaseTabComponent
)
{
...
...
terminus-core/src/services/config.service.ts
浏览文件 @
181c5230
...
...
@@ -95,7 +95,7 @@ export class ConfigService {
private
changed
=
new
Subject
<
void
>
()
private
_store
:
any
private
defaults
:
any
private
servicesCache
:
{
[
id
:
string
]:
Function
[]
}
=
null
private
servicesCache
:
{
[
id
:
string
]:
Function
[]
}
|
null
=
null
get
changed$
():
Observable
<
void
>
{
return
this
.
changed
}
...
...
@@ -170,7 +170,7 @@ export class ConfigService {
*
* @typeparam T Base provider type
*/
enabledServices
<
T
>
(
services
:
T
[]):
T
[]
{
enabledServices
<
T
extends
object
>
(
services
:
T
[]):
T
[]
{
if
(
!
this
.
servicesCache
)
{
this
.
servicesCache
=
{}
const
ngModule
=
window
[
'
rootModule
'
].
ngInjectorDef
...
...
terminus-core/src/services/hostApp.service.ts
浏览文件 @
181c5230
...
...
@@ -215,7 +215,7 @@ export class HostAppService {
setVibrancy
(
enable
:
boolean
,
type
:
string
)
{
document
.
body
.
classList
.
toggle
(
'
vibrant
'
,
enable
)
if
(
this
.
platform
===
Platform
.
macOS
)
{
this
.
getWindow
().
setVibrancy
(
enable
?
'
dark
'
:
null
)
this
.
getWindow
().
setVibrancy
(
enable
?
'
dark
'
:
null
as
any
)
// electron issue 20269
}
if
(
this
.
platform
===
Platform
.
Windows
)
{
this
.
electron
.
ipcRenderer
.
send
(
'
window-set-vibrancy
'
,
enable
,
type
)
...
...
terminus-core/src/services/hotkeys.service.ts
浏览文件 @
181c5230
...
...
@@ -93,7 +93,7 @@ export class HotkeysService {
return
stringifyKeySequence
(
this
.
currentKeystrokes
.
map
(
x
=>
x
.
event
))
}
getCurrentFullyMatchedHotkey
():
string
{
getCurrentFullyMatchedHotkey
():
string
|
null
{
const
currentStrokes
=
this
.
getCurrentKeystrokes
()
const
config
=
this
.
getHotkeysConfig
()
for
(
const
id
in
config
)
{
...
...
@@ -116,7 +116,7 @@ export class HotkeysService {
getCurrentPartiallyMatchedHotkeys
():
PartialHotkeyMatch
[]
{
const
currentStrokes
=
this
.
getCurrentKeystrokes
()
const
config
=
this
.
getHotkeysConfig
()
const
result
=
[]
const
result
:
PartialHotkeyMatch
[]
=
[]
for
(
const
id
in
config
)
{
for
(
const
sequence
of
config
[
id
])
{
for
(
let
matchLength
=
Math
.
min
(
currentStrokes
.
length
,
sequence
.
length
);
matchLength
>
0
;
matchLength
--
)
{
...
...
terminus-core/src/services/hotkeys.util.ts
浏览文件 @
181c5230
...
...
@@ -15,7 +15,7 @@ export function stringifyKeySequence (events: KeyboardEvent[]): string[] {
events
=
events
.
slice
()
while
(
events
.
length
>
0
)
{
const
event
=
events
.
shift
()
const
event
=
events
.
shift
()
!
if
((
event
as
any
).
event
===
'
keydown
'
)
{
const
itemKeys
:
string
[]
=
[]
if
(
event
.
ctrlKey
)
{
...
...
terminus-core/src/services/shellIntegration.service.ts
浏览文件 @
181c5230
...
...
@@ -37,7 +37,7 @@ export class ShellIntegrationService {
'
extras
'
,
'
automator-workflows
'
,
)
this
.
automatorWorkflowsDestination
=
path
.
join
(
process
.
env
.
HOME
,
'
Library
'
,
'
Services
'
)
this
.
automatorWorkflowsDestination
=
path
.
join
(
process
.
env
.
HOME
as
string
,
'
Library
'
,
'
Services
'
)
}
this
.
updatePaths
()
}
...
...
terminus-core/src/services/tabRecovery.service.ts
浏览文件 @
181c5230
...
...
@@ -27,7 +27,7 @@ export class TabRecoveryService {
)
}
async
recoverTab
(
token
:
any
):
Promise
<
RecoveredTab
>
{
async
recoverTab
(
token
:
any
):
Promise
<
RecoveredTab
|
null
>
{
for
(
const
provider
of
this
.
config
.
enabledServices
(
this
.
tabRecoveryProviders
))
{
try
{
const
tab
=
await
provider
.
recover
(
token
)
...
...
terminus-core/src/services/tabs.service.ts
浏览文件 @
181c5230
...
...
@@ -29,7 +29,7 @@ export class TabsService {
/**
* Duplicates an existing tab instance (using the tab recovery system)
*/
async
duplicate
(
tab
:
BaseTabComponent
):
Promise
<
BaseTabComponent
>
{
async
duplicate
(
tab
:
BaseTabComponent
):
Promise
<
BaseTabComponent
|
null
>
{
const
token
=
await
tab
.
getRecoveryToken
()
if
(
!
token
)
{
return
null
...
...
terminus-core/src/services/themes.service.ts
浏览文件 @
181c5230
...
...
@@ -4,7 +4,7 @@ import { Theme } from '../api/theme'
@
Injectable
({
providedIn
:
'
root
'
})
export
class
ThemesService
{
private
styleElement
:
HTMLElement
=
null
private
styleElement
:
HTMLElement
|
null
=
null
/** @hidden */
constructor
(
...
...
@@ -17,22 +17,22 @@ export class ThemesService {
})
}
findTheme
(
name
:
string
):
Theme
{
return
this
.
config
.
enabledServices
(
this
.
themes
).
find
(
x
=>
x
.
name
===
name
)
findTheme
(
name
:
string
):
Theme
|
null
{
return
this
.
config
.
enabledServices
(
this
.
themes
).
find
(
x
=>
x
.
name
===
name
)
||
null
}
findCurrentTheme
():
Theme
{
return
this
.
findTheme
(
this
.
config
.
store
.
appearance
.
theme
)
||
this
.
findTheme
(
'
Standard
'
)
return
this
.
findTheme
(
this
.
config
.
store
.
appearance
.
theme
)
||
this
.
findTheme
(
'
Standard
'
)
!
}
applyTheme
(
theme
:
Theme
):
void
{
if
(
!
this
.
styleElement
)
{
this
.
styleElement
=
document
.
createElement
(
'
style
'
)
this
.
styleElement
.
setAttribute
(
'
id
'
,
'
theme
'
)
document
.
querySelector
(
'
head
'
).
appendChild
(
this
.
styleElement
)
document
.
querySelector
(
'
head
'
)
!
.
appendChild
(
this
.
styleElement
)
}
this
.
styleElement
.
textContent
=
theme
.
css
document
.
querySelector
(
'
style#custom-css
'
).
innerHTML
=
this
.
config
.
store
.
appearance
.
css
document
.
querySelector
(
'
style#custom-css
'
)
!
.
innerHTML
=
this
.
config
.
store
.
appearance
.
css
}
private
applyCurrentTheme
():
void
{
...
...
terminus-core/src/services/touchbar.service.ts
浏览文件 @
181c5230
...
...
@@ -42,7 +42,7 @@ export class TouchbarService {
const
showIcon
=
this
.
app
.
activeTab
!==
tab
&&
hasActivity
const
segment
=
this
.
tabSegments
[
app
.
tabs
.
indexOf
(
tab
)]
if
(
segment
)
{
segment
.
icon
=
showIcon
?
activityIcon
:
null
segment
.
icon
=
showIcon
?
activityIcon
:
undefined
}
})
})
...
...
@@ -83,7 +83,9 @@ export class TouchbarService {
segments
:
buttons
.
map
(
button
=>
this
.
getButton
(
button
)),
mode
:
'
buttons
'
,
change
:
(
selectedIndex
)
=>
this
.
zone
.
run
(()
=>
{
buttons
[
selectedIndex
].
click
()
if
(
buttons
[
selectedIndex
].
click
)
{
buttons
[
selectedIndex
].
click
!
()
}
}),
})
...
...
@@ -100,8 +102,8 @@ export class TouchbarService {
private
getButton
(
button
:
ToolbarButton
):
Electron
.
SegmentedControlSegment
{
return
{
label
:
button
.
touchBarNSImage
?
null
:
this
.
shortenTitle
(
button
.
touchBarTitle
||
button
.
title
),
icon
:
button
.
touchBarNSImage
?
this
.
getCachedNSImage
(
button
.
touchBarNSImage
)
:
null
,
label
:
button
.
touchBarNSImage
?
undefined
:
this
.
shortenTitle
(
button
.
touchBarTitle
||
button
.
title
),
icon
:
button
.
touchBarNSImage
?
this
.
getCachedNSImage
(
button
.
touchBarNSImage
)
:
undefined
,
// click: () => this.zone.run(() => button.click()),
}
}
...
...
terminus-core/src/tabContextMenu.ts
浏览文件 @
181c5230
...
...
@@ -78,7 +78,7 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider {
return
[
{
label
:
'
Rename
'
,
click
:
()
=>
this
.
zone
.
run
(()
=>
tabHeader
.
showRenameTabModal
()),
click
:
()
=>
this
.
zone
.
run
(()
=>
tabHeader
&&
tabHeader
.
showRenameTabModal
()),
},
{
label
:
'
Duplicate
'
,
...
...
@@ -86,7 +86,7 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider {
},
{
label
:
'
Color
'
,
sublabel
:
COLORS
.
find
(
x
=>
x
.
value
===
tab
.
color
).
name
,
sublabel
:
COLORS
.
find
(
x
=>
x
.
value
===
tab
.
color
)
!
.
name
,
submenu
:
COLORS
.
map
(
color
=>
({
label
:
color
.
name
,
type
:
'
radio
'
,
...
...
terminus-plugin-manager/package.json
浏览文件 @
181c5230
{
"name"
:
"terminus-plugin-manager"
,
"version"
:
"1.0.
83
-nightly.0"
,
"version"
:
"1.0.
92
-nightly.0"
,
"description"
:
"Terminus' plugin manager"
,
"keywords"
:
[
"terminus-builtin-plugin"
...
...
@@ -20,7 +20,6 @@
"@types/semver"
:
"^6.0.0"
,
"axios"
:
"^0.19.0"
,
"mz"
:
"^2.6.0"
,
"ngx-pipes"
:
"^1.6.1"
,
"semver"
:
"^6.1.0"
},
"peerDependencies"
:
{
...
...
terminus-plugin-manager/src/components/pluginsSettingsTab.component.pug
浏览文件 @
181c5230
...
...
@@ -8,9 +8,9 @@
button.btn.btn-outline-info.btn-sm.ml-auto((click)='openPluginsFolder()')
i.fas.fa-folder
span Plugins folder
.list-group.list-group-flush.mt-2
.list-group-item.d-flex.align-items-center(*ngFor='let plugin of pluginManager.installedPlugins
|orderBy:"name"
')
.list-group-item.d-flex.align-items-center(*ngFor='let plugin of pluginManager.installedPlugins')
.mr-auto.d-flex.flex-column
div
strong {{plugin.name}}
...
...
@@ -33,15 +33,15 @@
(click)='enablePlugin(plugin)'
)
i.fas.fa-fw.fa-play
button.btn.btn-secondary.ml-2(
*ngIf='!config.store.pluginBlacklist.includes(plugin.name)',
(click)='disablePlugin(plugin)'
)
i.fas.fa-fw.fa-pause
button.btn.btn-danger.ml-2(
(click)='uninstallPlugin(plugin)',
(click)='uninstallPlugin(plugin)',
*ngIf='!plugin.isBuiltin',
[disabled]='busy[plugin.name] != undefined'
)
...
...
@@ -65,7 +65,7 @@ div
.list-group.list-group-flush.mb-4(*ngIf='availablePlugins$')
ng-container(*ngFor='let plugin of (availablePlugins$|async
|orderBy:"name"
)')
ng-container(*ngFor='let plugin of (availablePlugins$|async)')
.list-group-item.d-flex.align-items-center(*ngIf='!isAlreadyInstalled(plugin)')
button.btn.btn-primary.mr-3(
(click)='installPlugin(plugin)',
...
...
@@ -73,7 +73,7 @@ div
)
i.fas.fa-fw.fa-download(*ngIf='busy[plugin.name] != BusyState.Installing')
i.fas.fa-fw.fa-circle-notch.fa-spin(*ngIf='busy[plugin.name] == BusyState.Installing')
div((click)='showPluginInfo(plugin)')
div
strong {{plugin.name}}
...
...
terminus-plugin-manager/src/components/pluginsSettingsTab.component.ts
浏览文件 @
181c5230
import
{
BehaviorSubject
,
Observable
}
from
'
rxjs
'
import
{
debounceTime
,
distinctUntilChanged
,
first
,
tap
,
flatMap
}
from
'
rxjs/operators
'
import
{
debounceTime
,
distinctUntilChanged
,
first
,
tap
,
flatMap
,
map
}
from
'
rxjs/operators
'
import
*
as
semver
from
'
semver
'
import
{
Component
,
Input
}
from
'
@angular/core
'
...
...
@@ -18,7 +18,7 @@ export class PluginsSettingsTabComponent {
@
Input
()
availablePlugins$
:
Observable
<
PluginInfo
[]
>
@
Input
()
availablePluginsQuery$
=
new
BehaviorSubject
<
string
>
(
''
)
@
Input
()
availablePluginsReady
=
false
@
Input
()
knownUpgrades
:
{[
id
:
string
]:
PluginInfo
}
=
{}
@
Input
()
knownUpgrades
:
{[
id
:
string
]:
PluginInfo
|
null
}
=
{}
@
Input
()
busy
:
{[
id
:
string
]:
BusyState
}
=
{}
@
Input
()
erroredPlugin
:
string
@
Input
()
errorMessage
:
string
...
...
@@ -43,9 +43,12 @@ export class PluginsSettingsTabComponent {
}))
})
)
this
.
availablePlugins$
.
pipe
(
first
()).
subscribe
(
available
=>
{
this
.
availablePlugins$
.
pipe
(
first
(),
map
((
plugins
:
PluginInfo
[])
=>
{
plugins
.
sort
((
a
,
b
)
=>
a
.
name
>
b
.
name
?
1
:
-
1
)
return
plugins
})).
subscribe
(
available
=>
{
for
(
const
plugin
of
this
.
pluginManager
.
installedPlugins
)
{
this
.
knownUpgrades
[
plugin
.
name
]
=
available
.
find
(
x
=>
x
.
name
===
plugin
.
name
&&
semver
.
gt
(
x
.
version
,
plugin
.
version
))
this
.
knownUpgrades
[
plugin
.
name
]
=
available
.
find
(
x
=>
x
.
name
===
plugin
.
name
&&
semver
.
gt
(
x
.
version
,
plugin
.
version
))
||
null
}
})
}
...
...
@@ -91,7 +94,7 @@ export class PluginsSettingsTabComponent {
}
async
upgradePlugin
(
plugin
:
PluginInfo
):
Promise
<
void
>
{
return
this
.
installPlugin
(
this
.
knownUpgrades
[
plugin
.
name
])
return
this
.
installPlugin
(
this
.
knownUpgrades
[
plugin
.
name
]
!
)
}
showPluginInfo
(
plugin
:
PluginInfo
)
{
...
...
terminus-plugin-manager/src/index.ts
浏览文件 @
181c5230
import
{
NgModule
}
from
'
@angular/core
'
import
{
BrowserModule
}
from
'
@angular/platform-browser
'
import
{
FormsModule
}
from
'
@angular/forms
'
import
{
NgPipesModule
}
from
'
ngx-pipes
'
import
{
NgbModule
}
from
'
@ng-bootstrap/ng-bootstrap
'
import
{
SettingsTabProvider
}
from
'
terminus-settings
'
...
...
@@ -15,7 +14,6 @@ import { PluginsSettingsTabProvider } from './settings'
BrowserModule
,
FormsModule
,
NgbModule
,
NgPipesModule
,
],
providers
:
[
{
provide
:
SettingsTabProvider
,
useClass
:
PluginsSettingsTabProvider
,
multi
:
true
},
...
...
terminus-settings/package.json
浏览文件 @
181c5230
{
"name"
:
"terminus-settings"
,
"version"
:
"1.0.
83-nightly.4
"
,
"version"
:
"1.0.
92-nightly.0
"
,
"description"
:
"Terminus terminal settings page"
,
"keywords"
:
[
"terminus-builtin-plugin"
...
...
@@ -17,8 +17,7 @@
"author"
:
"Eugene Pankov"
,
"license"
:
"MIT"
,
"devDependencies"
:
{
"@types/deep-equal"
:
"1.0.1"
,
"ngx-pipes"
:
"^1.6.1"
"@types/deep-equal"
:
"1.0.1"
},
"peerDependencies"
:
{
"@angular/common"
:
"^7"
,
...
...
@@ -26,7 +25,7 @@
"@angular/forms"
:
"^7"
,
"@angular/platform-browser"
:
"^7"
,
"@ng-bootstrap/ng-bootstrap"
:
"^1"
,
"
terminus-core"
:
"*
"
,
"
rxjs"
:
"^5
"
"
rxjs"
:
"^5
"
,
"
terminus-core"
:
"*
"
}
}
terminus-settings/src/components/hotkeyInputModal.component.ts
浏览文件 @
181c5230
...
...
@@ -41,8 +41,8 @@ export class HotkeyInputModalComponent {
@
Input
()
timeoutProgress
=
0
private
keySubscription
:
Subscription
private
lastKeyEvent
:
number
private
keyTimeoutInterval
:
number
=
null
private
lastKeyEvent
:
number
|
null
=
null
private
keyTimeoutInterval
:
number
|
null
=
null
constructor
(
private
modalInstance
:
NgbActiveModal
,
...
...
@@ -78,7 +78,7 @@ export class HotkeyInputModalComponent {
this
.
keySubscription
.
unsubscribe
()
this
.
hotkeys
.
clearCurrentKeystrokes
()
this
.
hotkeys
.
enable
()
clearInterval
(
this
.
keyTimeoutInterval
)
clearInterval
(
this
.
keyTimeoutInterval
!
)
}
close
()
{
...
...
terminus-settings/src/components/settingsTab.component.pug
浏览文件 @
181c5230
...
...
@@ -8,14 +8,14 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
ng-template(ngbTabContent)
.d-flex.align-items-center.mb-4
h1.terminus-title.mb-2.mr-2 Terminus
sup α
sup α
.text-muted.mr-auto {{homeBase.appVersion}}
button.btn.btn-secondary.mr-3((click)='homeBase.openGitHub()')
i.fab.fa-github
span GitHub
button.btn.btn-secondary((click)='homeBase.reportBug()')
i.fas.fa-bug
span Report a problem
...
...
@@ -57,7 +57,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
.title(*ngIf='hostApp.platform === Platform.Windows') Acrylic background
.title(*ngIf='hostApp.platform === Platform.macOS') Vibrancy
.description Gives the window a blurred transparent background
toggle(
[(ngModel)]='config.store.appearance.vibrancy',
(ngModelChange)='config.save()'
...
...
@@ -85,7 +85,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
[value]='"fluent"'
)
| Fluent
.form-line
.header
.title Transparency
...
...
@@ -256,27 +256,28 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
| Hotkeys
ng-template(ngbTabContent)
h3.mb-3 Hotkeys
.input-group.mb-4
.input-group-prepend
.input-group-text
i.fas.fa-fw.fa-search
input.form-control(type='search', placeholder='Search hotkeys', [(ngModel)]='hotkeyFilter')
.form-group
table.hotkeys-table
tr
th Name
th ID
th Hotkey
tr(*ngFor='let hotkey of hotkeyDescriptions|filterBy:["name"]:hotkeyFilter')
td {{hotkey.name}}
td {{hotkey.id}}
td.pr-5
multi-hotkey-input(
[model]='getHotkey(hotkey.id)',
(modelChange)='setHotkey(hotkey.id, $event); config.save(); docking.dock()'
)
ng-container(*ngFor='let hotkey of hotkeyDescriptions')
tr(*ngIf='!hotkeyFilter || hotkey.name.toLowerCase().includes(hotkeyFilter.toLowerCase())')
td {{hotkey.name}}
td {{hotkey.id}}
td.pr-5
multi-hotkey-input(
[model]='getHotkey(hotkey.id)',
(modelChange)='setHotkey(hotkey.id, $event); config.save(); docking.dock()'
)
ngb-tab(*ngFor='let provider of settingsProviders', [id]='provider.id')
ng-template(ngbTabTitle)
...
...
@@ -285,7 +286,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
ng-template(ngbTabContent)
settings-tab-body([provider]='provider')
ngb-tab(id='config-file')
ng-template(ngbTabTitle)
i.fas.fa-fw.fa-code.mr-2
...
...
@@ -303,7 +304,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
textarea.form-control.h-100(
[(ngModel)]='configDefaults',
readonly
)
)
.mt-2.mb-2.d-flex
button.btn.btn-primary((click)='saveConfigFile()', *ngIf='isConfigFileValid()')
i.fas.fa-check.mr-2
...
...
terminus-settings/src/index.ts
浏览文件 @
181c5230
...
...
@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core'
import
{
BrowserModule
}
from
'
@angular/platform-browser
'
import
{
FormsModule
}
from
'
@angular/forms
'
import
{
NgbModule
}
from
'
@ng-bootstrap/ng-bootstrap
'
import
{
NgPipesModule
}
from
'
ngx-pipes
'
import
TerminusCorePlugin
,
{
ToolbarButtonProvider
,
TabRecoveryProvider
,
HotkeyProvider
,
ConfigProvider
}
from
'
terminus-core
'
...
...
@@ -22,7 +21,6 @@ import { SettingsConfigProvider } from './config'
BrowserModule
,
FormsModule
,
NgbModule
,
NgPipesModule
,
TerminusCorePlugin
,
],
providers
:
[
...
...
terminus-settings/src/recoveryProvider.ts
浏览文件 @
181c5230
...
...
@@ -6,7 +6,7 @@ import { SettingsTabComponent } from './components/settingsTab.component'
/** @hidden */
@
Injectable
()
export
class
RecoveryProvider
extends
TabRecoveryProvider
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
>
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
|
null
>
{
if
(
recoveryToken
&&
recoveryToken
.
type
===
'
app:settings
'
)
{
return
{
type
:
SettingsTabComponent
}
}
...
...
terminus-settings/yarn.lock
浏览文件 @
181c5230
...
...
@@ -8,6 +8,6 @@
integrity sha512-mMUu4nWHLBlHtxXY17Fg6+ucS/MnndyOWyOe7MmwkoMYxvfQU2ajtRaEvqSUv+aVkMqH/C0NCI8UoVfRNQ10yg==
ngx-pipes@^1.6.1:
version "1.
6.6
"
resolved "https://registry.yarnpkg.com/ngx-pipes/-/ngx-pipes-1.
6.6.tgz#32bb80906c220f1e84d5cce7d6dae002cffead4
b"
integrity sha512-
mRV0xOZDd6/Jlvti4W0pDepZRIHLHd3kZ6ZzdqyGCU0dxbKVWWLTR1jlNlxN1ruMk8eO0Y8lNh6a1bEW7dJP1w
==
version "1.
7.0
"
resolved "https://registry.yarnpkg.com/ngx-pipes/-/ngx-pipes-1.
7.0.tgz#70e166dc2f59a8b96f69dfbf75b58186c189037
b"
integrity sha512-
ZTJc0/a+e+8v7pP+tb301So5UlxVOoUEZZtJHMjuvHO/CADqfgF+sOAdq1dZMf2RnJ2QTuxbZ8wf34w3T/f8AA
==
terminus-ssh/package.json
浏览文件 @
181c5230
{
"name"
:
"terminus-ssh"
,
"version"
:
"1.0.
83
-nightly.0"
,
"version"
:
"1.0.
92
-nightly.0"
,
"description"
:
"SSH connection manager for Terminus"
,
"keywords"
:
[
"terminus-builtin-plugin"
...
...
terminus-ssh/src/api.ts
浏览文件 @
181c5230
import
{
BaseSession
}
from
'
terminus-terminal
'
export
interface
LoginScript
{
expect
?
:
string
expect
:
string
send
:
string
isRegex
?:
boolean
optional
?:
boolean
...
...
@@ -15,7 +15,7 @@ export enum SSHAlgorithmType {
}
export
interface
SSHConnection
{
name
?
:
string
name
:
string
host
:
string
port
:
number
user
:
string
...
...
@@ -122,7 +122,7 @@ export class SSHSession extends BaseSession {
this
.
kill
(
'
TERM
'
)
}
async
getWorkingDirectory
():
Promise
<
string
>
{
async
getWorkingDirectory
():
Promise
<
string
|
null
>
{
return
null
}
...
...
terminus-ssh/src/components/editConnectionModal.component.ts
浏览文件 @
181c5230
...
...
@@ -85,7 +85,7 @@ export class EditConnectionModalComponent {
title
:
'
Select private key
'
,
}
).
then
(
result
=>
{
if
(
!
result
.
filePaths
)
{
if
(
result
.
filePaths
)
{
this
.
connection
.
privateKey
=
result
.
filePaths
[
0
]
}
})
...
...
@@ -93,7 +93,7 @@ export class EditConnectionModalComponent {
save
()
{
for
(
const
k
of
Object
.
values
(
SSHAlgorithmType
))
{
this
.
connection
.
algorithms
[
k
]
=
Object
.
entries
(
this
.
algorithms
[
k
])
this
.
connection
.
algorithms
!
[
k
]
=
Object
.
entries
(
this
.
algorithms
[
k
])
.
filter
(([
_k
,
v
])
=>
!!
v
)
.
map
(([
k
,
_v
])
=>
k
)
}
...
...
@@ -105,6 +105,9 @@ export class EditConnectionModalComponent {
}
moveScriptUp
(
script
:
LoginScript
)
{
if
(
!
this
.
connection
.
scripts
)
{
this
.
connection
.
scripts
=
[]
}
const
index
=
this
.
connection
.
scripts
.
indexOf
(
script
)
if
(
index
>
0
)
{
this
.
connection
.
scripts
.
splice
(
index
,
1
)
...
...
@@ -113,6 +116,9 @@ export class EditConnectionModalComponent {
}
moveScriptDown
(
script
:
LoginScript
)
{
if
(
!
this
.
connection
.
scripts
)
{
this
.
connection
.
scripts
=
[]
}
const
index
=
this
.
connection
.
scripts
.
indexOf
(
script
)
if
(
index
>=
0
&&
index
<
this
.
connection
.
scripts
.
length
-
1
)
{
this
.
connection
.
scripts
.
splice
(
index
,
1
)
...
...
@@ -121,7 +127,7 @@ export class EditConnectionModalComponent {
}
async
deleteScript
(
script
:
LoginScript
)
{
if
((
await
this
.
electron
.
showMessageBox
(
if
(
this
.
connection
.
scripts
&&
(
await
this
.
electron
.
showMessageBox
(
this
.
hostApp
.
getWindow
(),
{
type
:
'
warning
'
,
...
...
@@ -136,6 +142,9 @@ export class EditConnectionModalComponent {
}
addScript
()
{
if
(
!
this
.
connection
.
scripts
)
{
this
.
connection
.
scripts
=
[]
}
this
.
connection
.
scripts
.
push
({
expect
:
''
,
send
:
''
})
}
}
terminus-ssh/src/components/sshModal.component.ts
浏览文件 @
181c5230
...
...
@@ -15,7 +15,7 @@ export class SSHModalComponent {
connections
:
SSHConnection
[]
childFolders
:
SSHConnectionGroup
[]
quickTarget
:
string
lastConnection
:
SSHConnection
lastConnection
:
SSHConnection
|
null
=
null
childGroups
:
SSHConnectionGroup
[]
groupCollapsed
:
{[
id
:
string
]:
boolean
}
=
{}
...
...
@@ -91,14 +91,14 @@ export class SSHModalComponent {
}
for
(
const
connection
of
connections
)
{
connection
.
group
=
connection
.
group
||
null
connection
.
group
=
connection
.
group
||
undefined
let
group
=
this
.
childGroups
.
find
(
x
=>
x
.
name
===
connection
.
group
)
if
(
!
group
)
{
group
=
{
name
:
connection
.
group
,
name
:
connection
.
group
!
,
connections
:
[],
}
this
.
childGroups
.
push
(
group
)
this
.
childGroups
.
push
(
group
!
)
}
group
.
connections
.
push
(
connection
)
}
...
...
terminus-ssh/src/components/sshSettingsTab.component.ts
浏览文件 @
181c5230
...
...
@@ -97,7 +97,7 @@ export class SSHSettingsTabComponent {
}
)).
response
===
1
)
{
for
(
const
connection
of
this
.
connections
.
filter
(
x
=>
x
.
group
===
group
.
name
))
{
connection
.
group
=
null
connection
.
group
=
undefined
}
this
.
config
.
save
()
this
.
refresh
()
...
...
@@ -109,14 +109,14 @@ export class SSHSettingsTabComponent {
this
.
childGroups
=
[]
for
(
const
connection
of
this
.
connections
)
{
connection
.
group
=
connection
.
group
||
null
connection
.
group
=
connection
.
group
||
undefined
let
group
=
this
.
childGroups
.
find
(
x
=>
x
.
name
===
connection
.
group
)
if
(
!
group
)
{
group
=
{
name
:
connection
.
group
,
name
:
connection
.
group
!
,
connections
:
[],
}
this
.
childGroups
.
push
(
group
)
this
.
childGroups
.
push
(
group
!
)
}
group
.
connections
.
push
(
connection
)
}
...
...
terminus-ssh/src/recoveryProvider.ts
浏览文件 @
181c5230
...
...
@@ -6,7 +6,7 @@ import { SSHTabComponent } from './components/sshTab.component'
/** @hidden */
@
Injectable
()
export
class
RecoveryProvider
extends
TabRecoveryProvider
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
>
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
|
null
>
{
if
(
recoveryToken
&&
recoveryToken
.
type
===
'
app:ssh-tab
'
)
{
return
{
type
:
SSHTabComponent
,
...
...
terminus-ssh/src/services/passwordStorage.service.ts
浏览文件 @
181c5230
...
...
@@ -12,7 +12,7 @@ export class PasswordStorageService {
await
keytar
.
deletePassword
(
`ssh@
${
connection
.
host
}
`
,
connection
.
user
)
}
async
loadPassword
(
connection
:
SSHConnection
):
Promise
<
string
>
{
async
loadPassword
(
connection
:
SSHConnection
):
Promise
<
string
|
null
>
{
return
keytar
.
getPassword
(
`ssh@
${
connection
.
host
}
`
,
connection
.
user
)
}
}
terminus-ssh/src/services/ssh.service.ts
浏览文件 @
181c5230
...
...
@@ -38,9 +38,9 @@ export class SSHService {
)
as
SSHTabComponent
)
}
async
connectSession
(
session
:
SSHSession
,
logCallback
?:
(
s
:
string
)
=>
void
):
Promise
<
void
>
{
let
privateKey
:
string
=
null
let
privateKeyPassphrase
:
string
=
null
async
connectSession
(
session
:
SSHSession
,
logCallback
?:
(
s
:
any
)
=>
void
):
Promise
<
void
>
{
let
privateKey
:
string
|
null
=
null
let
privateKeyPassphrase
:
string
|
null
=
null
let
privateKeyPath
=
session
.
connection
.
privateKey
if
(
!
logCallback
)
{
...
...
@@ -48,12 +48,12 @@ export class SSHService {
}
const
log
=
(
s
:
any
)
=>
{
logCallback
(
s
)
logCallback
!
(
s
)
this
.
logger
.
info
(
s
)
}
if
(
!
privateKeyPath
)
{
const
userKeyPath
=
path
.
join
(
process
.
env
.
HOME
,
'
.ssh
'
,
'
id_rsa
'
)
const
userKeyPath
=
path
.
join
(
process
.
env
.
HOME
as
string
,
'
.ssh
'
,
'
id_rsa
'
)
if
(
await
fs
.
exists
(
userKeyPath
))
{
log
(
`Using user's default private key:
${
userKeyPath
}
`
)
privateKeyPath
=
userKeyPath
...
...
@@ -92,7 +92,7 @@ export class SSHService {
const
ssh
=
new
Client
()
let
connected
=
false
let
savedPassword
:
string
=
null
let
savedPassword
:
string
|
null
=
null
await
new
Promise
(
async
(
resolve
,
reject
)
=>
{
ssh
.
on
(
'
ready
'
,
()
=>
{
connected
=
true
...
...
@@ -116,7 +116,7 @@ export class SSHService {
ssh
.
on
(
'
keyboard-interactive
'
,
(
name
,
instructions
,
instructionsLang
,
prompts
,
finish
)
=>
this
.
zone
.
run
(
async
()
=>
{
log
(
`Keyboard-interactive auth requested:
${
name
}
`
)
this
.
logger
.
info
(
'
Keyboard-interactive auth:
'
,
name
,
instructions
,
instructionsLang
)
const
results
=
[]
const
results
:
string
[]
=
[]
for
(
const
prompt
of
prompts
)
{
const
modal
=
this
.
ngbModal
.
open
(
PromptModalComponent
)
modal
.
componentInstance
.
prompt
=
prompt
.
prompt
...
...
@@ -135,7 +135,7 @@ export class SSHService {
log
(
'
Banner:
\n
'
+
banner
)
})
let
agent
:
string
=
null
let
agent
:
string
|
null
=
null
if
(
this
.
hostApp
.
platform
===
Platform
.
Windows
)
{
const
pageantRunning
=
new
Promise
<
boolean
>
(
resolve
=>
{
windowsProcessTreeNative
.
getProcessList
(
list
=>
{
// eslint-disable-line block-scoped-var
...
...
@@ -146,7 +146,7 @@ export class SSHService {
agent
=
'
pageant
'
}
}
else
{
agent
=
process
.
env
.
SSH_AUTH_SOCK
agent
=
process
.
env
.
SSH_AUTH_SOCK
as
string
}
try
{
...
...
@@ -155,10 +155,10 @@ export class SSHService {
port
:
session
.
connection
.
port
||
22
,
username
:
session
.
connection
.
user
,
password
:
session
.
connection
.
privateKey
?
undefined
:
''
,
privateKey
,
passphrase
:
privateKeyPassphrase
,
privateKey
:
privateKey
||
undefined
,
passphrase
:
privateKeyPassphrase
||
undefined
,
tryKeyboard
:
true
,
agent
,
agent
:
agent
||
undefined
,
agentForward
:
!!
agent
,
keepaliveInterval
:
session
.
connection
.
keepaliveInterval
,
keepaliveCountMax
:
session
.
connection
.
keepaliveCountMax
,
...
...
terminus-terminal/package.json
浏览文件 @
181c5230
{
"name"
:
"terminus-terminal"
,
"version"
:
"1.0.
83-nightly.4
"
,
"version"
:
"1.0.
92-nightly.0
"
,
"description"
:
"Terminus' terminal emulation core"
,
"keywords"
:
[
"terminus-builtin-plugin"
...
...
terminus-terminal/src/api/baseTerminalTab.component.ts
浏览文件 @
181c5230
...
...
@@ -43,7 +43,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
@
ViewChild
(
'
content
'
)
content
/** @hidden */
@
HostBinding
(
'
style.background-color
'
)
backgroundColor
:
string
@
HostBinding
(
'
style.background-color
'
)
backgroundColor
:
string
|
null
=
null
/** @hidden */
@
HostBinding
(
'
class.top-padded
'
)
topPadded
:
boolean
...
...
terminus-terminal/src/buttonProvider.ts
浏览文件 @
181c5230
...
...
@@ -18,7 +18,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
for
(
const
arg
of
argv
.
slice
(
1
).
concat
([
electron
.
remote
.
process
.
argv0
]))
{
if
(
await
fs
.
exists
(
arg
))
{
if
((
await
fs
.
stat
(
arg
)).
isDirectory
())
{
this
.
terminal
.
openTab
(
null
,
arg
)
this
.
terminal
.
openTab
(
undefined
,
arg
)
}
}
}
...
...
terminus-terminal/src/colorSchemes.ts
浏览文件 @
181c5230
...
...
@@ -8,7 +8,7 @@ import { TerminalColorScheme } from './api/interfaces'
@
Injectable
()
export
class
HyperColorSchemes
extends
TerminalColorSchemeProvider
{
async
getSchemes
():
Promise
<
TerminalColorScheme
[]
>
{
const
pluginsPath
=
path
.
join
(
process
.
env
.
HOME
,
'
.hyper_plugins
'
,
'
node_modules
'
)
const
pluginsPath
=
path
.
join
(
process
.
env
.
HOME
as
string
,
'
.hyper_plugins
'
,
'
node_modules
'
)
if
(
!
await
fs
.
exists
(
pluginsPath
))
{
return
[]
}
...
...
terminus-terminal/src/components/appearanceSettingsTab.component.ts
浏览文件 @
181c5230
...
...
@@ -19,7 +19,7 @@ export class AppearanceSettingsTabComponent {
fonts
:
string
[]
=
[]
colorSchemes
:
TerminalColorScheme
[]
=
[]
equalComparator
=
deepEqual
editingColorScheme
:
TerminalColorScheme
editingColorScheme
:
TerminalColorScheme
|
null
=
null
schemeChanged
=
false
constructor
(
...
...
@@ -68,7 +68,7 @@ export class AppearanceSettingsTabComponent {
saveScheme
()
{
let
schemes
=
this
.
config
.
store
.
terminal
.
customColorSchemes
schemes
=
schemes
.
filter
(
x
=>
x
!==
this
.
editingColorScheme
&&
x
.
name
!==
this
.
editingColorScheme
.
name
)
schemes
=
schemes
.
filter
(
x
=>
x
!==
this
.
editingColorScheme
&&
x
.
name
!==
this
.
editingColorScheme
!
.
name
)
schemes
.
push
(
this
.
editingColorScheme
)
this
.
config
.
store
.
terminal
.
customColorSchemes
=
schemes
this
.
config
.
save
()
...
...
terminus-terminal/src/components/shellSettingsTab.component.ts
浏览文件 @
181c5230
...
...
@@ -52,6 +52,9 @@ export class ShellSettingsTabComponent {
pickWorkingDirectory
()
{
const
shell
=
this
.
shells
.
find
(
x
=>
x
.
id
===
this
.
config
.
store
.
terminal
.
shell
)
if
(
!
shell
)
{
return
}
const
paths
=
this
.
electron
.
dialog
.
showOpenDialog
(
this
.
hostApp
.
getWindow
(),
{
...
...
@@ -66,7 +69,7 @@ export class ShellSettingsTabComponent {
newProfile
(
shell
:
Shell
)
{
const
profile
:
Profile
=
{
name
:
shell
.
name
,
name
:
shell
.
name
||
''
,
sessionOptions
:
this
.
terminalService
.
optionsFromShell
(
shell
),
}
this
.
config
.
store
.
terminal
.
profiles
=
[
profile
,
...
this
.
config
.
store
.
terminal
.
profiles
]
...
...
terminus-terminal/src/components/terminalSettingsTab.component.ts
浏览文件 @
181c5230
...
...
@@ -16,7 +16,7 @@ export class TerminalSettingsTabComponent {
openWSLVolumeMixer
()
{
this
.
electron
.
shell
.
openItem
(
'
sndvol.exe
'
)
this
.
terminal
.
openTab
({
name
:
null
,
name
:
''
,
sessionOptions
:
{
command
:
'
wsl.exe
'
,
args
:
[
'
tput
'
,
'
bel
'
],
...
...
terminus-terminal/src/components/terminalTab.component.ts
浏览文件 @
181c5230
...
...
@@ -68,7 +68,7 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
}
}
async
getCurrentProcess
():
Promise
<
BaseTabProcess
>
{
async
getCurrentProcess
():
Promise
<
BaseTabProcess
|
null
>
{
const
children
=
await
this
.
session
.
getChildProcesses
()
if
(
!
children
.
length
)
{
return
null
...
...
terminus-terminal/src/frontends/hterm.ts
浏览文件 @
181c5230
...
...
@@ -78,11 +78,11 @@ hterm.hterm.VT.CSI[' q'] = function (parseState) {
}
hterm
.
hterm
.
VT
.
OSC
[
'
4
'
]
=
function
(
parseState
)
{
const
args
=
parseState
.
args
[
0
].
split
(
'
;
'
)
const
args
:
string
[]
=
parseState
.
args
[
0
].
split
(
'
;
'
)
const
pairCount
=
args
.
length
/
2
const
colorPalette
=
this
.
terminal
.
getTextAttributes
().
colorPalette
const
responseArray
=
[]
const
responseArray
:
string
[]
=
[]
for
(
let
pairNumber
=
0
;
pairNumber
<
pairCount
;
++
pairNumber
)
{
const
colorIndex
=
parseInt
(
args
[
pairNumber
*
2
])
...
...
@@ -95,7 +95,7 @@ hterm.hterm.VT.OSC['4'] = function (parseState) {
if
(
colorValue
===
'
?
'
)
{
colorValue
=
hterm
.
lib
.
colors
.
rgbToX11
(
colorPalette
[
colorIndex
])
if
(
colorValue
)
{
responseArray
.
push
(
colorIndex
+
'
;
'
+
colorValue
)
responseArray
.
push
(
colorIndex
.
toString
()
+
'
;
'
+
colorValue
)
}
continue
}
...
...
terminus-terminal/src/frontends/htermFrontend.ts
浏览文件 @
181c5230
...
...
@@ -186,7 +186,7 @@ export class HTermFrontend extends Frontend {
this
.
io
.
onTerminalResize
=
(
columns
,
rows
)
=>
{
this
.
resize
.
next
({
columns
,
rows
})
}
this
.
ready
.
next
(
null
)
this
.
ready
.
next
()
this
.
ready
.
complete
()
this
.
term
.
scrollPort_
.
document_
.
addEventListener
(
'
dragOver
'
,
event
=>
{
...
...
terminus-terminal/src/frontends/xtermFrontend.ts
浏览文件 @
181c5230
...
...
@@ -120,7 +120,7 @@ export class XTermFrontend extends Frontend {
this
.
xterm
.
loadAddon
(
new
WebglAddon
())
}
this
.
ready
.
next
(
null
)
this
.
ready
.
next
()
this
.
ready
.
complete
()
this
.
xterm
.
loadAddon
(
this
.
search
)
...
...
@@ -250,7 +250,7 @@ export class XTermFrontend extends Frontend {
let
html
=
`<div style="font-family: '
${
this
.
configService
.
store
.
terminal
.
font
}
', monospace; white-space: pre">`
const
selection
=
this
.
xterm
.
getSelectionPosition
()
if
(
!
selection
)
{
return
null
return
''
}
if
(
selection
.
startRow
===
selection
.
endRow
)
{
html
+=
this
.
getLineAsHTML
(
selection
.
startRow
,
selection
.
startColumn
,
selection
.
endColumn
)
...
...
@@ -278,7 +278,7 @@ export class XTermFrontend extends Frontend {
private
getLineAsHTML
(
y
:
number
,
start
:
number
,
end
:
number
):
string
{
let
html
=
'
<div>
'
let
lastStyle
=
null
let
lastStyle
:
string
|
null
=
null
const
line
=
(
this
.
xterm
.
buffer
.
getLine
(
y
)
as
any
).
_line
const
cell
=
new
CellData
()
for
(
let
i
=
start
;
i
<
end
;
i
++
)
{
...
...
terminus-terminal/src/index.ts
浏览文件 @
181c5230
...
...
@@ -188,7 +188,7 @@ export default class TerminalModule { // eslint-disable-line @typescript-eslint/
hostApp
.
cliOpenDirectory$
.
subscribe
(
async
directory
=>
{
if
(
await
fs
.
exists
(
directory
))
{
if
((
await
fs
.
stat
(
directory
)).
isDirectory
())
{
terminal
.
openTab
(
null
,
directory
)
terminal
.
openTab
(
undefined
,
directory
)
hostApp
.
bringToFront
()
}
}
...
...
terminus-terminal/src/pathDrop.ts
浏览文件 @
181c5230
...
...
@@ -15,7 +15,7 @@ export class PathDropDecorator extends TerminalDecorator {
event
.
preventDefault
()
}),
terminal
.
frontend
.
drop$
.
subscribe
(
event
=>
{
for
(
const
file
of
event
.
dataTransfer
.
files
as
any
)
{
for
(
const
file
of
event
.
dataTransfer
!
.
files
as
any
)
{
this
.
injectPath
(
terminal
,
file
.
path
)
}
event
.
preventDefault
()
...
...
terminus-terminal/src/recoveryProvider.ts
浏览文件 @
181c5230
...
...
@@ -6,7 +6,7 @@ import { TerminalTabComponent } from './components/terminalTab.component'
/** @hidden */
@
Injectable
()
export
class
RecoveryProvider
extends
TabRecoveryProvider
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
>
{
async
recover
(
recoveryToken
:
any
):
Promise
<
RecoveredTab
|
null
>
{
if
(
recoveryToken
&&
recoveryToken
.
type
===
'
app:terminal-tab
'
)
{
return
{
type
:
TerminalTabComponent
,
...
...
terminus-terminal/src/services/dockMenu.service.ts
浏览文件 @
181c5230
...
...
@@ -30,7 +30,7 @@ export class DockMenuService {
iconPath
:
process
.
execPath
,
iconIndex
:
0
,
})),
}]
:
null
)
}]
:
null
as
any
)
}
if
(
this
.
hostApp
.
platform
===
Platform
.
macOS
)
{
this
.
electron
.
app
.
dock
.
setMenu
(
this
.
electron
.
Menu
.
buildFromTemplate
(
...
...
terminus-terminal/src/services/sessions.service.ts
浏览文件 @
181c5230
...
...
@@ -62,7 +62,7 @@ export abstract class BaseSession {
releaseInitialDataBuffer
()
{
this
.
initialDataBufferReleased
=
true
this
.
output
.
next
(
this
.
initialDataBuffer
)
this
.
initialDataBuffer
=
null
this
.
initialDataBuffer
=
''
}
async
destroy
():
Promise
<
void
>
{
...
...
@@ -81,14 +81,14 @@ export abstract class BaseSession {
abstract
kill
(
signal
?:
string
):
void
abstract
async
getChildProcesses
():
Promise
<
ChildProcess
[]
>
abstract
async
gracefullyKillProcess
():
Promise
<
void
>
abstract
async
getWorkingDirectory
():
Promise
<
string
>
abstract
async
getWorkingDirectory
():
Promise
<
string
|
null
>
}
/** @hidden */
export
class
Session
extends
BaseSession
{
private
pty
:
any
private
pauseAfterExit
=
false
private
guessedCWD
:
string
private
guessedCWD
:
string
|
null
=
null
private
reportedCWD
:
string
constructor
(
private
config
:
ConfigService
)
{
...
...
@@ -96,7 +96,7 @@ export class Session extends BaseSession {
}
start
(
options
:
SessionOptions
)
{
this
.
name
=
options
.
name
this
.
name
=
options
.
name
||
''
const
env
=
{
...
process
.
env
,
...
...
@@ -122,7 +122,7 @@ export class Session extends BaseSession {
if
(
!
fs
.
existsSync
(
cwd
))
{
console
.
warn
(
'
Ignoring non-existent CWD:
'
,
cwd
)
cwd
=
null
cwd
=
undefined
}
this
.
pty
=
nodePTY
.
spawn
(
options
.
command
,
options
.
args
||
[],
{
...
...
@@ -135,7 +135,7 @@ export class Session extends BaseSession {
experimentalUseConpty
:
(
isWindowsBuild
(
WIN_BUILD_CONPTY_SUPPORTED
)
&&
this
.
config
.
store
.
terminal
.
useConPTY
?
1
:
false
)
as
any
,
})
this
.
guessedCWD
=
cwd
this
.
guessedCWD
=
cwd
||
null
this
.
truePID
=
this
.
pty
[
'
pid
'
]
...
...
@@ -174,7 +174,7 @@ export class Session extends BaseSession {
}
})
this
.
pauseAfterExit
=
options
.
pauseAfterExit
this
.
pauseAfterExit
=
options
.
pauseAfterExit
||
false
}
processOSC1337
(
data
:
string
)
{
...
...
@@ -270,7 +270,7 @@ export class Session extends BaseSession {
}
}
async
getWorkingDirectory
():
Promise
<
string
>
{
async
getWorkingDirectory
():
Promise
<
string
|
null
>
{
if
(
this
.
reportedCWD
)
{
return
this
.
reportedCWD
}
...
...
terminus-terminal/src/services/terminal.service.ts
浏览文件 @
181c5230
...
...
@@ -51,7 +51,7 @@ export class TerminalService {
* Launches a new terminal with a specific shell and CWD
* @param pause Wait for a keypress when the shell exits
*/
async
openTab
(
profile
?:
Profile
,
cwd
?:
string
,
pause
?:
boolean
):
Promise
<
TerminalTabComponent
>
{
async
openTab
(
profile
?:
Profile
,
cwd
?:
string
|
null
,
pause
?:
boolean
):
Promise
<
TerminalTabComponent
>
{
if
(
!
profile
)
{
const
profiles
=
await
this
.
getProfiles
(
true
)
profile
=
profiles
.
find
(
x
=>
slug
(
x
.
name
).
toLowerCase
()
===
this
.
config
.
store
.
terminal
.
profile
)
||
profiles
[
0
]
...
...
@@ -85,7 +85,7 @@ export class TerminalService {
const
sessionOptions
=
{
...
profile
.
sessionOptions
,
pauseAfterExit
:
pause
,
cwd
,
cwd
:
cwd
||
undefined
,
}
return
this
.
openTabWithOptions
(
sessionOptions
)
...
...
terminus-terminal/src/services/terminalFrontend.service.ts
浏览文件 @
181c5230
...
...
@@ -34,6 +34,6 @@ export class TerminalFrontendService {
this
.
getFrontend
(),
)
}
return
this
.
containers
.
get
(
session
)
return
this
.
containers
.
get
(
session
)
!
}
}
terminus-terminal/src/shells/linuxDefault.ts
浏览文件 @
181c5230
...
...
@@ -23,7 +23,7 @@ export class LinuxDefaultShellProvider extends ShellProvider {
return
[]
}
const
line
=
(
await
fs
.
readFile
(
'
/etc/passwd
'
,
{
encoding
:
'
utf-8
'
}))
.
split
(
'
\n
'
).
find
(
x
=>
x
.
startsWith
(
process
.
env
.
LOGNAME
+
'
:
'
))
.
split
(
'
\n
'
).
find
(
x
=>
x
.
startsWith
(
`
${
process
.
env
.
LOGNAME
}
:`
))
if
(
!
line
)
{
this
.
logger
.
warn
(
'
Could not detect user shell
'
)
return
[{
...
...
tsconfig.json
浏览文件 @
181c5230
...
...
@@ -16,6 +16,7 @@
"esModuleInterop"
:
true
,
"allowSyntheticDefaultImports"
:
true
,
"importHelpers"
:
true
,
"strictNullChecks"
:
true
,
"lib"
:
[
"dom"
,
"es5"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录