From 6ed8dedc2728fa3029e406fe703d05318ac36214 Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Tue, 6 Sep 2022 10:12:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 6 ++- config.py | 2 +- js/alist.txt | 27 +++++++++++ models/__init__.py | 3 +- models/rules.db | Bin 32768 -> 40960 bytes models/storage.py | 66 +++++++++++++++++++++++++++ static/css/admin.css | 66 ++++++++++++++++++++++++++- static/js/common.js | 18 ++++++++ templates/admin.html | 104 +++++-------------------------------------- 9 files changed, 195 insertions(+), 97 deletions(-) create mode 100644 js/alist.txt create mode 100644 models/storage.py create mode 100644 static/js/common.js diff --git a/app.py b/app.py index c9788d8..394d3d9 100644 --- a/app.py +++ b/app.py @@ -58,7 +58,11 @@ else: # from geventwebsocket.handler import WebSocketHandler RuleClass = rule_classes.init(db) PlayParse = play_parse.init(db) - +lsg = storage.init(db) +print(lsg.setItem('直播地址','https://gitcode.net/qq_26898231/TVBox/-/raw/main/live/zb.txt')) +t12 = time() +print(lsg.getItem('直播地址','111')) +print(get_interval(t12)) def is_linux(): return not 'win' in sys.platform diff --git a/config.py b/config.py index e89538b..3a2ba8c 100644 --- a/config.py +++ b/config.py @@ -33,6 +33,6 @@ UNAME = 'admin' # 管理员账号 PWD = 'drpy' # 管理员密码 MAX_CONTENT_LENGTH = 1 * 1024 * 1024/100 # 100 kB LIVE_MODE = 1 # 0 本地 1外网 -LIVE_URL = 'https://gitcode.net/qq_26898231/TVBox/-/raw/main/live/0830zb.txt' # 外网直播地址 +LIVE_URL = 'https://gitcode.net/qq_26898231/TVBox/-/raw/main/live/zb.txt' # 外网直播地址 CATE_EXCLUDE = '首页|留言|APP|下载|资讯|新闻|动态' # 动态分类过滤 # {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %} \ No newline at end of file diff --git a/js/alist.txt b/js/alist.txt new file mode 100644 index 0000000..ba3b026 --- /dev/null +++ b/js/alist.txt @@ -0,0 +1,27 @@ +{ + "🔮嗨翻":"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/models/__init__.py b/models/__init__.py index ad5d31f..574f494 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -5,4 +5,5 @@ # Date : 2022/8/25 from . import rule_classes -from . import play_parse \ No newline at end of file +from . import play_parse +from . import storage \ No newline at end of file diff --git a/models/rules.db b/models/rules.db index 1be8eebe34935d66835455ee779a3cf36c023ef3..f728daa37e87aaf7ccb695afdbe2da31bdc05510 100644 GIT binary patch delta 366 zcmZo@U}`wPG(lQ0i-CcG3y5KWeWH%BbQXi2_XJ*kMh12sK?a_s{D=9{d29GIcm(-- zHa1S>Hf|Jd6l7x;mzHL1tSm`P%1JFQ$uCMwhf$o)L9UJ=t_mTJPCl**5V^?<`DEmk zvQsOS6v7;XoIMi;1briTb%Mx=+Qx!s7BSI$6;aA`QtI_1r+`N=0mWgvWL$|o1 zB4d;1SG1X^&P Qe_{aZ" % ( + self.key, self.value) + + @classmethod + def setItem(self, key, value=None): + res = db.session.query(self).filter(self.key == key).first() + if res: + res.value = value + db.session.add(res) + else: + res = Storage(key=key, value=value) + db.session.add(res) + db.session.flush() + try: + db.session.commit() + self.clearCache() + return res.id + except Exception as e: + print(f'发生了错误:{e}') + return None + + @classmethod + @lru_cache(maxsize=200) + def getItem(self, key, value=''): + res = db.session.query(self).filter(self.key == key).first() + if res: + return res.value or value + else: + return value + + @classmethod + def clearItem(self, key): + self.clearCache() + res = db.session.query(self).filter(self.key == key).first() + if res: + res.delete() + ret = db.session.commit() + self.clearCache() + return ret + else: + return True + + @classmethod + def clearCache(self): + self.getItem.cache_clear() + + # db.create_all() + db.create_all() + return Storage \ No newline at end of file diff --git a/static/css/admin.css b/static/css/admin.css index e79d48b..81d62d8 100644 --- a/static/css/admin.css +++ b/static/css/admin.css @@ -2,4 +2,68 @@ /*font-size: 18px;*/ color: #5dc2f1; -} \ No newline at end of file +} + +.red { + color:red; + font-weight: bold; + padding-left:10px; + /*padding-top:10px;*/ + margin-left:10px; + width: 360px; + height: 30px; + } + .green { + color:forestgreen; + font-weight: bold; + padding-left:10px; + /*padding-top:10px;*/ + margin-left:10px; + width: 360px; + height: 30px; + } + .btn{ + color:#FFFFFF; + background-color: #1379cb; + } + .clear{ + /*word-spacing:2px;*/ + letter-spacing:5px; + margin-left:20px; + width: 120px; + height: 30px; + text-align: center; + border-style: solid; + /*border-color: #8CD4F5;*/ + border-color: #1379cb; + text-decoration:none; + color:#FFFFFF; + background-color: #1379cb; + } + .view_home{ + letter-spacing:5px; + margin-left:20px; + width: 150px; + height: 30px; + text-align: center; + border-style: solid; + /*border-color: #8CD4F5;*/ + border-color: #17af30; + text-decoration:none; + color:#FFFFFF; + background-color: #17af30; + } + /*li a {*/ + /* display: block !important;*/ + /*}*/ + .ver_title{ + font-size: 15px;margin-left: 20px + } + + .ver{ + font-size: 16px;margin-left: 5px;color: #ea7d7d; + } + + a.funcbtn{ + margin-left: 10px; + } \ No newline at end of file diff --git a/static/js/common.js b/static/js/common.js new file mode 100644 index 0000000..e2c7546 --- /dev/null +++ b/static/js/common.js @@ -0,0 +1,18 @@ +function copy(text,mode){ + mode = mode||0; + if(mode === 0){ + let el = $(''); +    $('body').prepend(el); //添加到元素内部的前面 + el.val(text); // 修改文本框的内容 + el.select(); //选中 + console.log('复制的内容:\n'+text); + document.execCommand("copy"); // 执行浏览器复制命令 + el.remove(); + }else{ + let el = $(text); + console.log('复制的内容:\n'+el.val()); + el.select(); //选中 + document.execCommand("copy"); // 执行浏览器复制命令 + } + alert("复制成功"); +} \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index 0b8f5ad..7d2522b 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -9,86 +9,17 @@ + - -

欢迎使用drpy管理员界面当前版本:{{ ver }}

+

欢迎使用drpy管理员界面

+

+ 当前版本:{{ ver }} +

返回首页 检测升级 -cp ./tmp/dr_py-master/app.py ./app.py + +复制主程升级指令 +同步直播源

你可以在此页面在线上传规则文件到js目录或者删除js目录的文件

-
-- GitLab