From b6ca1a5e90122ae76be75ffa6c7d7f03fd5809ef Mon Sep 17 00:00:00 2001
From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Sun, 3 Nov 2024 02:09:14 +0900
Subject: [PATCH] fix
---
.../frontend/src/pages/admin/client-setting-overrides.vue | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/packages/frontend/src/pages/admin/client-setting-overrides.vue b/packages/frontend/src/pages/admin/client-setting-overrides.vue
index 6a7261b0d7..13e5fd8286 100644
--- a/packages/frontend/src/pages/admin/client-setting-overrides.vue
+++ b/packages/frontend/src/pages/admin/client-setting-overrides.vue
@@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.overrideValue }}
{{ i18n.ts.onToTrue }}
-
+
{{ i18n.ts.overrideValue }}
@@ -85,6 +85,7 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { reloadAsk } from '@/scripts/reload-ask.js';
import MkSwitch from '@/components/MkSwitch.vue';
import MkTextarea from '@/components/MkTextarea.vue';
+import JSON5 from 'json5';
const query = ref('');
@@ -145,6 +146,7 @@ function typeSafeObjectEntries>(obj: T) {
}
function getClientSettingOverridesUIDefObj(def: unknown): ClientSettingOverridesUIDefObj {
+ const _def = typeof def === 'object' ? JSON.stringify(def, null, '\t') : def;
return {
formType: (() => {
if (typeof def === 'boolean') {
@@ -159,7 +161,7 @@ function getClientSettingOverridesUIDefObj(def: unknown): ClientSettingOverrides
})() satisfies ClientSettingOverridesUIDefObj['formType'] as ClientSettingOverridesUIDefObj['formType'],
enableOverride: false,
defaultValue: def,
- overrideValue: def,
+ overrideValue: _def,
};
}
@@ -205,7 +207,7 @@ async function save() {
(typeof def.defaultValue !== 'string' && typeof def.overrideValue === 'string' && def.overrideValue !== JSON.stringify(def.defaultValue))
)
))
- .map(([key, def]) => [key, typeof def.overrideValue === 'string' && typeof def.defaultValue !== 'string' ? JSON.parse(def.overrideValue) : def.overrideValue])
+ .map(([key, def]) => [key, typeof def.overrideValue === 'string' && typeof def.defaultValue !== 'string' ? JSON5.parse(def.overrideValue) : def.overrideValue])
);
let defaultClientSettingOverrides: string | null = JSON.stringify(overrides);