mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-21 01:22:08 +02:00
parent
c82abf05d6
commit
012fc1f7b4
14
package-lock.json
generated
14
package-lock.json
generated
@ -27,7 +27,7 @@
|
||||
"reflect-metadata": "0.1.13",
|
||||
"sharp": "0.31.3",
|
||||
"ts-node-iptc": "1.0.11",
|
||||
"typeconfig": "2.2.15",
|
||||
"typeconfig": "2.3.1",
|
||||
"typeorm": "0.3.12",
|
||||
"xml2js": "0.6.2"
|
||||
},
|
||||
@ -20362,9 +20362,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typeconfig": {
|
||||
"version": "2.2.15",
|
||||
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.2.15.tgz",
|
||||
"integrity": "sha512-aqiuT5BtV0/0MYMMG78c1IqeJrF85r1W1pJckkGolPjHpE0ajA3oOgnRtX5DRDHsn3YzsY5FKMxj1B3J+ISx1g==",
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.3.1.tgz",
|
||||
"integrity": "sha512-xBdsf0tK/PcXyZzWq/U2xLNDNrVFkRQ9d8V9x3B5eu1LG5GmeDDK7zLScz79zbl0dCZzhjnvx4RRggY6DZAAZA==",
|
||||
"dependencies": {
|
||||
"minimist": "1.2.8"
|
||||
}
|
||||
@ -35283,9 +35283,9 @@
|
||||
}
|
||||
},
|
||||
"typeconfig": {
|
||||
"version": "2.2.15",
|
||||
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.2.15.tgz",
|
||||
"integrity": "sha512-aqiuT5BtV0/0MYMMG78c1IqeJrF85r1W1pJckkGolPjHpE0ajA3oOgnRtX5DRDHsn3YzsY5FKMxj1B3J+ISx1g==",
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.3.1.tgz",
|
||||
"integrity": "sha512-xBdsf0tK/PcXyZzWq/U2xLNDNrVFkRQ9d8V9x3B5eu1LG5GmeDDK7zLScz79zbl0dCZzhjnvx4RRggY6DZAAZA==",
|
||||
"requires": {
|
||||
"minimist": "1.2.8"
|
||||
}
|
||||
|
@ -54,7 +54,7 @@
|
||||
"reflect-metadata": "0.1.13",
|
||||
"sharp": "0.31.3",
|
||||
"ts-node-iptc": "1.0.11",
|
||||
"typeconfig": "2.2.15",
|
||||
"typeconfig": "2.3.1",
|
||||
"typeorm": "0.3.12",
|
||||
"xml2js": "0.6.2"
|
||||
},
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {IExtensionConfig} from './IExtension';
|
||||
import {Config} from '../../../common/config/private/Config';
|
||||
import {ServerExtensionsEntryConfig} from '../../../common/config/private/subconfigs/ServerExtensionsConfig';
|
||||
|
||||
export class ExtensionConfig<C> implements IExtensionConfig<C> {
|
||||
|
||||
@ -8,8 +9,7 @@ export class ExtensionConfig<C> implements IExtensionConfig<C> {
|
||||
|
||||
|
||||
public getConfig(): C {
|
||||
const c = (Config.Extensions.extensions || [])
|
||||
.find(e => e.path === this.extensionFolder);
|
||||
const c = Config.Extensions.extensions[this.extensionFolder] as ServerExtensionsEntryConfig;
|
||||
|
||||
return c?.configs as C;
|
||||
}
|
||||
|
@ -92,16 +92,20 @@ export class ExtensionConfigTemplateLoader {
|
||||
}
|
||||
|
||||
const ePaths = this.extensionTemplates.map(et => et.folder);
|
||||
|
||||
// delete not existing extensions
|
||||
config.Extensions.extensions = config.Extensions.extensions
|
||||
.filter(ec => ePaths.indexOf(ec.path) !== -1);
|
||||
for (const prop of config.Extensions.extensions.keys()) {
|
||||
if (ePaths.indexOf(prop) > -1) {
|
||||
continue;
|
||||
}
|
||||
config.Extensions.extensions.removeProperty(prop);
|
||||
}
|
||||
|
||||
|
||||
for (let i = 0; i < this.extensionTemplates.length; ++i) {
|
||||
const ext = this.extensionTemplates[i];
|
||||
|
||||
let c = (config.Extensions.extensions || [])
|
||||
.find(e => e.path === ext.folder);
|
||||
let c = config.Extensions.extensions[ext.folder];
|
||||
|
||||
// set the new structure with the new def values
|
||||
if (!c) {
|
||||
@ -109,9 +113,7 @@ export class ExtensionConfigTemplateLoader {
|
||||
if (ext.template) {
|
||||
c.configs = new ext.template();
|
||||
}
|
||||
// TODO: this does not hold if the order of the extensions mixes up.
|
||||
// TODO: experiment with a map instead of an array
|
||||
config.Extensions.extensions.push(c);
|
||||
config.Extensions.extensions.addProperty(ext.folder, {type: ServerExtensionsEntryConfig}, c);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import {SQLConnection} from '../database/SQLConnection';
|
||||
import {ExtensionObject} from './ExtensionObject';
|
||||
import {ExtensionDecoratorObject} from './ExtensionDecorator';
|
||||
import * as util from 'util';
|
||||
import {ServerExtensionsEntryConfig} from '../../../common/config/private/subconfigs/ServerExtensionsConfig';
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const exec = util.promisify(require('child_process').exec);
|
||||
|
||||
@ -80,7 +81,7 @@ export class ExtensionManager implements IObjectManager {
|
||||
extList.sort();
|
||||
|
||||
|
||||
Logger.debug(LOG_TAG, 'Extensions found: ', JSON.stringify(Config.Extensions.extensions.map(ec => ec.path)));
|
||||
Logger.debug(LOG_TAG, 'Extensions found: ', JSON.stringify(Config.Extensions.extensions.keys()));
|
||||
}
|
||||
|
||||
private createUniqueExtensionObject(name: string, folder: string): IExtensionObject<unknown> {
|
||||
@ -99,11 +100,12 @@ export class ExtensionManager implements IObjectManager {
|
||||
|
||||
private async initExtensions() {
|
||||
|
||||
for (let i = 0; i < Config.Extensions.extensions.length; ++i) {
|
||||
const extFolder = Config.Extensions.extensions[i].path;
|
||||
for (const prop of Config.Extensions.extensions.keys()) {
|
||||
const extConf: ServerExtensionsEntryConfig = Config.Extensions.extensions[prop] as ServerExtensionsEntryConfig;
|
||||
const extFolder = extConf.path;
|
||||
let extName = extFolder;
|
||||
|
||||
if (Config.Extensions.extensions[i].enabled === false) {
|
||||
if (extConf.enabled === false) {
|
||||
Logger.silly(LOG_TAG, `Skipping ${extFolder} initiation. Extension is disabled.`);
|
||||
}
|
||||
const extPath = path.join(ProjectPath.ExtensionFolder, extFolder);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-inferrable-types */
|
||||
import {ConfigProperty, SubConfigClass} from 'typeconfig/common';
|
||||
import {ConfigMap, ConfigProperty, IConfigMap, SubConfigClass} from 'typeconfig/common';
|
||||
import {ClientExtensionsConfig, ConfigPriority, TAGS} from '../../public/ClientConfig';
|
||||
import {GenericConfigType} from 'typeconfig/src/GenericConfigType';
|
||||
|
||||
@ -59,16 +59,14 @@ export class ServerExtensionsConfig extends ClientExtensionsConfig {
|
||||
})
|
||||
folder: string = 'extensions';
|
||||
|
||||
// TODO: this does not hold if the order of the extensions mixes up.
|
||||
// TODO: experiment with a map instead of an array
|
||||
@ConfigProperty({
|
||||
arrayType: ServerExtensionsEntryConfig,
|
||||
type: ConfigMap,
|
||||
tags: {
|
||||
name: $localize`Installed extensions`,
|
||||
priority: ConfigPriority.advanced
|
||||
}
|
||||
})
|
||||
extensions: ServerExtensionsEntryConfig[] = [];
|
||||
extensions: IConfigMap<ServerExtensionsEntryConfig> = new ConfigMap();
|
||||
|
||||
|
||||
@ConfigProperty({
|
||||
|
Loading…
Reference in New Issue
Block a user