pull/350/head
midoks 2 years ago
parent ddc8cde44c
commit d3db79a4ed
  1. 11
      plugins/webssh/index.py
  2. 39
      plugins/webssh/js/webssh.js
  3. 2
      plugins/webssh/menu/index.css

@ -73,7 +73,7 @@ class App():
if not check[0]: if not check[0]:
return check[1] return check[1]
title = args['title'] title = args['title'].strip()
cmd = args['cmd'] cmd = args['cmd']
t = { t = {
@ -90,7 +90,7 @@ class App():
if not check[0]: if not check[0]:
return check[1] return check[1]
title = args['title'] title = args['title'].strip()
data_tmp = json.loads(mw.readFile(self.__cmd_path)) data_tmp = json.loads(mw.readFile(self.__cmd_path))
for x in range(0, len(data_tmp)): for x in range(0, len(data_tmp)):
if data_tmp[x]['title'] == title: if data_tmp[x]['title'] == title:
@ -103,6 +103,13 @@ class App():
alist = json.loads(mw.readFile(self.__cmd_path)) alist = json.loads(mw.readFile(self.__cmd_path))
return mw.returnJson(True, 'ok', alist) return mw.returnJson(True, 'ok', alist)
def add_server(self):
args = self.getArgs()
check = self.checkArgs(
args, ['host', 'port', 'username', 'password', 'pkey', 'pkey_passwd', 'ps'])
if not check[0]:
return check[1]
if __name__ == "__main__": if __name__ == "__main__":
func = sys.argv[1] func = sys.argv[1]
classApp = App() classApp = App()

@ -436,8 +436,47 @@ function webShell_addServer(){
</div>\ </div>\
</div>', </div>',
success:function(){ success:function(){
$('.auth_type_checkbox').click(function(){
var ctype = $(this).attr('data-ctype');
$('.auth_type_checkbox').removeClass('btn-success');
$(this).addClass('btn-success');
if (ctype == 0){
$('.c_password_view').removeClass('show').addClass('show');
$('.c_pkey_view').removeClass('show').addClass('hide');
$('.key_pwd_line').removeClass('show').addClass('hide');
}else{
$('.c_password_view').removeClass('show').addClass('hide');
$('.c_pkey_view').removeClass('show').addClass('show');
$('.key_pwd_line').removeClass('show').addClass('show');
} }
}); });
},
yes:function(l,layeror){
var host = $('input[name="host"]').val();
var port = $('input[name="port"]').val();
var username = $('input[name="username"]').val();
var password = $('input[name="password"]').val();
var pkey = $('input[name="pkey"]').val();
var pkey_passwd = $('input[name="pkey_passwd"]').val();
var ps = $('input[name="ps"]').val();
appPost('add_server',{
host:host,
port:port,
username:username,
password:password,
pkey:pkey,
pkey_passwd:pkey_passwd,
ps
},function(rdata){
console.log(rdata);
});
},
});
} }
function webShell_cmd(title='', cmd=''){ function webShell_cmd(title='', cmd=''){

@ -470,9 +470,7 @@ color: #bbb;
.tootls_host_list, .tootls_host_list,
.tootls_commonly_list { .tootls_commonly_list {
/* min-height: 300px; */
overflow: auto; overflow: auto;
/* margin-bottom: 10px; */
overflow-x: hidden; overflow-x: hidden;
font-size: 12px; font-size: 12px;
bottom: 0; bottom: 0;

Loading…
Cancel
Save