mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Updating config name checking for settings. Obfuscation broke name matching so object matching is needed. fixes #709
This commit is contained in:
parent
569b11b1b1
commit
b8ed84b7ae
@ -1,19 +1,35 @@
|
|||||||
import {propertyTypes} from 'typeconfig/common';
|
import {propertyTypes} from 'typeconfig/common';
|
||||||
|
import {ClientGroupingConfig, ClientSortingConfig, SVGIconConfig} from '../../../../../common/config/public/ClientConfig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration in these class have a custom UI
|
* Configuration in these class have a custom UI
|
||||||
*/
|
*/
|
||||||
export class CustomSettingsEntries {
|
export class CustomSettingsEntries {
|
||||||
public static readonly entries = ['ClientSortingConfig', 'ClientGroupingConfig', 'SVGIconConfig'];
|
public static readonly entries = [
|
||||||
|
{c: ClientSortingConfig, name: 'ClientSortingConfig'},
|
||||||
|
{c: ClientGroupingConfig, name: 'ClientGroupingConfig'},
|
||||||
|
{c: SVGIconConfig, name: 'SVGIconConfig'},
|
||||||
|
];
|
||||||
|
|
||||||
public static getConfigName(s: { tags?: { uiType?: string }, type?: propertyTypes, arrayType?: propertyTypes }): string {
|
public static getConfigName(s: { tags?: { uiType?: string }, type?: propertyTypes, arrayType?: propertyTypes }): string {
|
||||||
let c = s.tags?.uiType;
|
let c = s.tags?.uiType;
|
||||||
try {
|
try {
|
||||||
if (!c) {
|
if (!c) {
|
||||||
if (s.arrayType) {
|
const ent = this.entries.find(e => {
|
||||||
c = Object.getPrototypeOf(Object.getPrototypeOf(s?.arrayType))?.name;
|
try {
|
||||||
} else {
|
if (s?.arrayType) {
|
||||||
c = Object.getPrototypeOf(Object.getPrototypeOf(s?.type))?.name;
|
return s?.arrayType == e.c;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
if (s?.type) {
|
||||||
|
return s?.type == e.c;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
if (ent) {
|
||||||
|
c = ent.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -32,7 +48,7 @@ export class CustomSettingsEntries {
|
|||||||
|
|
||||||
public static iS(s: { tags?: { uiType?: string }, type?: propertyTypes }) {
|
public static iS(s: { tags?: { uiType?: string }, type?: propertyTypes }) {
|
||||||
const c = this.getConfigName(s);
|
const c = this.getConfigName(s);
|
||||||
return this.entries.includes(c);
|
return this.entries.findIndex(e => e.name == c) !== -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user