Update index.py

pull/387/head
midoks 2 years ago
parent 583de57f96
commit 96875052cd
  1. 37
      plugins/webssh/index.py

@ -145,24 +145,25 @@ class App():
def get_server_list(self): def get_server_list(self):
host_list = [] host_list = []
for name in os.listdir(self.__host_dir): if os.path.exists(self.__host_dir):
info_file = self.__host_dir + '/' + name + '/info.json' for name in os.listdir(self.__host_dir):
if not os.path.exists(info_file): info_file = self.__host_dir + '/' + name + '/info.json'
continue if not os.path.exists(info_file):
try: continue
info_tmp = self.getSshInfo(info_file) try:
host_info = {} info_tmp = self.getSshInfo(info_file)
host_info['host'] = name host_info = {}
host_info['port'] = info_tmp['port'] host_info['host'] = name
host_info['ps'] = info_tmp['ps'] host_info['port'] = info_tmp['port']
# host_info['sort'] = int(info_tmp['sort']) host_info['ps'] = info_tmp['ps']
except Exception as e: # host_info['sort'] = int(info_tmp['sort'])
print(e) except Exception as e:
# if os.path.exists(info_file): print(e)
# os.remove(info_file) # if os.path.exists(info_file):
# continue # os.remove(info_file)
# continue
host_list.append(host_info)
host_list.append(host_info)
host_list = sorted(host_list, key=lambda x: x['host'], reverse=False) host_list = sorted(host_list, key=lambda x: x['host'], reverse=False)
return mw.returnJson(True, 'ok!', host_list) return mw.returnJson(True, 'ok!', host_list)

Loading…
Cancel
Save