Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxaah
dr_py
提交
05d3c65e
dr_py
项目概览
sxaah
/
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,发现更多精彩内容 >>
提交
05d3c65e
编写于
9月 22, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复bug
上级
d0dc7085
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
21 addition
and
10 deletion
+21
-10
app.py
app.py
+3
-3
base/rules.db
base/rules.db
+0
-0
controllers/admin.py
controllers/admin.py
+10
-2
controllers/home.py
controllers/home.py
+4
-3
js/version.txt
js/version.txt
+1
-1
readme.md
readme.md
+2
-0
templates/settings.html
templates/settings.html
+1
-1
未找到文件。
app.py
浏览文件 @
05d3c65e
...
...
@@ -31,12 +31,12 @@ def create_flask_app():
wlan_info
,
_
=
get_wlan_info
()
logger
.
info
(
rule_list
)
logger
.
info
(
f
'局域网:
{
getHost
(
1
,
app
.
config
.
get
(
"HTTP_PORT"
))
}
/index
\n
本地:
{
getHost
(
0
,
app
.
config
.
get
(
"HTTP_PORT"
))
}
/index
\n
wlan_info:
{
wlan_info
}
'
)
db
.
init_app
(
app
)
db
.
app
=
app
db
.
create_all
(
app
=
app
)
return
app
app
=
create_flask_app
()
db
.
init_app
(
app
)
db
.
app
=
app
db
.
create_all
(
app
=
app
)
migrate
=
Migrate
(
app
,
db
)
now_python_ver
=
"."
.
join
([
str
(
i
)
for
i
in
sys
.
version_info
[:
3
]])
...
...
base/rules.db
浏览文件 @
05d3c65e
无法预览此类型文件
controllers/admin.py
浏览文件 @
05d3c65e
...
...
@@ -8,6 +8,9 @@ import os
from
flask
import
Blueprint
,
request
,
render_template
,
jsonify
,
make_response
from
controllers.service
import
storage_service
,
rules_service
from
base.R
import
R
from
base.database
import
db
from
utils.log
import
logger
import
shutil
from
utils.update
import
getLocalVer
,
getOnlineVer
,
download_new_version
,
download_lives
,
copy_to_update
from
utils
import
parser
from
utils.web
import
getParmas
,
verfy_token
...
...
@@ -97,12 +100,17 @@ def admin_update_db():
if
not
verfy_token
():
# return render_template('login.html')
return
R
.
error
(
'请登录后再试'
)
old_dbfile
=
'migrations'
if
os
.
path
.
exists
(
old_dbfile
):
logger
.
info
(
f
'开始删除历史数据库迁移文件:
{
old_dbfile
}
'
)
shutil
.
rmtree
(
old_dbfile
)
db
.
session
.
execute
(
'drop table if exists alembic_version'
)
cmd
=
'flask db migrate && flask db upgrade'
if
not
os
.
path
.
exists
(
'migrations'
):
cmd
=
'flask db init && '
+
cmd
print
(
f
'开始执行cmd:
{
cmd
}
'
)
logger
.
info
(
f
'开始执行cmd:
{
cmd
}
'
)
result
=
os
.
system
(
cmd
)
print
(
f
'cmd执行结果:
{
result
}
'
)
logger
.
info
(
f
'cmd执行结果:
{
result
}
'
)
return
R
.
success
(
'数据库升级完毕'
)
@
admin
.
route
(
'/update_ver'
)
...
...
controllers/home.py
浏览文件 @
05d3c65e
...
...
@@ -254,21 +254,22 @@ def config_gen():
# print(set_local)
set_area
=
render_template
(
'config.txt'
,
pys
=
pys
,
rules
=
rules
,
alists
=
alists
,
alists_str
=
alists_str
,
live_url
=
get_live_url
(
new_conf
,
1
),
mode
=
1
,
host
=
getHost
(
1
),
jxs
=
jxs
)
set_online
=
render_template
(
'config.txt'
,
pys
=
pys
,
rules
=
rules
,
alists
=
alists
,
alists_str
=
alists_str
,
live_url
=
get_live_url
(
new_conf
,
2
),
mode
=
1
,
host
=
getHost
(
2
),
jxs
=
jxs
)
ali_token
=
new_conf
.
ALI_TOKEN
with
open
(
'txt/pycms0.json'
,
'w+'
,
encoding
=
'utf-8'
)
as
f
:
customConfig
=
getCustonDict
(
getHost
(
0
))
customConfig
=
getCustonDict
(
getHost
(
0
)
,
ali_token
)
set_dict
=
custom_merge
(
parseText
(
set_local
),
customConfig
)
merged_hide
(
set_dict
)
# set_dict = json.loads(set_local)
f
.
write
(
json
.
dumps
(
set_dict
,
ensure_ascii
=
False
,
indent
=
4
))
with
open
(
'txt/pycms1.json'
,
'w+'
,
encoding
=
'utf-8'
)
as
f
:
customConfig
=
getCustonDict
(
getHost
(
1
))
customConfig
=
getCustonDict
(
getHost
(
1
)
,
ali_token
)
set_dict
=
custom_merge
(
parseText
(
set_area
),
customConfig
)
merged_hide
(
set_dict
)
# set_dict = json.loads(set_area)
f
.
write
(
json
.
dumps
(
set_dict
,
ensure_ascii
=
False
,
indent
=
4
))
with
open
(
'txt/pycms2.json'
,
'w+'
,
encoding
=
'utf-8'
)
as
f
:
customConfig
=
getCustonDict
(
getHost
(
2
))
customConfig
=
getCustonDict
(
getHost
(
2
)
,
ali_token
)
set_dict
=
custom_merge
(
parseText
(
set_online
),
customConfig
)
merged_hide
(
set_dict
)
# set_dict = json.loads(set_online)
...
...
js/version.txt
浏览文件 @
05d3c65e
3.7.2
\ No newline at end of file
3.7.3
\ No newline at end of file
readme.md
浏览文件 @
05d3c65e
...
...
@@ -46,6 +46,8 @@
[
dockerfile教程
](
https://blog.csdn.net/qq_46158060/article/details/125718218
)
[
获取本地设备信息
](
https://blog.csdn.net/cui_yonghua/article/details/125508991
)
[
获取本地设备信息
](
https://m.jb51.net/article/140716.htm
)
###### 2022/09/22
-
[X] 1.v3.7.3修复静态文件阿里token没渲染的bug,修复数据库升级bug,优化app.py
###### 2022/09/21
-
[X] 1.未来功能增加显示和隐藏多选规则的实际逻辑,增加顺序字段等待有缘人
-
[X] 2.版本升级至3.7.0
...
...
templates/settings.html
浏览文件 @
05d3c65e
...
...
@@ -47,7 +47,7 @@
console
.
log
(
this
);
});
$
(
'
#update_db
'
).
click
(
function
(){
if
(
confirm
(
'
确定要升级数据库?判断标准为是否正常打开缓存文件列表-查看界面,如果正常就不需要进行此操作。升级数据库后将正常使用未来功能多选操作,可对规则进行多选显示或者隐藏
'
)){
if
(
confirm
(
'
确定要升级数据库?
升级过程可能较长,需要耐心等待提示完成。
判断标准为是否正常打开缓存文件列表-查看界面,如果正常就不需要进行此操作。升级数据库后将正常使用未来功能多选操作,可对规则进行多选显示或者隐藏
'
)){
$
.
get
(
"
/admin/update_db
"
,
function
(
data
,
status
){
console
.
log
(
data
);
if
(
data
.
code
===
200
){
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录