Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
言程序plus
dr_py
提交
119d77b2
dr_py
项目概览
言程序plus
/
dr_py
与 Fork 源项目一致
从无法访问的项目Fork
通知
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,发现更多精彩内容 >>
提交
119d77b2
编写于
9月 16, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加多源模式正常生成配置
上级
32dea9be
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
8 deletion
+14
-8
base/rules.db
base/rules.db
+0
-0
controllers/home.py
controllers/home.py
+3
-7
utils/files.py
utils/files.py
+11
-1
未找到文件。
base/rules.db
浏览文件 @
119d77b2
无法预览此类型文件
controllers/home.py
浏览文件 @
119d77b2
...
@@ -17,7 +17,7 @@ from utils.system import getHost,is_linux
...
@@ -17,7 +17,7 @@ from utils.system import getHost,is_linux
from
utils.cfg
import
cfg
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
,
get_multi_rules
from
utils.update
import
getLocalVer
,
getHotSuggest
from
utils.update
import
getLocalVer
,
getHotSuggest
from
utils.encode
import
parseText
from
utils.encode
import
parseText
from
utils.files
import
getCustonDict
from
utils.files
import
getCustonDict
...
@@ -198,12 +198,7 @@ def config_render(mode):
...
@@ -198,12 +198,7 @@ def config_render(mode):
alists_str
=
json
.
dumps
(
alists
,
ensure_ascii
=
False
)
alists_str
=
json
.
dumps
(
alists
,
ensure_ascii
=
False
)
live_url
=
get_live_url
(
new_conf
,
mode
)
live_url
=
get_live_url
(
new_conf
,
mode
)
rules
=
getRules
(
'js'
)
rules
=
getRules
(
'js'
)
multi_mode
=
lsg
.
getItem
(
'MULTI_MODE'
)
rules
=
get_multi_rules
(
rules
)
fix_multi
=
[
'drpy'
]
if
not
multi_mode
:
rules
[
'list'
]
=
list
(
filter
(
lambda
x
:
x
[
'name'
]
in
fix_multi
or
x
.
get
(
'multi'
),
rules
[
'list'
]))
rules
[
'count'
]
=
len
(
rules
[
'list'
])
print
(
rules
)
# html = render_template('config.txt',rules=getRules('js'),host=host,mode=mode,jxs=jxs,base64Encode=base64Encode,config=new_conf)
# html = render_template('config.txt',rules=getRules('js'),host=host,mode=mode,jxs=jxs,base64Encode=base64Encode,config=new_conf)
html
=
render_template
(
'config.txt'
,
pys
=
pys
,
rules
=
rules
,
host
=
host
,
mode
=
mode
,
jxs
=
jxs
,
alists
=
alists
,
alists_str
=
alists_str
,
live_url
=
live_url
,
config
=
new_conf
)
html
=
render_template
(
'config.txt'
,
pys
=
pys
,
rules
=
rules
,
host
=
host
,
mode
=
mode
,
jxs
=
jxs
,
alists
=
alists
,
alists_str
=
alists_str
,
live_url
=
live_url
,
config
=
new_conf
)
merged_config
=
custom_merge
(
parseText
(
html
),
customConfig
)
merged_config
=
custom_merge
(
parseText
(
html
),
customConfig
)
...
@@ -230,6 +225,7 @@ def config_gen():
...
@@ -230,6 +225,7 @@ def config_gen():
alists
=
getAlist
()
alists
=
getAlist
()
alists_str
=
json
.
dumps
(
alists
,
ensure_ascii
=
False
)
alists_str
=
json
.
dumps
(
alists
,
ensure_ascii
=
False
)
rules
=
getRules
(
'js'
)
rules
=
getRules
(
'js'
)
rules
=
get_multi_rules
(
rules
)
set_local
=
render_template
(
'config.txt'
,
pys
=
pys
,
rules
=
rules
,
alists
=
alists
,
alists_str
=
alists_str
,
live_url
=
get_live_url
(
new_conf
,
0
),
mode
=
0
,
host
=
getHost
(
0
),
jxs
=
jxs
)
set_local
=
render_template
(
'config.txt'
,
pys
=
pys
,
rules
=
rules
,
alists
=
alists
,
alists_str
=
alists_str
,
live_url
=
get_live_url
(
new_conf
,
0
),
mode
=
0
,
host
=
getHost
(
0
),
jxs
=
jxs
)
# print(set_local)
# 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_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
)
...
...
utils/files.py
浏览文件 @
119d77b2
...
@@ -103,4 +103,14 @@ def getCustonDict(host):
...
@@ -103,4 +103,14 @@ def getCustonDict(host):
customConfig
=
parseText
(
render_template_string
(
text
,
host
=
host
))
customConfig
=
parseText
(
render_template_string
(
text
,
host
=
host
))
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
info
(
f
'用户自定义配置加载失败:
{
e
}
'
)
logger
.
info
(
f
'用户自定义配置加载失败:
{
e
}
'
)
return
customConfig
return
customConfig
\ No newline at end of file
def
get_multi_rules
(
rules
):
lsg
=
storage_service
()
multi_mode
=
lsg
.
getItem
(
'MULTI_MODE'
)
fix_multi
=
[
'drpy'
]
if
not
multi_mode
:
rules
[
'list'
]
=
list
(
filter
(
lambda
x
:
x
[
'name'
]
in
fix_multi
or
x
.
get
(
'multi'
),
rules
[
'list'
]))
rules
[
'count'
]
=
len
(
rules
[
'list'
])
# print(rules)
return
rules
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录