refactor: ♻️ donation link logic, add link to /about, fix typo

This commit is contained in:
ThatOneCalculator 2023-07-11 23:42:59 -07:00
parent 04224bfc66
commit acb6edef3c
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
4 changed files with 37 additions and 12 deletions

View File

@ -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! 🥰"

View File

@ -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: {

View File

@ -18,10 +18,10 @@
</p>
</div>
<div class="_flexList">
<MkButton primary @click="openCalckeyDonation">{{
<MkButton primary @click="openExternal('https://opencollective.com/calckey')">{{
i18n.ts._aboutMisskey.donate
}}</MkButton>
<MkButton v-if="instance.donationLink" primary @click="openExternalDonation">{{
<MkButton v-if="instance.donationLink" primary @click="openExternal(instance.donationLink)">{{
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");
}
</script>

View File

@ -93,6 +93,21 @@
external
>{{ i18n.ts.tos }}</FormLink
>
<FormLink
v-if="$instance.donationLink"
:to="$instance.donationLink"
external
>
<template #icon
><i class="ph-money ph-bold ph-lg"></i
></template>
{{
i18n.t("_aboutMisskey.donateHost", {
host: $instance.name || host,
})
}}
<template #suffix>Donate</template>
</FormLink>
</FormSection>
<FormSuspense :p="initStats">