mirror of
https://github.com/alangrainger/immich-public-proxy.git
synced 2024-12-28 03:41:58 +00:00
Updated logging
This commit is contained in:
parent
1566f7abe4
commit
b191442d4b
4 changed files with 6 additions and 6 deletions
4
dist/index.js
vendored
4
dist/index.js
vendored
File diff suppressed because one or more lines are too long
4
dist/render.js
vendored
4
dist/render.js
vendored
|
@ -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 {
|
|||
}
|
||||
const render = new Render();
|
||||
exports.default = render;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVuZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3JlbmRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw4REFBNkI7QUFFN0IsbUNBQWlFO0FBQ2pFLDBEQUF5QjtBQUV6QixNQUFNLE1BQU07SUFDSixXQUFXLENBQUUsR0FBYSxFQUFFLEtBQVksRUFBRSxJQUFnQjs7WUFDOUQsTUFBTSxJQUFJLEdBQUcsTUFBTSxnQkFBTSxDQUFDLGNBQWMsQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUE7WUFDckQsSUFBSSxJQUFJLEVBQUUsQ0FBQztnQkFD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Nwb25zZSwgc2hhcmU6IFNoYXJlZExpbmssIG9wZW5JdGVtPzogbnVtYmVyKSB7XG4gICAgY29uc3QgaXRlbXMgPSBbXVxuICAgIGZvciAoY29uc3QgYXNzZXQgb2Ygc2hhcmUuYXNzZXRzKSB7XG4gICAgICBsZXQgdmlkZW9cbiAgICAgIGlmIChhc3NldC50eXBlID09PSBBc3NldFR5cGUudmlkZW8pIHtcbiAgICAgICAgLy8gUG9wdWxhdGUgdGhlIGRhdGEtdmlkZW8gcHJvcGVydHlcbiAgICAgICAgdmlkZW8gPSBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgc291cmNlOiBbXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIHNyYzogaW1taWNoLnZpZGVvVXJsKHNoYXJlLmtleSwgYXNzZXQuaWQpLFxuICAgICAgICAgICAgICB0eXBlOiBhd2FpdCBpbW1pY2guZ2V0Q29udGVudFR5cGUoYXNzZXQpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBhdHRyaWJ1dGVzOiB7XG4gICAgICAgICAgICBwcmVsb2FkOiBmYWxzZSxcbiAgICAgICAgICAgIGNvbnRyb2xzOiB0cnVlXG4gICAgICAgICAgfVxuICAgICAgICB9KVxuICAgICAgfVxuICAgICAgaXRlbXMucHVzaCh7XG4gICAgICAgIG9yaWdpbmFsVXJsOiBpbW1pY2gucGhvdG9Vcmwoc2hhcmUua2V5LCBhc3NldC5pZCksXG4gICAgICAgIHRodW1ibmFpbFVybDogaW1taWNoLnBob3RvVXJsKHNoYXJlLmtleSwgYXNzZXQuaWQsIEltYWdlU2l6ZS50aHVtYm5haWwpLFxuICAgICAgICB2aWRlb1xuICAgICAgfSlcbiAgICB9XG4gICAgcmVzLnJlbmRlcignZ2FsbGVyeScsIHtcbiAgICAgIGl0ZW1zLFxuICAgICAgb3Blbkl0ZW1cbiAgICB9KVxuICB9XG59XG5cbmNvbnN0IHJlbmRlciA9IG5ldyBSZW5kZXIoK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l6ZS50aHVtYm5haWwpLFxuICAgICAgICB2aWRlb1xuICAgICAgfSlcbiAgICB9XG4gICAgcmVzLnJlbmRlcignZ2FsbGVyeScsIHtcbiAgICAgIGl0ZW1zLFxuICAgICAgb3Blbkl0ZW1cbiAgICB9KVxuICB9XG59XG5cbmNvbnN0IHJlbmRlciA9IG5ldyBSZW5kZXIoKVxuXG5leHBvcnQgZGVmYXVsdCByZW5kZXJcbiJdfQ==
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue