提交 a5dc3eff 编写于 作者: H hjdhnx

修改模板.js兼容性

上级 dc04952d
......@@ -38,8 +38,11 @@ def admin_index(): # 管理员界面
live_url = lsg.getItem('LIVE_URL')
use_py = lsg.getItem('USE_PY')
# print(f'live_url:', live_url)
rules = getRules('js')
# print(rules)
cache_count = getCacheCount()
return render_template('admin.html', pystate=use_py,rules=getRules('js'),cache_count=cache_count, ver=getLocalVer(), live_url=live_url)
# print(cache_count)
return render_template('admin.html', pystate=use_py,rules=rules,cache_count=cache_count, ver=getLocalVer(), live_url=live_url)
@admin.route('/settings')
def admin_settings(): # 管理员界面
......@@ -214,7 +217,7 @@ def upload_file():
if os.path.exists(savePath):
return R.failed(f'上传失败,文件已存在,请先查看删除再试')
with open('js/模板.js', encoding='utf-8') as f2:
before = f2.read()
before = f2.read().split('export')[0]
upcode = file.stream.read().decode('utf-8')
check_to_run = before + upcode
# print(check_to_run)
......
......@@ -1245,7 +1245,7 @@ if __name__ == '__main__':
# js_path = f'js/玩偶姐姐.js'
# js_path = f'js/555影视.js'
with open('../js/模板.js', encoding='utf-8') as f:
before = f.read()
before = f.read().split('export')[0]
js_path = f'js/360影视.js'
ctx, js_code = parser.runJs(js_path,before=before)
ruleDict = ctx.rule.to_dict()
......
......@@ -27,7 +27,7 @@ def search_one(rule, wd, before: str = ''):
t1 = time()
if not before:
with open('js/模板.js', encoding='utf-8') as f:
before = f.read()
before = f.read().split('export')[0]
js_path = f'js/{rule}.js'
try:
ctx, js_code = parser.runJs(js_path, before=before)
......@@ -63,7 +63,7 @@ def multi_search2(wd):
# print(search_sites)
res = []
with open('js/模板.js', encoding='utf-8') as f:
before = f.read()
before = f.read().split('export')[0]
logger.info(f'聚搜准备工作耗时:{get_interval(t1)}毫秒')
t2 = time()
thread_pool = ThreadPoolExecutor(len(search_sites)) # 定义线程池来启动多线程执行此任务
......@@ -109,7 +109,7 @@ def multi_search(wd):
# print(search_sites)
res = []
with open('js/模板.js', encoding='utf-8') as f:
before = f.read()
before = f.read().split('export')[0]
with ThreadPoolExecutor(max_workers=len(search_sites)) as executor:
to_do = []
for site in search_sites:
......@@ -159,7 +159,7 @@ def vod_home():
# js_path = f'js/{rule}.js' if not ext.startswith('http') else ext
js_path = f'js/{rule}.js' if not ext else ext
with open('js/模板.js', encoding='utf-8') as f:
before = f.read()
before = f.read().split('export')[0]
# logger.info(f'js读取耗时:{get_interval(t1)}毫秒')
logger.info(f'参数检验js读取共计耗时:{get_interval(t0)}毫秒')
t2 = time()
......
......@@ -40,7 +40,7 @@ def getRules(path='cache'):
rule_list = [file.replace('.js', '') for file in file_name]
js_path = [f'{path}/{rule}.js' for rule in rule_list]
with open('js/模板.js', encoding='utf-8') as f:
before = f.read()
before = f.read().split('export')[0]
rule_codes = []
# for js in js_path:
# with open(js,encoding='utf-8') as f:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册