feat: 下载文件名增加前后缀

This commit is contained in:
xream
2025-02-14 15:39:13 +08:00
parent f9d120bac3
commit 5058662651
5 changed files with 49 additions and 5 deletions

View File

@@ -27,7 +27,18 @@ export default function register($app) {
res.set('content-type', 'application/json')
.set(
'content-disposition',
'attachment; filename="sub-store.json"',
`attachment; filename="${encodeURIComponent(
`sub-store_data_${new Date()
.toLocaleString('zh-CN', {
year: 'numeric',
day: 'numeric',
month: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
})
.replace(/\D/g, '')}.json`,
)}"`,
)
.send(
$.env.isNode