修复移动端浏览器下载卡住:下载响应禁用缓存协商(no-store + 去 ETag/Last-Modified,消除 304 空体卡死);前端下载改 fetch+Blob 绕过原生下载;修复内置 basic auth 的 Buffer.from 拼写

This commit is contained in:
2026-08-31 19:19:04 +08:00
parent d78d1b013e
commit 1becf740c3
3 changed files with 39 additions and 5 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ app.use(express.json({ limit: '2mb' }));
// 可选 basic auth(若前置 nginx 已做,可不启用)
if (cfg.auth && cfg.auth.user) {
const expected = 'Basic ' + Buffer.From(cfg.auth.user + ':' + cfg.auth.password).toString('base64');
const expected = 'Basic ' + Buffer.from(cfg.auth.user + ':' + cfg.auth.password).toString('base64');
app.use((req, res, next) => {
if (req.headers.authorization === expected) return next();
res.set('WWW-Authenticate', 'Basic realm="agent"');