Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zgaoliang520
dr_py
提交
ff5936ef
dr_py
项目概览
zgaoliang520
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
dr_py
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ff5936ef
编写于
9月 11, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加了一堆Bug
上级
4167eeed
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
237 addition
and
134 deletion
+237
-134
app.py
app.py
+3
-1
base/rules.db
base/rules.db
+0
-0
controllers/admin.py
controllers/admin.py
+25
-3
controllers/cms.py
controllers/cms.py
+10
-4
controllers/home.py
controllers/home.py
+10
-3
controllers/service.py
controllers/service.py
+38
-8
js/version.txt
js/version.txt
+1
-1
js/养端.jsd
js/养端.jsd
+0
-0
js/吸瓜.jsd
js/吸瓜.jsd
+0
-0
js/玩偶姐姐.jsd
js/玩偶姐姐.jsd
+0
-0
models/storage.py
models/storage.py
+10
-1
readme.md
readme.md
+2
-0
static/css/settings.css
static/css/settings.css
+21
-0
templates/admin.html
templates/admin.html
+8
-6
templates/settings.html
templates/settings.html
+67
-0
txt/pycms0.json
txt/pycms0.json
+2
-29
txt/pycms1.json
txt/pycms1.json
+2
-29
txt/pycms2.json
txt/pycms2.json
+2
-29
utils/cfg.py
utils/cfg.py
+20
-0
utils/files.py
utils/files.py
+3
-2
utils/system.py
utils/system.py
+6
-15
utils/web.py
utils/web.py
+7
-3
未找到文件。
app.py
浏览文件 @
ff5936ef
...
@@ -22,7 +22,9 @@ def create_flask_app():
...
@@ -22,7 +22,9 @@ def create_flask_app():
app
.
register_blueprint
(
vod
.
vod
,
url_prefix
=
''
)
app
.
register_blueprint
(
vod
.
vod
,
url_prefix
=
''
)
app
.
register_blueprint
(
cls
.
cls
,
url_prefix
=
'/cls'
)
app
.
register_blueprint
(
cls
.
cls
,
url_prefix
=
'/cls'
)
app
.
logger
.
name
=
"drLogger"
app
.
logger
.
name
=
"drLogger"
logger
.
info
(
f
"自定义播放解析地址:
{
app
.
config
.
get
(
'PLAY_URL'
)
}
"
)
# lsg = service.storage_service()
logger
.
info
(
f
"默认解析地址:
{
app
.
config
.
get
(
'PLAY_URL'
)
}
"
)
# logger.info(f"自定义播放解析地址:{lsg.getItem('PLAY_URL')}")
logger
.
info
(
f
'当前操作系统
{
sys
.
platform
}
'
)
logger
.
info
(
f
'当前操作系统
{
sys
.
platform
}
'
)
rule_list
=
getRuleLists
()
rule_list
=
getRuleLists
()
wlan_info
,
_
=
get_wlan_info
()
wlan_info
,
_
=
get_wlan_info
()
...
...
base/rules.db
浏览文件 @
ff5936ef
无法预览此类型文件
controllers/admin.py
浏览文件 @
ff5936ef
...
@@ -31,15 +31,37 @@ admin = Blueprint("admin", __name__)
...
@@ -31,15 +31,37 @@ admin = Blueprint("admin", __name__)
@
admin
.
route
(
'/'
)
@
admin
.
route
(
'/'
)
def
admin_index
():
# 管理员界面
def
admin_index
():
# 管理员界面
if
not
verfy_token
():
return
render_template
(
'login.html'
)
lsg
=
storage_service
()
lsg
=
storage_service
()
live_url
=
lsg
.
getItem
(
'LIVE_URL'
)
live_url
=
lsg
.
getItem
(
'LIVE_URL'
)
use_py
=
lsg
.
getItem
(
'USE_PY'
)
use_py
=
lsg
.
getItem
(
'USE_PY'
)
print
(
f
'live_url:'
,
live_url
)
print
(
f
'live_url:'
,
live_url
)
return
render_template
(
'admin.html'
,
pystate
=
use_py
,
rules
=
getRules
(
'js'
),
ver
=
getLocalVer
(),
live_url
=
live_url
)
@
admin
.
route
(
'/settings'
)
def
admin_settings
():
# 管理员界面
if
not
verfy_token
():
if
not
verfy_token
():
return
render_template
(
'login.html'
)
return
render_template
(
'login.html'
)
lsg
=
storage_service
()
# 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
())
@
admin
.
route
(
'/save_conf'
,
methods
=
[
'POST'
])
def
admin_save_conf
():
# 管理员界面
if
not
verfy_token
():
if
not
verfy_token
():
# return render_template('login.html')
return
R
.
error
(
'请登录后再试'
)
key
=
getParmas
(
'key'
)
value
=
getParmas
(
'value'
)
print
(
f
'key:
{
key
}
,value:
{
value
}
'
)
lsg
=
storage_service
()
res_id
=
lsg
.
setItem
(
key
,
value
)
return
R
.
success
(
f
'修改成功,记录ID为:
{
res_id
}
'
)
live_url
=
lsg
.
getItem
(
'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'
])
@
admin
.
route
(
"/view/<name>"
,
methods
=
[
'GET'
])
def
admin_view_rule
(
name
):
def
admin_view_rule
(
name
):
...
...
controllers/cms.py
浏览文件 @
ff5936ef
...
@@ -21,6 +21,7 @@ from urllib.parse import urljoin
...
@@ -21,6 +21,7 @@ from urllib.parse import urljoin
from
concurrent.futures
import
ThreadPoolExecutor
# 引入线程池
from
concurrent.futures
import
ThreadPoolExecutor
# 引入线程池
from
flask
import
url_for
,
redirect
from
flask
import
url_for
,
redirect
from
easydict
import
EasyDict
as
edict
from
easydict
import
EasyDict
as
edict
from
controllers.service
import
storage_service
py_ctx
=
{
py_ctx
=
{
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
...
@@ -34,17 +35,22 @@ class CMS:
...
@@ -34,17 +35,22 @@ class CMS:
def
__init__
(
self
,
rule
,
db
=
None
,
RuleClass
=
None
,
PlayParse
=
None
,
new_conf
=
None
):
def
__init__
(
self
,
rule
,
db
=
None
,
RuleClass
=
None
,
PlayParse
=
None
,
new_conf
=
None
):
if
new_conf
is
None
:
if
new_conf
is
None
:
new_conf
=
{}
new_conf
=
{}
self
.
lsg
=
storage_service
()
self
.
title
=
rule
.
get
(
'title'
,
''
)
self
.
title
=
rule
.
get
(
'title'
,
''
)
self
.
id
=
rule
.
get
(
'id'
,
self
.
title
)
self
.
id
=
rule
.
get
(
'id'
,
self
.
title
)
cate_exclude
=
rule
.
get
(
'cate_exclude'
,
''
)
cate_exclude
=
rule
.
get
(
'cate_exclude'
,
''
)
tab_exclude
=
rule
.
get
(
'tab_exclude'
,
''
)
tab_exclude
=
rule
.
get
(
'tab_exclude'
,
''
)
self
.
lazy
=
rule
.
get
(
'lazy'
,
False
)
self
.
lazy
=
rule
.
get
(
'lazy'
,
False
)
self
.
play_disable
=
new_conf
.
get
(
'PLAY_DISABLE'
,
False
)
# self.play_disable = new_conf.get('PLAY_DISABLE',False)
self
.
play_disable
=
self
.
lsg
.
getItem
(
'PLAY_DISABLE'
,
False
)
self
.
retry_count
=
new_conf
.
get
(
'RETRY_CNT'
,
3
)
self
.
retry_count
=
new_conf
.
get
(
'RETRY_CNT'
,
3
)
self
.
lazy_mode
=
new_conf
.
get
(
'LAZYPARSE_MODE'
)
# self.lazy_mode = new_conf.get('LAZYPARSE_MODE')
self
.
lazy_mode
=
self
.
lsg
.
getItem
(
'LAZYPARSE_MODE'
)
self
.
ocr_api
=
new_conf
.
get
(
'OCR_API'
)
self
.
ocr_api
=
new_conf
.
get
(
'OCR_API'
)
self
.
cate_exclude
=
new_conf
.
get
(
'CATE_EXCLUDE'
,
''
)
# self.cate_exclude = new_conf.get('CATE_EXCLUDE','')
self
.
tab_exclude
=
new_conf
.
get
(
'TAB_EXCLUDE'
,
''
)
self
.
cate_exclude
=
self
.
lsg
.
getItem
(
'CATE_EXCLUDE'
,
''
)
# self.tab_exclude = new_conf.get('TAB_EXCLUDE','')
self
.
tab_exclude
=
self
.
lsg
.
getItem
(
'TAB_EXCLUDE'
,
''
)
if
cate_exclude
:
if
cate_exclude
:
if
not
str
(
cate_exclude
).
startswith
(
'|'
)
and
not
str
(
self
.
cate_exclude
).
endswith
(
'|'
):
if
not
str
(
cate_exclude
).
startswith
(
'|'
)
and
not
str
(
self
.
cate_exclude
).
endswith
(
'|'
):
self
.
cate_exclude
=
self
.
cate_exclude
+
'|'
+
cate_exclude
self
.
cate_exclude
=
self
.
cate_exclude
+
'|'
+
cate_exclude
...
...
controllers/home.py
浏览文件 @
ff5936ef
...
@@ -13,7 +13,8 @@ from utils.web import getParmas
...
@@ -13,7 +13,8 @@ from utils.web import getParmas
from
utils.files
import
getPics
,
custom_merge
from
utils.files
import
getPics
,
custom_merge
from
js.rules
import
getRules
,
getPys
from
js.rules
import
getRules
,
getPys
from
base.R
import
R
from
base.R
import
R
from
utils.system
import
cfg
,
getHost
,
is_linux
from
utils.system
import
getHost
,
is_linux
from
utils.cfg
import
cfg
from
utils
import
parser
from
utils
import
parser
from
utils.log
import
logger
from
utils.log
import
logger
from
utils.files
import
getAlist
,
get_live_url
from
utils.files
import
getAlist
,
get_live_url
...
@@ -61,8 +62,8 @@ def random_pics():
...
@@ -61,8 +62,8 @@ def random_pics():
id
=
getParmas
(
'id'
)
id
=
getParmas
(
'id'
)
# print(f'id:{id}')
# print(f'id:{id}')
pics
=
getPics
()
pics
=
getPics
()
print
(
pics
)
#
print(pics)
if
len
(
pics
)
>
0
:
if
not
cfg
.
WALL_PAPER
and
len
(
pics
)
>
0
:
if
id
and
f
'images/
{
id
}
.jpg'
in
pics
:
if
id
and
f
'images/
{
id
}
.jpg'
in
pics
:
pic
=
f
'images/
{
id
}
.jpg'
pic
=
f
'images/
{
id
}
.jpg'
else
:
else
:
...
@@ -172,6 +173,9 @@ def config_render(mode):
...
@@ -172,6 +173,9 @@ def config_render(mode):
jyw_ip
=
getHost
(
mode
)
jyw_ip
=
getHost
(
mode
)
logger
.
info
(
jyw_ip
)
logger
.
info
(
jyw_ip
)
new_conf
=
cfg
new_conf
=
cfg
lsg
=
storage_service
()
store_conf_dict
=
lsg
.
getStoreConfDict
()
new_conf
.
update
(
store_conf_dict
)
host
=
getHost
(
mode
)
host
=
getHost
(
mode
)
try
:
try
:
with
open
(
customFile
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
customFile
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
...
@@ -203,6 +207,9 @@ def config_gen():
...
@@ -203,6 +207,9 @@ def config_gen():
# 生成文件
# 生成文件
os
.
makedirs
(
'txt'
,
exist_ok
=
True
)
os
.
makedirs
(
'txt'
,
exist_ok
=
True
)
new_conf
=
cfg
new_conf
=
cfg
lsg
=
storage_service
()
store_conf_dict
=
lsg
.
getStoreConfDict
()
new_conf
.
update
(
store_conf_dict
)
jxs
=
getJxs
()
jxs
=
getJxs
()
# pys = getPys() if cfg.get('USE_PY') else []
# pys = getPys() if cfg.get('USE_PY') else []
lsg
=
storage_service
()
lsg
=
storage_service
()
...
...
controllers/service.py
浏览文件 @
ff5936ef
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
from
base.R
import
copy_utils
from
base.R
import
copy_utils
from
models.storage
import
Storage
from
models.storage
import
Storage
from
utils.
system
import
cfg
from
utils.
cfg
import
cfg
class
storage_service
(
object
):
class
storage_service
(
object
):
...
@@ -17,17 +17,47 @@ class storage_service(object):
...
@@ -17,17 +17,47 @@ class storage_service(object):
return
copy_utils
.
obj_to_list
(
res
)
return
copy_utils
.
obj_to_list
(
res
)
def
__init__
(
self
):
def
__init__
(
self
):
if
not
self
.
getItem
(
'LIVE_URL'
):
conf_list
=
[
'LIVE_URL'
,
'USE_PY'
,
'PLAY_URL'
,
'PLAY_DISABLE'
,
'LAZYPARSE_MODE'
,
'WALL_PAPER_ENABLE'
,
print
(
'开始初始化lsg'
)
'WALL_PAPER'
,
'UNAME'
,
'PWD'
,
'LIVE_MODE'
,
'CATE_EXCLUDE'
,
'TAB_EXCLUDE'
]
self
.
setItem
(
'LIVE_URL'
,
cfg
.
get
(
'LIVE_URL'
))
for
conf
in
conf_list
:
if
not
self
.
hasItem
(
conf
):
print
(
f
'开始初始化
{
conf
}
'
)
self
.
setItem
(
conf
,
cfg
.
get
(
conf
))
# if not self.getItem('USE_PY'):
@
classmethod
# print('开始初始化USE_PY')
def
getStoreConf
(
self
):
# self.setItem('USE_PY', '1' if cfg.get('USE_PY') else '')
conf_list
=
[
'LIVE_URL'
,
'USE_PY'
,
'PLAY_URL'
,
'PLAY_DISABLE'
,
'LAZYPARSE_MODE'
,
'WALL_PAPER_ENABLE'
,
'WALL_PAPER'
,
'UNAME'
,
'PWD'
,
'LIVE_MODE'
,
'CATE_EXCLUDE'
,
'TAB_EXCLUDE'
]
conf_name_list
=
[
'直播地址'
,
'启用py源'
,
'远程地址'
,
'禁用免嗅'
,
'免嗅模式'
,
'启用壁纸'
,
'壁纸链接'
,
'管理账号'
,
'管理密码'
,
'直播模式'
,
'分类排除'
,
'线路排除'
]
conf_lists
=
[]
for
i
in
range
(
len
(
conf_list
)):
conf
=
conf_list
[
i
]
conf_lists
.
append
({
'key'
:
conf
,
'value'
:
self
.
getItem
(
conf
),
'name'
:
conf_name_list
[
i
]
})
return
conf_lists
@
classmethod
def
getStoreConfDict
(
self
):
store_conf
=
self
.
getStoreConf
()
store_conf_dict
=
{}
for
stc
in
store_conf
:
store_conf_dict
[
stc
[
'key'
]]
=
stc
[
'value'
]
return
store_conf_dict
@
classmethod
@
classmethod
def
getItem
(
self
,
key
,
value
=
''
):
def
getItem
(
self
,
key
,
value
=
''
):
return
Storage
.
getItem
(
key
,
value
)
res
=
Storage
.
getItem
(
key
,
value
)
if
str
(
res
)
==
'0'
or
str
(
res
)
==
'false'
or
str
(
res
)
==
'False'
:
return
0
return
res
@
classmethod
def
hasItem
(
self
,
key
):
return
Storage
.
hasItem
(
key
)
@
classmethod
@
classmethod
def
setItem
(
self
,
key
,
value
):
def
setItem
(
self
,
key
,
value
):
...
...
js/version.txt
浏览文件 @
ff5936ef
3.4.7
3.5.0
\ No newline at end of file
\ No newline at end of file
js/养端.js
→
js/养端.js
d
浏览文件 @
ff5936ef
文件已移动
js/吸瓜.js
→
js/吸瓜.js
d
浏览文件 @
ff5936ef
文件已移动
js/玩偶姐姐.js
→
js/玩偶姐姐.js
d
浏览文件 @
ff5936ef
文件已移动
models/storage.py
浏览文件 @
ff5936ef
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
from
base.database
import
db
from
base.database
import
db
from
functools
import
lru_cache
from
functools
import
lru_cache
from
utils.system
import
cfg
class
Storage
(
db
.
Model
):
class
Storage
(
db
.
Model
):
__tablename__
=
'storage'
__tablename__
=
'storage'
...
@@ -47,6 +46,16 @@ class Storage(db.Model):
...
@@ -47,6 +46,16 @@ class Storage(db.Model):
else
:
else
:
return
value
return
value
@
classmethod
@
lru_cache
(
maxsize
=
200
)
def
hasItem
(
self
,
key
):
exists
=
db
.
session
.
query
(
self
).
filter
(
self
.
key
==
key
).
scalar
()
is
not
None
# res = db.session.query(self).filter(self.key == key).
if
exists
:
return
True
else
:
return
False
@
classmethod
@
classmethod
def
clearItem
(
self
,
key
):
def
clearItem
(
self
,
key
):
self
.
clearCache
()
self
.
clearCache
()
...
...
readme.md
浏览文件 @
ff5936ef
...
@@ -46,6 +46,8 @@
...
@@ -46,6 +46,8 @@
[
dockerfile教程
](
https://blog.csdn.net/qq_46158060/article/details/125718218
)
[
dockerfile教程
](
https://blog.csdn.net/qq_46158060/article/details/125718218
)
[
获取本地设备信息
](
https://blog.csdn.net/cui_yonghua/article/details/125508991
)
[
获取本地设备信息
](
https://blog.csdn.net/cui_yonghua/article/details/125508991
)
[
获取本地设备信息
](
https://m.jb51.net/article/140716.htm
)
[
获取本地设备信息
](
https://m.jb51.net/article/140716.htm
)
###### 2022/09/11
-
[X] 1.升级至3.5.0.后台管理增加设置中心 (可能会存在bug)
###### 2022/09/10
###### 2022/09/10
-
[X] 1.升级至3.4.4.增加小强迷源,增加二级重定向属性(提供重定向后的源码,让代码重新取重定向过后的线路和播放列表)
-
[X] 1.升级至3.4.4.增加小强迷源,增加二级重定向属性(提供重定向后的源码,让代码重新取重定向过后的线路和播放列表)
-
[X] 2.升级至3.4.5.增加兔小贝儿歌源,优化json:细节处理以及详情页拼接细节
-
[X] 2.升级至3.4.5.增加兔小贝儿歌源,优化json:细节处理以及详情页拼接细节
...
...
static/css/settings.css
0 → 100644
浏览文件 @
ff5936ef
.save_conf
{
border-radius
:
50px
;
border-style
:
solid
;
color
:
#FFFFFF
;
text-align
:
center
;
padding
:
1px
3px
1px
3px
;
border-style
:
solid
;
border-color
:
#5c6cf6
;
text-decoration
:
none
;
background-color
:
#1379cb
;
}
input
.conf
{
margin-bottom
:
10px
;
width
:
240px
;
}
label
{
font-size
:
12px
;
color
:
#5c6cf6
;
font-weight
:
bold
;
}
\ No newline at end of file
templates/admin.html
浏览文件 @
ff5936ef
...
@@ -188,20 +188,22 @@ function getFileSize(fileObj) {
...
@@ -188,20 +188,22 @@ function getFileSize(fileObj) {
</h2>
</h2>
<h4>
<h4>
<button
type=
"button"
class=
"yongyin"
><a
href=
"/index"
>
返回首页
</a></button>
<button
type=
"button"
class=
"yongyin"
><a
href=
"/index"
>
返回首页
</a></button>
<button
type=
"button"
class=
"yongyin"
><a
href=
"/admin/settings"
>
设置中心
</a></button>
<button
type=
"button"
class=
"yongyin1"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
<button
type=
"button"
class=
"yongyin1"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
id=
"checkUpdate"
>
检测升级
</a></button>
id=
"checkUpdate"
>
检测升级
</a></button>
<button
type=
"button"
class=
"yongyin2"
><a
href=
"javascript:copy('cp ./tmp/dr_py-master/app.py ./app.py');"
<button
type=
"button"
class=
"yongyin1"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
class=
"funcbtn"
id=
"update_by_self"
>
升级指令
</a></button>
id=
"force_update"
>
强制升级
</a></button>
<button
type=
"button"
class=
"yongyin2"
><a
href=
"javascript:copy('cp ./tmp/dr_py-master/base/custom.conf base');"
<!-- <button type="button" class="yongyin2"><a href="javascript:copy('cp ./tmp/dr_py-master/app.py ./app.py');"-->
class=
"funcbtn"
id=
"user_custom"
>
用户配置
</a></button>
<!-- class="funcbtn" id="update_by_self">升级指令</a></button>-->
<!-- <button type="button" class="yongyin2"><a href="javascript:copy('cp ./tmp/dr_py-master/base/custom.conf base');"-->
<!-- class="funcbtn" id="user_custom">用户配置</a></button>-->
<button
type=
"button"
class=
"yongyin3"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
<button
type=
"button"
class=
"yongyin3"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
id=
"write_lives"
>
修改直播源
</a></button>
id=
"write_lives"
>
修改直播源
</a></button>
<button
type=
"button"
class=
"yongyin4"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
<button
type=
"button"
class=
"yongyin4"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
id=
"update_lives"
>
同步直播源
</a></button>
id=
"update_lives"
>
同步直播源
</a></button>
<button
type=
"button"
class=
"yongyin3"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
<button
type=
"button"
class=
"yongyin3"
><a
href=
"javascript:void(0);"
class=
"funcbtn"
id=
"use_py"
>
已{% if pystate=='1' %}启用{% else %}关闭{% endif %}py源
</a></button>
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"
>
<input
id=
"live_url"
value=
"{{live_url}}"
style=
"display: none"
>
<p
class=
"box"
>
你可以在此界面在线管理JS目录里规则文件的上传/删除
</p>
<p
class=
"box"
>
你可以在此界面在线管理JS目录里规则文件的上传/删除
</p>
</h4>
</h4>
...
...
templates/settings.html
0 → 100644
浏览文件 @
ff5936ef
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
<title>
管理员操作中心-配置修改
</title>
<meta
name=
"description"
content=
"particles.js is a lightweight JavaScript library for creating particles."
>
<meta
name=
"author"
content=
"道长"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
>
<link
rel=
"stylesheet"
media=
"screen"
href=
"/static/css/admin.css"
>
<link
rel=
"stylesheet"
media=
"screen"
href=
"/static/css/settings.css"
>
<link
rel=
"icon"
href=
"/static/img/logo.png"
type=
"image/x-icon"
>
<script
src=
"/static/js/jquery.min.js"
></script>
<script
src=
"/static/js/common.js"
></script>
</head>
<body>
<script>
function
saveConf
(
obj
){
let
thisObj
=
$
(
obj
);
//js对象转jquery对象
let
key
=
thisObj
.
attr
(
"
value
"
);
let
value
=
$
(
'
.conf[name="
'
+
key
+
'
"]
'
).
val
();
console
.
log
(
'
key:
'
+
key
+
'
,value:
'
+
value
);
let
params
=
{
key
:
key
,
value
:
value
};
$
.
post
(
"
/admin/save_conf
"
,
params
,
function
(
data
,
status
){
// console.log(data);
if
(
data
.
code
===
200
){
alert
(
data
.
msg
);
console
.
log
(
'
保存
'
+
key
+
'
成功了...
'
);
// location.reload();
}
else
{
if
(
/登录/
.
test
(
data
.
msg
)){
location
.
href
=
'
/admin
'
}
else
{
alert
(
data
.
msg
);
console
.
log
(
'
保存
'
+
key
+
'
失败了...
'
);
return
false
}
}
});
}
$
(
document
).
ready
(
function
()
{
$
(
"
.save_conf1
"
).
click
(
function
()
{
console
.
log
(
this
);
});
});
</script>
<h2
class=
"title"
>
欢迎使用DR-PY配置界面
<div><span
class=
"ver_title"
>
当前版本: {{ ver }}
</span><span
class=
"ver_title"
>
框架开发:道长
</span><span
class=
"ver_title"
>
框架美化:蓝莓
</span></div>
</h2>
<h4>
<button
type=
"button"
class=
"yongyin"
><a
href=
"/admin"
>
返回管理页
</a></button>
<!-- <button type="button" class="yongyin"><a href="/index">返回首页</a></button>-->
<button
type=
"button"
class=
"yongyin2"
><a
href=
"javascript:copy('cp ./tmp/dr_py-master/app.py ./app.py');"
class=
"funcbtn"
id=
"update_by_self"
>
升级指令
</a></button>
<button
type=
"button"
class=
"yongyin2"
><a
href=
"javascript:copy('cp ./tmp/dr_py-master/base/custom.conf base');"
class=
"funcbtn"
id=
"user_custom"
>
用户配置
</a></button>
</h4>
<form
action=
"#"
>
{% for conf in conf_lists %}
<label>
{{ conf.name }}
</label>
:
<input
class=
"conf"
type=
"text"
name=
"{{ conf.key }}"
placeholder=
"请输入{{ conf.key }}..."
value=
"{{ conf.value }}"
/>
<a
class=
"save_conf"
href=
"javascript:void(0);"
onclick=
"saveConf(this)"
value=
"{{ conf.key }}"
>
保存
</a>
{% if loop.last==False %}
</br>
{% endif %}{% endfor %}
</form>
</body>
</html>
\ No newline at end of file
txt/pycms0.json
浏览文件 @
ff5936ef
{
{
"wallpaper"
:
"http://localhost:5705/pics"
,
"wallpaper"
:
"http://localhost:5705/pics"
,
"dr_count"
:
30
,
"dr_count"
:
27
,
"mode"
:
0
,
"mode"
:
0
,
"spider"
:
"http://localhost:5705/liveslib"
,
"spider"
:
"http://localhost:5705/liveslib"
,
"drives"
:
[
"drives"
:
[
...
@@ -213,15 +213,6 @@
...
@@ -213,15 +213,6 @@
"quickSearch"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_养端"
,
"name"
:
"养端(道长)"
,
"type"
:
1
,
"api"
:
"http://localhost:5705/vod?rule=养端"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_剧白白"
,
"key"
:
"dr_剧白白"
,
"name"
:
"剧白白(道长)"
,
"name"
:
"剧白白(道长)"
,
...
@@ -231,15 +222,6 @@
...
@@ -231,15 +222,6 @@
"quickSearch"
:
1
,
"quickSearch"
:
1
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_吸瓜"
,
"name"
:
"吸瓜(道长)"
,
"type"
:
1
,
"api"
:
"http://localhost:5705/vod?rule=吸瓜"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_喵喵"
,
"key"
:
"dr_喵喵"
,
"name"
:
"喵喵(道长)"
,
"name"
:
"喵喵(道长)"
,
...
@@ -321,15 +303,6 @@
...
@@ -321,15 +303,6 @@
"quickSearch"
:
1
,
"quickSearch"
:
1
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_玩偶姐姐"
,
"name"
:
"玩偶姐姐(道长)"
,
"type"
:
1
,
"api"
:
"http://localhost:5705/vod?rule=玩偶姐姐"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_瓜皮TV"
,
"key"
:
"dr_瓜皮TV"
,
"name"
:
"瓜皮TV(道长)"
,
"name"
:
"瓜皮TV(道长)"
,
...
@@ -843,7 +816,7 @@
...
@@ -843,7 +816,7 @@
{
{
"name"
:
"直播"
,
"name"
:
"直播"
,
"urls"
:
[
"urls"
:
[
"proxy://do=live&type=txt&ext=aHR0c
DovL2xvY2FsaG9zdDo1NzA1L2xpdmVz
"
"proxy://do=live&type=txt&ext=aHR0c
HM6Ly9naXRjb2RlLm5ldC9xcV8yNjg5ODIzMS9UVkJveC8tL3Jhdy9tYWluL2xpdmUvemIudHh0
"
]
]
}
}
]
]
...
...
txt/pycms1.json
浏览文件 @
ff5936ef
{
{
"wallpaper"
:
"http://192.168.3.224:5705/pics"
,
"wallpaper"
:
"http://192.168.3.224:5705/pics"
,
"dr_count"
:
30
,
"dr_count"
:
27
,
"mode"
:
1
,
"mode"
:
1
,
"spider"
:
"http://192.168.3.224:5705/liveslib"
,
"spider"
:
"http://192.168.3.224:5705/liveslib"
,
"drives"
:
[
"drives"
:
[
...
@@ -213,15 +213,6 @@
...
@@ -213,15 +213,6 @@
"quickSearch"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_养端"
,
"name"
:
"养端(道长)"
,
"type"
:
1
,
"api"
:
"http://192.168.3.224:5705/vod?rule=养端"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_剧白白"
,
"key"
:
"dr_剧白白"
,
"name"
:
"剧白白(道长)"
,
"name"
:
"剧白白(道长)"
,
...
@@ -231,15 +222,6 @@
...
@@ -231,15 +222,6 @@
"quickSearch"
:
1
,
"quickSearch"
:
1
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_吸瓜"
,
"name"
:
"吸瓜(道长)"
,
"type"
:
1
,
"api"
:
"http://192.168.3.224:5705/vod?rule=吸瓜"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_喵喵"
,
"key"
:
"dr_喵喵"
,
"name"
:
"喵喵(道长)"
,
"name"
:
"喵喵(道长)"
,
...
@@ -321,15 +303,6 @@
...
@@ -321,15 +303,6 @@
"quickSearch"
:
1
,
"quickSearch"
:
1
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_玩偶姐姐"
,
"name"
:
"玩偶姐姐(道长)"
,
"type"
:
1
,
"api"
:
"http://192.168.3.224:5705/vod?rule=玩偶姐姐"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_瓜皮TV"
,
"key"
:
"dr_瓜皮TV"
,
"name"
:
"瓜皮TV(道长)"
,
"name"
:
"瓜皮TV(道长)"
,
...
@@ -843,7 +816,7 @@
...
@@ -843,7 +816,7 @@
{
{
"name"
:
"直播"
,
"name"
:
"直播"
,
"urls"
:
[
"urls"
:
[
"proxy://do=live&type=txt&ext=aHR0c
DovLzE5Mi4xNjguMy4yMjQ6NTcwNS9saXZlcw==
"
"proxy://do=live&type=txt&ext=aHR0c
HM6Ly9naXRjb2RlLm5ldC9xcV8yNjg5ODIzMS9UVkJveC8tL3Jhdy9tYWluL2xpdmUvemIudHh0
"
]
]
}
}
]
]
...
...
txt/pycms2.json
浏览文件 @
ff5936ef
{
{
"wallpaper"
:
"http://cms.nokia.press/pics"
,
"wallpaper"
:
"http://cms.nokia.press/pics"
,
"dr_count"
:
30
,
"dr_count"
:
27
,
"mode"
:
1
,
"mode"
:
1
,
"spider"
:
"http://cms.nokia.press/liveslib"
,
"spider"
:
"http://cms.nokia.press/liveslib"
,
"drives"
:
[
"drives"
:
[
...
@@ -213,15 +213,6 @@
...
@@ -213,15 +213,6 @@
"quickSearch"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_养端"
,
"name"
:
"养端(道长)"
,
"type"
:
1
,
"api"
:
"http://cms.nokia.press/vod?rule=养端"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_剧白白"
,
"key"
:
"dr_剧白白"
,
"name"
:
"剧白白(道长)"
,
"name"
:
"剧白白(道长)"
,
...
@@ -231,15 +222,6 @@
...
@@ -231,15 +222,6 @@
"quickSearch"
:
1
,
"quickSearch"
:
1
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_吸瓜"
,
"name"
:
"吸瓜(道长)"
,
"type"
:
1
,
"api"
:
"http://cms.nokia.press/vod?rule=吸瓜"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_喵喵"
,
"key"
:
"dr_喵喵"
,
"name"
:
"喵喵(道长)"
,
"name"
:
"喵喵(道长)"
,
...
@@ -321,15 +303,6 @@
...
@@ -321,15 +303,6 @@
"quickSearch"
:
1
,
"quickSearch"
:
1
,
"filterable"
:
0
"filterable"
:
0
},
},
{
"key"
:
"dr_玩偶姐姐"
,
"name"
:
"玩偶姐姐(道长)"
,
"type"
:
1
,
"api"
:
"http://cms.nokia.press/vod?rule=玩偶姐姐"
,
"searchable"
:
0
,
"quickSearch"
:
0
,
"filterable"
:
0
},
{
{
"key"
:
"dr_瓜皮TV"
,
"key"
:
"dr_瓜皮TV"
,
"name"
:
"瓜皮TV(道长)"
,
"name"
:
"瓜皮TV(道长)"
,
...
@@ -843,7 +816,7 @@
...
@@ -843,7 +816,7 @@
{
{
"name"
:
"直播"
,
"name"
:
"直播"
,
"urls"
:
[
"urls"
:
[
"proxy://do=live&type=txt&ext=aHR0c
DovL2Ntcy5ub2tpYS5wcmVzcy9saXZlcw==
"
"proxy://do=live&type=txt&ext=aHR0c
HM6Ly9naXRjb2RlLm5ldC9xcV8yNjg5ODIzMS9UVkJveC8tL3Jhdy9tYWluL2xpdmUvemIudHh0
"
]
]
}
}
]
]
...
...
utils/cfg.py
0 → 100644
浏览文件 @
ff5936ef
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : cfg.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/10
from
werkzeug.utils
import
import_string
from
base
import
config
from
easydict
import
EasyDict
as
edict
def
get_conf
(
obj
):
new_conf
=
{}
if
isinstance
(
obj
,
str
):
obj
=
import_string
(
obj
)
for
key
in
dir
(
obj
):
if
key
.
isupper
():
new_conf
[
key
]
=
getattr
(
obj
,
key
)
return
new_conf
cfg
=
edict
(
get_conf
(
config
))
\ No newline at end of file
utils/files.py
浏览文件 @
ff5936ef
...
@@ -16,7 +16,7 @@ def getPics(path='images'):
...
@@ -16,7 +16,7 @@ def getPics(path='images'):
file_name
=
os
.
listdir
(
img_path
)
file_name
=
os
.
listdir
(
img_path
)
# file_name = list(filter(lambda x: str(x).endswith('.js') and str(x).find('模板') < 0, file_name))
# file_name = list(filter(lambda x: str(x).endswith('.js') and str(x).find('模板') < 0, file_name))
# print(file_name)
# print(file_name)
pic_list
=
[
base_path
+
file
for
file
in
file_name
]
pic_list
=
[
img_path
+
'/'
+
file
for
file
in
file_name
]
# pic_list = file_name
# pic_list = file_name
# print(type(pic_list))
# print(type(pic_list))
return
pic_list
return
pic_list
...
@@ -25,7 +25,8 @@ def get_live_url(new_conf,mode):
...
@@ -25,7 +25,8 @@ def get_live_url(new_conf,mode):
host
=
getHost
(
mode
)
host
=
getHost
(
mode
)
lsg
=
storage_service
()
lsg
=
storage_service
()
# t1 = time()
# t1 = time()
live_url
=
host
+
'/lives'
if
new_conf
.
get
(
'LIVE_MODE'
,
1
)
==
0
else
lsg
.
getItem
(
'LIVE_URL'
,
getHost
(
2
)
+
'/lives'
)
# live_url = host + '/lives' if new_conf.get('LIVE_MODE',1) == 0 else lsg.getItem('LIVE_URL',getHost(2)+'/lives')
live_url
=
host
+
'/lives'
if
lsg
.
getItem
(
'LIVE_MODE'
,
1
)
==
0
else
lsg
.
getItem
(
'LIVE_URL'
,
getHost
(
2
)
+
'/lives'
)
live_url
=
base64Encode
(
live_url
)
live_url
=
base64Encode
(
live_url
)
# print(f'{get_interval(t1)}毫秒')
# print(f'{get_interval(t1)}毫秒')
return
live_url
return
live_url
...
...
utils/system.py
浏览文件 @
ff5936ef
...
@@ -4,23 +4,10 @@
...
@@ -4,23 +4,10 @@
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/6
# Date : 2022/9/6
from
werkzeug.utils
import
import_string
from
base
import
config
from
flask
import
request
from
flask
import
request
import
psutil
import
psutil
import
sys
import
sys
from
easydict
import
EasyDict
as
edict
from
utils.cfg
import
cfg
def
get_conf
(
obj
):
new_conf
=
{}
if
isinstance
(
obj
,
str
):
obj
=
import_string
(
obj
)
for
key
in
dir
(
obj
):
if
key
.
isupper
():
new_conf
[
key
]
=
getattr
(
obj
,
key
)
return
new_conf
cfg
=
edict
(
get_conf
(
config
))
def
get_wlan_info
():
def
get_wlan_info
():
info
=
psutil
.
net_if_addrs
()
info
=
psutil
.
net_if_addrs
()
...
@@ -51,7 +38,11 @@ def getHost(mode=0,port=None):
...
@@ -51,7 +38,11 @@ def getHost(mode=0,port=None):
ip
=
REAL_IP
ip
=
REAL_IP
host
=
f
'http://
{
ip
}
:
{
port
}
'
host
=
f
'http://
{
ip
}
:
{
port
}
'
else
:
else
:
host
=
cfg
.
get
(
'PLAY_URL'
,
'http://cms.nokia.press'
)
# host = cfg.get('PLAY_URL','http://cms.nokia.press')
from
controllers.service
import
storage_service
lsg
=
storage_service
()
host
=
lsg
.
getItem
(
'PLAY_URL'
,
cfg
.
get
(
'PLAY_URL'
,
''
))
# print(mode,host)
return
host
return
host
def
is_linux
():
def
is_linux
():
...
...
utils/web.py
浏览文件 @
ff5936ef
...
@@ -8,7 +8,8 @@ import os
...
@@ -8,7 +8,8 @@ import os
from
flask
import
request
from
flask
import
request
import
hashlib
import
hashlib
from
time
import
time
from
time
import
time
from
utils.system
import
cfg
from
utils.cfg
import
cfg
from
controllers.service
import
storage_service
MOBILE_UA
=
'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36'
MOBILE_UA
=
'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36'
PC_UA
=
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'
PC_UA
=
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'
...
@@ -53,8 +54,11 @@ def verfy_token(token=None):
...
@@ -53,8 +54,11 @@ def verfy_token(token=None):
token
=
cookies
.
get
(
'token'
,
''
)
token
=
cookies
.
get
(
'token'
,
''
)
if
not
token
or
len
(
str
(
token
))
!=
32
:
if
not
token
or
len
(
str
(
token
))
!=
32
:
return
False
return
False
username
=
cfg
.
get
(
'UNAME'
,
''
)
lsg
=
storage_service
()
pwd
=
cfg
.
get
(
'PWD'
,
''
)
# username = cfg.get('UNAME','')
username
=
lsg
.
getItem
(
'UNAME'
,
''
)
# pwd = cfg.get('PWD','')
pwd
=
lsg
.
getItem
(
'PWD'
,
''
)
ctoken
=
md5
(
f
'
{
username
}
;
{
pwd
}
'
)
ctoken
=
md5
(
f
'
{
username
}
;
{
pwd
}
'
)
# print(f'username:{username},pwd:{pwd},current_token:{ctoken},input_token:{ctoken}')
# print(f'username:{username},pwd:{pwd},current_token:{ctoken},input_token:{ctoken}')
if
token
!=
ctoken
:
if
token
!=
ctoken
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录