1
0
Fork 0
mirror of https://github.com/alangrainger/immich-public-proxy.git synced 2024-12-28 03:41:58 +00:00
This commit is contained in:
Alan Grainger 2024-10-29 10:31:40 +01:00
parent 9584746067
commit 1498fe3a15
4 changed files with 152 additions and 30 deletions

56
dist/immich.js vendored
View file

@ -1,35 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const types_1 = require("./types");
class Immich {
request(endpoint_1) {
return tslib_1.__awaiter(this, arguments, void 0, function* (endpoint, json = true) {
request(endpoint) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const res = yield fetch(process.env.IMMICH_URL + '/api' + endpoint, {
headers: {
'x-api-key': process.env.API_KEY || ''
}
});
if (json) {
return res.json();
}
else {
return res;
if (res.status === 200) {
const contentType = res.headers.get('Content-Type') || '';
if (contentType.includes('application/json')) {
return res.json();
}
else {
return res;
}
}
});
}
getShareByKey(key) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const links = yield this.request('/shared-links');
return links.find(x => x.key === key);
const res = ((yield this.request('/shared-links')) || []);
return res === null || res === void 0 ? void 0 : res.find(x => x.key === key);
});
}
getImage(id_1) {
return tslib_1.__awaiter(this, arguments, void 0, function* (id, size = 'original') {
size = size === 'thumbnail' ? 'thumbnail' : 'original';
return this.request('/assets/' + id + '/' + size, false);
getAssetBuffer(asset, size) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
switch (asset.type) {
case types_1.AssetType.image:
size = size === types_1.ImageSize.thumbnail ? types_1.ImageSize.thumbnail : types_1.ImageSize.original;
return this.request('/assets/' + asset.id + '/' + size);
case types_1.AssetType.video:
return this.request('/assets/' + asset.id + '/video/playback');
}
});
}
getContentType(asset) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const assetBuffer = yield this.getAssetBuffer(asset);
return assetBuffer.headers.get('Content-Type');
});
}
photoUrl(id, size) {
return `${process.env.SERVER_URL}/photo/${id}` + (size ? `?size=${size}` : '');
}
videoUrl(id) {
return `${process.env.SERVER_URL}/video/${id}`;
}
isId(id) {
return !!id.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
}
}
const api = new Immich();
exports.default = api;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1taWNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ltbWljaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxNQUFNLE1BQU07SUFDSixPQUFPO3FFQUFFLFFBQWdCLEVBQUUsSUFBSSxHQUFHLElBQUk7WUFDMUMsTUFBTSxHQUFHLEdBQUcsTUFBTSxLQUFLLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLEdBQUcsTUFBTSxHQUFHLFFBQVEsRUFBRTtnQkFDbEUsT0FBTyxFQUFFO29CQUNQLFdBQVcsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sSUFBSSxFQUFFO2lCQUN2QzthQUNGLENBQUMsQ0FBQTtZQUNGLElBQUksSUFBSSxFQUFFLENBQUM7Z0JBQ1QsT0FBTyxHQUFHLENBQUMsSUFBSSxFQUFFLENBQUE7WUFDbkIsQ0FBQztpQkFBTSxDQUFDO2dCQUNOLE9BQU8sR0FBRyxDQUFBO1lBQ1osQ0FBQztRQUNILENBQUM7S0FBQTtJQUVLLGFBQWEsQ0FBRSxHQUFXOztZQUM5QixNQUFNLEtBQUssR0FBRyxNQUFNLElBQUksQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFpQixDQUFBO1lBQ2pFLE9BQU8sS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxHQUFHLEtBQUssR0FBRyxDQUFDLENBQUE7UUFDdkMsQ0FBQztLQUFBO0lBRUssUUFBUTtxRUFBRSxFQUFVLEVBQUUsSUFB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5cbiAgYXN5bmMgZ2V0Q29udGVudFR5cGUgKGFzc2V0OiBBc3NldCkge1xuICAgIGNvbnN0IGFzc2V0QnVmZmVyID0gYXdhaXQgdGhpcy5nZXRBc3NldEJ1ZmZlcihhc3NldClcbiAgICByZXR1cm4gYXNzZXRCdWZmZXIuaGVhZGVycy5nZXQoJ0NvbnRlbnQtVHlwZScpXG4gIH1cblxuICBwaG90b1VybCAoaWQ6IHN0cmluZywgc2l6ZT86IEltYWdlU2l6ZSkge1xuICAgIHJldHVybiBgJHtwcm9jZXNzLmVudi5TRVJWRVJfVVJMfS9waG90by8ke2lkfWAgKyAoc2l6ZSA/IGA/c2l6ZT0ke3NpemV9YCA6ICcnKVxuICB9XG5cbiAgdmlkZW9VcmwgKGlkOiBzdHJpbmcpIHtcbiAgICByZXR1cm4gYCR7cHJvY2Vzcy5lbnYuU0VSVkVSX1VSTH0vdmlkZW8vJHtpZH1gXG4gIH1cblxuICBpc0lkIChpZDogc3RyaW5nKSB7XG4gICAgcmV0dXJuICEhaWQubWF0Y2goL15bMC05YS1mXXs4fS1bMC05YS1mXXs0fS1bMC05YS1mXXs0fS1bMC05YS1mXXs0fS1bMC05YS1mXXsxMn0kLylcbiAgfVxufVxuXG5jb25zdCBpbW1pY2ggPSBuZXcgSW1taWNoKClcblxuZXhwb3J0IGRlZmF1bHQgaW1taWNoXG4iXX0=

55
dist/index.js vendored

File diff suppressed because one or more lines are too long

58
dist/render.js vendored Normal file
View file

@ -0,0 +1,58 @@
"use strict";
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* () {
const data = yield immich_1.default.getAssetBuffer(asset, size);
if (data) {
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 {
res.status(404).send();
}
});
}
gallery(res, assets, openItem) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const items = [];
for (const asset of assets) {
let video;
if (asset.type === types_1.AssetType.video) {
// Populate the data-video property
video = JSON.stringify({
source: [
{
src: immich_1.default.videoUrl(asset.id),
type: yield immich_1.default.getContentType(asset)
}
],
attributes: {
preload: false,
controls: true
}
});
}
items.push({
originalUrl: immich_1.default.photoUrl(asset.id),
thumbnailUrl: immich_1.default.photoUrl(asset.id, types_1.ImageSize.thumbnail),
video
});
}
res.render('gallery', {
items,
openItem
});
});
}
}
const render = new Render();
exports.default = render;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVuZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3JlbmRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw4REFBNkI7QUFFN0IsbUNBQXFEO0FBQ3JELDBEQUF5QjtBQUV6QixNQUFNLE1BQU07SUFDSixXQUFXLENBQUUsR0FBYSxFQUFFLEtBQVksRUFBRSxJQUFnQjs7WUFDOUQsTUFBTSxJQUFJLEdBQUcsTUFBTSxnQkFBTSxDQUFDLGNBQWMsQ0FBQyxLQUFLLEVBQUUsSUFBSSxDQUFDLENBQUE7WUFDckQsSUFBSSxJQUFJLEVBQUUsQ0FBQztnQkFDVCxLQUFLLE1BQU0sTUFBTSxJQUFJLENBQUMsY0FBYyxFQUFFLGdCQUFnQixDQUFDLEVBQUUsQ0FBQztvQkFDeEQsR0FBRyxDQUFDLEdBQUcsQ0FBQyxNQUFNLEVBQUUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFBO2dCQUN2QyxDQUFDO2dCQUNELE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxJQUFBLGVBQUssR0F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aXplLnRodW1ibmFpbCksXG4gICAgICAgIHZpZGVvXG4gICAgICB9KVxuICAgIH1cbiAgICByZXMucmVuZGVyKCdnYWxsZXJ5Jywge1xuICAgICAgaXRlbXMsXG4gICAgICBvcGVuSXRlbVxuICAgIH0pXG4gIH1cbn1cblxuY29uc3QgcmVuZGVyID0gbmV3IFJlbmRlcigpXG5cbmV4cG9ydCBkZWZhdWx0IHJlbmRlclxuIl19

13
dist/types.js vendored
View file

@ -1,3 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBpbnRlcmZhY2UgU2hhcmVkTGlua0Fzc2V0IHtcbiAgaWQ6IHN0cmluZztcbn1cblxuZXhwb3J0IGludGVyZmFjZSBTaGFyZWRMaW5rIHtcbiAga2V5OiBzdHJpbmc7XG4gIGFzc2V0czogU2hhcmVkTGlua0Fzc2V0W11cbn1cbiJdfQ==
exports.ImageSize = exports.AssetType = void 0;
var AssetType;
(function (AssetType) {
AssetType["image"] = "IMAGE";
AssetType["video"] = "VIDEO";
})(AssetType || (exports.AssetType = AssetType = {}));
var ImageSize;
(function (ImageSize) {
ImageSize["thumbnail"] = "thumbnail";
ImageSize["original"] = "original";
})(ImageSize || (exports.ImageSize = ImageSize = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsSUFBWSxTQUdYO0FBSEQsV0FBWSxTQUFTO0lBQ25CLDRCQUFlLENBQUE7SUFDZiw0QkFBZSxDQUFBO0FBQ2pCLENBQUMsRUFIVyxTQUFTLHlCQUFULFNBQVMsUUFHcEI7QUFZRCxJQUFZLFNBR1g7QUFIRCxXQUFZLFNBQVM7SUFDbkIsb0NBQXVCLENBQUE7SUFDdkIsa0NBQXFCLENBQUE7QUFDdkIsQ0FBQyxFQUhXLFNBQVMseUJBQVQsU0FBUyxRQUdwQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBlbnVtIEFzc2V0VHlwZSB7XG4gIGltYWdlID0gJ0lNQUdFJyxcbiAgdmlkZW8gPSAnVklERU8nXG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQXNzZXQge1xuICBpZDogc3RyaW5nO1xuICB0eXBlOiBBc3NldFR5cGU7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgU2hhcmVkTGluayB7XG4gIGtleTogc3RyaW5nO1xuICBhc3NldHM6IEFzc2V0W11cbn1cblxuZXhwb3J0IGVudW0gSW1hZ2VTaXplIHtcbiAgdGh1bWJuYWlsID0gJ3RodW1ibmFpbCcsXG4gIG9yaWdpbmFsID0gJ29yaWdpbmFsJ1xufVxuIl19