Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
molin.JC
dr_py
提交
d687e715
dr_py
项目概览
molin.JC
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
1
Star
1
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,发现更多精彩内容 >>
提交
d687e715
编写于
9月 11, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
移除了一些不需要的冗余代码
上级
471a227a
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
27 addition
and
12 deletion
+27
-12
base/rules.db
base/rules.db
+0
-0
controllers/admin.py
controllers/admin.py
+1
-3
controllers/cms.py
controllers/cms.py
+14
-1
controllers/home.py
controllers/home.py
+8
-5
controllers/vod.py
controllers/vod.py
+2
-1
logs/.gitkeep
logs/.gitkeep
+0
-0
models/rules.db
models/rules.db
+0
-0
utils/system.py
utils/system.py
+1
-1
utils/web.py
utils/web.py
+1
-1
未找到文件。
base/rules.db
浏览文件 @
d687e715
无法预览此类型文件
controllers/admin.py
浏览文件 @
d687e715
...
@@ -15,7 +15,6 @@ from utils.web import getParmas
...
@@ -15,7 +15,6 @@ from utils.web import getParmas
from
js.rules
import
getRules
from
js.rules
import
getRules
from
utils.parser
import
runJScode
from
utils.parser
import
runJScode
from
werkzeug.utils
import
secure_filename
from
werkzeug.utils
import
secure_filename
import
js2py
from
utils.web
import
md5
from
utils.web
import
md5
admin
=
Blueprint
(
"admin"
,
__name__
)
admin
=
Blueprint
(
"admin"
,
__name__
)
...
@@ -36,7 +35,7 @@ def admin_index(): # 管理员界面
...
@@ -36,7 +35,7 @@ def admin_index(): # 管理员界面
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
)
return
render_template
(
'admin.html'
,
pystate
=
use_py
,
rules
=
getRules
(
'js'
),
ver
=
getLocalVer
(),
live_url
=
live_url
)
@
admin
.
route
(
'/settings'
)
@
admin
.
route
(
'/settings'
)
...
@@ -178,7 +177,6 @@ def upload_file():
...
@@ -178,7 +177,6 @@ def upload_file():
check_to_run
=
before
+
upcode
check_to_run
=
before
+
upcode
# print(check_to_run)
# print(check_to_run)
try
:
try
:
# js2py.eval_js(check_to_run)
loader
,
_
=
runJScode
(
check_to_run
)
loader
,
_
=
runJScode
(
check_to_run
)
rule
=
loader
.
eval
(
'rule'
)
rule
=
loader
.
eval
(
'rule'
)
if
not
rule
:
if
not
rule
:
...
...
controllers/cms.py
浏览文件 @
d687e715
...
@@ -23,11 +23,24 @@ from flask import url_for,redirect
...
@@ -23,11 +23,24 @@ from flask import url_for,redirect
from
easydict
import
EasyDict
as
edict
from
easydict
import
EasyDict
as
edict
from
controllers.service
import
storage_service
from
controllers.service
import
storage_service
def
setItem
(
key
,
value
):
lsg
=
storage_service
()
return
lsg
.
setItem
(
key
,
value
)
def
getItem
(
key
,
value
=
''
):
lsg
=
storage_service
()
return
lsg
.
getItem
(
key
,
value
)
def
clearItem
(
key
):
lsg
=
storage_service
()
return
lsg
.
clearItem
(
key
)
py_ctx
=
{
py_ctx
=
{
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
'log'
:
logger
.
info
,
'fetch'
:
fetch
,
'post'
:
post
,
'request'
:
request
,
'getCryptoJS'
:
getCryptoJS
,
'log'
:
logger
.
info
,
'fetch'
:
fetch
,
'post'
:
post
,
'request'
:
request
,
'getCryptoJS'
:
getCryptoJS
,
'buildUrl'
:
buildUrl
,
'getHome'
:
getHome
,
'setDetail'
:
setDetail
,
'join'
:
join
,
'urljoin2'
:
urljoin2
,
'buildUrl'
:
buildUrl
,
'getHome'
:
getHome
,
'setDetail'
:
setDetail
,
'join'
:
join
,
'urljoin2'
:
urljoin2
,
'PC_UA'
:
PC_UA
,
'MOBILE_UA'
:
MOBILE_UA
,
'UC_UA'
:
UC_UA
,
'IOS_UA'
:
IOS_UA
'PC_UA'
:
PC_UA
,
'MOBILE_UA'
:
MOBILE_UA
,
'UC_UA'
:
UC_UA
,
'IOS_UA'
:
IOS_UA
,
'setItem'
:
setItem
,
'getItem'
:
getItem
,
'clearItem'
:
clearItem
}
}
# print(getCryptoJS())
# print(getCryptoJS())
...
...
controllers/home.py
浏览文件 @
d687e715
...
@@ -38,7 +38,7 @@ def favicon():
...
@@ -38,7 +38,7 @@ def favicon():
@
home
.
route
(
'/index'
)
@
home
.
route
(
'/index'
)
def
index
():
def
index
():
sup_port
=
cfg
.
get
(
'SUP_PORT'
,
False
)
sup_port
=
cfg
.
get
(
'SUP_PORT'
,
9001
)
manager0
=
':'
.
join
(
getHost
(
0
).
split
(
':'
)[
0
:
2
])
manager0
=
':'
.
join
(
getHost
(
0
).
split
(
':'
)[
0
:
2
])
manager1
=
':'
.
join
(
getHost
(
1
).
split
(
':'
)[
0
:
2
])
manager1
=
':'
.
join
(
getHost
(
1
).
split
(
':'
)[
0
:
2
])
manager2
=
':'
.
join
(
getHost
(
2
).
split
(
':'
)[
0
:
2
]).
replace
(
'https'
,
'http'
)
manager2
=
':'
.
join
(
getHost
(
2
).
split
(
':'
)[
0
:
2
]).
replace
(
'https'
,
'http'
)
...
@@ -63,7 +63,11 @@ def random_pics():
...
@@ -63,7 +63,11 @@ def random_pics():
# print(f'id:{id}')
# print(f'id:{id}')
pics
=
getPics
()
pics
=
getPics
()
# print(pics)
# print(pics)
if
not
cfg
.
WALL_PAPER
and
len
(
pics
)
>
0
:
new_conf
=
cfg
lsg
=
storage_service
()
store_conf_dict
=
lsg
.
getStoreConfDict
()
new_conf
.
update
(
store_conf_dict
)
if
not
new_conf
.
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
:
...
@@ -73,7 +77,7 @@ def random_pics():
...
@@ -73,7 +77,7 @@ def random_pics():
response
.
headers
[
'Content-Type'
]
=
'image/jpeg'
response
.
headers
[
'Content-Type'
]
=
'image/jpeg'
return
response
return
response
else
:
else
:
return
redirect
(
cfg
.
WALL_PAPER
)
return
redirect
(
new_conf
.
WALL_PAPER
)
@
home
.
route
(
'/clear'
)
@
home
.
route
(
'/clear'
)
def
clear_rule
():
def
clear_rule
():
...
@@ -176,6 +180,7 @@ def config_render(mode):
...
@@ -176,6 +180,7 @@ def config_render(mode):
lsg
=
storage_service
()
lsg
=
storage_service
()
store_conf_dict
=
lsg
.
getStoreConfDict
()
store_conf_dict
=
lsg
.
getStoreConfDict
()
new_conf
.
update
(
store_conf_dict
)
new_conf
.
update
(
store_conf_dict
)
# print(type(new_conf),new_conf)
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
:
...
@@ -186,7 +191,6 @@ def config_render(mode):
...
@@ -186,7 +191,6 @@ def config_render(mode):
jxs
=
getJxs
()
jxs
=
getJxs
()
lsg
=
storage_service
()
lsg
=
storage_service
()
use_py
=
lsg
.
getItem
(
'USE_PY'
)
use_py
=
lsg
.
getItem
(
'USE_PY'
)
# pys = getPys() if cfg.get('USE_PY') else []
pys
=
getPys
()
if
use_py
else
[]
pys
=
getPys
()
if
use_py
else
[]
# print(pys)
# print(pys)
alists
=
getAlist
()
alists
=
getAlist
()
...
@@ -211,7 +215,6 @@ def config_gen():
...
@@ -211,7 +215,6 @@ def config_gen():
store_conf_dict
=
lsg
.
getStoreConfDict
()
store_conf_dict
=
lsg
.
getStoreConfDict
()
new_conf
.
update
(
store_conf_dict
)
new_conf
.
update
(
store_conf_dict
)
jxs
=
getJxs
()
jxs
=
getJxs
()
# pys = getPys() if cfg.get('USE_PY') else []
lsg
=
storage_service
()
lsg
=
storage_service
()
use_py
=
lsg
.
getItem
(
'USE_PY'
)
use_py
=
lsg
.
getItem
(
'USE_PY'
)
pys
=
getPys
()
if
use_py
else
False
pys
=
getPys
()
if
use_py
else
False
...
...
controllers/vod.py
浏览文件 @
d687e715
...
@@ -6,7 +6,8 @@
...
@@ -6,7 +6,8 @@
from
flask
import
Blueprint
,
request
,
render_template
,
jsonify
,
make_response
,
redirect
from
flask
import
Blueprint
,
request
,
render_template
,
jsonify
,
make_response
,
redirect
from
time
import
time
from
time
import
time
from
utils.web
import
getParmas
,
get_interval
,
cfg
from
utils.web
import
getParmas
,
get_interval
from
utils.cfg
import
cfg
from
js.rules
import
getRuleLists
,
getJxs
from
js.rules
import
getRuleLists
,
getJxs
from
base.R
import
R
from
base.R
import
R
from
utils.log
import
logger
from
utils.log
import
logger
...
...
logs/.gitkeep
已删除
100644 → 0
浏览文件 @
471a227a
models/rules.db
已删除
100644 → 0
浏览文件 @
471a227a
文件已删除
utils/system.py
浏览文件 @
d687e715
...
@@ -38,9 +38,9 @@ def getHost(mode=0,port=None):
...
@@ -38,9 +38,9 @@ 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')
from
controllers.service
import
storage_service
from
controllers.service
import
storage_service
lsg
=
storage_service
()
lsg
=
storage_service
()
# print(cfg.PLAY_URL) # 可能会报错: 'EasyDict' object has no attribute 'xxx'
host
=
lsg
.
getItem
(
'PLAY_URL'
,
cfg
.
get
(
'PLAY_URL'
,
''
))
host
=
lsg
.
getItem
(
'PLAY_URL'
,
cfg
.
get
(
'PLAY_URL'
,
''
))
# print(mode,host)
# print(mode,host)
return
host
return
host
...
...
utils/web.py
浏览文件 @
d687e715
...
@@ -8,7 +8,7 @@ import os
...
@@ -8,7 +8,7 @@ import os
from
flask
import
request
from
flask
import
request
import
hashlib
import
hashlib
from
time
import
time
from
time
import
time
from
utils.cfg
import
cfg
#
from utils.cfg import cfg
from
controllers.service
import
storage_service
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'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录