feat(file): 新增启用下载(文件名为显示名称), 前端 > 2.14.264

This commit is contained in:
xream 2024-10-07 17:26:15 +08:00
parent 02031019f7
commit dc320eaa6c
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.385",
"version": "2.14.386",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@ -141,7 +141,14 @@ async function getFile(req, res) {
)}`,
);
}
if (file.download) {
res.set(
'Content-Disposition',
`attachment; filename*=UTF-8''${encodeURIComponent(
file.displayName || file.name,
)}`,
);
}
res.set('Content-Type', 'text/plain; charset=utf-8').send(
output ?? '',
);