From 87e9cbb5ed669e34d9104691865ee676f1d864d2 Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Tue, 6 Sep 2022 11:50:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81alist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 10 ++++++---- js/alist.conf | 26 ++++++++++++++++++++++++++ js/alist.txt | 27 --------------------------- js/version.txt | 2 +- readme.md | 1 + templates/config.txt | 1 + utils/web.py | 27 +++++++++++++++++++++++++-- 7 files changed, 60 insertions(+), 34 deletions(-) create mode 100644 js/alist.conf delete mode 100644 js/alist.txt diff --git a/app.py b/app.py index 5fdf30b..5939adc 100644 --- a/app.py +++ b/app.py @@ -535,9 +535,10 @@ def config_render(mode): new_conf = dict(app.config) host = getHost(mode) jxs = getJxs() + alists = getAlist() live_url = get_live_url(new_conf,mode) # html = render_template('config.txt',rules=getRules('js'),host=host,mode=mode,jxs=jxs,base64Encode=base64Encode,config=new_conf) - html = render_template('config.txt',rules=getRules('js'),host=host,mode=mode,jxs=jxs,live_url=live_url,config=new_conf) + html = render_template('config.txt',rules=getRules('js'),host=host,mode=mode,jxs=jxs,alists=alists,live_url=live_url,config=new_conf) response = make_response(html) response.headers['Content-Type'] = 'application/json; charset=utf-8' return response @@ -576,10 +577,11 @@ def config_gen(): os.makedirs('txt',exist_ok=True) new_conf = dict(app.config) jxs = getJxs() - set_local = render_template('config.txt',rules=getRules('js'),live_url=get_live_url(new_conf,0),mode=0,host=getHost(0),jxs=jxs) + alists = getAlist() + set_local = render_template('config.txt',rules=getRules('js'),alists=alists,live_url=get_live_url(new_conf,0),mode=0,host=getHost(0),jxs=jxs) print(set_local) - set_area = render_template('config.txt',rules=getRules('js'),live_url=get_live_url(new_conf,1),mode=1,host=getHost(1),jxs=jxs) - set_online = render_template('config.txt',rules=getRules('js'),live_url=get_live_url(new_conf,2),mode=1,host=getHost(2),jxs=jxs) + set_area = render_template('config.txt',rules=getRules('js'),alists=alists,live_url=get_live_url(new_conf,1),mode=1,host=getHost(1),jxs=jxs) + set_online = render_template('config.txt',rules=getRules('js'),alists=alists,live_url=get_live_url(new_conf,2),mode=1,host=getHost(2),jxs=jxs) with open('txt/pycms0.json','w+',encoding='utf-8') as f: set_dict = json.loads(set_local) f.write(json.dumps(set_dict,ensure_ascii=False,indent=4)) diff --git a/js/alist.conf b/js/alist.conf new file mode 100644 index 0000000..b0261b5 --- /dev/null +++ b/js/alist.conf @@ -0,0 +1,26 @@ +# c=[];for(let i in a){c.push(i+','+a[i])}d=c.join('\n');console.log(d); +🔮嗨翻,https://pan.hikerfans.com +🦀9T(Adult),https://drive.9t.ee +🐱梓澪の妙妙屋,https://xn--i0v44m.xyz +🚆资源小站,https://pan.142856.xyz +🌤晴园的宝藏库,https://alist.52qy.repl.co +🐭米奇妙妙屋,https://anime.mqmmw.ga +💂小兵组网盘影视,https://6vv.app +📀小光盘,https://alist.xiaoguanxiaocheng.life +🐋一只鱼,https://alist.youte.ml +🌊七米蓝,https://al.chirmyram.com +🌴非盘,http://www.feifwp.top +🥼帅盘,https://hi.shuaipeng.wang +🐉神族九帝,https://alist.shenzjd.com +☃姬路白雪,https://pan.jlbx.xyz +🎧听闻网盘,https://wangpan.sangxuesheng.com +💾DISK,http://124.222.140.243:8080 +🌨云播放,https://quanzi.laoxianghuijia.cn +✨星梦,https://pan.bashroot.top +🌊小江,https://dyj.me +💫触光,https://pan.ichuguang.com +🕵好汉吧,https://8023.haohanba.cn +🥗AUNEY,http://121.227.25.116:8008 +🎡资源小站,https://960303.xyz/ +🏝fenwe,http://www.fenwe.tk:5244 +🎢轻弹浅唱,https://g.xiang.lol \ No newline at end of file diff --git a/js/alist.txt b/js/alist.txt deleted file mode 100644 index ba3b026..0000000 --- a/js/alist.txt +++ /dev/null @@ -1,27 +0,0 @@ -{ - "🔮嗨翻":"https://pan.hikerfans.com", - "🦀9T(Adult)":"https://drive.9t.ee", - "🐱梓澪の妙妙屋":"https://xn--i0v44m.xyz", - "🚆资源小站":"https://pan.142856.xyz", - "🌤晴园的宝藏库":"https://alist.52qy.repl.co", - "🐭米奇妙妙屋":"https://anime.mqmmw.ga", - "💂小兵组网盘影视":"https://6vv.app", - "📀小光盘":"https://alist.xiaoguanxiaocheng.life", - "🐋一只鱼":"https://alist.youte.ml", - "🌊七米蓝":"https://al.chirmyram.com", - "🌴非盘":"http://www.feifwp.top", - "🥼帅盘":"https://hi.shuaipeng.wang", - "🐉神族九帝":"https://alist.shenzjd.com", - "☃姬路白雪":"https://pan.jlbx.xyz", - "🎧听闻网盘":"https://wangpan.sangxuesheng.com", - "💾DISK":"http://124.222.140.243:8080", - "🌨云播放":"https://quanzi.laoxianghuijia.cn", - "✨星梦":"https://pan.bashroot.top", - "🌊小江":"https://dyj.me", - "💫触光":"https://pan.ichuguang.com", - "🕵好汉吧":"https://8023.haohanba.cn", - "🥗AUNEY":"http://121.227.25.116:8008", - "🎡资源小站":"https://960303.xyz/", - "🏝fenwe":"http://www.fenwe.tk:5244", - "🎢轻弹浅唱":"https://g.xiang.lol" -} diff --git a/js/version.txt b/js/version.txt index 8a4b275..d40b13a 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.1.6 \ No newline at end of file +3.1.7 \ No newline at end of file diff --git a/readme.md b/readme.md index a8d0daf..e74e30a 100644 --- a/readme.md +++ b/readme.md @@ -51,6 +51,7 @@ - [X] 2.增加了后台管理界面修改直播源地址和同步直播源 - [X] 3.首页推荐内容不限制数量(新版pluto牛逼!!!) - [X] 4.增加lsg配置模型和缓存 +- [X] 5.增加了默认alist挂载 ###### 2022/09/05 - [X] 1.内置jar修复了原本tv_box无法播放直播的问题 - [X] 2.重新构建了三种平台的镜像 amd64,armv7,arm64 diff --git a/templates/config.txt b/templates/config.txt index a423aae..3001847 100644 --- a/templates/config.txt +++ b/templates/config.txt @@ -3,6 +3,7 @@ "dr_count": {{rules.list|length}}, "mode": {{ mode }}, "spider": "{{ host }}/liveslib", +{% if alists|length > 0 %}"drives": {{alists}},{% endif %} "homepage":"https://gitcode.net/qq_32394351/dr_py", "sites": [{% for rule in rules.list %}{% if mode == 0 %} { diff --git a/utils/web.py b/utils/web.py index ec14fa0..812d80e 100644 --- a/utils/web.py +++ b/utils/web.py @@ -3,7 +3,7 @@ # File : web.py # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------ # Date : 2022/8/25 - +import os import socket import hashlib from werkzeug.utils import import_string @@ -115,4 +115,27 @@ def getHeaders(url): headers.setdefault("User-Agent", PC_UA) headers.setdefault("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") headers.setdefault("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2") - return headers \ No newline at end of file + return headers + +def getAlist(): + base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录 + alist_path = os.path.join(base_path, 'js/alist.conf') + with open(alist_path,encoding='utf-8') as f: + data = f.read().strip() + alists = [] + for i in data.split('\n'): + i = i.strip() + dt = i.split(',') + if not i.strip().startswith('#'): + obj = { + 'name': dt[0], + 'server': dt[1], + 'type':"alist", + } + if len(dt) > 2: + obj.update({ + 'password': dt[2] + }) + alists.append(obj) + print(f'共计{len(alists)}条alist记录') + return alists \ No newline at end of file -- GitLab