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
caee03a6
Commit
caee03a6
authored
Jun 29, 2016
by
Antoor
Committed by
GitHub
Jun 29, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #62 from antoor/v2.0-beta-random-encoder
v2.0-beta::random encoder features
parents
9c156004
fda78468
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
base.js
source/core/base.js
+24
-1
form.js
source/modules/shellmanager/list/form.js
+5
-0
No files found.
source/core/base.js
View file @
caee03a6
...
...
@@ -20,12 +20,35 @@ class Base {
opts
[
'encode'
]
=
opts
[
'encode'
]
||
'utf8'
;
opts
[
'encoder'
]
=
opts
[
'encoder'
]
||
'default'
;
this
.
__opts__
=
opts
;
// 默认编码器
this
[
'__encoder__'
]
=
{
/**
* 默认编码器
* @param {String} pwd 连接密码
* @param {Object} data 请求数据
* @return {Object} 生成数据
*/
default
(
pwd
,
data
)
{
data
[
pwd
]
=
data
[
'_'
];
delete
data
[
'_'
];
return
data
;
},
/**
* 随机编码器
* @param {String} pwd 连接密码
* @param {Object} data 请求数据
* @return {Object} 生成数据
*/
random
(
pwd
,
data
)
{
let
_encoders
=
[];
for
(
let
_
in
this
)
{
if
(
_
===
'random'
)
{
continue
}
_encoders
.
push
(
_
);
}
let
_index
=
parseInt
(
Math
.
random
()
*
_encoders
.
length
);
return
this
[
_encoders
[
_index
]
](
pwd
,
data
);
}
}
}
...
...
source/modules/shellmanager/list/form.js
View file @
caee03a6
...
...
@@ -200,6 +200,11 @@ class Form {
{
type
:
'label'
,
label
:
LANG
[
'list'
][
'add'
][
'form'
][
'encoder'
]
},
{
type
:
'radio'
,
name
:
`encoder_
${
c
}
`
,
value
:
'default'
,
label
:
'default'
,
checked
:
true
}
];
if
(
c
!==
'custom'
)
{
_
.
push
({
type
:
'radio'
,
name
:
`encoder_
${
c
}
`
,
value
:
'random'
,
label
:
'random'
});
}
encoders
.
map
((
e
)
=>
{
_
.
push
({
type
:
'radio'
,
name
:
`encoder_
${
c
}
`
,
...
...
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