From 50d09a4c663cfbc5e147f840098d68c049566ed2 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 31 Aug 2023 01:09:20 +0200 Subject: [PATCH] Switch to emoji status images (related: #42) --- packages/backend/src/config/load.ts | 7 +++++++ packages/backend/src/config/types.ts | 6 ++++++ .../src/server/api/endpoints/admin/send-mod-mail.ts | 3 ++- packages/backend/src/server/api/endpoints/meta.ts | 11 +++++++++++ packages/backend/src/server/web/views/base.pug | 6 +++--- packages/client/src/components/MkChannelList.vue | 3 ++- packages/client/src/components/MkNotes.vue | 3 ++- packages/client/src/components/MkNotifications.vue | 3 ++- packages/client/src/components/MkPagination.vue | 3 ++- packages/client/src/components/MkUserList.vue | 3 ++- packages/client/src/components/global/MkError.vue | 3 ++- packages/client/src/pages/_error_.vue | 4 +++- packages/client/src/pages/favorites.vue | 3 ++- packages/client/src/pages/follow-requests.vue | 3 ++- .../client/src/pages/messaging/messaging-room.vue | 3 ++- packages/client/src/pages/no-graze.vue | 3 ++- packages/client/src/pages/not-found.vue | 3 ++- packages/client/src/pages/search.vue | 3 ++- packages/client/src/pages/settings/apps.vue | 3 ++- packages/iceshrimp-js/src/entities.ts | 5 +++++ 20 files changed, 63 insertions(+), 18 deletions(-) diff --git a/packages/backend/src/config/load.ts b/packages/backend/src/config/load.ts index 38bee03bc..76e2153ba 100644 --- a/packages/backend/src/config/load.ts +++ b/packages/backend/src/config/load.ts @@ -44,6 +44,13 @@ export default function load() { config.port = config.port || parseInt(process.env.PORT || "", 10); + config.images = { + ...config.images, + info: '/twemoji/1f440.svg', + notFound: '/twemoji/2049.svg', + error: '/twemoji/1f480.svg', + }; + mixin.version = meta.version; mixin.host = url.host; mixin.hostname = url.hostname; diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index 89085bd1b..86167acf1 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -66,6 +66,12 @@ export type Source = { keepHeaders?: boolean; }; + images?: { + error?: string; + notFound?: string; + info?: string; + }; + proxy?: string; proxySmtp?: string; proxyBypassHosts?: string[]; diff --git a/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts b/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts index f7a9ad778..82a1dc2de 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts @@ -4,6 +4,7 @@ import { Users, UserProfiles } from "@/models/index.js"; import { ApiError } from "../../error.js"; import { sendEmail } from "@/services/send-email.js"; import { createNotification } from "@/services/create-notification.js"; +import config from "@/config/index.js"; export const meta = { tags: ["users"], @@ -49,7 +50,7 @@ export default define(meta, paramDef, async (ps) => { createNotification(user.id, "app", { customBody: ps.comment, customHeader: "Moderation Notice", - customIcon: "/static-assets/badges/info.png", + customIcon: config?.images?.info, }); setImmediate(async () => { diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 40211ae55..36950c941 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -269,6 +269,15 @@ export const meta = { optional: false, nullable: true, }, + images: { + type: 'object', + optional: false, nullable: false, + properties: { + info: { type: 'string' }, + notFound: { type: 'string' }, + error: { type: 'string' }, + }, + }, features: { type: "object", optional: true, @@ -441,6 +450,8 @@ export default define(meta, paramDef, async (ps, me) => { ? JSON.stringify(JSON5.parse(instance.defaultDarkTheme)) : null, + images: config.images, + enableEmail: instance.enableEmail, enableTwitterIntegration: instance.enableTwitterIntegration, diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index 481641555..17f92d9f9 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -28,9 +28,9 @@ html link(rel='icon' href= icon || `/favicon.ico?${ timestamp }`) link(rel='apple-touch-icon' href= icon || `/apple-touch-icon.png?${ timestamp }`) link(rel='manifest' href='/manifest.json') - link(rel='prefetch' href=`/static-assets/badges/info.png?${ timestamp }`) - link(rel='prefetch' href=`/static-assets/badges/not-found.png?${ timestamp }`) - link(rel='prefetch' href=`/static-assets/badges/error.png?${ timestamp }`) + link(rel='prefetch' href=config.images.info) + link(rel='prefetch' href=config.images.notFound) + link(rel='prefetch' href=config.images.error) link(rel='stylesheet' href=`/static-assets/instance.css?${ timestamp }`) link(rel='modulepreload' href=`/assets/${clientEntry.file}`) diff --git a/packages/client/src/components/MkChannelList.vue b/packages/client/src/components/MkChannelList.vue index 0861bf5a8..ff61ec7c6 100644 --- a/packages/client/src/components/MkChannelList.vue +++ b/packages/client/src/components/MkChannelList.vue @@ -3,7 +3,7 @@