diff --git a/locales/en-US.yml b/locales/en-US.yml index 1b029a3214..6ea2d36129 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1100,6 +1100,11 @@ noGraze: "Please disable the \"Graze for Mastodon\" browser extension, as it int with Calckey." silencedWarning: "This page is showing because these users are from servers your admin silenced, so they may potentially be spam." +isBot: "This account is a bot" +isLocked: "This account has follow approvals" +isModerator: "Moderator" +isAdmin: "Administrator" +isPatron: "Calckey Patron" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing diff --git a/packages/backend/src/server/api/endpoints/patrons.ts b/packages/backend/src/server/api/endpoints/patrons.ts index d6ac6c3971..aa9d25cf06 100644 --- a/packages/backend/src/server/api/endpoints/patrons.ts +++ b/packages/backend/src/server/api/endpoints/patrons.ts @@ -1,4 +1,5 @@ import define from "../define.js"; +import Logger from "@/services/logger.js"; export const meta = { tags: ["meta"], @@ -22,6 +23,9 @@ export default define(meta, paramDef, async () => { .then((response) => response.json()) .then((data) => { patrons = data["patrons"]; + }) + .catch((error) => { + console.error("Error fetching patrons:", error); }); return patrons; diff --git a/packages/client/src/instance.ts b/packages/client/src/instance.ts index 3381684a03..4b2c6a953e 100644 --- a/packages/client/src/instance.ts +++ b/packages/client/src/instance.ts @@ -5,6 +5,7 @@ import type * as Misskey from "calckey-js"; // TODO: 他のタブと永続化されたstateを同期 const instanceData = localStorage.getItem("instance"); +const patronData = localStorage.getItem("patrons"); // TODO: instanceをリアクティブにするかは再考の余地あり @@ -16,6 +17,8 @@ export const instance: Misskey.entities.DetailedInstanceMetadata = reactive( }, ); +export const patrons = patronData || []; + export async function fetchInstance() { const meta = await api("meta", { detail: true, @@ -28,6 +31,11 @@ export async function fetchInstance() { localStorage.setItem("instance", JSON.stringify(instance)); } +export async function fetchPatrons() { + const patrons = await api("patrons"); + localStorage.setItem("patrons", JSON.stringify(patrons)); +} + export const emojiCategories = computed(() => { if (instance.emojis == null) return []; const categories = new Set(); diff --git a/packages/client/src/pages/about-calckey.vue b/packages/client/src/pages/about-calckey.vue index 1e16356a51..01350d8403 100644 --- a/packages/client/src/pages/about-calckey.vue +++ b/packages/client/src/pages/about-calckey.vue @@ -163,14 +163,15 @@ import { i18n } from "@/i18n"; import { defaultStore } from "@/store"; import * as os from "@/os"; import { definePageMetadata } from "@/scripts/page-metadata"; - -const patrons = await os.api("patrons"); +import { patrons, fetchPatrons } from "@/instance"; let easterEggReady = false; let easterEggEmojis = $ref([]); let easterEggEngine = $ref(null); const containerEl = $ref(); +await fetchPatrons() + function iconLoaded() { const emojis = defaultStore.state.reactions; const containerWidth = containerEl?.offsetWidth; diff --git a/packages/client/src/pages/user/home.vue b/packages/client/src/pages/user/home.vue index 1926fee887..61f3d31687 100644 --- a/packages/client/src/pages/user/home.vue +++ b/packages/client/src/pages/user/home.vue @@ -54,7 +54,7 @@ /> + @@ -110,7 +124,7 @@ /> - +