Compare commits

...

5 Commits

Author SHA1 Message Date
x1ao4
f9730f2994
Merge pull request #59 from x1ao4/dev
移除更换海报的日志输出,更新 Docker Compose 和 Wiki 链接地址
2025-09-16 01:58:03 +08:00
x1ao4
6e72dee20d
更新 Docker Compose 和 Wiki 链接地址 2025-09-16 01:54:59 +08:00
x1ao4
8036e3256b 移除更换海报的日志输出
- 移除 “成功保存自定义海报: …” 与 “成功更新自定义海报: …” 的 info 日志输出,改为静默处理
- 不影响海报保存、数据库同步与 `poster_updated:<tmdb_id>` 通知链路,功能保持不变,减少无意义日志噪音
2025-09-16 01:46:54 +08:00
x1ao4
070e409dc4
Merge pull request #58 from x1ao4/dev
优化任务海报的加载逻辑,启用长缓存并保留更换海报的精确热更新
2025-09-16 01:26:22 +08:00
x1ao4
842730e3dd 优化任务海报的加载逻辑,启用长缓存并保留更换海报的精确热更新
将 `/cache/images` 改为 `Cache-Control: public, max-age=31536000, immutable` 提升切页性能;在自定义海报、刷新剧目、批量重下海报时发送 `poster_updated:<tmdb_id>`,前端 SSE 监听后对目标节目设置 `imageCacheBustById`,仅变更项追加 `?t=` 强制刷新,未变更项命中缓存。
2025-09-16 01:20:42 +08:00
3 changed files with 42 additions and 12 deletions

View File

@ -38,7 +38,7 @@
- [x] 支持分享链接的子目录
- [x] 记录失效分享并跳过任务
- [x] 支持需提取码的分享链接 <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/使用技巧集锦#支持需提取码的分享链接)</sup>
- [x] 智能搜索资源并自动填充(**支持自动过滤失效链接** <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/CloudSaver搜索源)</sup>
- [x] 智能搜索资源并自动填充(**支持自动过滤失效链接** <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/资源搜索)</sup>
- 文件管理
- [x] 目标目录不存在时自动新建
@ -63,9 +63,9 @@
- 其它
- [x] 每日签到领空间 <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/使用技巧集锦#每日签到领空间)</sup>
- [x] 支持多个通知推送渠道 <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/通知推送服务配置)</sup>
- [x] 支持多个通知推送渠道 <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/通知置)</sup>
- [x] 支持多账号(多账号签到、**文件管理**,仅首账号转存)
- [x] 支持网盘文件下载、strm 文件生成等功能 <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/插件置)</sup>
- [x] 支持网盘文件下载、strm 文件生成等功能 <sup>[?](https://github.com/x1ao4/quark-auto-save-x/wiki/插件置)</sup>
- [x] **支持通过追剧日历功能了解订阅内容的播出情况**
## 部署
@ -86,7 +86,6 @@ docker run -d \
Docker Compose推荐
```yaml
version: "3.3"
services:
quark-auto-save-x:
image: x1ao4/quark-auto-save-x:latest
@ -130,10 +129,10 @@ services:
| `乘风2025 - S06E{}` | | 按照文件顺序命名,`{}` 会被代入序号,新增项目序号在已存在的最大序号的基础上递增 |
| `黑镜 - S07E[]` | | 自动识别文件名中的集编号,`[]` 会被代入从文件名中自动提取的集编号 |
更多正则使用说明:[正则处理教程](https://github.com/x1ao4/quark-auto-save-x/wiki/正则处理教程)
更多正则使用说明:[命名规则](https://github.com/x1ao4/quark-auto-save-x/wiki/命名规则)
### 刷新媒体库
在有新转存时,可触发完成相应功能,如自动刷新媒体库、生成 .strm 文件等。配置指南:[插件配置](https://github.com/x1ao4/quark-auto-save-x/wiki/插件配置)
在有新转存时,可触发完成相应功能,如自动刷新媒体库、生成 .strm 文件等。配置指南:[插件设置](https://github.com/x1ao4/quark-auto-save-x/wiki/插件设置)
媒体库模块以插件的方式的集成,如果你有兴趣请参考[插件开发指南](https://github.com/x1ao4/quark-auto-save-x/tree/x/plugins)。

View File

@ -699,10 +699,13 @@ def favicon():
def serve_cache_images(filename):
resp = send_from_directory(CACHE_IMAGES_DIR, filename)
try:
# 禁用强缓存,允许协商缓存
resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate, max-age=0'
resp.headers['Pragma'] = 'no-cache'
resp.headers['Expires'] = '0'
# 启用长期缓存:依赖前端通过 `?t=` 穿透参数在变更时刷新
# 说明:图片文件名稳定且内容稳定,正常情况应命中浏览器缓存;
# 当用户主动更换海报时,前端会为该节目生成新的时间戳参数,形成新的 URL从而触发重新下载。
resp.headers['Cache-Control'] = 'public, max-age=31536000, immutable'
# 清理可能的历史字段(部分代理可能保留)
resp.headers.pop('Pragma', None)
resp.headers.pop('Expires', None)
except Exception:
pass
return resp
@ -4353,6 +4356,11 @@ def redownload_all_posters():
# 更新数据库中的海报路径
cal_db.update_show_poster(int(tmdb_id), poster_local_path)
success_count += 1
# 通知前端该节目海报已更新
try:
notify_calendar_changed(f'poster_updated:{int(tmdb_id)}')
except Exception:
pass
except Exception as e:
logging.error(f"重新下载海报失败 (TMDB ID: {show.get('tmdb_id')}): {e}")
@ -4505,7 +4513,7 @@ def download_custom_poster(poster_url: str, tmdb_id: int, target_safe_name: str
with open(file_path, 'wb') as f:
f.write(r.content)
logging.info(f"成功保存自定义海报: {poster_url} -> {file_path}")
# 自定义海报保存成功(静默)
return f"/cache/images/{safe_name}"
except Exception as e:
@ -4820,6 +4828,12 @@ def calendar_refresh_show():
try:
notify_calendar_changed('refresh_show')
# 通知前端指定节目海报可能已更新,用于触发按节目维度的缓存穿透
try:
if tmdb_id:
notify_calendar_changed(f'poster_updated:{int(tmdb_id)}')
except Exception:
pass
except Exception:
pass
@ -5155,8 +5169,13 @@ def calendar_edit_metadata():
# 即使对比失败也不影响功能
pass
logging.info(f"成功更新自定义海报: TMDB ID {current_tmdb_id}, 路径: {saved_path}")
# 成功更新自定义海报(静默)
changed = True
# 仅当自定义海报保存成功时,通知前端该节目海报已更新
try:
notify_calendar_changed(f'poster_updated:{int(current_tmdb_id)}')
except Exception:
pass
else:
logging.warning(f"自定义海报保存失败: {custom_poster_url}")
except Exception as e:

View File

@ -5531,6 +5531,18 @@
let changeReason = '';
try { changeReason = JSON.parse(ev && ev.data || '{}').reason || ''; } catch (e) {}
// 如果是海报更新通知poster_updated:<tmdb_id>),为该节目设置缓存穿透,避免使用旧缓存
try {
if (typeof changeReason === 'string' && changeReason.startsWith('poster_updated:')) {
const idStr = changeReason.split(':')[1] || '';
const eid = parseInt(idStr, 10);
if (!isNaN(eid)) {
const nowTick = Date.now();
this.$set(this.imageCacheBustById, eid, nowTick);
}
}
} catch (e) {}
// 先拉取最新转存信息并重建映射(用于管理视图与进度判定)
try {
const latestRes = await axios.get('/task_latest_info');