提交 6486f4b4 编写于 作者: H hjdhnx

增加随机图片

上级 54a77836
...@@ -111,7 +111,8 @@ def vod(): ...@@ -111,7 +111,8 @@ def vod():
play_url = getParmas('play_url') play_url = getParmas('play_url')
if play_url: # 播放 if play_url: # 播放
play_url = cms.playContent(play_url) jxs = getJxs()
play_url = cms.playContent(play_url,jxs)
return redirect(play_url) return redirect(play_url)
if ac and t: # 一级 if ac and t: # 一级
...@@ -230,9 +231,14 @@ def rules_raw(): ...@@ -230,9 +231,14 @@ def rules_raw():
@app.route('/pics') @app.route('/pics')
def random_pics(): def random_pics():
id = getParmas('id')
# print(f'id:{id}')
pics = getPics() pics = getPics()
if len(pics) > 0: if len(pics) > 0:
pic = random.choice(pics) if id and f'images/{id}.jpg' in pics:
pic = f'images/{id}.jpg'
else:
pic = random.choice(pics)
file = open(pic, "rb").read() file = open(pic, "rb").read()
response = make_response(file) response = make_response(file)
response.headers['Content-Type'] = 'image/jpeg' response.headers['Content-Type'] = 'image/jpeg'
......
...@@ -619,7 +619,9 @@ class CMS: ...@@ -619,7 +619,9 @@ class CMS:
} }
return result return result
def playContent(self, play_url): def playContent(self, play_url,jxs=None):
if not jxs:
jxs = []
if self.lazy: if self.lazy:
print(f'{play_url}->开始执行免嗅代码->{self.lazy}') print(f'{play_url}->开始执行免嗅代码->{self.lazy}')
if not str(self.lazy).startswith('js:'): if not str(self.lazy).startswith('js:'):
...@@ -641,10 +643,12 @@ class CMS: ...@@ -641,10 +643,12 @@ class CMS:
py_ctx.update({ py_ctx.update({
'input': play_url, 'input': play_url,
'd': self.d, 'd': self.d,
'jxs':jxs,
'pdfh': self.d.jsp.pdfh, 'pdfh': self.d.jsp.pdfh,
'pdfa': self.d.jsp.pdfa, 'pd': self.d.jsp.pd, 'pdfa': self.d.jsp.pdfa, 'pd': self.d.jsp.pd,
}) })
ctx = py_ctx ctx = py_ctx
# print(ctx)
loader,_ = runJScode(jscode,ctx=ctx) loader,_ = runJScode(jscode,ctx=ctx)
# print(loader.toString()) # print(loader.toString())
play_url = loader.eval('input') play_url = loader.eval('input')
......
...@@ -20,5 +20,6 @@ JSON_AS_ASCII = False # jsonify返回的中文正常显示 ...@@ -20,5 +20,6 @@ JSON_AS_ASCII = False # jsonify返回的中文正常显示
# PLAY_URL = 'http://localhost:5705' # 匹配远程解析服务器链接 # PLAY_URL = 'http://localhost:5705' # 匹配远程解析服务器链接
# PLAY_URL = PLAY_URL.rstrip('/') # PLAY_URL = PLAY_URL.rstrip('/')
PLAY_DISABLE = False # 全局禁用播放解析 PLAY_DISABLE = False # 全局禁用播放解析
WALL_PAPER_ENABLE = True # 启用自定义壁纸
WALL_PAPER = "https://picsum.photos/1280/720/?blur=10" # 自定义壁纸,可注释 WALL_PAPER = "https://picsum.photos/1280/720/?blur=10" # 自定义壁纸,可注释
# {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %} # {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %}
\ No newline at end of file
无法预览此类型文件
{ {
"wallpaper":"http://{{ host }}/pics", {% if config.WALL_PAPER_ENABLE %}"wallpaper":"http://{{ host }}/pics",{% endif %}
"dr_count": {{rules.list|length}}, "dr_count": {{rules.list|length}},
"mode": {{ mode }}, "mode": {{ mode }},
"sites": [{% for rule in rules.list %}{% if mode == 0 %} "sites": [{% for rule in rules.list %}{% if mode == 0 %}
......
...@@ -66,7 +66,7 @@ a { ...@@ -66,7 +66,7 @@ a {
<a href="http://{{ getHost(0) }}/config/0">本地配置地址</a> <a href="http://{{ getHost(0) }}/config/0">本地配置地址</a>
</div> </div>
<!--<a href="{{ getHost(1) }}">局域网:{{ getHost(1) }}</a>--> <!--<a href="{{ getHost(1) }}">局域网:{{ getHost(1) }}</a>-->
<p>局域网:{{ getHost(1) }}</p> <a href="https://picsum.photos/1280/720/?blur=10">局域网:{{ getHost(1) }}</a>
{% if '192.168' in getHost(1) %} {% if '192.168' in getHost(1) %}
<div class="btn"> <div class="btn">
<a href="http://{{ getHost(1) }}/config/1">局域网配置地址</a> <a href="http://{{ getHost(1) }}/config/1">局域网配置地址</a>
...@@ -74,6 +74,9 @@ a { ...@@ -74,6 +74,9 @@ a {
<div class="btn"> <div class="btn">
<a href="http://{{ manager }}" target="_blank">局域网在线进程管理</a> <a href="http://{{ manager }}" target="_blank">局域网在线进程管理</a>
</div> </div>
<div class="btn">
<a href="http://{{ getHost(1) }}/pics" target="_blank">局域网随机图片</a>
</div>
{% endif %} {% endif %}
<div class="btn"> <div class="btn">
<a href="http://{{ getHost(2) }}/config/2">远程配置地址</a> <a href="http://{{ getHost(2) }}/config/2">远程配置地址</a>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册