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
3bb51597
Commit
3bb51597
authored
Dec 03, 2018
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传文件分片大小可自定义设置,默认为500kb
parent
a68c74d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
7 deletions
+65
-7
request.js
modules/request.js
+5
-1
en.js
source/language/en.js
+4
-0
zh.js
source/language/zh.js
+4
-0
index.js
source/modules/filemanager/index.js
+29
-5
form.js
source/modules/shellmanager/list/form.js
+23
-1
No files found.
modules/request.js
View file @
3bb51597
...
@@ -122,7 +122,11 @@ class Request {
...
@@ -122,7 +122,11 @@ class Request {
},
res
,
callback
);
},
res
,
callback
);
})
})
.
end
((
err
,
ret
)
=>
{
.
end
((
err
,
ret
)
=>
{
let
buff
=
ret
.
body
;
if
(
!
ret
)
{
// 请求失败 TIMEOUT
return
event
.
sender
.
send
(
'request-error-'
+
opts
[
'hash'
],
err
);
}
let
buff
=
ret
.
hasOwnProperty
(
'body'
)
?
ret
.
body
:
new
Buffer
();
// 解码
// 解码
let
text
=
iconv
.
decode
(
buff
,
opts
[
'encode'
]);
let
text
=
iconv
.
decode
(
buff
,
opts
[
'encode'
]);
if
(
err
&&
text
==
""
)
{
if
(
err
&&
text
==
""
)
{
...
...
source/language/en.js
View file @
3bb51597
...
@@ -170,6 +170,7 @@ module.exports = {
...
@@ -170,6 +170,7 @@ module.exports = {
nohttps
:
'Ignore HTTPS certificate'
,
nohttps
:
'Ignore HTTPS certificate'
,
terminalCache
:
"Use the terminal's cache"
,
terminalCache
:
"Use the terminal's cache"
,
filemanagerCache
:
"Use the filemanager's cache"
,
filemanagerCache
:
"Use the filemanager's cache"
,
uploadFragment
:
"Upload File Fragmentation Size"
,
requestTimeout
:
'Request timeout'
,
requestTimeout
:
'Request timeout'
,
commandPath
:
'Custom terminal-execPath'
commandPath
:
'Custom terminal-execPath'
}
}
...
@@ -240,6 +241,9 @@ module.exports = {
...
@@ -240,6 +241,9 @@ module.exports = {
task
:
{
task
:
{
name
:
'Upload'
,
name
:
'Upload'
,
success
:
'Upload success!'
,
success
:
'Upload success!'
,
httperr_413
:
'Please lower the upload file shard size setting.'
,
httperr_etime
:
'Request timeout, please increase the timeout period.'
,
httperr_econnrefused
:
'Connection refused, check target or proxy is enabled.'
,
failed
:
(
err
)
=>
antSword
.
noxss
(
`Failed:
${
err
}
`
),
failed
:
(
err
)
=>
antSword
.
noxss
(
`Failed:
${
err
}
`
),
error
:
(
err
)
=>
antSword
.
noxss
(
`Error:
${
err
}
`
)
error
:
(
err
)
=>
antSword
.
noxss
(
`Error:
${
err
}
`
)
},
},
...
...
source/language/zh.js
View file @
3bb51597
...
@@ -171,6 +171,7 @@ module.exports = {
...
@@ -171,6 +171,7 @@ module.exports = {
nohttps
:
'忽略HTTPS证书'
,
nohttps
:
'忽略HTTPS证书'
,
terminalCache
:
'虚拟终端使用缓存'
,
terminalCache
:
'虚拟终端使用缓存'
,
filemanagerCache
:
'文件管理使用缓存'
,
filemanagerCache
:
'文件管理使用缓存'
,
uploadFragment
:
'上传文件分片大小'
,
requestTimeout
:
'请求超时'
,
requestTimeout
:
'请求超时'
,
commandPath
:
'自定义终端执行路径'
commandPath
:
'自定义终端执行路径'
}
}
...
@@ -241,6 +242,9 @@ module.exports = {
...
@@ -241,6 +242,9 @@ module.exports = {
task
:
{
task
:
{
name
:
'上传'
,
name
:
'上传'
,
success
:
'上传成功'
,
success
:
'上传成功'
,
httperr_413
:
'请将上传文件分片大小设置调低'
,
httperr_etime
:
'请求超时,请将超时时间调大'
,
httperr_econnrefused
:
'连接被拒绝,检查目标或代理是否开启'
,
failed
:
(
err
)
=>
antSword
.
noxss
(
`失败:
${
err
}
`
),
failed
:
(
err
)
=>
antSword
.
noxss
(
`失败:
${
err
}
`
),
error
:
(
err
)
=>
antSword
.
noxss
(
`出错:
${
err
}
`
)
error
:
(
err
)
=>
antSword
.
noxss
(
`出错:
${
err
}
`
)
},
},
...
...
source/modules/filemanager/index.js
View file @
3bb51597
...
@@ -696,9 +696,9 @@ class FileManager {
...
@@ -696,9 +696,9 @@ class FileManager {
let buffIndex = 0;
let buffIndex = 0;
let buff = [];
let buff = [];
// 分段上传大小,默认0.5M(jsp 超过1M响应会出错)
// 分段上传大小,默认0.5M(jsp 超过1M响应会出错)
let dataSplit = 5
12
* 1024;
let dataSplit = 5
00
* 1024;
if (
this.opts['
type
'].toLowerCase() === '
php
'
) {
if (
parseInt((this.opts.otherConf || {})['
upload
-
fragment
']) > 0
) {
dataSplit =
1024 * 1024
dataSplit =
parseInt((this.opts.otherConf || {})['
upload
-
fragment
']) * 1024;
}
}
let task = tasks[filePath];
let task = tasks[filePath];
// 获取文件名
// 获取文件名
...
@@ -751,8 +751,32 @@ class FileManager {
...
@@ -751,8 +751,32 @@ class FileManager {
ret === '
0
' ? '' : `<br/>${ret}`
ret === '
0
' ? '' : `<br/>${ret}`
), LANG_T['
error
']);
), LANG_T['
error
']);
}).catch((err) => {
}).catch((err) => {
task.failed(LANG['
upload
']['
task
']['
error
'](err));
// 出错后友好提示
toastr.error(LANG['
upload
']['
error
'](fileName, err), LANG_T['
error
']);
let errmsg = err;
if (err.hasOwnProperty('
status
') && err.hasOwnProperty('
response
')) {
errmsg = `${err.status} ${err.response.res.statusMessage}`;
switch(err.status) {
case 413:
errmsg += `${LANG['
upload
']['
task
']['
httperr_413
']}`;
break;
default:
break;
}
}else if(err.hasOwnProperty('
errno
')) {
switch(err.errno) {
case '
ETIME
':
errmsg = `${LANG['
upload
']['
task
']['
httperr_etime
']}`;
break;
case '
ECONNREFUSED
':
errmsg = `${LANG['
upload
']['
task
']['
httperr_econnrefused
']}`;
break;
default:
errmsg = `${err.errno} ${err.code}`;
break;
}
}
task.failed(LANG['
upload
']['
task
']['
error
'](errmsg));
toastr.error(LANG['
upload
']['
error
'](fileName, errmsg), LANG_T['
error
']);
});
});
})
})
}
}
...
...
source/modules/shellmanager/list/form.js
View file @
3bb51597
...
@@ -278,6 +278,7 @@ class Form {
...
@@ -278,6 +278,7 @@ class Form {
'ignore-https'
:
0
,
'ignore-https'
:
0
,
'terminal-cache'
:
0
,
'terminal-cache'
:
0
,
'filemanager-cache'
:
1
,
'filemanager-cache'
:
1
,
'upload-fragment'
:
'500'
,
'request-timeout'
:
'10000'
,
'request-timeout'
:
'10000'
,
'command-path'
:
''
'command-path'
:
''
},
arg
.
otherConf
);
},
arg
.
otherConf
);
...
@@ -294,7 +295,28 @@ class Form {
...
@@ -294,7 +295,28 @@ class Form {
},
{
},
{
type
:
"checkbox"
,
name
:
'filemanager-cache'
,
label
:
LANG
[
'list'
][
'otherConf'
][
'filemanagerCache'
],
type
:
"checkbox"
,
name
:
'filemanager-cache'
,
label
:
LANG
[
'list'
][
'otherConf'
][
'filemanagerCache'
],
checked
:
opt
[
'filemanager-cache'
]
===
1
checked
:
opt
[
'filemanager-cache'
]
===
1
},{
},
{
type
:
"label"
,
label
:
LANG
[
'list'
][
'otherConf'
][
'uploadFragment'
]
},
{
type
:
"combo"
,
label
:
'/kb'
,
inputWidth
:
100
,
name
:
"upload-fragment"
,
options
:
((
items
)
=>
{
let
ret
=
[];
// 如果自定义的路径不在items里,则++
if
(
items
.
indexOf
(
opt
[
'upload-fragment'
])
===
-
1
)
{
items
.
unshift
(
opt
[
'upload-fragment'
]);
}
items
.
map
((
_
)
=>
{
ret
.
push
({
text
:
_
,
value
:
_
,
selected
:
opt
[
'upload-fragment'
]
===
_
})
});
return
ret
;
})([
'500'
,
'400'
,
'200'
,
'100'
,
'50'
,
'10'
])
},
{
type
:
"label"
,
label
:
LANG
[
'list'
][
'otherConf'
][
'requestTimeout'
]
type
:
"label"
,
label
:
LANG
[
'list'
][
'otherConf'
][
'requestTimeout'
]
},
{
},
{
type
:
"combo"
,
label
:
'/ms'
,
inputWidth
:
100
,
name
:
"request-timeout"
,
type
:
"combo"
,
label
:
'/ms'
,
inputWidth
:
100
,
name
:
"request-timeout"
,
...
...
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