Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tianxiawei
dr_py
提交
e262ce6b
dr_py
项目概览
tianxiawei
/
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,发现更多精彩内容 >>
提交
e262ce6b
编写于
8月 31, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增登录功能
上级
d483fec1
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
259 addition
and
28 deletion
+259
-28
app.py
app.py
+39
-1
classes/cms.py
classes/cms.py
+2
-2
config.py
config.py
+2
-0
readme.md
readme.md
+2
-0
static/css/index.css
static/css/index.css
+24
-0
static/css/login.css
static/css/login.css
+154
-0
templates/admin.html
templates/admin.html
+11
-0
templates/index.html
templates/index.html
+7
-23
utils/config.py
utils/config.py
+1
-1
utils/web.py
utils/web.py
+17
-1
未找到文件。
app.py
浏览文件 @
e262ce6b
...
...
@@ -54,9 +54,17 @@ def getParmas(key=None,value=''):
:param key:
:return:
"""
content_type
=
request
.
headers
.
get
(
'Content-Type'
)
args
=
{}
if
request
.
method
==
'POST'
:
args
=
request
.
json
if
'application/x-www-form-urlencoded'
in
content_type
or
'multipart/form-data'
in
content_type
:
args
=
request
.
form
elif
'application/json'
in
content_type
:
args
=
request
.
json
elif
'text/plain'
in
content_type
:
args
=
request
.
data
else
:
args
=
request
.
args
elif
request
.
method
==
'GET'
:
args
=
request
.
args
if
key
:
...
...
@@ -79,6 +87,36 @@ def index(): # put application's code here
# print(manager2)
return
render_template
(
'index.html'
,
getHost
=
getHost
,
manager0
=
manager0
,
manager1
=
manager1
,
manager2
=
manager2
,
is_linux
=
is_linux
())
@
app
.
route
(
'/admin'
)
def
admin_home
():
# 管理员界面
# headers = request.headers
# print(headers)
cookies
=
request
.
cookies
# print(cookies)
token
=
cookies
.
get
(
'token'
,
''
)
# print(f'mytoken:{token}')
if
not
verfy_token
(
token
):
return
render_template
(
'login.html'
)
# return jsonify(error.success('登录成功'))
return
render_template
(
'admin.html'
)
@
app
.
route
(
'/api/login'
,
methods
=
[
'GET'
,
'POST'
])
def
login_api
():
username
=
getParmas
(
'username'
)
password
=
getParmas
(
'password'
)
autologin
=
getParmas
(
'autologin'
)
if
not
all
([
username
,
password
]):
return
jsonify
(
error
.
failed
(
'账号密码字段必填'
))
token
=
md5
(
f
'
{
username
}
;
{
password
}
'
)
check
=
verfy_token
(
token
)
if
check
:
# response = make_response(redirect('/admin'))
response
=
make_response
(
jsonify
(
error
.
success
(
'登录成功'
)))
response
.
set_cookie
(
'token'
,
token
)
return
response
else
:
return
jsonify
(
error
.
failed
(
'登录失败,用户名或密码错误'
))
@
app
.
route
(
'/vod'
)
def
vod
():
t0
=
time
()
...
...
classes/cms.py
浏览文件 @
e262ce6b
...
...
@@ -9,7 +9,7 @@ import re
import
math
from
utils.web
import
*
from
models
import
*
from
utils.config
import
c
onfig
from
utils.config
import
playerC
onfig
from
utils.log
import
logger
from
utils.encode
import
base64Encode
,
baseDecode
,
fetch
,
post
,
request
,
getCryptoJS
,
getPreJs
,
buildUrl
,
getHome
from
utils.encode
import
verifyCode
...
...
@@ -382,7 +382,7 @@ class CMS:
result
[
'class'
]
=
classes
if
self
.
filter
:
result
[
'filters'
]
=
c
onfig
[
'filter'
]
result
[
'filters'
]
=
playerC
onfig
[
'filter'
]
result
.
update
(
video_result
)
logger
.
info
(
f
'
{
self
.
getName
()
}
获取首页总耗时(包含读取缓存):
{
get_interval
(
t1
)
}
毫秒'
)
return
result
...
...
config.py
浏览文件 @
e262ce6b
...
...
@@ -27,4 +27,6 @@ SUP_PORT = 9001 # supervisord 服务端口
RETRY_CNT
=
3
# 验证码重试次数
# OCR_API = 'http://192.168.3.224:9000/api/ocr_img' # 验证码识别接口,传参数data
OCR_API
=
'http://dm.mudery.com:10000'
# 验证码识别接口,传参数data
UNAME
=
'admin'
# 管理员账号
PWD
=
'drpy'
# 管理员密码
# {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %}
\ No newline at end of file
readme.md
浏览文件 @
e262ce6b
...
...
@@ -2,6 +2,8 @@
##### python3.6-3.8完美运行(3.9以上不支持linux进程启动)
###### 更新日志
###### 2022/08/30
-
[X] 1.增加管理员登录功能(用户上传和删除规则)
###### 2022/08/30
-
[X] 1.增加动态局域网ip获取
-
[X] 2.增加js规则热加载(增删改不用重启)
-
[X] 3.增加视界的加密库
...
...
static/css/index.css
0 → 100644
浏览文件 @
e262ce6b
.btn
{
margin-bottom
:
1rem
;
border
:
1px
solid
#615e5e
;
width
:
240px
;
height
:
30px
;
text-align
:
center
;
background-color
:
#1379cb
;
color
:
#ffffff
;
border-radius
:
20px
;
line-height
:
30px
;
}
.btn
a
{
color
:
#ffffff
;
}
a
{
text-decoration
:
none
;
text-align
:
center
;
line-height
:
30px
;
}
.jyw
{
margin-bottom
:
5rem
;
}
\ No newline at end of file
static/css/login.css
0 → 100644
浏览文件 @
e262ce6b
/* =============================================================================
HTML5 CSS Reset Minified - Eric Meyer
========================================================================== */
html
,
body
,
div
,
span
,
object
,
iframe
,
h1
,
h2
,
h3
,
h4
,
h5
,
h6
,
p
,
blockquote
,
pre
,
abbr
,
address
,
cite
,
code
,
del
,
dfn
,
em
,
img
,
ins
,
kbd
,
q
,
samp
,
small
,
strong
,
sub
,
sup
,
var
,
b
,
i
,
dl
,
dt
,
dd
,
ol
,
ul
,
li
,
fieldset
,
form
,
label
,
legend
,
table
,
caption
,
tbody
,
tfoot
,
thead
,
tr
,
th
,
td
,
article
,
aside
,
canvas
,
details
,
figcaption
,
figure
,
footer
,
header
,
hgroup
,
menu
,
nav
,
section
,
summary
,
time
,
mark
,
audio
,
video
{
margin
:
0
;
padding
:
0
;
border
:
0
;
outline
:
0
;
font-size
:
100%
;
vertical-align
:
baseline
;
background
:
transparent
}
body
{
line-height
:
1
}
article
,
aside
,
details
,
figcaption
,
figure
,
footer
,
header
,
hgroup
,
menu
,
nav
,
section
{
display
:
block
}
nav
ul
{
list-style
:
none
}
blockquote
,
q
{
quotes
:
none
}
blockquote
:before
,
blockquote
:after
,
q
:before
,
q
:after
{
content
:
none
}
a
{
margin
:
0
;
padding
:
0
;
font-size
:
100%
;
vertical-align
:
baseline
;
background
:
transparent
;
text-decoration
:
none
}
mark
{
background-color
:
#ff9
;
color
:
#000
;
font-style
:
italic
;
font-weight
:
bold
}
del
{
text-decoration
:
line-through
}
abbr
[
title
],
dfn
[
title
]
{
border-bottom
:
1px
dotted
;
cursor
:
help
}
table
{
border-collapse
:
collapse
;
border-spacing
:
0
}
hr
{
display
:
block
;
height
:
1px
;
border
:
0
;
border-top
:
1px
solid
#ccc
;
margin
:
1em
0
;
padding
:
0
}
input
,
select
{
vertical-align
:
middle
}
li
{
list-style
:
none
}
/* =============================================================================
My CSS
========================================================================== */
/* ---- base ---- */
html
,
body
{
width
:
100%
;
height
:
100%
;
background
:
#111
;
}
html
{
-webkit-tap-highlight-color
:
rgba
(
0
,
0
,
0
,
0
);
}
body
{
font
:
normal
75%
Arial
,
Helvetica
,
sans-serif
;
}
canvas
{
display
:
block
;
vertical-align
:
bottom
;
}
/* ---- stats.js ---- */
.count-particles
{
background
:
#000022
;
position
:
absolute
;
top
:
48px
;
left
:
0
;
width
:
80px
;
color
:
#13E8E9
;
font-size
:
.8em
;
text-align
:
left
;
text-indent
:
4px
;
line-height
:
14px
;
padding-bottom
:
2px
;
font-family
:
Helvetica
,
Arial
,
sans-serif
;
font-weight
:
bold
;
}
.js-count-particles
{
font-size
:
1.1em
;
}
#stats
,
.count-particles
{
-webkit-user-select
:
none
;
margin-top
:
5px
;
margin-left
:
5px
;
}
#stats
{
border-radius
:
3px
3px
0
0
;
overflow
:
hidden
;
}
.count-particles
{
border-radius
:
0
0
3px
3px
;
}
/* ---- particles.js container ---- */
#particles-js
{
width
:
100%
;
height
:
100%
;
background-image
:
url('../img/login_background.png')
;
background-size
:
cover
;
background-position
:
50%
50%
;
background-repeat
:
no-repeat
;
width
:
100%
;
height
:
100%
;
position
:
absolute
;
top
:
0
;
left
:
0
;
}
.login-content
{
width
:
400px
;
height
:
280px
;
margin
:
0
auto
;
position
:
relative
;
top
:
300px
;
border
:
1px
solid
#2890fa
;
background
:
rgba
(
40
,
144
,
250
,
0.2
);
border-radius
:
5px
;
}
.login-tit
{
background
:
rgba
(
0
,
0
,
0
,
0.8
);
border
:
1px
solid
#2890fa
;
color
:
#fff
;
padding
:
15px
20px
;
font-size
:
18px
}
.login-input
{
width
:
90%
;
margin
:
30px
auto
0
auto
;
}
.login-input
input
{
background
:
rgba
(
0
,
0
,
0
,
0
);
border
:
0
;
height
:
30px
;
width
:
100%
;
line-height
:
30px
;
color
:
#fff
;
border-bottom
:
1px
solid
rgba
(
40
,
144
,
250
,
0.4
);
}
.login-input
input
:focus
{
outline
:
none
;
}
.login-btn
{
width
:
90%
;
display
:
flex
;
color
:
#ffffff
;
margin
:
40px
auto
0
auto
;
}
.login-btn-left
span
{
background
:
#2890fa
;
padding
:
10px
30px
;
border-radius
:
5px
;
cursor
:
pointer
;
}
.login-btn-right
{
display
:
flex
;
align-items
:
center
;
margin-left
:
20px
}
.login-btn-right
img
{
margin-right
:
10px
}
\ No newline at end of file
templates/admin.html
0 → 100644
浏览文件 @
e262ce6b
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
管理员界面
</title>
</head>
<body>
<h1>
欢迎使用py_dr管理员界面
</h1>
<p>
你可以在此页面在线上传规则文件到js目录或者删除js目录的文件
</p>
</body>
</html>
\ No newline at end of file
templates/index.html
浏览文件 @
e262ce6b
...
...
@@ -9,31 +9,11 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
>
<title>
dr_py首页
</title>
<script
src=
"/static/js/jquery.min.js"
></script>
<link
rel=
"stylesheet"
media=
"screen"
href=
"/static/css/index.css"
/>
</head>
<style>
.btn
{
margin-bottom
:
2rem
;
border
:
1px
solid
#615e5e
;
width
:
240px
;
height
:
30px
;
text-align
:
center
;
background-color
:
#1379cb
;
color
:
#ffffff
;
border-radius
:
20px
;
line-height
:
30px
;
}
.btn
a
{
color
:
#ffffff
;
}
a
{
text-decoration
:
none
;
text-align
:
center
;
line-height
:
30px
;
}
.jyw
{
margin-bottom
:
5rem
;
.title
{
font-size
:
18px
;
}
</style>
<body
style=
"background: #FFFFFF url(https://cdn.seovx.com/d/?mom=302) no-repeat fixed center;max-hright;"
>
...
...
@@ -59,6 +39,10 @@ a {
<div
class=
"btn"
>
<a
href=
"/vod?rule="
>
猫CMS接口
</a>
</div>
<div
class=
"btn"
>
<!-- <a href="/admin" target="_blank">CMS后台管理</a>-->
<a
href=
"/admin"
>
CMS后台管理
</a>
</div>
<div
class=
"btn"
>
<a
href=
"/rules"
>
缓存文件列表-清除
</a>
</div>
...
...
utils/config.py
浏览文件 @
e262ce6b
此差异已折叠。
点击以展开。
utils/web.py
浏览文件 @
e262ce6b
...
...
@@ -5,6 +5,7 @@
# Date : 2022/8/25
import
socket
import
hashlib
from
werkzeug.utils
import
import_string
from
netifaces
import
interfaces
,
ifaddresses
,
AF_INET
from
flask
import
request
...
...
@@ -70,4 +71,19 @@ def get_conf(obj):
def
get_interval
(
t
):
interval
=
time
()
-
t
interval
=
round
(
interval
*
1000
,
2
)
return
interval
\ No newline at end of file
return
interval
def
md5
(
str
):
return
hashlib
.
md5
(
str
.
encode
(
encoding
=
'UTF-8'
)).
hexdigest
()
def
verfy_token
(
token
=
''
):
if
not
token
or
len
(
str
(
token
))
!=
32
:
return
False
cfg
=
get_conf
(
settings
)
username
=
cfg
.
get
(
'UNAME'
,
''
)
pwd
=
cfg
.
get
(
'PWD'
,
''
)
ctoken
=
md5
(
f
'
{
username
}
;
{
pwd
}
'
)
# print(f'username:{username},pwd:{pwd},current_token:{ctoken},input_token:{ctoken}')
if
token
!=
ctoken
:
return
False
return
True
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录