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
f00d2706
Commit
f00d2706
authored
Apr 10, 2016
by
Y.H
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code rewrite, increase local storage API
代码重写,增加本地存储API
parent
3acc7441
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
app.entry.jsx
source/app.entry.jsx
+26
-15
No files found.
source/app.entry.jsx
View file @
f00d2706
...
...
@@ -18,11 +18,21 @@ const antSword = window.antSword = {
noxss
:
(
html
)
=>
{
return
String
(
html
).
replace
(
/&/g
,
"&"
).
replace
(
/>/g
,
">"
).
replace
(
/</g
,
"<"
).
replace
(
/"/g
,
"""
);
},
modules
:
{}
core
:
{},
modules
:
{},
// localStorage存储
// 参数{key:存储键值,[value]:存储内容,[def]:默认内容}
storage
:
(
key
,
value
,
def
)
=>
{
// 读取
if
(
!
value
)
{
return
localStorage
.
getItem
(
key
)
||
def
;
};
// 设置
localStorage
.
setItem
(
key
,
value
);
}
};
// 加载模板代码
antSword
[
'core'
]
=
{};
[
'php'
,
'asp'
,
'aspx'
,
'custom'
].
map
((
_
)
=>
{
antSword
[
'core'
][
_
]
=
require
(
`./core/
${
_
}
/index`
);
});
...
...
@@ -33,22 +43,23 @@ _lang = ['en', 'zh'].indexOf(_lang) === -1 ? 'en' : _lang;
antSword
[
'language'
]
=
require
(
`./language/
${
_lang
}
`
);
// 加载代理
var
_aproxymode
=
localStorage
.
getItem
(
'aproxymode'
)
||
"noproxy"
;
var
_aproxyprotocol
=
localStorage
.
getItem
(
'aproxyprotocol'
);
var
_aproxyserver
=
localStorage
.
getItem
(
'aproxyserver'
);
var
_aproxyport
=
localStorage
.
getItem
(
'aproxyport'
);
var
_aproxyusername
=
localStorage
.
getItem
(
'aproxyusername'
);
var
_aproxypassword
=
localStorage
.
getItem
(
'aproxypassword'
);
const
aproxy
=
{
mode
:
antSword
[
'storage'
](
'aproxymode'
,
false
,
'noproxy'
),
port
:
antSword
[
'storage'
](
'aproxyport'
),
server
:
antSword
[
'storage'
](
'aproxyserver'
),
password
:
antSword
[
'storage'
](
'aproxypassword'
),
username
:
antSword
[
'storage'
](
'aproxyusername'
),
protocol
:
antSword
[
'storage'
](
'aproxyprotocol'
)
}
antSword
[
'aproxymode'
]
=
aproxy
[
'mode'
];
antSword
[
'aproxymode'
]
=
_aproxymode
;
antSword
[
'aproxyauth'
]
=
(
!
aproxy
[
'username'
]
||
!
aproxy
[
'password'
]
)
?
''
:
`
${
aproxy
[
'username'
]}
:
${
aproxy
[
'password'
]}
`
;
if
(
_aproxyusername
==
""
||
_aproxyusername
==
null
||
_aproxypassword
==
""
||
_aproxypassword
==
null
)
{
antSword
[
'aproxyauth'
]
=
""
;
}
else
{
antSword
[
'aproxyauth'
]
=
_aproxyusername
+
":"
+
_aproxypassword
;
}
antSword
[
'aproxyuri'
]
=
_aproxyprotocol
+
"://"
+
antSword
[
'aproxyauth'
]
+
"@"
+
_aproxyserver
+
":"
+
_aproxyport
;
antSword
[
'aproxyuri'
]
=
`
${
aproxy
[
'protocol'
]}
:\/\/
${
antSword
[
'aproxyauth'
]}
@
${
aproxy
[
'server'
]}
:
${
aproxy
[
'port'
]}
`
;
// 通知后端设置代理
ipcRenderer
.
send
(
'aproxy'
,
{
aproxymode
:
antSword
[
'aproxymode'
],
aproxyuri
:
antSword
[
'aproxyuri'
]
...
...
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