diff --git a/src/routes/api/photos/+server.js b/src/routes/api/photos/+server.js index e3bbf53..cee2ccb 100644 --- a/src/routes/api/photos/+server.js +++ b/src/routes/api/photos/+server.js @@ -16,6 +16,8 @@ export async function GET({ url }) { } }); + const tokenDuration = parseInt(env.B2_TOKEN_DURATION, 10) || 600; + // Fetch a batch of files from the thumbs/ folder const listCommand = new ListObjectsV2Command({ Bucket: env.B2_BUCKET_NAME, @@ -44,8 +46,8 @@ export async function GET({ url }) { // 10 minutes = 600 seconds const [thumbUrl, fullUrl] = await Promise.all([ - getSignedUrl(s3, thumbCommand, { expiresIn: 600 }), - getSignedUrl(s3, fullCommand, { expiresIn: 600 }) + getSignedUrl(s3, thumbCommand, { expiresIn: tokenDuration }), + getSignedUrl(s3, fullCommand, { expiresIn: tokenDuration }) ]); return { id, thumbUrl, fullUrl };