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:
parent
b191442d4b
commit
ffe26f1806
4 changed files with 16 additions and 10 deletions
4
dist/immich.js
vendored
4
dist/immich.js
vendored
File diff suppressed because one or more lines are too long
18
dist/index.js
vendored
18
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue