pigallery2-extension-kit 2.0.3-edge4 → 2.0.3-edge6
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 +9 -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 +87 -0
- package/lib/backend/model/extension/ExtensionConfigWrapper.d.ts +3 -11
- package/lib/backend/model/extension/ExtensionConfigWrapper.js +46 -0
- package/lib/backend/model/extension/ExtensionObject.d.ts +1 -1
- package/lib/backend/model/extension/IExtension.d.ts +21 -3
- package/lib/backend/model/fileaccess/DiskManager.d.ts +5 -1
- package/lib/backend/model/fileaccess/MetadataLoader.d.ts +1 -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/common/BackendTexts.d.ts +4 -0
- package/lib/common/BackendTexts.js +1 -0
- package/lib/common/DataStructureVersion.d.ts +1 -1
- package/lib/common/QueryParams.d.ts +1 -0
- package/lib/common/Utils.d.ts +7 -0
- package/lib/common/Utils.js +52 -0
- package/lib/common/config/private/Config.d.ts +4 -6
- package/lib/common/config/private/Config.js +10 -92
- 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/subconfigs/MessagingConfig.d.ts +15 -0
- package/lib/common/config/private/subconfigs/MessagingConfig.js +134 -0
- package/lib/common/config/private/subconfigs/ServerExtensionsConfig.d.ts +13 -0
- package/lib/common/config/private/subconfigs/ServerExtensionsConfig.js +98 -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 +13 -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/Logger.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare type logFN = (...args: (string | number)[]) => void;
|
|
2
|
-
export declare type
|
|
1
|
+
export declare type logFN = (...args: (string | number | (() => string))[]) => void;
|
|
2
|
+
export declare type LoggerArgs = (string | number | (() => string));
|
|
3
|
+
export declare type LoggerFunction = (...args: LoggerArgs[]) => void;
|
|
3
4
|
export interface ILogger {
|
|
4
5
|
silly: LoggerFunction;
|
|
5
6
|
debug: LoggerFunction;
|
|
@@ -10,11 +11,11 @@ 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;
|
|
20
21
|
}
|
|
@@ -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,87 @@
|
|
|
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 LOG_TAG = '[ExtensionConfigTemplateLoader]';
|
|
8
|
+
/**
|
|
9
|
+
* This class decouples the extension management and the config.
|
|
10
|
+
* It helps to solve the "chicken and the egg" which should load first:
|
|
11
|
+
* Config or the extension as they have a circular dependency
|
|
12
|
+
*/
|
|
13
|
+
class ExtensionConfigTemplateLoader {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.loaded = false;
|
|
16
|
+
this.extensionList = [];
|
|
17
|
+
this.extensionTemplates = [];
|
|
18
|
+
}
|
|
19
|
+
static get Instance() {
|
|
20
|
+
if (!this.instance) {
|
|
21
|
+
this.instance = new ExtensionConfigTemplateLoader();
|
|
22
|
+
}
|
|
23
|
+
return this.instance;
|
|
24
|
+
}
|
|
25
|
+
init(extensionsFolder) {
|
|
26
|
+
this.extensionsFolder = extensionsFolder;
|
|
27
|
+
}
|
|
28
|
+
loadExtensionTemplates(config) {
|
|
29
|
+
if (!this.extensionsFolder) {
|
|
30
|
+
throw new Error('Unknown extensions folder.');
|
|
31
|
+
}
|
|
32
|
+
// already loaded
|
|
33
|
+
if (!this.loaded) {
|
|
34
|
+
this.extensionList = (fs
|
|
35
|
+
.readdirSync(this.extensionsFolder))
|
|
36
|
+
.filter((f) => fs.statSync(path.join(this.extensionsFolder, f)).isDirectory());
|
|
37
|
+
this.extensionList.sort();
|
|
38
|
+
this.extensionTemplates = [];
|
|
39
|
+
for (let i = 0; i < this.extensionList.length; ++i) {
|
|
40
|
+
const extFolder = this.extensionList[i];
|
|
41
|
+
const extPath = path.join(this.extensionsFolder, extFolder);
|
|
42
|
+
const serverExtPath = path.join(extPath, 'server.js');
|
|
43
|
+
if (!fs.existsSync(serverExtPath)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
47
|
+
const ext = require(serverExtPath);
|
|
48
|
+
if (typeof ext?.initConfig === 'function') {
|
|
49
|
+
ext?.initConfig({
|
|
50
|
+
setConfigTemplate: (template) => {
|
|
51
|
+
this.extensionTemplates.push({ folder: extFolder, template: template });
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
//also create basic config extensions that do not have any
|
|
57
|
+
this.extensionTemplates.push({ folder: extFolder });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this.loaded = true;
|
|
61
|
+
}
|
|
62
|
+
this.setTemplatesToConfig(config);
|
|
63
|
+
}
|
|
64
|
+
setTemplatesToConfig(config) {
|
|
65
|
+
if (!this.extensionTemplates) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const ePaths = this.extensionTemplates.map(et => et.folder);
|
|
69
|
+
// delete not existing extensions
|
|
70
|
+
config.Extensions.extensions = config.Extensions.extensions
|
|
71
|
+
.filter(ec => ePaths.indexOf(ec.path) !== -1);
|
|
72
|
+
for (let i = 0; i < this.extensionTemplates.length; ++i) {
|
|
73
|
+
const ext = this.extensionTemplates[i];
|
|
74
|
+
let c = (config.Extensions.extensions || [])
|
|
75
|
+
.find(e => e.path === ext.folder);
|
|
76
|
+
// set the new structure with the new def values
|
|
77
|
+
if (!c) {
|
|
78
|
+
c = new ServerExtensionsConfig_1.ServerExtensionsEntryConfig(ext.folder);
|
|
79
|
+
if (ext.template) {
|
|
80
|
+
c.configs = new ext.template();
|
|
81
|
+
}
|
|
82
|
+
config.Extensions.extensions.push(c);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
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(showError?: boolean): Promise<PrivateConfigClass & IConfigClass>;
|
|
8
|
+
static originalSync(showError?: boolean): PrivateConfigClass & IConfigClass;
|
|
17
9
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 LOG_TAG = '[ExtensionConfigWrapper]';
|
|
9
|
+
/**
|
|
10
|
+
* Wraps to original config and makes sure all extension related config is loaded
|
|
11
|
+
*/
|
|
12
|
+
class ExtensionConfigWrapper {
|
|
13
|
+
static async original(showError = false) {
|
|
14
|
+
const pc = node_1.ConfigClassBuilder.attachPrivateInterface(new PrivateConfigClass_1.PrivateConfigClass());
|
|
15
|
+
ExtensionConfigTemplateLoader_1.ExtensionConfigTemplateLoader.Instance.loadExtensionTemplates(pc);
|
|
16
|
+
try {
|
|
17
|
+
await pc.load(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
if (showError) {
|
|
21
|
+
console.error(LOG_TAG, 'Error during loading config. Reverting to defaults.');
|
|
22
|
+
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.');
|
|
23
|
+
console.error(e);
|
|
24
|
+
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)));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return pc;
|
|
28
|
+
}
|
|
29
|
+
static originalSync(showError = false) {
|
|
30
|
+
const pc = node_1.ConfigClassBuilder.attachPrivateInterface(new PrivateConfigClass_1.PrivateConfigClass());
|
|
31
|
+
ExtensionConfigTemplateLoader_1.ExtensionConfigTemplateLoader.Instance.loadExtensionTemplates(pc);
|
|
32
|
+
try {
|
|
33
|
+
pc.loadSync(); // loading the basic configs, but we do not know the extension config hierarchy yet
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
if (showError) {
|
|
37
|
+
console.error(LOG_TAG, 'Error during loading config. Reverting to defaults.');
|
|
38
|
+
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.');
|
|
39
|
+
console.error(e);
|
|
40
|
+
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)));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return pc;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
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,10 +194,22 @@ 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
205
|
* Extension interface. All extension is expected to implement and export these methods
|
|
193
206
|
*/
|
|
194
207
|
export interface IServerExtension<C> {
|
|
208
|
+
/**
|
|
209
|
+
* This function can be called any time. It should only set the config template class
|
|
210
|
+
* @param extension
|
|
211
|
+
*/
|
|
212
|
+
initConfig(extension: IExtensionConfigInit<C>): void;
|
|
195
213
|
/**
|
|
196
214
|
* Extension init function. Extension should at minimum expose this function.
|
|
197
215
|
* @param extension
|
|
@@ -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,5 +1,5 @@
|
|
|
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;
|
|
@@ -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;
|
|
@@ -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 },
|
package/lib/common/Utils.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export declare class Utils {
|
|
|
14
14
|
static equalsFilter(object: any, filter: any, skipProp?: string[]): boolean;
|
|
15
15
|
static toIsoString(d: number | Date): string;
|
|
16
16
|
static makeUTCMidnight(d: number | Date): Date;
|
|
17
|
+
static getUTCFullYear(d: number | Date, offset: string): number;
|
|
18
|
+
static getFullYear(d: number | Date, offset: string): number;
|
|
19
|
+
static getOffsetString(offsetMinutes: number): string;
|
|
20
|
+
static getOffsetMinutes(offsetString: string): number;
|
|
21
|
+
static isLeapYear(year: number): boolean;
|
|
22
|
+
static isDateFromLeapYear(date: Date): boolean;
|
|
23
|
+
static getDayOfYear(date: Date): number;
|
|
17
24
|
static renderDataSize(size: number): string;
|
|
18
25
|
static getUnique(arr: any[]): any[];
|
|
19
26
|
static createRange(from: number, to: number): Array<number>;
|
package/lib/common/Utils.js
CHANGED
|
@@ -98,6 +98,58 @@ class Utils {
|
|
|
98
98
|
d.setUTCMilliseconds(0);
|
|
99
99
|
return d;
|
|
100
100
|
}
|
|
101
|
+
static getUTCFullYear(d, offset) {
|
|
102
|
+
if (!(d instanceof Date)) {
|
|
103
|
+
d = new Date(d);
|
|
104
|
+
}
|
|
105
|
+
return new Date(new Date(d).toISOString().substring(0, 19) + (offset ? offset : '')).getUTCFullYear();
|
|
106
|
+
}
|
|
107
|
+
static getFullYear(d, offset) {
|
|
108
|
+
if (!(d instanceof Date)) {
|
|
109
|
+
d = new Date(d);
|
|
110
|
+
}
|
|
111
|
+
return new Date(new Date(d).toISOString().substring(0, 19) + (offset ? offset : '')).getFullYear();
|
|
112
|
+
}
|
|
113
|
+
static getOffsetString(offsetMinutes) {
|
|
114
|
+
if (-720 <= offsetMinutes && offsetMinutes <= 840) {
|
|
115
|
+
//valid offset is within -12 and +14 hrs (https://en.wikipedia.org/wiki/List_of_UTC_offsets)
|
|
116
|
+
return (offsetMinutes < 0 ? "-" : "+") + //leading +/-
|
|
117
|
+
("0" + Math.trunc(Math.abs(offsetMinutes) / 60)).slice(-2) + ":" + //zeropadded hours and ':'
|
|
118
|
+
("0" + Math.abs(offsetMinutes) % 60).slice(-2); //zeropadded minutes
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
static getOffsetMinutes(offsetString) {
|
|
125
|
+
const regex = /^([+-](0[0-9]|1[0-4]):[0-5][0-9])$/; //checks if offset is between -14:00 and +14:00.
|
|
126
|
+
//-12:00 is the lowest valid UTC-offset, but we allow down to -14 for efficiency
|
|
127
|
+
if (regex.test(offsetString)) {
|
|
128
|
+
const hhmm = offsetString.split(":");
|
|
129
|
+
const hours = parseInt(hhmm[0]);
|
|
130
|
+
return hours < 0 ? ((hours * 60) - parseInt(hhmm[1])) : ((hours * 60) + parseInt(hhmm[1]));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
static isLeapYear(year) {
|
|
137
|
+
return (0 == year % 4) && (0 != year % 100) || (0 == year % 400);
|
|
138
|
+
}
|
|
139
|
+
static isDateFromLeapYear(date) {
|
|
140
|
+
return Utils.isLeapYear(date.getFullYear());
|
|
141
|
+
}
|
|
142
|
+
// Get Day of Year
|
|
143
|
+
static getDayOfYear(date) {
|
|
144
|
+
//Day-number at the start of Jan to Dec. A month baseline
|
|
145
|
+
const dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
|
146
|
+
const mn = date.getMonth();
|
|
147
|
+
let dayOfYear = dayCount[mn] + date.getDate(); //add the date to the month baseline
|
|
148
|
+
if (mn > 1 && Utils.isLeapYear((date.getFullYear()))) {
|
|
149
|
+
dayOfYear++; //Add an extra day for march to december (mn>1) on leap years
|
|
150
|
+
}
|
|
151
|
+
return dayOfYear;
|
|
152
|
+
}
|
|
101
153
|
static renderDataSize(size) {
|
|
102
154
|
const postFixes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
103
155
|
let index = 0;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare const Config: IConfigClass<unknown> & PrivateConfigClass;
|
|
1
|
+
import { PrivateConfigClass } from './PrivateConfigClass';
|
|
2
|
+
export declare const Config: PrivateConfigClass & import("typeconfig").IConfigClass<{
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}>;
|