From ffe26f1806869fac5c21b8f988bac95b8e7fa2ca Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Wed, 30 Oct 2024 14:43:26 +0100 Subject: [PATCH] Updated logging --- dist/immich.js | 4 +++- dist/index.js | 18 ++++++++++-------- src/immich.ts | 2 ++ src/index.ts | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/dist/immich.js b/dist/immich.js index 07e3148..0a77462 100644 --- a/dist/immich.js +++ b/dist/immich.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const types_1 = require("./types"); const dayjs_1 = tslib_1.__importDefault(require("dayjs")); +const index_1 = require("./index"); class Immich { /** * Make a request to Immich API. We're not using the SDK to limit @@ -42,6 +43,7 @@ class Immich { link.assets = link.assets.filter(x => !x.isTrashed); if (link.expiresAt && (0, dayjs_1.default)(link.expiresAt) < (0, dayjs_1.default)()) { // This link has expired + (0, index_1.log)('Expired link ' + key); } else { return link; @@ -102,4 +104,4 @@ class Immich { } const immich = new Immich(); exports.default = immich; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1taWNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ltbWljaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxtQ0FBaUU7QUFDakUsMERBQXlCO0FBRXpCLE1BQU0sTUFBTTtJQUNWOzs7T0FHRztJQUNHLE9BQU8sQ0FBRSxRQUFnQjs7WUFDN0IsTUFBTSxHQUFHLEdBQUcsTUFBTSxLQUFLLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLEdBQUcsTUFBTSxHQUFHLFFBQVEsRUFBRTtnQkFDbEUsT0FBTyxFQUFFO29CQUNQLFdBQVcsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sSUFBSSxFQUFFO2lCQUN2QzthQUNGLENBQUMs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ZXkgbWF0Y2hlcyB0aGUgSW1taWNoIHNoYXJlZC1saW5rIGtleSBmb3JtYXRcbiAgICovXG4gIGlzS2V5IChrZXk6IHN0cmluZykge1xuICAgIHJldHVybiAhIWtleS5tYXRjaCgvXltcXHctXSskLylcbiAgfVxufVxuXG5jb25zdCBpbW1pY2ggPSBuZXcgSW1taWNoKClcblxuZXhwb3J0IGRlZmF1bHQgaW1taWNoXG4iXX0= \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 19272a0..a5ee77b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.log = void 0; const tslib_1 = require("tslib"); const express_1 = tslib_1.__importDefault(require("express")); const immich_1 = tslib_1.__importDefault(require("./immich")); @@ -15,25 +16,26 @@ const getSize = (req) => { return ((_a = req === null || req === void 0 ? void 0 : req.query) === null || _a === void 0 ? void 0 : _a.size) === 'thumbnail' ? types_1.ImageSize.thumbnail : types_1.ImageSize.original; }; const log = (message) => console.log((0, dayjs_1.default)().format() + ' ' + message); +exports.log = log; app.get('/share/:key', (req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { res.set('Cache-Control', 'public, max-age=' + process.env.CACHE_AGE); if (!immich_1.default.isKey(req.params.key)) { - log('Invalid share key ' + req.params.key); + (0, exports.log)('Invalid share key ' + req.params.key); res.status(404).send(); } else { const sharedLink = yield immich_1.default.getShareByKey(req.params.key); if (!sharedLink) { - log('Unknown share key ' + req.params.key); + (0, exports.log)('Unknown share key ' + req.params.key); res.status(404).send(); } else if (!sharedLink.assets.length) { - log('No assets for key ' + req.params.key); + (0, exports.log)('No assets for key ' + req.params.key); res.status(404).send(); } else if (sharedLink.assets.length === 1) { // This is an individual item (not a gallery) - log('Serving link ' + req.params.key); + (0, exports.log)('Serving link ' + req.params.key); const asset = sharedLink.assets[0]; if (asset.type === types_1.AssetType.image) { // For photos, output the image directly @@ -46,7 +48,7 @@ app.get('/share/:key', (req, res) => tslib_1.__awaiter(void 0, void 0, void 0, f } else { // Multiple images - render as a gallery - log('Serving link ' + req.params.key); + (0, exports.log)('Serving link ' + req.params.key); yield render_1.default.gallery(res, sharedLink); } } @@ -68,15 +70,15 @@ app.get('/:type(photo|video)/:key/:id', (req, res) => tslib_1.__awaiter(void 0, } } } - log('No asset found for ' + req.path); + (0, exports.log)('No asset found for ' + req.path); res.status(404).send(); })); // Send a 404 for all other unmatched routes app.get('*', (req, res) => { - log('Invalid route ' + req.path); + (0, exports.log)('Invalid route ' + req.path); res.status(404).send(); }); app.listen(3000, () => { console.log((0, dayjs_1.default)().format() + ' Server started'); }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsOERBQTZCO0FBQzdCLDhEQUE2QjtBQUM3Qiw4REFBNkI7QUFDN0IsMERBQXlCO0FBQ3pCLG1DQUE4QztBQUc5QyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUMsTUFBTSxFQUFFLENBQUE7QUFFMUIsTUFBTSxHQUFHLEdBQUcsSUFBQSxpQkFBTyxHQUFFLENBQUE7QUFDckIsR0FBRyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsS0FBSyxDQUFDLENBQUE7QUFDN0IsR0FBRyxDQUFDLEdBQUcsQ0FBQyxpQkFBTyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFBO0FBRWpDLE1BQU0sT0FBTyxHQUFHLENBQUMsR0FBWSxFQUFFLEVBQUU7O0lBQy9CLE9BQU8sQ0FBQSxNQUFBLEdBQUcsYUFBSCxHQUFHLHVCQUFILEdBQUcsQ0FBRSxLQUFLLDBDQUFFLElBQUksTUFBSyxXQUFXLENBQUMsQ0FBQyxDQUFDLGlCQUFTLENB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ZWNrIHRoYXQgdGhlIHJlcXVlc3RlZCBhc3NldCBleGlzdHMgaW4gdGhpcyBzaGFyZVxuICAgICAgY29uc3QgYXNzZXQgPSBzaGFyZWRMaW5rLmFzc2V0cy5maW5kKHggPT4geC5pZCA9PT0gcmVxLnBhcmFtcy5pZClcbiAgICAgIGlmIChhc3NldCkge1xuICAgICAgICBhc3NldC50eXBlID0gcmVxLnBhcmFtcy50eXBlID09PSAndmlkZW8nID8gQXNzZXRUeXBlLnZpZGVvIDogQXNzZXRUeXBlLmltYWdlXG4gICAgICAgIHJlbmRlci5hc3NldEJ1ZmZlcihyZXMsIGFzc2V0LCBnZXRTaXplKHJlcSkpLnRoZW4oKVxuICAgICAgICByZXR1cm5cbiAgICAgIH1cbiAgICB9XG4gIH1cbiAgbG9nKCdObyBhc3NldCBmb3VuZCBmb3IgJyArIHJlcS5wYXRoKVxuICByZXMuc3RhdHVzKDQwNCkuc2VuZCgpXG59KVxuXG4vLyBTZW5kIGEgNDA0IGZvciBhbGwgb3RoZXIgdW5tYXRjaGVkIHJvdXRlc1xuYXBwLmdldCgnKicsIChyZXEsIHJlcykgPT4ge1xuICBsb2coJ0ludmFsaWQgcm91dGUgJyArIHJlcS5wYXRoKVxuICByZXMuc3RhdHVzKDQwNCkuc2VuZCgpXG59KVxuXG5hcHAubGlzdGVuKDMwMDAsICgpID0+IHtcbiAgY29uc29sZS5sb2coZGF5anMoKS5mb3JtYXQoKSArICcgU2VydmVyIHN0YXJ0ZWQnKVxufSlcbiJdfQ== \ No newline at end of file diff --git a/src/immich.ts b/src/immich.ts index 3e3d4a2..82207f6 100644 --- a/src/immich.ts +++ b/src/immich.ts @@ -1,5 +1,6 @@ import { Asset, AssetType, ImageSize, SharedLink } from './types' import dayjs from 'dayjs' +import { log } from './index' class Immich { /** @@ -37,6 +38,7 @@ class Immich { link.assets = link.assets.filter(x => !x.isTrashed) if (link.expiresAt && dayjs(link.expiresAt) < dayjs()) { // This link has expired + log('Expired link ' + key) } else { return link } diff --git a/src/index.ts b/src/index.ts index c245a77..d72d12f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,7 @@ const getSize = (req: Request) => { 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) => { res.set('Cache-Control', 'public, max-age=' + process.env.CACHE_AGE)