From b8ed84b7ae22891f6b0448fb0cc921523ff3ae7c Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sat, 2 Sep 2023 15:48:28 +0200 Subject: [PATCH] Updating config name checking for settings. Obfuscation broke name matching so object matching is needed. fixes #709 --- .../template/CustomSettingsEntries.ts | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/frontend/app/ui/settings/template/CustomSettingsEntries.ts b/src/frontend/app/ui/settings/template/CustomSettingsEntries.ts index 34b906f5..b2346b6c 100644 --- a/src/frontend/app/ui/settings/template/CustomSettingsEntries.ts +++ b/src/frontend/app/ui/settings/template/CustomSettingsEntries.ts @@ -1,19 +1,35 @@ import {propertyTypes} from 'typeconfig/common'; +import {ClientGroupingConfig, ClientSortingConfig, SVGIconConfig} from '../../../../../common/config/public/ClientConfig'; /** * Configuration in these class have a custom UI */ 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 { let c = s.tags?.uiType; try { if (!c) { - if (s.arrayType) { - c = Object.getPrototypeOf(Object.getPrototypeOf(s?.arrayType))?.name; - } else { - c = Object.getPrototypeOf(Object.getPrototypeOf(s?.type))?.name; + const ent = this.entries.find(e => { + try { + if (s?.arrayType) { + 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) { @@ -32,7 +48,7 @@ export class CustomSettingsEntries { public static iS(s: { tags?: { uiType?: string }, type?: propertyTypes }) { const c = this.getConfigName(s); - return this.entries.includes(c); + return this.entries.findIndex(e => e.name == c) !== -1; } }