优化主页显示

pull/121/head
midoks 3 years ago
parent 4ac1f1e35c
commit 573218cdca
  1. 32
      class/core/plugins_api.py

@ -565,7 +565,6 @@ class plugins_api:
if dirinfo[0:1] == '.': if dirinfo[0:1] == '.':
continue continue
path = self.__plugin_dir + '/' + dirinfo path = self.__plugin_dir + '/' + dirinfo
if os.path.isdir(path):
json_file = path + '/info.json' json_file = path + '/info.json'
if os.path.exists(json_file): if os.path.exists(json_file):
try: try:
@ -747,27 +746,28 @@ class plugins_api:
indexList = json.loads(mw.readFile(self.__index)) indexList = json.loads(mw.readFile(self.__index))
plist = [] plist = []
app = []
for i in indexList: for i in indexList:
info = i.split('-') tmp = i.split('-')
if not info[0] in app: tmp_len = len(tmp)
app.append(info[0]) plugin_name = tmp[0]
path = self.__plugin_dir + '/' + info[0] plugin_ver = tmp[1]
if os.path.isdir(path): if tmp_len > 2:
json_file = path + '/info.json' tmpArr = tmp[0:tmp_len - 1]
plugin_name = '-'.join(tmpArr)
plugin_ver = tmp[tmp_len - 1]
json_file = self.__plugin_dir + '/' + plugin_name + '/info.json'
if os.path.exists(json_file): if os.path.exists(json_file):
try:
content = mw.readFile(json_file) content = mw.readFile(json_file)
if content: try:
data = json.loads(content) data = json.loads(content)
tmp_data = self.makeList(data) data = self.makeList(data)
for index in range(len(tmp_data)): for index in range(len(data)):
if tmp_data[index]['versions'] == info[1] or info[1] in tmp_data[index]['versions']: if data[index]['versions'] == plugin_ver or plugin_ver in data[index]['versions']:
tmp_data[index]['display'] = True data[index]['display'] = True
plist.append(tmp_data[index]) plist.append(data[index])
continue continue
except Exception as e: except Exception as e:
# raise e
print('getIndexList:', e) print('getIndexList:', e)
# 使用gevent模式时,无法使用多进程 # 使用gevent模式时,无法使用多进程

Loading…
Cancel
Save