From acb6edef3cfb0529b744b5f505b01739584a2007 Mon Sep 17 00:00:00 2001
From: ThatOneCalculator
Date: Tue, 11 Jul 2023 23:42:59 -0700
Subject: [PATCH] refactor: :recycle: donation link logic, add link to /about,
fix typo
---
locales/en-US.yml | 2 +-
.../server/api/endpoints/admin/update-meta.ts | 18 ++++++++++++++++++
packages/client/src/components/MkDonation.vue | 14 +++-----------
packages/client/src/pages/about.vue | 15 +++++++++++++++
4 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/locales/en-US.yml b/locales/en-US.yml
index 08eb2a62fe..d8a26b1f25 100644
--- a/locales/en-US.yml
+++ b/locales/en-US.yml
@@ -1219,7 +1219,7 @@ _aboutMisskey:
donate: "Donate to Calckey"
donateTitle: "Enjoying Calckey?"
pleaseDonateToCalckey: "Please consider donating to Calckey to support its development."
- pleaseDonateToHost: "Please also consider donating to your honme server, {host}, to help support its operation costs."
+ pleaseDonateToHost: "Please also consider donating to your home server, {host}, to help support its operation costs."
donateHost: "Donate to {host}"
morePatrons: "We also appreciate the support of many other helpers not listed here.
Thank you! 🥰"
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 cf22c6c489..16e49a85a8 100644
--- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts
+++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts
@@ -177,6 +177,9 @@ export const paramDef = {
postImports: { type: "boolean" },
},
},
+ enableServerMachineStats: { type: "boolean" },
+ enableIdenticonGeneration: { type: "boolean" },
+ donationLink: { type: "string", nullable: true },
},
required: [],
} as const;
@@ -568,6 +571,21 @@ export default define(meta, paramDef, async (ps, me) => {
set.experimentalFeatures = ps.experimentalFeatures || undefined;
}
+ if (ps.enableServerMachineStats !== undefined) {
+ set.enableServerMachineStats = ps.enableServerMachineStats;
+ }
+
+ if (ps.enableIdenticonGeneration !== undefined) {
+ set.enableIdenticonGeneration = ps.enableIdenticonGeneration;
+ }
+
+ if (ps.donationLink !== undefined) {
+ set.donationLink = ps.donationLink;
+ if (set.donationLink && !/^https?:\/\//i.test(set.donationLink)) {
+ set.donationLink = `https://${set.donationLink}`;
+ }
+ }
+
await db.transaction(async (transactionalEntityManager) => {
const metas = await transactionalEntityManager.find(Meta, {
order: {
diff --git a/packages/client/src/components/MkDonation.vue b/packages/client/src/components/MkDonation.vue
index beaeef2d22..367ec7b58a 100644
--- a/packages/client/src/components/MkDonation.vue
+++ b/packages/client/src/components/MkDonation.vue
@@ -18,10 +18,10 @@
- {{
+ {{
i18n.ts._aboutMisskey.donate
}}
- {{
+ {{
i18n.t("_aboutMisskey.donateHost", {
host: hostname,
})
@@ -63,15 +63,7 @@ function neverShow() {
close();
}
-function openCalckeyDonation() {
- window.open("https://opencollective.com/calckey", "_blank");
-}
-
-function openExternalDonation() {
- let link = instance.donationLink;
- if (!/^https?:\/\//i.test(link)) {
- link = `http://${link}`;
- }
+function openExternal(link) {
window.open(link, "_blank");
}
diff --git a/packages/client/src/pages/about.vue b/packages/client/src/pages/about.vue
index 88ed1add21..bbc340fe23 100644
--- a/packages/client/src/pages/about.vue
+++ b/packages/client/src/pages/about.vue
@@ -93,6 +93,21 @@
external
>{{ i18n.ts.tos }}
+
+
+ {{
+ i18n.t("_aboutMisskey.donateHost", {
+ host: $instance.name || host,
+ })
+ }}
+ Donate
+