1
0
Fork 0
mirror of https://github.com/alangrainger/immich-public-proxy.git synced 2024-12-29 12:21:57 +00:00

Updated logging

This commit is contained in:
Alan Grainger 2024-10-30 14:43:26 +01:00
parent b191442d4b
commit ffe26f1806
4 changed files with 16 additions and 10 deletions

4
dist/immich.js vendored

File diff suppressed because one or more lines are too long

18
dist/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,6 @@
import { Asset, AssetType, ImageSize, SharedLink } from './types' import { Asset, AssetType, ImageSize, SharedLink } from './types'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { log } from './index'
class Immich { class Immich {
/** /**
@ -37,6 +38,7 @@ class Immich {
link.assets = link.assets.filter(x => !x.isTrashed) link.assets = link.assets.filter(x => !x.isTrashed)
if (link.expiresAt && dayjs(link.expiresAt) < dayjs()) { if (link.expiresAt && dayjs(link.expiresAt) < dayjs()) {
// This link has expired // This link has expired
log('Expired link ' + key)
} else { } else {
return link return link
} }

View file

@ -15,7 +15,7 @@ const getSize = (req: Request) => {
return req?.query?.size === 'thumbnail' ? ImageSize.thumbnail : ImageSize.original return req?.query?.size === 'thumbnail' ? ImageSize.thumbnail : ImageSize.original
} }
const log = (message: string) => console.log(dayjs().format() + ' ' + message) export const log = (message: string) => console.log(dayjs().format() + ' ' + message)
app.get('/share/:key', async (req, res) => { app.get('/share/:key', async (req, res) => {
res.set('Cache-Control', 'public, max-age=' + process.env.CACHE_AGE) res.set('Cache-Control', 'public, max-age=' + process.env.CACHE_AGE)