提交 0757eebb 编写于 作者: H hjdhnx

增加py源开关

上级 05c8832d
......@@ -31,6 +31,7 @@ RETRY_CNT = 3 # 验证码重试次数
OCR_API = 'http://dm.mudery.com:10000' # 验证码识别接口,传参数data
UNAME = 'admin' # 管理员账号
PWD = 'drpy' # 管理员密码
USE_PY = 0 # 开启py源
MAX_CONTENT_LENGTH = 1 * 1024 * 1024/100 # 100 kB
LIVE_MODE = 0 # 0 本地 1外网
LIVE_URL = 'https://gitcode.net/qq_26898231/TVBox/-/raw/main/live/zb.txt' # 初始化外网直播地址(后续在管理界面改)
......
......@@ -33,11 +33,13 @@ admin = Blueprint("admin", __name__)
def admin_index(): # 管理员界面
lsg = storage_service()
live_url = lsg.getItem('LIVE_URL')
use_py = lsg.getItem('USE_PY')
print(f'live_url:',live_url)
if not verfy_token():
return render_template('login.html')
live_url = lsg.getItem('LIVE_URL')
return render_template('admin.html', rules=getRules('js'), ver=getLocalVer(), live_url=live_url)
return render_template('admin.html', pystate=use_py,rules=getRules('js'), ver=getLocalVer(), live_url=live_url)
@admin.route("/view/<name>",methods=['GET'])
def admin_view_rule(name):
......@@ -115,6 +117,27 @@ def admin_write_live_url():
msg = f'已修改的配置记录id为:{id}'
return R.success(msg)
@admin.route('/change_use_py')
def admin_change_use_py():
if not verfy_token():
return R.failed('请登录后再试')
lsg = storage_service()
use_py = lsg.getItem('USE_PY')
new_use_py = '' if use_py else '1'
state = '开启' if new_use_py else '关闭'
id = lsg.setItem('USE_PY', new_use_py)
msg = f'已修改的配置记录id为:{id},结果为{state}'
return R.success(msg)
# @admin.route('/get_use_py')
# def admin_get_use_py():
# if not verfy_token():
# return R.failed('请登录后再试')
# lsg = storage_service()
# use_py = lsg.getItem('USE_PY')
# state = 1 if use_py else 0
# return R.success(state)
@admin.route('/upload', methods=['GET', 'POST'])
def upload_file():
if not verfy_token():
......
......@@ -180,8 +180,11 @@ def config_render(mode):
except Exception as e:
logger.info(f'用户自定义配置加载失败:{e}')
jxs = getJxs()
pys = getPys()
print(pys)
lsg = storage_service()
use_py = lsg.getItem('USE_PY')
# pys = getPys() if cfg.get('USE_PY') else []
pys = getPys() if use_py else []
# print(pys)
alists = getAlist()
alists_str = json.dumps(alists, ensure_ascii=False)
live_url = get_live_url(new_conf,mode)
......@@ -201,7 +204,10 @@ def config_gen():
os.makedirs('txt',exist_ok=True)
new_conf = cfg
jxs = getJxs()
pys = getPys()
# pys = getPys() if cfg.get('USE_PY') else []
lsg = storage_service()
use_py = lsg.getItem('USE_PY')
pys = getPys() if use_py else False
alists = getAlist()
alists_str = json.dumps(alists,ensure_ascii=False)
set_local = render_template('config.txt',pys=pys,rules=getRules('js'),alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,0),mode=0,host=getHost(0),jxs=jxs)
......
......@@ -21,6 +21,10 @@ class storage_service(object):
print('开始初始化lsg')
self.setItem('LIVE_URL', cfg.get('LIVE_URL'))
# if not self.getItem('USE_PY'):
# print('开始初始化USE_PY')
# self.setItem('USE_PY', '1' if cfg.get('USE_PY') else '')
@classmethod
def getItem(self, key, value=''):
return Storage.getItem(key,value)
......
3.4.5
\ No newline at end of file
3.4.7
\ No newline at end of file
无法预览此类型文件
......@@ -48,7 +48,8 @@
[获取本地设备信息](https://m.jb51.net/article/140716.htm)
###### 2022/09/10
- [X] 1.升级至3.4.4.增加小强迷源,增加二级重定向属性(提供重定向后的源码,让代码重新取重定向过后的线路和播放列表)
- [X] 1.升级至3.4.5.增加兔小贝儿歌源,优化json:细节处理以及详情页拼接细节
- [X] 2.升级至3.4.5.增加兔小贝儿歌源,优化json:细节处理以及详情页拼接细节
- [X] 3.升级至3.4.7 后台管理增加了py源开关
###### 2022/09/09
- [X] 1.增加西瓜源,修复一级不支持lazy的bug
- [X] 2.兄弟们dockerhub没法push镜像不知道咋回事,3.4.1的镜像自己用docker目录下的文件build吧
......
......@@ -164,6 +164,20 @@
}
});
$('#use_py').click(function (){
$.get("/admin/change_use_py",function(data,status){
console.log(data);
if(data.code === 200){
alert(data.msg);
location.reload();
}else{
alert(data.msg);
console.log('升级失败了...');
return false
}
});
});
});
function getFileSize(fileObj) {
$('#file_size').text('文件大小为:'+fileObj.files[0].size/1024+'kb');
......@@ -184,6 +198,8 @@ function getFileSize(fileObj) {
id="write_lives">修改直播源</a></button>
<button type="button" class="yongyin4"><a href="javascript:void(0);" class="funcbtn"
id="update_lives">同步直播源</a></button>
<button type="button" class="yongyin3"><a href="javascript:void(0);" class="funcbtn"
id="use_py">已{% if pystate=='1' %}启用{% else %}关闭{% endif %}py源</a></button>
<button type="button" class="yongyin1"><a href="javascript:void(0);" class="funcbtn"
id="force_update">强制升级</a></button>
<input id="live_url" value="{{live_url}}" style="display: none">
......
......@@ -24,6 +24,7 @@
"quickSearch": {{ rule.quickSearch }},
"filterable": {{ rule.filterable }}
}{% endif %}{% if loop.last==False %},{% endif %}{% endfor %}
{% if pys %}
,{% for py in pys %}{
"key":"{{ py.name }}",
"name":"{{ py.name }}(Pyramid)",
......@@ -34,6 +35,7 @@
"filterable": {{ py.filterable }},
"ext": "{{ host }}/txt/py/{{ py.name }}.py"
}{% if loop.last==False %},{% endif %}{% endfor %}
{% endif %}
],
"parses": [{
"name": "🌐Ⓤ",
......
{
"wallpaper": "http://localhost:5705/pics",
"dr_count": 28,
"dr_count": 30,
"mode": 0,
"spider": "http://localhost:5705/liveslib",
"drives": [
......@@ -204,6 +204,15 @@
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_兔小贝",
"name": "兔小贝(道长)",
"type": 1,
"api": "http://localhost:5705/vod?rule=兔小贝",
"searchable": 1,
"quickSearch": 0,
"filterable": 0
},
{
"key": "dr_养端",
"name": "养端(道长)",
......@@ -267,6 +276,15 @@
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_小强迷",
"name": "小强迷(道长)",
"type": 1,
"api": "http://localhost:5705/vod?rule=小强迷",
"searchable": 1,
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_小猫咪",
"name": "小猫咪(道长)",
......
{
"wallpaper": "http://192.168.3.224:5705/pics",
"dr_count": 28,
"dr_count": 30,
"mode": 1,
"spider": "http://192.168.3.224:5705/liveslib",
"drives": [
......@@ -204,6 +204,15 @@
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_兔小贝",
"name": "兔小贝(道长)",
"type": 1,
"api": "http://192.168.3.224:5705/vod?rule=兔小贝",
"searchable": 1,
"quickSearch": 0,
"filterable": 0
},
{
"key": "dr_养端",
"name": "养端(道长)",
......@@ -267,6 +276,15 @@
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_小强迷",
"name": "小强迷(道长)",
"type": 1,
"api": "http://192.168.3.224:5705/vod?rule=小强迷",
"searchable": 1,
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_小猫咪",
"name": "小猫咪(道长)",
......
{
"wallpaper": "http://cms.nokia.press/pics",
"dr_count": 28,
"dr_count": 30,
"mode": 1,
"spider": "http://cms.nokia.press/liveslib",
"drives": [
......@@ -204,6 +204,15 @@
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_兔小贝",
"name": "兔小贝(道长)",
"type": 1,
"api": "http://cms.nokia.press/vod?rule=兔小贝",
"searchable": 1,
"quickSearch": 0,
"filterable": 0
},
{
"key": "dr_养端",
"name": "养端(道长)",
......@@ -267,6 +276,15 @@
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_小强迷",
"name": "小强迷(道长)",
"type": 1,
"api": "http://cms.nokia.press/vod?rule=小强迷",
"searchable": 1,
"quickSearch": 1,
"filterable": 0
},
{
"key": "dr_小猫咪",
"name": "小猫咪(道长)",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册