Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "immich-public-proxy",
|
||||
"version": "1.7.2",
|
||||
"version": "1.7.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "immich-public-proxy",
|
||||
"version": "1.7.2",
|
||||
"version": "1.7.3",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"archiver": "^7.0.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "immich-public-proxy",
|
||||
"version": "1.7.2",
|
||||
"version": "1.7.3",
|
||||
"scripts": {
|
||||
"dev": "ts-node src/index.ts",
|
||||
"build": "npx tsc",
|
||||
|
||||
+7
-2
@@ -140,7 +140,7 @@ class Render {
|
||||
res.setHeader('Content-Type', 'application/zip')
|
||||
const title = this.title(share).replace(/[^\w .-]/g, '') + '.zip'
|
||||
res.setHeader('Content-Disposition', `attachment; filename="${title}"`)
|
||||
const archive = archiver('zip', { zlib: { level: 9 } })
|
||||
const archive = archiver('zip', { zlib: { level: 6 } })
|
||||
archive.pipe(res)
|
||||
for (const asset of share.assets) {
|
||||
const url = immich.buildUrl(immich.apiUrl() + '/assets/' + encodeURIComponent(asset.id) + '/original', {
|
||||
@@ -148,10 +148,15 @@ class Render {
|
||||
password: asset.password
|
||||
})
|
||||
const data = await fetch(url)
|
||||
// Check the response for validity
|
||||
if (!data.ok) {
|
||||
console.warn(`Failed to fetch asset: ${asset.id}`)
|
||||
continue
|
||||
}
|
||||
archive.append(Buffer.from(await data.arrayBuffer()), { name: asset.originalFileName || asset.id })
|
||||
}
|
||||
await archive.finalize()
|
||||
res.end()
|
||||
archive.on('end', () => res.end())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user