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
80e82185
Commit
80e82185
authored
Aug 28, 2021
by
Medicean
Committed by
Medicean
Jul 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance: Settings/Encoder) 优化了新增 Core 类型时,编码设置模块解析的逻辑
parent
38ac1b04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
115 deletions
+48
-115
CHANGELOG.md
CHANGELOG.md
+4
-0
encoders.js
source/modules/settings/encoders.js
+44
-115
No files found.
CHANGELOG.md
View file @
80e82185
...
@@ -23,6 +23,10 @@
...
@@ -23,6 +23,10 @@
*
支持自定义 Content-Type, 默认是
`form`
*
支持自定义 Content-Type, 默认是
`form`
### 设置模块
*
优化了新增Core类型时,编码设置解析逻辑, 现在不需要再改该模块的源代码了
## 2021/07/25 `v(2.1.14)`
## 2021/07/25 `v(2.1.14)`
### 核心
### 核心
...
...
source/modules/settings/encoders.js
View file @
80e82185
...
@@ -45,85 +45,44 @@ class Encoders {
...
@@ -45,85 +45,44 @@ class Encoders {
icon
:
'plus-circle'
,
icon
:
'plus-circle'
,
id
:
'new'
,
id
:
'new'
,
openAll
:
true
,
openAll
:
true
,
options
:
[{
options
:
((
items
)
=>
{
id
:
'new_asp'
,
let
ret
=
[];
icon
:
'file-code-o'
,
items
.
map
((
_
)
=>
{
type
:
'button'
,
ret
.
push
({
text
:
"ASP"
id
:
`new_
${
antSword
.
noxss
(
_
.
toLocaleLowerCase
())}
`
,
},
{
icon
:
'file-code-o'
,
id
:
'new_aspx'
,
type
:
'button'
,
icon
:
'file-code-o'
,
text
:
antSword
.
noxss
(
_
.
toUpperCase
())
type
:
'button'
,
});
text
:
"ASPX"
});
},
{
ret
=
ret
.
concat
([{
id
:
'new_php'
,
type
:
'separator'
icon
:
'file-code-o'
,
},
{
type
:
'button'
,
id
:
'new_php_rsa'
,
text
:
"PHP"
icon
:
'file-code-o'
,
},
{
type
:
'button'
,
id
:
'new_jsp'
,
text
:
"PHP RSA"
icon
:
'file-code-o'
,
}]);
type
:
'button'
,
return
ret
;
text
:
"JSP"
})(
antSword
[
"core_types"
]),
},
{
id
:
'new_jspjs'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"JSPJS"
},
{
id
:
'new_cmdlinux'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"CMDLINUX"
},
{
type
:
'separator'
},
{
id
:
'new_custom'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"Custom"
},
{
type
:
'separator'
},
{
id
:
'new_php_rsa'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"PHP RSA"
}]
},
{
},
{
type
:
'buttonSelect'
,
type
:
'buttonSelect'
,
text
:
LANG
[
'toolbar'
][
'new_decoder'
],
text
:
LANG
[
'toolbar'
][
'new_decoder'
],
icon
:
'plus-circle'
,
icon
:
'plus-circle'
,
id
:
'new_decoder'
,
id
:
'new_decoder'
,
openAll
:
true
,
openAll
:
true
,
options
:
[{
options
:
((
items
)
=>
{
id
:
'new_php_decoder'
,
let
ret
=
[];
icon
:
'file-code-o'
,
items
.
map
((
_
)
=>
{
type
:
'button'
,
ret
.
push
({
text
:
"PHP"
id
:
`new_
${
antSword
.
noxss
(
_
.
toLocaleLowerCase
())}
_decoder`
,
},
{
icon
:
'file-code-o'
,
id
:
'new_jsp_decoder'
,
type
:
'button'
,
icon
:
'file-code-o'
,
text
:
antSword
.
noxss
(
_
.
toUpperCase
())
type
:
'button'
,
});
text
:
"JSP"
});
},
{
return
ret
;
id
:
'new_jspjs_decoder'
,
})(
antSword
[
"core_types"
]),
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"JSPJS"
},
{
id
:
'new_cmdlinux_decoder'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"CMDLINUX"
},
{
type
:
'separator'
},
{
id
:
'new_custom_decoder'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"Custom"
}]
},
{
},
{
type
:
'separator'
type
:
'separator'
},
{
},
{
...
@@ -154,43 +113,6 @@ class Encoders {
...
@@ -154,43 +113,6 @@ class Encoders {
toolbar
.
attachEvent
(
"onClick"
,
(
id
)
=>
{
toolbar
.
attachEvent
(
"onClick"
,
(
id
)
=>
{
switch
(
id
)
{
switch
(
id
)
{
case
"new_asp"
:
that
.
createEncoder
(
id
);
break
;
case
"new_aspx"
:
that
.
createEncoder
(
id
);
break
;
case
"new_jsp"
:
that
.
createEncoder
(
id
);
break
;
case
"new_jspjs"
:
that
.
createEncoder
(
id
);
break
;
case
"new_cmdlinux"
:
that
.
createEncoder
(
id
);
break
;
case
"new_php"
:
case
"new_php_rsa"
:
that
.
createEncoder
(
id
);
break
;
case
"new_custom"
:
that
.
createEncoder
(
id
);
break
;
case
"new_php_decoder"
:
that
.
createEncoder
(
id
,
'decoder'
);
break
;
case
"new_jsp_decoder"
:
that
.
createEncoder
(
id
,
'decoder'
);
break
;
case
"new_jspjs_decoder"
:
that
.
createEncoder
(
id
,
'decoder'
);
break
;
case
"new_cmdlinux_decoder"
:
that
.
createEncoder
(
id
,
'decoder'
);
break
;
case
"new_custom_decoder"
:
that
.
createEncoder
(
id
,
'decoder'
);
break
;
case
"edit"
:
case
"edit"
:
that
.
editEncoder
();
that
.
editEncoder
();
break
;
break
;
...
@@ -205,6 +127,13 @@ class Encoders {
...
@@ -205,6 +127,13 @@ class Encoders {
.
shell
.
shell
.
openExternal
(
"https://github.com/AntSwordProject/AwesomeEncoder"
);
.
openExternal
(
"https://github.com/AntSwordProject/AwesomeEncoder"
);
break
;
break
;
default
:
if
(
id
.
indexOf
(
"decoder"
)
>-
1
)
{
that
.
createEncoder
(
id
,
'decoder'
);
}
else
{
that
.
createEncoder
(
id
);
}
break
;
}
}
});
});
...
@@ -256,7 +185,7 @@ class Encoders {
...
@@ -256,7 +185,7 @@ class Encoders {
break
break
case
2
:
case
2
:
// type
// type
if
(
nValue
!=
"asp"
&&
nValue
!=
"aspx"
&&
nValue
!=
"php"
&&
nValue
!=
"jsp"
&&
nValue
!=
"jspjs"
&&
nValue
!=
"cmdlinux"
&&
nValue
!=
"custom"
)
{
if
(
antSword
[
'core_types'
].
indexOf
(
nValue
)
==
-
1
)
{
toastr
.
error
(
LANG
[
'message'
][
"etype_error"
],
LANG_T
[
'error'
]);
toastr
.
error
(
LANG
[
'message'
][
"etype_error"
],
LANG_T
[
'error'
]);
return
return
}
}
...
@@ -264,10 +193,10 @@ class Encoders {
...
@@ -264,10 +193,10 @@ class Encoders {
toastr
.
error
(
LANG
[
'message'
][
'ename_duplicate'
],
LANG_T
[
'error'
]);
toastr
.
error
(
LANG
[
'message'
][
'ename_duplicate'
],
LANG_T
[
'error'
]);
return
;
return
;
}
}
if
(
oedtype
===
"decoder"
&&
nValue
!=
"php"
&&
nValue
!=
"custom"
)
{
//
if (oedtype === "decoder" && nValue != "php" && nValue != "custom") {
toastr
.
error
(
"Not Support"
,
LANG_T
[
"error"
]);
//
toastr.error("Not Support", LANG_T["error"]);
return
;
//
return;
}
//
}
fs
.
renameSync
(
oepath
,
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
nValue
}
/
${
oedtype
}
/
${
oename
}
.js`
));
fs
.
renameSync
(
oepath
,
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
nValue
}
/
${
oedtype
}
/
${
oename
}
.js`
));
toastr
.
success
(
LANG
[
'message'
][
"retype_success"
],
LANG_T
[
"success"
]);
toastr
.
success
(
LANG
[
'message'
][
"retype_success"
],
LANG_T
[
"success"
]);
break
break
...
...
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