From b191442d4b196fb1191355480c01b74530ba06a4 Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Wed, 30 Oct 2024 14:38:08 +0100 Subject: [PATCH] Updated logging --- dist/index.js | 4 +++- dist/render.js | 4 +--- src/index.ts | 2 ++ src/render.ts | 2 -- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2a0323d..19272a0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33,6 +33,7 @@ app.get('/share/:key', (req, res) => tslib_1.__awaiter(void 0, void 0, void 0, f } else if (sharedLink.assets.length === 1) { // This is an individual item (not a gallery) + log('Serving link ' + req.params.key); const asset = sharedLink.assets[0]; if (asset.type === types_1.AssetType.image) { // For photos, output the image directly @@ -45,6 +46,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); yield render_1.default.gallery(res, sharedLink); } } @@ -77,4 +79,4 @@ app.get('*', (req, res) => { app.listen(3000, () => { console.log((0, dayjs_1.default)().format() + ' Server started'); }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsOERBQTZCO0FBQzdCLDhEQUE2QjtBQUM3Qiw4REFBNkI7QUFDN0IsMERBQXlCO0FBQ3pCLG1DQUE4QztBQUc5QyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUMsTUFBTSxFQUFFLENBQUE7QUFFMUIsTUFBTSxHQUFHLEdBQUcsSUFBQSxpQkFBTyxHQUFFLENBQUE7QUFDckIsR0FBRyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEVBQUUsS0FBSyxDQUFDLENBQUE7QUFDN0IsR0FBRyxDQUFDLEdBQUcsQ0FBQyxpQkFBTyxDQUFDLE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S5wYXJhbXMuaWQpXG4gICAgICBpZiAoYXNzZXQpIHtcbiAgICAgICAgYXNzZXQudHlwZSA9IHJlcS5wYXJhbXMudHlwZSA9PT0gJ3ZpZGVvJyA/IEFzc2V0VHlwZS52aWRlbyA6IEFzc2V0VHlwZS5pbWFnZVxuICAgICAgICByZW5kZXIuYXNzZXRCdWZmZXIocmVzLCBhc3NldCwgZ2V0U2l6ZShyZXEpKS50aGVuKClcbiAgICAgICAgcmV0dXJuXG4gICAgICB9XG4gICAgfVxuICB9XG4gIGxvZygnTm8gYXNzZXQgZm91bmQgZm9yICcgKyByZXEucGF0aClcbiAgcmVzLnN0YXR1cyg0MDQpLnNlbmQoKVxufSlcblxuLy8gU2VuZCBhIDQwNCBmb3IgYWxsIG90aGVyIHVubWF0Y2hlZCByb3V0ZXNcbmFwcC5nZXQoJyonLCAocmVxLCByZXMpID0+IHtcbiAgbG9nKCdJbnZhbGlkIHJvdXRlICcgKyByZXEucGF0aClcbiAgcmVzLnN0YXR1cyg0MDQpLnNlbmQoKVxufSlcblxuYXBwLmxpc3RlbigzMDAwLCAoKSA9PiB7XG4gIGNvbnNvbGUubG9nKGRheWpzKCkuZm9ybWF0KCkgKyAnIFNlcnZlciBzdGFydGVkJylcbn0pXG4iXX0= \ No newline at end of file diff --git a/dist/render.js b/dist/render.js index 564dc9f..28e9374 100644 --- a/dist/render.js +++ b/dist/render.js @@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const immich_1 = tslib_1.__importDefault(require("./immich")); const types_1 = require("./types"); -const dayjs_1 = tslib_1.__importDefault(require("dayjs")); class Render { assetBuffer(res, asset, size) { return tslib_1.__awaiter(this, void 0, void 0, function* () { @@ -12,7 +11,6 @@ class Render { for (const header of ['content-type', 'content-length']) { res.set(header, data.headers[header]); } - console.log(`${(0, dayjs_1.default)().format()} Serving asset ${asset.id}`); res.send(Buffer.from(yield data.arrayBuffer())); } else { @@ -62,4 +60,4 @@ class Render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gICAgIGNvbnRyb2xzOiB0cnVlXG4gICAgICAgICAgfVxuICAgICAgICB9KVxuICAgICAgfVxuICAgICAgaXRlbXMucHVzaCh7XG4gICAgICAgIG9yaWdpbmFsVXJsOiBpbW1pY2gucGhvdG9Vcmwoc2hhcmUua2V5LCBhc3NldC5pZCksXG4gICAgICAgIHRodW1ibmFpbFVybDogaW1taWNoLnBob3RvVXJsKHNoYXJlLmtleSwgYXNzZXQuaWQsIEltYWdlU2l6ZS50aHVtYm5haWwpLFxuICAgICAgICB2aWRlb1xuICAgICAgfSlcbiAgICB9XG4gICAgcmVzLnJlbmRlcignZ2FsbGVyeScsIHtcbiAgICAgIGl0ZW1zLFxuICAgICAgb3Blbkl0ZW1cbiAgICB9KVxuICB9XG59XG5cbmNvbnN0IHJlbmRlciA9IG5ldyBSZW5kZXIoKVxuXG5leHBvcnQgZGVmYXVsdCByZW5kZXJcbiJdfQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVuZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3JlbmRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw4REFBNkI7QUFFN0IsbUNBQWlFO0FBRWpFLE1BQU0sTUFBTTtJQUNKLFdBQVcsQ0FBRSxHQUFhLEVBQUUsS0FBWSxFQUFFLElBQWdCOztZQUM5RCxNQUFNLElBQUksR0FBRyxNQUFNLGdCQUFNLENBQUMsY0FBYyxDQUFDLEtBQUssRUFBRSxJQUFJLENBQUMsQ0FBQTtZQUNyRCxJQUFJLElBQUksRUFBRSxDQUFDO2dCQUNULEtBQUssTUFBTSxNQUFNLElBQUksQ0FBQyxjQUFjLEVBQUUsZ0JBQWdCLENBQUMsRUFBRSxDQUFDO29CQUN4RCxHQUFHLENBQUMsR0FBRyxDQUFDLE1BQU0sRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQ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SwgYXNzZXQuaWQpLFxuICAgICAgICAgICAgICB0eXBlOiBhd2FpdCBpbW1pY2guZ2V0Q29udGVudFR5cGUoYXNzZXQpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBhdHRyaWJ1dGVzOiB7XG4gICAgICAgICAgICBwcmVsb2FkOiBmYWxzZSxcbiAgICAgICAgICAgIGNvbnRyb2xzOiB0cnVlXG4gICAgICAgICAgfVxuICAgICAgICB9KVxuICAgICAgfVxuICAgICAgaXRlbXMucHVzaCh7XG4gICAgICAgIG9yaWdpbmFsVXJsOiBpbW1pY2gucGhvdG9Vcmwoc2hhcmUua2V5LCBhc3NldC5pZCksXG4gICAgICAgIHRodW1ibmFpbFVybDogaW1taWNoLnBob3RvVXJsKHNoYXJlLmtleSwgYXNzZXQuaWQsIEltYWdlU2l6ZS50aHVtYm5haWwpLFxuICAgICAgICB2aWRlb1xuICAgICAgfSlcbiAgICB9XG4gICAgcmVzLnJlbmRlcignZ2FsbGVyeScsIHtcbiAgICAgIGl0ZW1zLFxuICAgICAgb3Blbkl0ZW1cbiAgICB9KVxuICB9XG59XG5cbmNvbnN0IHJlbmRlciA9IG5ldyBSZW5kZXIoKVxuXG5leHBvcnQgZGVmYXVsdCByZW5kZXJcbiJdfQ== \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index cb4f66e..c245a77 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,6 +32,7 @@ app.get('/share/:key', async (req, res) => { res.status(404).send() } else if (sharedLink.assets.length === 1) { // This is an individual item (not a gallery) + log('Serving link ' + req.params.key) const asset = sharedLink.assets[0] if (asset.type === AssetType.image) { // For photos, output the image directly @@ -42,6 +43,7 @@ app.get('/share/:key', async (req, res) => { } } else { // Multiple images - render as a gallery + log('Serving link ' + req.params.key) await render.gallery(res, sharedLink) } } diff --git a/src/render.ts b/src/render.ts index b072f03..6c02d86 100644 --- a/src/render.ts +++ b/src/render.ts @@ -1,7 +1,6 @@ import immich from './immich' import { Response } from 'express-serve-static-core' import { Asset, AssetType, ImageSize, SharedLink } from './types' -import dayjs from 'dayjs' class Render { async assetBuffer (res: Response, asset: Asset, size?: ImageSize) { @@ -10,7 +9,6 @@ class Render { for (const header of ['content-type', 'content-length']) { res.set(header, data.headers[header]) } - console.log(`${dayjs().format()} Serving asset ${asset.id}`) res.send(Buffer.from(await data.arrayBuffer())) } else { res.status(404).send()