pigallery2-extension-kit 2.0.3-edge5 → 2.0.3-edge7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/backend/Logger.d.ts +10 -8
- package/lib/backend/model/database/enitites/MediaEntity.d.ts +2 -0
- package/lib/backend/model/diagnostics/ConfigDiagnostics.d.ts +4 -3
- package/lib/backend/model/extension/ExtensionApp.d.ts +3 -1
- package/lib/backend/model/extension/ExtensionConfig.d.ts +6 -0
- package/lib/backend/model/extension/ExtensionConfigTemplateLoader.d.ts +17 -0
- package/lib/backend/model/extension/ExtensionConfigTemplateLoader.js +97 -0
- package/lib/backend/model/extension/ExtensionConfigWrapper.d.ts +3 -11
- package/lib/backend/model/extension/ExtensionConfigWrapper.js +59 -0
- package/lib/backend/model/extension/ExtensionObject.d.ts +1 -1
- package/lib/backend/model/extension/IExtension.d.ts +29 -4
- package/lib/backend/model/fileaccess/DiskManager.d.ts +5 -1
- package/lib/backend/model/fileaccess/MetadataLoader.d.ts +13 -1
- package/lib/backend/model/fileaccess/fileprocessing/PhotoProcessing.d.ts +0 -1
- package/lib/backend/model/jobs/JobRepository.d.ts +1 -0
- package/lib/backend/model/jobs/jobs/PhotoConvertingJob.d.ts +12 -1
- package/lib/backend/model/messenger/MessengerRepository.d.ts +3 -1
- package/lib/backend/routes/GalleryRouter.d.ts +6 -2
- package/lib/backend/routes/LoggerRouter.d.ts +2 -2
- package/lib/backend/server.d.ts +4 -2
- package/lib/common/BackendTexts.d.ts +4 -0
- package/lib/common/BackendTexts.js +1 -0
- package/lib/common/DataStructureVersion.d.ts +1 -1
- package/lib/common/HTMLCharCodes.d.ts +5 -0
- package/lib/common/HTMLCharCodes.js +117 -0
- package/lib/common/QueryParams.d.ts +1 -0
- package/lib/common/Utils.d.ts +16 -0
- package/lib/common/Utils.js +182 -1
- package/lib/common/config/private/Config.d.ts +4 -6
- package/lib/common/config/private/Config.js +11 -91
- package/lib/common/config/private/PrivateConfig.d.ts +4 -17
- package/lib/common/config/private/PrivateConfig.js +16 -130
- package/lib/common/config/private/PrivateConfigClass.d.ts +4 -0
- package/lib/common/config/private/PrivateConfigClass.js +86 -0
- package/lib/common/config/private/{MessagingConfig.js → subconfigs/MessagingConfig.js} +1 -1
- package/lib/common/config/private/subconfigs/ServerExtensionsConfig.d.ts +13 -0
- package/lib/common/config/private/subconfigs/ServerExtensionsConfig.js +100 -0
- package/lib/common/config/public/ClientConfig.d.ts +45 -25
- package/lib/common/config/public/ClientConfig.js +150 -110
- package/lib/common/entities/ConentWrapper.js +12 -0
- package/lib/common/entities/MediaDTO.d.ts +3 -0
- package/lib/common/entities/PhotoDTO.d.ts +2 -0
- package/lib/common/entities/VideoDTO.d.ts +1 -0
- package/lib/common/entities/job/JobDTO.d.ts +6 -2
- package/lib/common/entities/job/JobDTO.js +1 -2
- package/lib/frontend/app/model/query.service.d.ts +4 -1
- package/lib/frontend/app/ui/gallery/Media.d.ts +0 -1
- package/lib/frontend/app/ui/gallery/MediaIcon.d.ts +13 -2
- package/lib/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.d.ts +19 -11
- package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.d.ts +4 -0
- package/lib/frontend/app/ui/settings/scheduled-jobs.service.d.ts +2 -1
- package/lib/frontend/app/ui/settings/template/CustomSettingsEntries.d.ts +24 -1
- package/lib/frontend/app/ui/settings/template/template.component.d.ts +5 -0
- package/lib/frontend/app/ui/settings/workflow/button/job-button.settings.component.d.ts +9 -2
- package/package.json +1 -1
- package/lib/backend/middlewares/thumbnail/PhotoConverterMWs.d.ts +0 -4
- package/lib/backend/model/jobs/jobs/ThumbnailGenerationJob.d.ts +0 -18
- /package/lib/common/config/private/{MessagingConfig.d.ts → subconfigs/MessagingConfig.d.ts} +0 -0
package/lib/backend/Logger.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type
|
|
1
|
+
import { ErrorCodes } from '../common/entities/Error';
|
|
2
|
+
export declare type LoggerArgs = (string | number | (() => string) | Record<any, unknown> | Error);
|
|
3
|
+
export declare type LoggerFunction = (...args: LoggerArgs[]) => void;
|
|
3
4
|
export interface ILogger {
|
|
4
5
|
silly: LoggerFunction;
|
|
5
6
|
debug: LoggerFunction;
|
|
@@ -10,11 +11,12 @@ export interface ILogger {
|
|
|
10
11
|
}
|
|
11
12
|
export declare const createLoggerWrapper: (TAG: string) => ILogger;
|
|
12
13
|
export declare class Logger {
|
|
13
|
-
static silly(...args:
|
|
14
|
-
static debug(...args:
|
|
15
|
-
static verbose(...args:
|
|
16
|
-
static info(...args:
|
|
17
|
-
static warn(...args:
|
|
18
|
-
static error(...args:
|
|
14
|
+
static silly(...args: LoggerArgs[]): void;
|
|
15
|
+
static debug(...args: LoggerArgs[]): void;
|
|
16
|
+
static verbose(...args: LoggerArgs[]): void;
|
|
17
|
+
static info(...args: LoggerArgs[]): void;
|
|
18
|
+
static warn(...args: LoggerArgs[]): void;
|
|
19
|
+
static error(...args: LoggerArgs[]): void;
|
|
19
20
|
private static log;
|
|
21
|
+
static logLevelForError(e: ErrorCodes): LoggerFunction;
|
|
20
22
|
}
|
|
@@ -27,6 +27,7 @@ export declare class PositionMetaDataEntity implements PositionMetaData {
|
|
|
27
27
|
}
|
|
28
28
|
export declare class MediaMetadataEntity implements MediaMetadata {
|
|
29
29
|
caption: string;
|
|
30
|
+
title?: string;
|
|
30
31
|
size: MediaDimensionEntity;
|
|
31
32
|
/**
|
|
32
33
|
* Date in local timezone
|
|
@@ -34,6 +35,7 @@ export declare class MediaMetadataEntity implements MediaMetadata {
|
|
|
34
35
|
* you do not want to see 2AM next to a photo that was taken during lunch
|
|
35
36
|
*/
|
|
36
37
|
creationDate: number;
|
|
38
|
+
creationDateOffset?: string;
|
|
37
39
|
fileSize: number;
|
|
38
40
|
keywords: string[];
|
|
39
41
|
cameraData: CameraMetadataEntity;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { PrivateConfigClass } from '../../../common/config/private/
|
|
1
|
+
import { PrivateConfigClass } from '../../../common/config/private/PrivateConfigClass';
|
|
2
2
|
import { ClientAlbumConfig, ClientFacesConfig, ClientMapConfig, ClientMetaFileConfig, ClientRandomPhotoConfig, ClientSearchConfig, ClientSharingConfig } from '../../../common/config/public/ClientConfig';
|
|
3
|
-
import { ServerAlbumCoverConfig, ServerDataBaseConfig, ServerJobConfig,
|
|
3
|
+
import { ServerAlbumCoverConfig, ServerDataBaseConfig, ServerJobConfig, ServerPhotoConfig, ServerVideoConfig } from '../../../common/config/private/PrivateConfig';
|
|
4
4
|
export declare class ConfigDiagnostics {
|
|
5
5
|
static testAlbumsConfig(albumConfig: ClientAlbumConfig, original: PrivateConfigClass): void;
|
|
6
6
|
static checkReadWritePermission(path: string): Promise<void>;
|
|
7
7
|
static testDatabase(databaseConfig: ServerDataBaseConfig): Promise<void>;
|
|
8
|
+
static testJobsConfig(jobsConfig: ServerJobConfig): Promise<void>;
|
|
8
9
|
static testMetaFileConfig(metaFileConfig: ClientMetaFileConfig, config: PrivateConfigClass): Promise<void>;
|
|
9
10
|
static testVideoConfig(videoConfig: ServerVideoConfig, config: PrivateConfigClass): Promise<void>;
|
|
10
11
|
static testSharp(): Promise<void>;
|
|
11
12
|
static testTempFolder(folder: string): Promise<void>;
|
|
12
13
|
static testImageFolder(folder: string): Promise<void>;
|
|
13
|
-
static
|
|
14
|
+
static testPhotoConfig(photoConfig: ServerPhotoConfig): Promise<void>;
|
|
14
15
|
static testTasksConfig(task: ServerJobConfig, config: PrivateConfigClass): Promise<void>;
|
|
15
16
|
static testFacesConfig(faces: ClientFacesConfig, config: PrivateConfigClass): Promise<void>;
|
|
16
17
|
static testSearchConfig(search: ClientSearchConfig, config: PrivateConfigClass): Promise<void>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { IExtensionApp } from './IExtension';
|
|
3
3
|
import { ObjectManagers } from '../ObjectManagers';
|
|
4
4
|
export declare class ExtensionApp implements IExtensionApp {
|
|
5
|
-
get config(): import("
|
|
5
|
+
get config(): import("../../../common/config/private/PrivateConfigClass").PrivateConfigClass & import("typeconfig").IConfigClass<{
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>;
|
|
6
8
|
get expressApp(): import("express").Express;
|
|
7
9
|
get objectManagers(): ObjectManagers;
|
|
8
10
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PrivateConfigClass } from '../../../common/config/private/PrivateConfigClass';
|
|
2
|
+
/**
|
|
3
|
+
* This class decouples the extension management and the config.
|
|
4
|
+
* It helps to solve the "chicken and the egg" which should load first:
|
|
5
|
+
* Config or the extension as they have a circular dependency
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExtensionConfigTemplateLoader {
|
|
8
|
+
private static instance;
|
|
9
|
+
private extensionsFolder;
|
|
10
|
+
private loaded;
|
|
11
|
+
private extensionList;
|
|
12
|
+
private extensionTemplates;
|
|
13
|
+
static get Instance(): ExtensionConfigTemplateLoader;
|
|
14
|
+
init(extensionsFolder: string): void;
|
|
15
|
+
loadExtensionTemplates(config: PrivateConfigClass): void;
|
|
16
|
+
private setTemplatesToConfig;
|
|
17
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtensionConfigTemplateLoader = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const ServerExtensionsConfig_1 = require("../../../common/config/private/subconfigs/ServerExtensionsConfig");
|
|
7
|
+
const child_process = require("child_process");
|
|
8
|
+
const execSync = child_process.execSync;
|
|
9
|
+
const LOG_TAG = '[ExtensionConfigTemplateLoader]';
|
|
10
|
+
/**
|
|
11
|
+
* This class decouples the extension management and the config.
|
|
12
|
+
* It helps to solve the "chicken and the egg" which should load first:
|
|
13
|
+
* Config or the extension as they have a circular dependency
|
|
14
|
+
*/
|
|
15
|
+
class ExtensionConfigTemplateLoader {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.loaded = false;
|
|
18
|
+
this.extensionList = [];
|
|
19
|
+
this.extensionTemplates = [];
|
|
20
|
+
}
|
|
21
|
+
static get Instance() {
|
|
22
|
+
if (!this.instance) {
|
|
23
|
+
this.instance = new ExtensionConfigTemplateLoader();
|
|
24
|
+
}
|
|
25
|
+
return this.instance;
|
|
26
|
+
}
|
|
27
|
+
init(extensionsFolder) {
|
|
28
|
+
this.extensionsFolder = extensionsFolder;
|
|
29
|
+
}
|
|
30
|
+
loadExtensionTemplates(config) {
|
|
31
|
+
if (!this.extensionsFolder) {
|
|
32
|
+
throw new Error('Unknown extensions folder.');
|
|
33
|
+
}
|
|
34
|
+
// already loaded
|
|
35
|
+
if (!this.loaded) {
|
|
36
|
+
this.extensionTemplates = [];
|
|
37
|
+
if (fs.existsSync(this.extensionsFolder)) {
|
|
38
|
+
this.extensionList = (fs
|
|
39
|
+
.readdirSync(this.extensionsFolder))
|
|
40
|
+
.filter((f) => fs.statSync(path.join(this.extensionsFolder, f)).isDirectory());
|
|
41
|
+
this.extensionList.sort();
|
|
42
|
+
for (let i = 0; i < this.extensionList.length; ++i) {
|
|
43
|
+
const extFolder = this.extensionList[i];
|
|
44
|
+
const extPath = path.join(this.extensionsFolder, extFolder);
|
|
45
|
+
const configExtPath = path.join(extPath, 'config.js');
|
|
46
|
+
const serverExtPath = path.join(extPath, 'server.js');
|
|
47
|
+
// if server.js is missing, it's not a valid extension
|
|
48
|
+
if (!fs.existsSync(serverExtPath)) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (fs.existsSync(configExtPath)) {
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
53
|
+
const extCfg = require(configExtPath);
|
|
54
|
+
if (typeof extCfg?.initConfig === 'function') {
|
|
55
|
+
extCfg?.initConfig({
|
|
56
|
+
setConfigTemplate: (template) => {
|
|
57
|
+
this.extensionTemplates.push({ folder: extFolder, template: template });
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
//also create basic config extensions that do not have any
|
|
64
|
+
this.extensionTemplates.push({ folder: extFolder });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
this.loaded = true;
|
|
69
|
+
}
|
|
70
|
+
this.setTemplatesToConfig(config);
|
|
71
|
+
}
|
|
72
|
+
setTemplatesToConfig(config) {
|
|
73
|
+
if (!this.extensionTemplates) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const ePaths = this.extensionTemplates.map(et => et.folder);
|
|
77
|
+
// delete not existing extensions
|
|
78
|
+
config.Extensions.extensions = config.Extensions.extensions
|
|
79
|
+
.filter(ec => ePaths.indexOf(ec.path) !== -1);
|
|
80
|
+
for (let i = 0; i < this.extensionTemplates.length; ++i) {
|
|
81
|
+
const ext = this.extensionTemplates[i];
|
|
82
|
+
let c = (config.Extensions.extensions || [])
|
|
83
|
+
.find(e => e.path === ext.folder);
|
|
84
|
+
// set the new structure with the new def values
|
|
85
|
+
if (!c) {
|
|
86
|
+
c = new ServerExtensionsConfig_1.ServerExtensionsEntryConfig(ext.folder);
|
|
87
|
+
if (ext.template) {
|
|
88
|
+
c.configs = new ext.template();
|
|
89
|
+
}
|
|
90
|
+
// TODO: this does not hold if the order of the extensions mixes up.
|
|
91
|
+
// TODO: experiment with a map instead of an array
|
|
92
|
+
config.Extensions.extensions.push(c);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.ExtensionConfigTemplateLoader = ExtensionConfigTemplateLoader;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { IConfigClass } from 'typeconfig/common';
|
|
2
|
-
import { PrivateConfigClass } from '../../../common/config/private/
|
|
3
|
-
import { IExtensionConfig } from './IExtension';
|
|
2
|
+
import { PrivateConfigClass } from '../../../common/config/private/PrivateConfigClass';
|
|
4
3
|
/**
|
|
5
4
|
* Wraps to original config and makes sure all extension related config is loaded
|
|
6
5
|
*/
|
|
7
6
|
export declare class ExtensionConfigWrapper {
|
|
8
|
-
static original(): Promise<PrivateConfigClass & IConfigClass>;
|
|
9
|
-
|
|
10
|
-
export declare class ExtensionConfig<C> implements IExtensionConfig<C> {
|
|
11
|
-
private readonly extensionId;
|
|
12
|
-
template: new () => C;
|
|
13
|
-
constructor(extensionId: string);
|
|
14
|
-
getConfig(): C;
|
|
15
|
-
setTemplate(template: new () => C): void;
|
|
16
|
-
loadToConfig(config: PrivateConfigClass): void;
|
|
7
|
+
static original(showDetailedError?: boolean): Promise<PrivateConfigClass & IConfigClass>;
|
|
8
|
+
static originalSync(showDetailedError?: boolean): PrivateConfigClass & IConfigClass;
|
|
17
9
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtensionConfigWrapper = void 0;
|
|
4
|
+
const PrivateConfigClass_1 = require("../../../common/config/private/PrivateConfigClass");
|
|
5
|
+
const node_1 = require("typeconfig/node");
|
|
6
|
+
const ExtensionConfigTemplateLoader_1 = require("./ExtensionConfigTemplateLoader");
|
|
7
|
+
const NotifocationManager_1 = require("../NotifocationManager");
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const LOG_TAG = '[ExtensionConfigWrapper]';
|
|
10
|
+
/**
|
|
11
|
+
* Wraps to original config and makes sure all extension related config is loaded
|
|
12
|
+
*/
|
|
13
|
+
class ExtensionConfigWrapper {
|
|
14
|
+
static async original(showDetailedError = false) {
|
|
15
|
+
const pc = node_1.ConfigClassBuilder.attachPrivateInterface(new PrivateConfigClass_1.PrivateConfigClass());
|
|
16
|
+
ExtensionConfigTemplateLoader_1.ExtensionConfigTemplateLoader.Instance.loadExtensionTemplates(pc);
|
|
17
|
+
try {
|
|
18
|
+
// make sure the config file exists by the time we load it.
|
|
19
|
+
// TODO: remove this once typeconfig is fixed and can properly load defaults in arrays
|
|
20
|
+
if (!fs.existsSync(pc.__options.configPath)) {
|
|
21
|
+
await pc.save();
|
|
22
|
+
}
|
|
23
|
+
await pc.load(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
|
24
|
+
// TODO make sure that all extensions are present even after loading them from file
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
console.error(LOG_TAG, 'Error during loading config. Reverting to defaults.');
|
|
28
|
+
console.error(e);
|
|
29
|
+
if (showDetailedError) {
|
|
30
|
+
console.error(LOG_TAG, 'This is most likely due to: 1) you added a bad configuration in the server.json OR 2) The configuration changed in the latest release.');
|
|
31
|
+
NotifocationManager_1.NotificationManager.error('Can\'t load config. Reverting to default. This is most likely due to: 1) you added a bad configuration in the server.json OR 2) The configuration changed in the latest release.', (e.toString ? e.toString() : JSON.stringify(e)));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return pc;
|
|
35
|
+
}
|
|
36
|
+
static originalSync(showDetailedError = false) {
|
|
37
|
+
const pc = node_1.ConfigClassBuilder.attachPrivateInterface(new PrivateConfigClass_1.PrivateConfigClass());
|
|
38
|
+
ExtensionConfigTemplateLoader_1.ExtensionConfigTemplateLoader.Instance.loadExtensionTemplates(pc);
|
|
39
|
+
try {
|
|
40
|
+
// make sure the config file exists by the time we load it.
|
|
41
|
+
// TODO: remove this once typeconfig is fixed and can properly load defaults in arrays
|
|
42
|
+
if (!fs.existsSync(pc.__options.configPath)) {
|
|
43
|
+
pc.saveSync();
|
|
44
|
+
}
|
|
45
|
+
pc.loadSync(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
|
46
|
+
// TODO make sure that all extensions are present even after loading them from file
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
console.error(LOG_TAG, 'Error during loading config. Reverting to defaults.');
|
|
50
|
+
console.error(e);
|
|
51
|
+
if (showDetailedError) {
|
|
52
|
+
console.error(LOG_TAG, 'This is most likely due to: 1) you added a bad configuration in the server.json OR 2) The configuration changed in the latest release.');
|
|
53
|
+
NotifocationManager_1.NotificationManager.error('Ca\'nt load config. Reverting to default. This is most likely due to: 1) you added a bad configuration in the server.json OR 2) The configuration changed in the latest release.', (e.toString ? e.toString() : JSON.stringify(e)));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return pc;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.ExtensionConfigWrapper = ExtensionConfigWrapper;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IExtensionEvents, IExtensionObject } from './IExtension';
|
|
2
2
|
import { ExtensionApp } from './ExtensionApp';
|
|
3
|
-
import { ExtensionConfig } from './ExtensionConfigWrapper';
|
|
4
3
|
import { ExtensionDB } from './ExtensionDB';
|
|
5
4
|
import { ExpressRouterWrapper } from './ExpressRouterWrapper';
|
|
6
5
|
import * as express from 'express';
|
|
7
6
|
import { ExtensionMessengerHandler } from './ExtensionMessengerHandler';
|
|
7
|
+
import { ExtensionConfig } from './ExtensionConfig';
|
|
8
8
|
export declare class ExtensionObject<C> implements IExtensionObject<C> {
|
|
9
9
|
readonly extensionId: string;
|
|
10
10
|
readonly extensionName: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
2
|
import { NextFunction, Request, Response } from 'express';
|
|
3
|
-
import { PrivateConfigClass } from '../../../common/config/private/
|
|
3
|
+
import { PrivateConfigClass } from '../../../common/config/private/PrivateConfigClass';
|
|
4
4
|
import { ObjectManagers } from '../ObjectManagers';
|
|
5
5
|
import { ProjectPathClass } from '../../ProjectPath';
|
|
6
6
|
import { ILogger } from '../../Logger';
|
|
@@ -20,7 +20,7 @@ export declare type IExtensionBeforeEventHandler<I extends unknown[], O> = (inpu
|
|
|
20
20
|
stopPropagation: boolean;
|
|
21
21
|
}) => Promise<I | O>;
|
|
22
22
|
/**
|
|
23
|
-
* input: is the input
|
|
23
|
+
* input: is the original input: this is output of all before handler. This value was also piped to app's function
|
|
24
24
|
* output: is the output of the app's function or the previous after handler
|
|
25
25
|
*/
|
|
26
26
|
export declare type IExtensionAfterEventHandler<I extends unknown[], O> = (data: {
|
|
@@ -75,6 +75,13 @@ export interface IExtensionEvents {
|
|
|
75
75
|
* photos, videos and metafiles
|
|
76
76
|
*/
|
|
77
77
|
DiskManager: {
|
|
78
|
+
excludeDir: IExtensionEvent<[
|
|
79
|
+
{
|
|
80
|
+
name: string;
|
|
81
|
+
parentDirRelativeName: string;
|
|
82
|
+
parentDirAbsoluteName: string;
|
|
83
|
+
}
|
|
84
|
+
], boolean>;
|
|
78
85
|
scanDirectory: IExtensionEvent<[
|
|
79
86
|
string,
|
|
80
87
|
DirectoryScanSettings
|
|
@@ -129,7 +136,6 @@ export interface IExtensionDB {
|
|
|
129
136
|
_getAllTables(): Function[];
|
|
130
137
|
}
|
|
131
138
|
export interface IExtensionConfig<C> {
|
|
132
|
-
setTemplate(template: new () => C): void;
|
|
133
139
|
getConfig(): C;
|
|
134
140
|
}
|
|
135
141
|
export interface IExtensionMessengers {
|
|
@@ -188,8 +194,16 @@ export interface IExtensionObject<C = void> {
|
|
|
188
194
|
*/
|
|
189
195
|
messengers: IExtensionMessengers;
|
|
190
196
|
}
|
|
197
|
+
export interface IExtensionConfigInit<C> {
|
|
198
|
+
/**
|
|
199
|
+
* Sets the config tempalte class
|
|
200
|
+
* @param template
|
|
201
|
+
*/
|
|
202
|
+
setConfigTemplate(template: new () => C): void;
|
|
203
|
+
}
|
|
191
204
|
/**
|
|
192
|
-
* Extension interface. All extension is expected to implement and export these methods
|
|
205
|
+
* Extension interface. All extension is expected to implement and export these methods.
|
|
206
|
+
* This is the content of the server.js file
|
|
193
207
|
*/
|
|
194
208
|
export interface IServerExtension<C> {
|
|
195
209
|
/**
|
|
@@ -199,3 +213,14 @@ export interface IServerExtension<C> {
|
|
|
199
213
|
init(extension: IExtensionObject<C>): Promise<void>;
|
|
200
214
|
cleanUp?: (extension: IExtensionObject<C>) => Promise<void>;
|
|
201
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Extension config interface. All extension can implement and export these methods.
|
|
218
|
+
* This is the content of the config.js file.
|
|
219
|
+
*/
|
|
220
|
+
export interface IServerExtensionConfig<C> {
|
|
221
|
+
/**
|
|
222
|
+
* This function can be called any time. It should only set the config template class
|
|
223
|
+
* @param extension
|
|
224
|
+
*/
|
|
225
|
+
initConfig(extension: IExtensionConfigInit<C>): void;
|
|
226
|
+
}
|
|
@@ -11,7 +11,11 @@ export declare class DiskManager {
|
|
|
11
11
|
name: string;
|
|
12
12
|
}): string;
|
|
13
13
|
static dirName(dirPath: string): string;
|
|
14
|
-
static excludeDir(
|
|
14
|
+
static excludeDir(dir: {
|
|
15
|
+
name: string;
|
|
16
|
+
parentDirRelativeName: string;
|
|
17
|
+
parentDirAbsoluteName: string;
|
|
18
|
+
}): Promise<boolean>;
|
|
15
19
|
static scanDirectoryNoMetadata(relativeDirectoryName: string, settings?: DirectoryScanSettings): Promise<ParentDirectoryDTO<FileDTO>>;
|
|
16
20
|
static scanDirectory(relativeDirectoryName: string, settings?: DirectoryScanSettings): Promise<ParentDirectoryDTO>;
|
|
17
21
|
private static isEnabledMetaFile;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import { VideoMetadata } from '../../../common/entities/VideoDTO';
|
|
2
1
|
import { PhotoMetadata } from '../../../common/entities/PhotoDTO';
|
|
2
|
+
import { VideoMetadata } from '../../../common/entities/VideoDTO';
|
|
3
3
|
export declare class MetadataLoader {
|
|
4
4
|
static loadVideoMetadata(fullPath: string): Promise<VideoMetadata>;
|
|
5
5
|
private static readonly EMPTY_METADATA;
|
|
6
6
|
static loadPhotoMetadata(fullPath: string): Promise<PhotoMetadata>;
|
|
7
|
+
private static mapMetadata;
|
|
8
|
+
private static getOrientation;
|
|
9
|
+
private static mapImageDimensions;
|
|
10
|
+
private static mapKeywords;
|
|
11
|
+
private static mapTitle;
|
|
12
|
+
private static mapCaption;
|
|
13
|
+
private static mapTimestampAndOffset;
|
|
14
|
+
private static mapCameraData;
|
|
15
|
+
private static mapGPS;
|
|
16
|
+
private static mapToponyms;
|
|
17
|
+
private static mapRating;
|
|
18
|
+
private static mapFaces;
|
|
7
19
|
}
|
|
@@ -15,7 +15,6 @@ export declare class PhotoProcessing {
|
|
|
15
15
|
* @param convertedPath
|
|
16
16
|
*/
|
|
17
17
|
static isValidConvertedPath(convertedPath: string): Promise<boolean>;
|
|
18
|
-
static convertPhoto(mediaPath: string): Promise<string>;
|
|
19
18
|
static convertedPhotoExist(mediaPath: string, size: number): Promise<boolean>;
|
|
20
19
|
static generateThumbnail(mediaPath: string, size: number, sourceType: ThumbnailSourceType, makeSquare: boolean): Promise<string>;
|
|
21
20
|
static isPhoto(fullPath: string): boolean;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { FileJob } from './FileJob';
|
|
2
|
-
|
|
2
|
+
import { FileDTO } from '../../../../common/entities/FileDTO';
|
|
3
|
+
export declare class PhotoConvertingJob extends FileJob<{
|
|
4
|
+
sizes?: number[];
|
|
5
|
+
maxVideoSize?: number;
|
|
6
|
+
indexedOnly?: boolean;
|
|
7
|
+
}> {
|
|
3
8
|
readonly Name: string;
|
|
4
9
|
constructor();
|
|
5
10
|
get Supported(): boolean;
|
|
11
|
+
start(config: {
|
|
12
|
+
sizes?: number[];
|
|
13
|
+
indexedOnly?: boolean;
|
|
14
|
+
}, soloRun?: boolean, allowParallelRun?: boolean): Promise<void>;
|
|
15
|
+
protected filterMediaFiles(files: FileDTO[]): Promise<FileDTO[]>;
|
|
16
|
+
protected filterMetaFiles(files: FileDTO[]): Promise<FileDTO[]>;
|
|
6
17
|
protected shouldProcess(mPath: string): Promise<boolean>;
|
|
7
18
|
protected processFile(mPath: string): Promise<void>;
|
|
8
19
|
}
|
|
@@ -6,7 +6,9 @@ export declare class MessengerRepository {
|
|
|
6
6
|
};
|
|
7
7
|
static get Instance(): MessengerRepository;
|
|
8
8
|
getAll(): Messenger[];
|
|
9
|
-
remove(m:
|
|
9
|
+
remove(m: {
|
|
10
|
+
Name: string;
|
|
11
|
+
}): void;
|
|
10
12
|
register(msgr: Messenger): void;
|
|
11
13
|
get(name: string): Messenger;
|
|
12
14
|
}
|
|
@@ -4,13 +4,17 @@ export declare class GalleryRouter {
|
|
|
4
4
|
protected static addDirectoryList(app: Express): void;
|
|
5
5
|
protected static addDirectoryZip(app: Express): void;
|
|
6
6
|
protected static addGetImage(app: Express): void;
|
|
7
|
-
protected static addGetBestFitImage(app: Express): void;
|
|
8
7
|
protected static addGetVideo(app: Express): void;
|
|
9
8
|
protected static addGetBestFitVideo(app: Express): void;
|
|
10
9
|
protected static addGetMetaFile(app: Express): void;
|
|
11
10
|
protected static addGetBestFitMetaFile(app: Express): void;
|
|
12
11
|
protected static addRandom(app: Express): void;
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Used for serving photo thumbnails and previews
|
|
14
|
+
* @param app
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
17
|
+
protected static addGetResizedPhoto(app: Express): void;
|
|
14
18
|
protected static addGetVideoThumbnail(app: Express): void;
|
|
15
19
|
protected static addGetVideoIcon(app: Express): void;
|
|
16
20
|
protected static addGetImageIcon(app: Express): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Express, Request, Response } from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import { LoggerFunction } from '../Logger';
|
|
3
3
|
declare global {
|
|
4
4
|
namespace Express {
|
|
5
5
|
interface Request {
|
|
@@ -12,6 +12,6 @@ declare global {
|
|
|
12
12
|
* Adds logging to express
|
|
13
13
|
*/
|
|
14
14
|
export declare class LoggerRouter {
|
|
15
|
-
static log(loggerFn:
|
|
15
|
+
static log(loggerFn: LoggerFunction, req: Request, res: Response): void;
|
|
16
16
|
static route(app: Express): void;
|
|
17
17
|
}
|
package/lib/backend/server.d.ts
CHANGED
|
@@ -8,9 +8,10 @@ export declare class Server {
|
|
|
8
8
|
private server;
|
|
9
9
|
static instance: Server;
|
|
10
10
|
static getInstance(): Server;
|
|
11
|
-
constructor();
|
|
11
|
+
constructor(listen?: boolean);
|
|
12
12
|
get Server(): HttpServer;
|
|
13
|
-
init(): Promise<void>;
|
|
13
|
+
init(listen?: boolean): Promise<void>;
|
|
14
|
+
private SIGTERM;
|
|
14
15
|
/**
|
|
15
16
|
* Event listener for HTTP server "error" event.
|
|
16
17
|
*/
|
|
@@ -23,4 +24,5 @@ export declare class Server {
|
|
|
23
24
|
* Event listener for HTTP server "close" event.
|
|
24
25
|
*/
|
|
25
26
|
private onClose;
|
|
27
|
+
Stop(): Promise<void>;
|
|
26
28
|
}
|
|
@@ -5,6 +5,7 @@ exports.backendTexts = void 0;
|
|
|
5
5
|
exports.backendTexts = {
|
|
6
6
|
indexedFilesOnly: { name: 10, description: 12 },
|
|
7
7
|
sizeToGenerate: { name: 20, description: 22 },
|
|
8
|
+
maxVideoSize: { name: 23, description: 24 },
|
|
8
9
|
indexChangesOnly: { name: 30, description: 32 },
|
|
9
10
|
mediaPick: { name: 40, description: 42 },
|
|
10
11
|
emailTo: { name: 70, description: 72 },
|