Browse Source

增加随机图片

keep-around/37ce0a323abd2c9d471e0491c0eeaac42249b953
hjdhnx 2 years ago
parent
commit
6486f4b49c
12 changed files with 19 additions and 5 deletions
  1. +8
    -2
      app.py
  2. +5
    -1
      classes/cms.py
  3. +1
    -0
      config.py
  4. BIN
      images/2.jpg
  5. BIN
      images/3.jpg
  6. BIN
      images/4.jpg
  7. BIN
      images/城市长凳.jpg
  8. BIN
      images/绿林.jpg
  9. BIN
      images/高铁.jpg
  10. BIN
      models/rules.db
  11. +1
    -1
      templates/config.txt
  12. +4
    -1
      templates/index.html

+ 8
- 2
app.py View File

@ -111,7 +111,8 @@ def vod():
play_url = getParmas('play_url')
if play_url: # 播放
play_url = cms.playContent(play_url)
jxs = getJxs()
play_url = cms.playContent(play_url,jxs)
return redirect(play_url)
if ac and t: # 一级
@ -230,9 +231,14 @@ def rules_raw():
@app.route('/pics')
def random_pics():
id = getParmas('id')
# print(f'id:{id}')
pics = getPics()
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()
response = make_response(file)
response.headers['Content-Type'] = 'image/jpeg'


+ 5
- 1
classes/cms.py View File

@ -619,7 +619,9 @@ class CMS:
}
return result
def playContent(self, play_url):
def playContent(self, play_url,jxs=None):
if not jxs:
jxs = []
if self.lazy:
print(f'{play_url}->开始执行免嗅代码->{self.lazy}')
if not str(self.lazy).startswith('js:'):
@ -641,10 +643,12 @@ class CMS:
py_ctx.update({
'input': play_url,
'd': self.d,
'jxs':jxs,
'pdfh': self.d.jsp.pdfh,
'pdfa': self.d.jsp.pdfa, 'pd': self.d.jsp.pd,
})
ctx = py_ctx
# print(ctx)
loader,_ = runJScode(jscode,ctx=ctx)
# print(loader.toString())
play_url = loader.eval('input')


+ 1
- 0
config.py View File

@ -20,5 +20,6 @@ JSON_AS_ASCII = False # jsonify返回的中文正常显示
# PLAY_URL = 'http://localhost:5705' # 匹配远程解析服务器链接
# PLAY_URL = PLAY_URL.rstrip('/')
PLAY_DISABLE = False # 全局禁用播放解析
WALL_PAPER_ENABLE = True # 启用自定义壁纸
WALL_PAPER = "https://picsum.photos/1280/720/?blur=10" # 自定义壁纸,可注释
# {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %}

BIN
images/2.jpg View File

Before After
Width: 1280  |  Height: 720  |  Size: 24 KB

BIN
images/3.jpg View File

Before After
Width: 1280  |  Height: 720  |  Size: 30 KB

BIN
images/4.jpg View File

Before After
Width: 1280  |  Height: 720  |  Size: 33 KB

BIN
images/城市长凳.jpg View File

Before After
Width: 1280  |  Height: 720  |  Size: 41 KB

BIN
images/绿林.jpg View File

Before After
Width: 1280  |  Height: 720  |  Size: 44 KB

BIN
images/高铁.jpg View File

Before After
Width: 1280  |  Height: 720  |  Size: 45 KB

BIN
models/rules.db View File


+ 1
- 1
templates/config.txt View File

@ -1,5 +1,5 @@
{
"wallpaper":"http://{{ host }}/pics",
{% if config.WALL_PAPER_ENABLE %}"wallpaper":"http://{{ host }}/pics",{% endif %}
"dr_count": {{rules.list|length}},
"mode": {{ mode }},
"sites": [{% for rule in rules.list %}{% if mode == 0 %}


+ 4
- 1
templates/index.html View File

@ -66,7 +66,7 @@ a {
<a href="http://{{ getHost(0) }}/config/0">本地配置地址</a>
</div>
<!--<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) %}
<div class="btn">
<a href="http://{{ getHost(1) }}/config/1">局域网配置地址</a>
@ -74,6 +74,9 @@ a {
<div class="btn">
<a href="http://{{ manager }}" target="_blank">局域网在线进程管理</a>
</div>
<div class="btn">
<a href="http://{{ getHost(1) }}/pics" target="_blank">局域网随机图片</a>
</div>
{% endif %}
<div class="btn">
<a href="http://{{ getHost(2) }}/config/2">远程配置地址</a>


Loading…
Cancel
Save