fix(export): 禁止账号导出下载缓存,避免重复拿到旧 tdata 包

- 前端下载地址追加 ts 时间戳参数,强制每次请求唯一 URL\n- 后端 /downloads/accounts.zip 返回 no-store/no-cache 头,禁止浏览器复用旧响应\n- 修复导出后仍下载到历史坏包(旧 tdata 无法登录)的现象
This commit is contained in:
meoacgx committed 2026-03-03 00:38:11 +08:00
1 parent 4947f7a9ad
commit 57683f8de8
2 files changed
+7 -1

No files matched your search

@@ -958,7 +958,8 @@
return;
var qs = string.Join(",", ids);
Navigation.NavigateTo($"/downloads/accounts.zip?ids={qs}&format={format}", forceLoad: true);
var ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
Navigation.NavigateTo($"/downloads/accounts.zip?ids={qs}&format={format}&ts={ts}", forceLoad: true);
}
private async Task<string?> SelectExportFormatAsync(int accountCount, string scopeLabel)
+5
View File
@@ -864,6 +864,11 @@ var accountsZipDownload = app.MapGet("/downloads/accounts.zip", async (
var zipBytes = await exporter.BuildAccountsZipAsync(accounts, cancellationToken, format);
var formatName = format == AccountExportFormat.Tdata ? "tdata" : "telethon";
var fileName = $"telegram-panel-accounts-{formatName}-{DateTime.UtcNow:yyyyMMdd-HHmmss}.zip";
// 下载文件禁止缓存,避免浏览器复用旧的 accounts.zip 导致“重复拿到旧导出包”。
http.Response.Headers.CacheControl = "no-store, no-cache, must-revalidate, max-age=0";
http.Response.Headers.Pragma = "no-cache";
http.Response.Headers.Expires = "0";
return Results.File(zipBytes, "application/zip", fileName);
}).DisableAntiforgery();
if (adminAuthEnabled)