From a075813d30845f5b2c1da3878a965500e7a3e5ce Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Wed, 21 Sep 2022 13:05:59 -0700 Subject: [PATCH] Allow admins to set logo url --- locales/en-US.yml | 1 + locales/ja-JP.yml | 1 + .../backend/src/server/api/endpoints/admin/update-meta.ts | 5 +++++ packages/client/src/pages/admin/settings.vue | 8 ++++++++ 4 files changed, 15 insertions(+) diff --git a/locales/en-US.yml b/locales/en-US.yml index de2fc2169a..92d658b2ec 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -915,6 +915,7 @@ caption: "Auto Caption" splash: "Splash Screen" updateAvailable: "There might be an update available!" swipeOnDesktop: "Allow mobile-style swiping on desktop" +logoUrl: "Logo URL" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing NSFW media via Machine Learning. This will slightly increase the load on the server." diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c8a1b43747..f4a9c3c44f 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -915,6 +915,7 @@ caption: "自動キャプション" splash: "スプラッシュスクリーン" updateAvailable: "アップデートがありますよ" swipeOnDesktop: "デスクトップでモバイルスタイルのスワイプを可能にする" +logoUrl: "ロゴのURL" _sensitiveMediaDetection: description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てることができます。サーバーの負荷が少し増えます。" diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 0220c4a7ca..3e061a9e0c 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -45,6 +45,7 @@ export const paramDef = { themeColor: { type: 'string', nullable: true, pattern: '^#[0-9a-fA-F]{6}$' }, mascotImageUrl: { type: 'string', nullable: true }, bannerUrl: { type: 'string', nullable: true }, + logoUrl: { type: 'string', nullable: true }, errorImageUrl: { type: 'string', nullable: true }, iconUrl: { type: 'string', nullable: true }, backgroundImageUrl: { type: 'string', nullable: true }, @@ -193,6 +194,10 @@ export default define(meta, paramDef, async (ps, me) => { set.bannerUrl = ps.bannerUrl; } + if (ps.logoUrl !== undefined) { + set.logoUrl = ps.logoUrl; + } + if (ps.iconUrl !== undefined) { set.iconUrl = ps.iconUrl; } diff --git a/packages/client/src/pages/admin/settings.vue b/packages/client/src/pages/admin/settings.vue index 55aebbf7e4..206858087c 100644 --- a/packages/client/src/pages/admin/settings.vue +++ b/packages/client/src/pages/admin/settings.vue @@ -71,6 +71,11 @@ + + + + + @@ -191,6 +196,7 @@ let maintainerName: string | null = $ref(null); let maintainerEmail: string | null = $ref(null); let iconUrl: string | null = $ref(null); let bannerUrl: string | null = $ref(null); +let logoUrl: string | null = $ref(null); let backgroundImageUrl: string | null = $ref(null); let themeColor: any = $ref(null); let defaultLightTheme: any = $ref(null); @@ -220,6 +226,7 @@ async function init() { tosUrl = meta.tosUrl; iconUrl = meta.iconUrl; bannerUrl = meta.bannerUrl; + logoUrl = meta.logoUrl; backgroundImageUrl = meta.backgroundImageUrl; themeColor = meta.themeColor; defaultLightTheme = meta.defaultLightTheme; @@ -252,6 +259,7 @@ function save() { tosUrl, iconUrl, bannerUrl, + logoUrl, backgroundImageUrl, themeColor: themeColor === '' ? null : themeColor, defaultLightTheme: defaultLightTheme === '' ? null : defaultLightTheme,