From bef01175dc4eb5917805041b2e25c2d67dfe533b Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Fri, 18 Nov 2022 23:54:50 -0800 Subject: [PATCH] fetch patrons remotely --- package.json | 2 +- packages/backend/src/server/api/endpoints.ts | 2 ++ .../src/server/api/endpoints/patrons.ts | 28 +++++++++++++++++++ packages/client/src/pages/about-calckey.vue | 6 +--- patrons.json | 7 +++++ 5 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 packages/backend/src/server/api/endpoints/patrons.ts create mode 100644 patrons.json diff --git a/package.json b/package.json index 29cb616870..c37277e1c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "12.119.0-calc.15.3", + "version": "12.119.0-calc.15.4", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 29cd190268..d662d53aff 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -275,6 +275,7 @@ import * as ep___pinnedUsers from './endpoints/pinned-users.js'; import * as ep___customMOTD from './endpoints/custom-motd.js'; import * as ep___customSplashIcons from './endpoints/custom-splash-icons.js'; import * as ep___latestVersion from './endpoints/latest-version.js'; +import * as ep___patrons from './endpoints/patrons.js'; import * as ep___promo_read from './endpoints/promo/read.js'; import * as ep___requestResetPassword from './endpoints/request-reset-password.js'; import * as ep___resetDb from './endpoints/reset-db.js'; @@ -599,6 +600,7 @@ const eps = [ ['custom-motd', ep___customMOTD], ['custom-splash-icons', ep___customSplashIcons], ['latest-version', ep___latestVersion], + ['patrons', ep___patrons], ['promo/read', ep___promo_read], ['request-reset-password', ep___requestResetPassword], ['reset-db', ep___resetDb], diff --git a/packages/backend/src/server/api/endpoints/patrons.ts b/packages/backend/src/server/api/endpoints/patrons.ts new file mode 100644 index 0000000000..21f8d67177 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/patrons.ts @@ -0,0 +1,28 @@ +import define from '../define.js'; + +export const meta = { + tags: ['meta'], + + requireCredential: false, + requireCredentialPrivateMode: false, +} as const; + +export const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + +// eslint-disable-next-line import/no-default-export +export default define(meta, paramDef, async () => { + let patrons; + await fetch('https://codeberg.org/thatonecalculator/calckey/raw/branch/develop/patrons.json') + .then((response) => response.json()) + .then((data) => { + patrons = data[0]; + }); + + return { + patrons, + }; +}); diff --git a/packages/client/src/pages/about-calckey.vue b/packages/client/src/pages/about-calckey.vue index ddd13d9c79..4124e795d3 100644 --- a/packages/client/src/pages/about-calckey.vue +++ b/packages/client/src/pages/about-calckey.vue @@ -69,11 +69,7 @@ import { defaultStore } from '@/store'; import * as os from '@/os'; import { definePageMetadata } from '@/scripts/page-metadata'; -const patrons = [ - '@atomicpoet@vancity.social', - '@shoq@newsroom.social', - '@pikadude@erisly.social', -]; +const patrons = await os.api('patrons'); let easterEggReady = false; let easterEggEmojis = $ref([]); diff --git a/patrons.json b/patrons.json new file mode 100644 index 0000000000..d2f9c2e341 --- /dev/null +++ b/patrons.json @@ -0,0 +1,7 @@ +[{ + [ + "@atomicpoet@vancity.social" + "@shoq@newsroom.social" + "@pikadude@erisly.social" + ] +}]