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
d741d054
Unverified
Commit
d741d054
authored
Sep 01, 2019
by
Virink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance: Source::ShellManger::Toolbar) 新增插件工具栏,插件新增字段 global用于判断师傅需要shell信息
parent
6d71ec78
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
202 additions
and
3 deletions
+202
-3
app.entry.js
source/app.entry.js
+2
-0
en.js
source/language/en.js
+7
-0
zh.js
source/language/zh.js
+7
-0
zh_hk.js
source/language/zh_hk.js
+7
-0
zh_tw.js
source/language/zh_tw.js
+7
-0
index.js
source/modules/shellmanager/index.js
+6
-3
toolbar.js
source/modules/shellmanager/toolbar.js
+166
-0
No files found.
source/app.entry.js
View file @
d741d054
...
...
@@ -131,6 +131,8 @@ const antSword = window.antSword = {
}
});
}
// 加载工具栏
antSword
.
modules
.
shellmanager
.
toolbar
.
reloadToolbar
()
}
};
...
...
source/language/en.js
View file @
d741d054
...
...
@@ -192,6 +192,13 @@ module.exports = {
requestTimeout
:
'Request timeout'
,
commandPath
:
'Custom terminal-execPath'
}
},
toolbar
:
{
select
:
'Please select at least one shell'
,
setting
:
{
text
:
'Setting'
,
title
:
'Setting pligins which you want to show'
}
}
},
terminal
:
{
...
...
source/language/zh.js
View file @
d741d054
...
...
@@ -192,6 +192,13 @@ module.exports = {
requestTimeout
:
'请求超时'
,
commandPath
:
'自定义终端执行路径'
}
},
toolbar
:
{
select
:
'至少选择一个 webshell 吧'
,
setting
:
{
text
:
'设置'
,
title
:
'设置你要添加到工具栏的插件'
}
}
},
terminal
:
{
...
...
source/language/zh_hk.js
View file @
d741d054
...
...
@@ -191,6 +191,13 @@ module.exports = {
requestTimeout
:
'請求超時'
,
commandPath
:
'自定義終端執行路徑'
}
},
toolbar
:
{
select
:
'至少選擇壹個 webshell 吧'
,
setting
:
{
text
:
'設置'
,
title
:
'設置妳要添加到工具欄的插件'
}
}
},
terminal
:
{
...
...
source/language/zh_tw.js
View file @
d741d054
...
...
@@ -191,6 +191,13 @@ module.exports = {
requestTimeout
:
'請求超時'
,
commandPath
:
'自定義終端執行路徑'
}
},
toolbar
:
{
select
:
'至少選擇壹個 webshell 吧'
,
setting
:
{
text
:
'設置'
,
title
:
'設置妳要添加到工具欄的插件'
}
}
},
terminal
:
{
...
...
source/modules/shellmanager/index.js
View file @
d741d054
...
...
@@ -5,6 +5,7 @@
const
Data
=
require
(
'./data'
);
const
List
=
require
(
'./list/'
);
const
Toolbar
=
require
(
'./toolbar'
);
const
Category
=
require
(
'./category/'
);
class
ShellManager
{
...
...
@@ -12,11 +13,13 @@ class ShellManager {
const
tabbar
=
antSword
[
'tabbar'
];
tabbar
.
addTab
(
'tab_shellmanager'
,
'<i class="fa fa-th-large"></i>'
,
null
,
null
,
true
,
false
);
const
cell
=
tabbar
.
cells
(
'tab_shellmanager'
);
const
layout
=
cell
.
attachLayout
(
'2U'
);
const
layout
=
cell
.
attachLayout
(
'3T'
);
// 初始化顶侧栏:工具栏 - 插件
this
.
toolbar
=
new
Toolbar
(
layout
.
cells
(
'a'
),
this
);
// 初始化左侧栏:数据
this
.
list
=
new
List
(
layout
.
cells
(
'
a
'
),
this
);
this
.
list
=
new
List
(
layout
.
cells
(
'
b
'
),
this
);
// 初始化右侧栏:目录
this
.
category
=
new
Category
(
layout
.
cells
(
'
b
'
),
this
);
this
.
category
=
new
Category
(
layout
.
cells
(
'
c
'
),
this
);
this
.
searchPop
=
null
;
this
.
searchForm
=
null
;
...
...
source/modules/shellmanager/toolbar.js
0 → 100644
View file @
d741d054
/**
* AntSword::ShellManager::Toolbar
* Create: 2019-09-01
* Update: 2019-09-01
* Author: Virink <https://github.com/virink>
*/
'use strict'
;
const
LANG_T
=
antSword
[
'language'
][
'toastr'
];
const
LANG
=
antSword
[
'language'
][
'shellmanager'
][
'toolbar'
];
const
WIN
=
require
(
"ui/window"
);
class
Toolbar
{
constructor
(
cell
,
manager
)
{
var
self
=
this
;
cell
.
hideHeader
();
cell
.
setHeight
(
43
);
let
lang
=
antSword
.
storage
(
'language'
,
false
,
navigator
.
language
.
substr
(
0
,
2
));
this
.
lang
=
(
lang
==
'en'
)
?
'_en'
:
''
;
// Create toolbar
let
toolbar
=
cell
.
attachToolbar
();
toolbar
.
setIconSize
(
32
);
toolbar
.
attachEvent
(
"onClick"
,
function
(
id
)
{
console
.
log
(
id
);
if
(
id
==
'setting'
)
{
self
.
settingPane
();
}
else
{
// Load Plugin
let
plug
=
antSword
[
'plugins'
][
id
];
if
(
!
antSword
[
'plugins'
][
id
][
'module'
])
{
antSword
[
'plugins'
][
id
][
'module'
]
=
require
(
path
.
join
(
plug
[
'path'
],
plug
[
'info'
][
'main'
]
||
'index.js'
));
}
// Load WebShell
var
ids
=
(
manager
.
list
.
grid
.
getSelectedId
()
||
''
).
split
(
','
);
if
(
ids
.
length
>=
1
&&
ids
[
0
]
!=
""
)
{
var
infos
=
antSword
.
ipcRenderer
.
sendSync
(
'shell-find'
,
{
_id
:
{
$in
:
ids
}
});
if
(
infos
.
length
>
0
)
{
new
antSword
[
'plugins'
][
id
][
'module'
](
plug
[
'info'
][
'multiple'
]
?
infos
:
infos
[
0
]);
}
}
else
if
(
plug
[
'info'
][
'global'
])
{
new
antSword
[
'plugins'
][
id
][
'module'
]({});
}
else
{
toastr
.
error
(
LANG
[
'select'
],
LANG_T
[
'error'
]);
}
}
});
this
.
toolbar
=
toolbar
;
// antSword.modules.shellmanager.toolbar.reloadToolbar()
}
/**
* ::reloadToolbar
* Reload Toolbar
*/
reloadToolbar
()
{
this
.
toolbar
.
clearAll
();
var
plugsData
=
[];
try
{
var
plugsList
=
JSON
.
parse
(
antSword
.
storage
(
'toolbar'
));
plugsList
.
forEach
((
plug
)
=>
{
if
(
plug
in
antSword
[
"plugins"
])
{
p
=
antSword
[
"plugins"
][
plug
][
"info"
];
plugsData
.
push
({
id
:
plug
,
text
:
antSword
.
noxss
(
p
[
"name"
+
this
.
lang
]
||
p
[
"name"
]),
title
:
antSword
.
noxss
(
p
[
"description"
+
this
.
lang
]
||
p
[
"description"
]),
icon
:
p
[
"icon"
],
type
:
'button'
},
{
type
:
'separator'
});
}
});
}
catch
(
e
)
{
toastr
.
error
(
e
,
LANG_T
[
'error'
]);
}
// Add Setting Button
plugsData
.
push
({
id
:
'setting'
,
text
:
LANG
[
'setting'
][
'text'
],
title
:
LANG
[
'setting'
][
'title'
],
icon
:
'cog'
,
type
:
'button'
});
this
.
toolbar
.
loadStruct
(
plugsData
);
}
/**
* ::settingPane
* Open the Setting Pane
*/
settingPane
()
{
let
win
=
new
WIN
({
title
:
LANG
[
'setting'
][
'text'
],
height
:
450
,
width
:
400
});
let
layout
=
win
.
win
.
attachLayout
(
'1C'
);
let
cell
=
layout
.
cells
(
'a'
);
cell
.
hideHeader
();
let
plugsForm
=
cell
.
attachForm
();
var
plugsData
=
[];
try
{
var
i
=
1
;
var
plugs
=
JSON
.
parse
(
antSword
.
storage
(
'toolbar'
));
for
(
let
plug
in
antSword
[
"plugins"
])
{
p
=
antSword
[
"plugins"
][
plug
][
"info"
];
plugsData
.
push
({
type
:
"checkbox"
,
label
:
antSword
.
noxss
(
p
[
"name"
+
this
.
lang
]
||
p
[
"name"
]),
name
:
plug
,
checked
:
plugs
.
indexOf
(
plug
)
!=
-
1
});
plugsData
.
push
({
type
:
'newcolumn'
,
});
}
}
catch
(
e
)
{
toastr
.
error
(
e
,
LANG_T
[
'error'
]);
}
plugsForm
.
loadStruct
([{
type
:
"settings"
,
position
:
"label-right"
},
{
type
:
"fieldset"
,
name
:
"Setting"
,
label
:
LANG
[
'setting'
][
'text'
],
list
:
plugsData
},
{
type
:
"button"
,
name
:
"toolbar_setting_save"
,
value
:
"Save"
,
width
:
378
}])
var
eventId
=
plugsForm
.
attachEvent
(
"onButtonClick"
,
(
name
)
=>
{
if
(
name
==
'toolbar_setting_save'
)
{
var
save_data
=
[]
var
_formvals
=
plugsForm
.
getValues
();
for
(
let
v
in
_formvals
)
{
if
(
_formvals
[
v
])
save_data
.
push
(
v
)
}
// Save and Reload Toolbar
antSword
.
storage
(
'toolbar'
,
save_data
);
antSword
.
modules
.
shellmanager
.
toolbar
.
reloadToolbar
()
}
plugsForm
.
detachEvent
(
eventId
);
win
.
close
()
});
}
}
module
.
exports
=
Toolbar
;
\ No newline at end of file
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