From 1af6f8c5da88d1fcc4ca8785f2c002c1e5e43d24 Mon Sep 17 00:00:00 2001 From: piuvas Date: Sun, 22 Sep 2024 13:27:41 -0300 Subject: [PATCH] backend configuring --- .../src/core/entities/InstanceEntityService.ts | 1 + .../backend/src/core/entities/MetaEntityService.ts | 1 + packages/backend/src/models/Instance.ts | 5 +++++ packages/backend/src/models/Meta.ts | 6 ++++++ .../backend/src/server/api/endpoints/admin/meta.ts | 5 +++++ .../src/server/api/endpoints/admin/update-meta.ts | 5 +++++ packages/frontend/src/pages/admin/branding.vue | 11 +++++++++++ packages/misskey-js/src/autogen/types.ts | 2 ++ 8 files changed, 36 insertions(+) diff --git a/packages/backend/src/core/entities/InstanceEntityService.ts b/packages/backend/src/core/entities/InstanceEntityService.ts index 7695e6dfa7..87fe8723f8 100644 --- a/packages/backend/src/core/entities/InstanceEntityService.ts +++ b/packages/backend/src/core/entities/InstanceEntityService.ts @@ -52,6 +52,7 @@ export class InstanceEntityService { isSilenced: this.utilityService.isSilencedHost(meta.silencedHosts, instance.host), isMediaSilenced: this.utilityService.isMediaSilencedHost(meta.mediaSilencedHosts, instance.host), iconUrl: instance.iconUrl, + sidebarLogoUrl: instance.sidebarLogoUrl, faviconUrl: instance.faviconUrl, themeColor: instance.themeColor, infoUpdatedAt: instance.infoUpdatedAt ? instance.infoUpdatedAt.toISOString() : null, diff --git a/packages/backend/src/core/entities/MetaEntityService.ts b/packages/backend/src/core/entities/MetaEntityService.ts index 3128b762f4..afeefc9033 100644 --- a/packages/backend/src/core/entities/MetaEntityService.ts +++ b/packages/backend/src/core/entities/MetaEntityService.ts @@ -105,6 +105,7 @@ export class MetaEntityService { serverErrorImageUrl: instance.serverErrorImageUrl, notFoundImageUrl: instance.notFoundImageUrl, iconUrl: instance.iconUrl, + sidebarLogoUrl: instance.sidebarLogoUrl, backgroundImageUrl: instance.backgroundImageUrl, logoImageUrl: instance.logoImageUrl, maxNoteTextLength: this.config.maxNoteLength, diff --git a/packages/backend/src/models/Instance.ts b/packages/backend/src/models/Instance.ts index dd625f95d3..820002c91c 100644 --- a/packages/backend/src/models/Instance.ts +++ b/packages/backend/src/models/Instance.ts @@ -139,6 +139,11 @@ export class MiInstance { }) public iconUrl: string | null; + @Column('varchar', { + length: 256, nullable: true, + }) + public sidebarLogoUrl: string | null; + @Column('varchar', { length: 256, nullable: true, }) diff --git a/packages/backend/src/models/Meta.ts b/packages/backend/src/models/Meta.ts index 07c4e28b3a..a84b6fcc5b 100644 --- a/packages/backend/src/models/Meta.ts +++ b/packages/backend/src/models/Meta.ts @@ -127,6 +127,12 @@ export class MiMeta { }) public iconUrl: string | null; + @Column('varchar', { + length: 1024, + nullable: true, + }) + public sidebarLogoUrl: string | null; + @Column('varchar', { length: 1024, nullable: true, diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 063bb6751b..ed90d3fdde 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -102,6 +102,10 @@ export const meta = { type: 'string', optional: false, nullable: true, }, + sidebarLogoUrl: { + type: 'string', + optional: false, nullable: true, + }, app192IconUrl: { type: 'string', optional: false, nullable: true, @@ -580,6 +584,7 @@ export default class extends Endpoint { // eslint- notFoundImageUrl: instance.notFoundImageUrl, infoImageUrl: instance.infoImageUrl, iconUrl: instance.iconUrl, + sidebarLogoUrl: instance.sidebarLogoUrl, app192IconUrl: instance.app192IconUrl, app512IconUrl: instance.app512IconUrl, backgroundImageUrl: instance.backgroundImageUrl, 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 6bda1ae6ad..b8b2416b14 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -53,6 +53,7 @@ export const paramDef = { infoImageUrl: { type: 'string', nullable: true }, notFoundImageUrl: { type: 'string', nullable: true }, iconUrl: { type: 'string', nullable: true }, + sidebarLogoUrl: { type: 'string', nullable: true }, app192IconUrl: { type: 'string', nullable: true }, app512IconUrl: { type: 'string', nullable: true }, backgroundImageUrl: { type: 'string', nullable: true }, @@ -242,6 +243,10 @@ export default class extends Endpoint { // eslint- set.iconUrl = ps.iconUrl; } + if (ps.sidebarLogoUrl !== undefined) { + set.sidebarLogoUrl = ps.sidebarLogoUrl; + } + if (ps.app192IconUrl !== undefined) { set.app192IconUrl = ps.app192IconUrl; } diff --git a/packages/frontend/src/pages/admin/branding.vue b/packages/frontend/src/pages/admin/branding.vue index 2e14aef0b9..57abbe4432 100644 --- a/packages/frontend/src/pages/admin/branding.vue +++ b/packages/frontend/src/pages/admin/branding.vue @@ -14,6 +14,14 @@ SPDX-License-Identifier: AGPL-3.0-only + + + + + + @@ -128,6 +136,7 @@ import MkColorInput from '@/components/MkColorInput.vue'; import { host } from '@/config.js'; const iconUrl = ref(null); +const sidebarLogoUrl = ref(null); const app192IconUrl = ref(null); const app512IconUrl = ref(null); const bannerUrl = ref(null); @@ -146,6 +155,7 @@ const manifestJsonOverride = ref('{}'); async function init() { const meta = await misskeyApi('admin/meta'); iconUrl.value = meta.iconUrl; + sidebarLogoUrl.value = meta.sidebarLogoUrl; app192IconUrl.value = meta.app192IconUrl; app512IconUrl.value = meta.app512IconUrl; bannerUrl.value = meta.bannerUrl; @@ -165,6 +175,7 @@ async function init() { function save() { os.apiWithDialog('admin/update-meta', { iconUrl: iconUrl.value, + sidebarLogoUrl: sidebarLogoUrl.value, app192IconUrl: app192IconUrl.value, app512IconUrl: app512IconUrl.value, bannerUrl: bannerUrl.value, diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 562c498190..10354043fc 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -5191,6 +5191,7 @@ export type operations = { infoImageUrl: string | null; notFoundImageUrl: string | null; iconUrl: string | null; + sidebarLogoUrl: string | null; app192IconUrl: string | null; app512IconUrl: string | null; enableEmail: boolean; @@ -9704,6 +9705,7 @@ export type operations = { infoImageUrl?: string | null; notFoundImageUrl?: string | null; iconUrl?: string | null; + sidebarLogoUrl?: string | null; app192IconUrl?: string | null; app512IconUrl?: string | null; backgroundImageUrl?: string | null;