From 989bf8ee7699d0427a893c2f96975ebe92abfef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=9A=E9=A3=8E=E6=8B=82=E6=9F=B3=E9=A2=9C?= <434857005@qq.com> Date: Fri, 30 Jun 2023 10:29:44 +0800 Subject: [PATCH] =?UTF-8?q?drpy=E5=8D=87=E7=BA=A7=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E5=88=87=E6=8D=A2?= =?UTF-8?q?jar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/config.py | 1 + base/custom.conf | 2 +- controllers/admin.py | 8 +++++++- controllers/home.py | 5 ++++- controllers/service.py | 6 +++--- doc/更新日志.md | 4 ++++ js/drpy.txt | 2 +- js/version.txt | 2 +- {js => libs/jar}/SP.jar | Bin {base/files => libs/jar}/base.jar | Bin {js => libs/jar}/custom_spider.jar | Bin .../files => libs/jar}/custom_spider.mini.jar | Bin .../jar}/custom_spider_dz1201.jar | Bin .../jar}/custom_spider_dz230509.jar | Bin .../jar}/custom_spider_qy0627.jar | Bin .../files => libs/jar}/custom_spider_tang.jar | Bin .../jar}/custom_spider_xiaoya.jar | Bin .../jar}/custom_spider_xyq1106.jar | Bin static/css/settings.css | 15 ++++++++++++++ templates/settings.html | 19 +++++++++++++++--- utils/files.py | 13 ++++++++++++ 21 files changed, 66 insertions(+), 11 deletions(-) rename {js => libs/jar}/SP.jar (100%) rename {base/files => libs/jar}/base.jar (100%) rename {js => libs/jar}/custom_spider.jar (100%) rename {base/files => libs/jar}/custom_spider.mini.jar (100%) rename {base/files => libs/jar}/custom_spider_dz1201.jar (100%) rename {base/files => libs/jar}/custom_spider_dz230509.jar (100%) rename {base/files => libs/jar}/custom_spider_qy0627.jar (100%) rename {base/files => libs/jar}/custom_spider_tang.jar (100%) rename {base/files => libs/jar}/custom_spider_xiaoya.jar (100%) rename {base/files => libs/jar}/custom_spider_xyq1106.jar (100%) diff --git a/base/config.py b/base/config.py index 8a17cc0..c2ed27a 100644 --- a/base/config.py +++ b/base/config.py @@ -59,3 +59,4 @@ UPDATE_PROXY = 'https://ghproxy.net/' # 检测升级代理 THREAD = True # 开启windows多线程调用 GEVENT = True # windows开启此参数就不走gevent,方便调试 SPECIAL = '腾云驾雾:腾讯&奇珍异兽:爱奇艺&百忙无果:芒果&优酷&哔哩影视&Alist&CMS_非凡资源:非凡&CMS_量子资源:量子' # 特殊优选 +SPIDER_JAR = 'custom_spider_qy0627.jar' diff --git a/base/custom.conf b/base/custom.conf index c23a05e..f25db08 100644 --- a/base/custom.conf +++ b/base/custom.conf @@ -3,7 +3,7 @@ # 可以使用Python的 # 单行注释 { -# "spider": "{{host}}/files/custom_spider.jar", +# "spider": "{{host}}/libs/jar/custom_spider.jar", "parses":[ {"name":"keyu","type":1,"url":"http://newjiexi.gotka.top/keyu3.php?url=","ext":{"flag":["qq","腾讯","qiyi","爱奇艺","奇艺","youku","优酷","mgtv","芒果","letv","乐视","pptv","PPTV","sohu","bilibili","哔哩哔哩","哔哩"],"header":{"User-Agent":"okhttp/4.1.0"}}}, ], diff --git a/controllers/admin.py b/controllers/admin.py index 59f0278..e8192dd 100644 --- a/controllers/admin.py +++ b/controllers/admin.py @@ -21,6 +21,7 @@ from utils.parser import runJScode from werkzeug.utils import secure_filename from utils.web import md5 from utils.common_api import js_render +from utils.files import get_jar_list admin = Blueprint("admin", __name__) @@ -59,7 +60,10 @@ def admin_settings(): # 管理员界面 # conf_list = 'LIVE_URL|USE_PY|PLAY_URL|PLAY_DISABLE|LAZYPARSE_MODE|WALL_PAPER_ENABLE|WALL_PAPER|UNAME|PWD|LIVE_MODE|LIVE_URL|CATE_EXCLUDE|TAB_EXCLUDE'.split('|') conf_lists = lsg.getStoreConf() # print(conf_lists) - return render_template('settings.html', conf_lists=conf_lists, ver=getLocalVer()) + jar_lists = get_jar_list() + SPIDER_JAR = lsg.getItem('SPIDER_JAR', 'custom_spider.jar') + return render_template('settings.html', conf_lists=conf_lists, jar_lists=jar_lists, jar_now=SPIDER_JAR, + ver=getLocalVer()) @admin.route('/save_conf', methods=['POST']) @@ -94,6 +98,7 @@ def admin_edit_rule(name): return render_template('login.html') return render_template('edit_rule.html', name=name) + @admin.route("/edit2/", methods=['GET']) def admin_edit2_rule(name): # print(name) @@ -101,6 +106,7 @@ def admin_edit2_rule(name): return render_template('login.html') return render_template('edit_rule_mobile.html', name=name) + @admin.route("/save_edit/", methods=['POST']) def admin_save_edit_rule(name): # print(name) diff --git a/controllers/home.py b/controllers/home.py index 8d07470..c071a1b 100644 --- a/controllers/home.py +++ b/controllers/home.py @@ -191,7 +191,10 @@ def get_lives(): @home.route('/liveslib') def get_liveslib(): - live_path = 'js/custom_spider.jar' + lsg = storage_service() + SPIDER_JAR = lsg.getItem('SPIDER_JAR', 'custom_spider.jar') + live_path = f'libs/jar/{SPIDER_JAR}' + logger.info(f'SPIDER_JAR:{SPIDER_JAR}>>当前系统挂载的指定jar文件位置:{live_path}') if not os.path.exists(live_path): with open(live_path,mode='w+',encoding='utf-8') as f: f.write('') diff --git a/controllers/service.py b/controllers/service.py index d9fb182..a2406b7 100644 --- a/controllers/service.py +++ b/controllers/service.py @@ -26,7 +26,7 @@ class storage_service(object): 'LAZYPARSE_MODE', 'WALL_PAPER_ENABLE', 'WALL_PAPER', 'UNAME', 'PWD', 'LIVE_MODE', 'CATE_EXCLUDE', 'TAB_EXCLUDE', 'SEARCH_TIMEOUT', 'SEARCH_LIMIT', 'MULTI_MODE', 'XR_MODE', 'JS_PROXY', 'UPDATE_PROXY', 'ENV', 'ALI_TOKEN', 'OCR_API', - 'SPECIAL'] + 'SPECIAL','SPIDER_JAR'] for conf in conf_list: if not self.hasItem(conf): print(f'开始初始化{conf}') @@ -38,11 +38,11 @@ class storage_service(object): conf_list = ['LIVE_URL', 'LIVE_MODE', 'PLAY_URL', 'PID_URL', 'USE_PY', 'JS_MODE', 'JS0_DISABLE', 'JS0_PASSWORD', 'PLAY_DISABLE', 'LAZYPARSE_MODE', 'WALL_PAPER_ENABLE', 'WALL_PAPER', 'UNAME', 'PWD', 'CATE_EXCLUDE', 'TAB_EXCLUDE', 'SEARCH_TIMEOUT', 'SEARCH_LIMIT', - 'MULTI_MODE', 'XR_MODE', 'JS_PROXY', 'UPDATE_PROXY', 'ENV', 'SPECIAL', 'ALI_TOKEN', 'OCR_API'] + 'MULTI_MODE', 'XR_MODE', 'JS_PROXY', 'UPDATE_PROXY', 'ENV', 'SPECIAL', 'SPIDER_JAR', 'ALI_TOKEN', 'OCR_API'] conf_name_list = ['直播地址', '直播模式', '远程地址', '进程管理链接', '启用py源', 'js模式', '禁用js0', 'js0密码', '禁用免嗅', '免嗅模式', '启用壁纸', '壁纸链接', '管理账号', '管理密码', '分类排除', '线路排除', '聚搜超时', '搜索条数', '多源模式', '仙人模式', '源代理', - '升级代理', '环境变量', '优选源', '阿里tk', 'OCR接口'] + '升级代理', '环境变量', '优选源', '挂载JAR', '阿里tk', 'OCR接口'] conf_lists = [] for i in range(len(conf_list)): conf = conf_list[i] diff --git a/doc/更新日志.md b/doc/更新日志.md index daf7d35..f70e3f1 100644 --- a/doc/更新日志.md +++ b/doc/更新日志.md @@ -1,3 +1,7 @@ +###### 2023/06/30 +- [X] 后台管理增加jar文件切换,文件放在libs/jar目录即可 +- [X] 3.9.45beta1 + ###### 2023/06/12 - [X] 发布新版本,增加谷歌跨域设置说明。播放页手动增加&debug=1 这个参数可以实现强制嗅探(浏览器支持跨域的情况下手动调试使用) ```text diff --git a/js/drpy.txt b/js/drpy.txt index f6ef7f5..3f6036f 100644 --- a/js/drpy.txt +++ b/js/drpy.txt @@ -1 +1 @@ -{"showTime":89200000,"txt":"drpy 3.9.44beta1 -道长"} \ No newline at end of file +{"showTime":89200000,"txt":"drpy 3.9.45beta1 -道长"} \ No newline at end of file diff --git a/js/version.txt b/js/version.txt index 2364597..08e5aac 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.9.44beta7 \ No newline at end of file +3.9.45beta1 \ No newline at end of file diff --git a/js/SP.jar b/libs/jar/SP.jar similarity index 100% rename from js/SP.jar rename to libs/jar/SP.jar diff --git a/base/files/base.jar b/libs/jar/base.jar similarity index 100% rename from base/files/base.jar rename to libs/jar/base.jar diff --git a/js/custom_spider.jar b/libs/jar/custom_spider.jar similarity index 100% rename from js/custom_spider.jar rename to libs/jar/custom_spider.jar diff --git a/base/files/custom_spider.mini.jar b/libs/jar/custom_spider.mini.jar similarity index 100% rename from base/files/custom_spider.mini.jar rename to libs/jar/custom_spider.mini.jar diff --git a/base/files/custom_spider_dz1201.jar b/libs/jar/custom_spider_dz1201.jar similarity index 100% rename from base/files/custom_spider_dz1201.jar rename to libs/jar/custom_spider_dz1201.jar diff --git a/base/files/custom_spider_dz230509.jar b/libs/jar/custom_spider_dz230509.jar similarity index 100% rename from base/files/custom_spider_dz230509.jar rename to libs/jar/custom_spider_dz230509.jar diff --git a/base/files/custom_spider_qy0627.jar b/libs/jar/custom_spider_qy0627.jar similarity index 100% rename from base/files/custom_spider_qy0627.jar rename to libs/jar/custom_spider_qy0627.jar diff --git a/base/files/custom_spider_tang.jar b/libs/jar/custom_spider_tang.jar similarity index 100% rename from base/files/custom_spider_tang.jar rename to libs/jar/custom_spider_tang.jar diff --git a/base/files/custom_spider_xiaoya.jar b/libs/jar/custom_spider_xiaoya.jar similarity index 100% rename from base/files/custom_spider_xiaoya.jar rename to libs/jar/custom_spider_xiaoya.jar diff --git a/base/files/custom_spider_xyq1106.jar b/libs/jar/custom_spider_xyq1106.jar similarity index 100% rename from base/files/custom_spider_xyq1106.jar rename to libs/jar/custom_spider_xyq1106.jar diff --git a/static/css/settings.css b/static/css/settings.css index c156b73..853a04e 100644 --- a/static/css/settings.css +++ b/static/css/settings.css @@ -30,6 +30,21 @@ input.conf { padding-left: 10px; } + +select.conf { + margin-bottom: 10px; + width: 120px; + border-radius: 25px; + height: 20px; + border: 1px solid #60afca; + text-align: center; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding-left: 10px; + +} + .edit_conf{ border: 1px solid #000000; color: #000000; diff --git a/templates/settings.html b/templates/settings.html index 2d44661..b3c2e4d 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -37,7 +37,7 @@ // alert(data.msg); layer.msg(data.msg,{time:1000}); console.log('保存'+key+'成功了...'); - $(`input.conf[name="${key}"]`).val(value); + $(`*.conf[name="${key}"]`).val(value); if(/UNAME|PWD/.test(params.key)){ location.reload(); } @@ -68,14 +68,14 @@ $(document).ready(function() { $(".save_conf").click(function () { let key = $(this).attr('value'); - let value = $(`input.conf[name="${key}"]`).val(); + let value = $(`*.conf[name="${key}"]`).val(); if(checkValue(key,value)){ saveConf(key,value); } }); $('.edit_conf').click(function (){ let key = $(this).attr('value'); - let value = $(`input.conf[name="${key}"]`).val(); + let value = $(`*.conf[name="${key}"]`).val(); layer.prompt({ formType: 2, value: value, @@ -139,7 +139,20 @@ {{ conf.name }}: + {% if conf.key!="SPIDER_JAR" %} + {% else %} + + {% endif %} 编辑 保存 {% if loop.last==False %}
{% endif %}{% endfor %} diff --git a/utils/files.py b/utils/files.py index 1a16620..1343a55 100644 --- a/utils/files.py +++ b/utils/files.py @@ -65,6 +65,19 @@ def getAlist(): print(f'获取alist列表失败:{e}') return [] +def get_jar_list(): + base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录 + jar_path = os.path.join(base_path, 'libs/jar') + if not os.path.exists(jar_path): + os.makedirs(jar_path, exist_ok=True) + logger.info(f'初始化{jar_path}目录') + + jars = os.listdir(jar_path) + jars = list(filter(lambda x: str(x).endswith('.jar') and str(x).find('base') < 0, jars)) + # print(jars) + # jar_list = [file.replace('.jar', '') for file in jars] + return jars + def custom_merge(original:dict,custom:dict): """ 合并用户配置