Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
f0873342
Commit
f0873342
authored
Jul 06, 2016
by
Antoor
Committed by
GitHub
Jul 06, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72 from antoor/v2.0-beta-terminal-setp
v2.0-beta::terminal custom execPath
parents
79e2e989
b6f1cb42
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
17 deletions
+55
-17
en.js
source/language/en.js
+3
-1
zh.js
source/language/zh.js
+3
-1
form.js
source/modules/shellmanager/list/form.js
+43
-13
index.js
source/modules/terminal/index.js
+6
-2
No files found.
source/language/en.js
View file @
f0873342
...
...
@@ -155,7 +155,9 @@ module.exports = {
},
otherConf
:
{
nohttps
:
'Ignore HTTPS certificate'
,
terminalCache
:
"Use the terminal's cache"
terminalCache
:
"Use the terminal's cache"
,
requestTimeout
:
'Request timeout'
,
commandPath
:
'Custom terminal-execPath'
}
}
},
...
...
source/language/zh.js
View file @
f0873342
...
...
@@ -156,7 +156,9 @@ module.exports = {
},
otherConf
:
{
nohttps
:
'忽略HTTPS证书'
,
terminalCache
:
"虚拟终端使用缓存"
terminalCache
:
'虚拟终端使用缓存'
,
requestTimeout
:
'请求超时'
,
commandPath
:
'自定义终端执行路径'
}
}
},
...
...
source/modules/shellmanager/list/form.js
View file @
f0873342
...
...
@@ -271,7 +271,8 @@ class Form {
const
opt
=
Object
.
assign
({},
{
'ignore-https'
:
0
,
'terminal-cache'
:
0
,
'request-timeout'
:
'10000'
'request-timeout'
:
'10000'
,
'command-path'
:
''
},
arg
.
otherConf
);
const
form
=
this
.
accordion
.
cells
(
'other'
).
attachForm
([{
type
:
'settings'
,
position
:
'label-right'
,
inputWidth
:
400
...
...
@@ -284,19 +285,48 @@ class Form {
type
:
"checkbox"
,
name
:
'terminal-cache'
,
label
:
LANG
[
'list'
][
'otherConf'
][
'terminalCache'
],
checked
:
opt
[
'terminal-cache'
]
===
1
},
{
type
:
"label"
,
label
:
'请求超时'
type
:
"label"
,
label
:
LANG
[
'list'
][
'otherConf'
][
'requestTimeout'
]
},
{
type
:
"combo"
,
label
:
'/ms'
,
inputWidth
:
100
,
name
:
"request-timeout"
,
readonly
:
true
,
options
:
[
{
text
:
"5000"
,
value
:
"5000"
,
selected
:
opt
[
'request-timeout'
]
===
'5000'
},
{
text
:
"10000"
,
value
:
"10000"
,
selected
:
opt
[
'request-timeout'
]
===
'10000'
},
{
text
:
"30000"
,
value
:
"30000"
,
selected
:
opt
[
'request-timeout'
]
===
'30000'
},
{
text
:
"60000"
,
value
:
"60000"
,
selected
:
opt
[
'request-timeout'
]
===
'60000'
}
]},
type
:
"combo"
,
label
:
'/ms'
,
inputWidth
:
100
,
name
:
"request-timeout"
,
options
:
((
items
)
=>
{
let
ret
=
[];
// 如果自定义的路径不在items里,则++
if
(
items
.
indexOf
(
opt
[
'request-timeout'
])
===
-
1
)
{
items
.
unshift
(
opt
[
'request-timeout'
]);
}
items
.
map
((
_
)
=>
{
ret
.
push
({
text
:
_
,
value
:
_
,
selected
:
opt
[
'command-path'
]
===
_
})
});
return
ret
;
})([
'5000'
,
'10000'
,
'30000'
,
'60000'
])
},
{
type
:
'label'
,
label
:
LANG
[
'list'
][
'otherConf'
][
'commandPath'
]
},
{
type
:
'combo'
,
name
:
'command-path'
,
inputWidth
:
200
,
options
:
((
items
)
=>
{
let
ret
=
[];
// 如果自定义的路径不在items里,则++
if
(
items
.
indexOf
(
opt
[
'command-path'
])
===
-
1
)
{
items
.
unshift
(
opt
[
'command-path'
]);
}
items
.
map
((
_
)
=>
{
ret
.
push
({
text
:
_
,
value
:
_
,
selected
:
opt
[
'command-path'
]
===
_
})
});
return
ret
;
})([
'/bin/sh'
,
'cmd'
])
}
]}],
true
);
return
form
;
}
...
...
source/modules/terminal/index.js
View file @
f0873342
...
...
@@ -134,7 +134,7 @@ class Terminal {
if
(
!
cmd
)
{
return
false
};
// 如果为exit||quit则关闭窗口
if
(
cmd
===
'exit'
||
cmd
===
'quit'
)
{
return
this
.
cell
.
close
()
};
term
.
pause
();
//
term.pause();
// 是否有缓存
let
cacheTag
=
'command-'
+
new
Buffer
(
this
.
path
+
cmd
).
toString
(
'base64'
);
let
cacheCmd
=
this
.
cache
.
get
(
cacheTag
);
...
...
@@ -146,11 +146,15 @@ class Terminal {
);
return
term
.
resume
();
};
// 获取自定义执行路径
let
_bin
=
this
.
isWin
?
'cmd'
:
'/bin/sh'
;
let
_confBin
=
(
this
.
opts
[
'otherConf'
]
||
{})[
'command-path'
];
_bin
=
_confBin
||
_bin
;
// 开始执行命令
this
.
core
.
request
(
this
.
core
.
command
.
exec
({
cmd
:
this
.
parseCmd
(
cmd
,
this
.
path
),
bin
:
this
.
isWin
?
'cmd'
:
'/bin/sh'
bin
:
_bin
})
).
then
((
ret
)
=>
{
let
_
=
ret
[
'text'
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment