feat: Implement Donation URL
This commit is contained in:
parent
d974b30e56
commit
9ceb74b98d
16 changed files with 87 additions and 9 deletions
10
packages/backend/migration/1704744370000-add-donation-url.js
Normal file
10
packages/backend/migration/1704744370000-add-donation-url.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
export class AddDonationUrl1704744370000 {
|
||||
name = 'AddDonationUrl1704744370000'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD "donationUrl" character varying(1024)`);
|
||||
}
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "donationUrl"`);
|
||||
}
|
||||
}
|
|
@ -385,6 +385,12 @@ export class MiMeta {
|
|||
})
|
||||
public privacyPolicyUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public donationUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 8192,
|
||||
nullable: true,
|
||||
|
|
|
@ -36,12 +36,12 @@ export class NodeinfoServerService {
|
|||
@bindThis
|
||||
public getLinks() {
|
||||
return [{
|
||||
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1',
|
||||
href: this.config.url + nodeinfo2_1path
|
||||
}, {
|
||||
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0',
|
||||
href: this.config.url + nodeinfo2_0path,
|
||||
}];
|
||||
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1',
|
||||
href: this.config.url + nodeinfo2_1path,
|
||||
}, {
|
||||
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0',
|
||||
href: this.config.url + nodeinfo2_0path,
|
||||
}];
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
@ -108,6 +108,7 @@ export class NodeinfoServerService {
|
|||
tosUrl: meta.termsOfServiceUrl,
|
||||
privacyPolicyUrl: meta.privacyPolicyUrl,
|
||||
impressumUrl: meta.impressumUrl,
|
||||
donationUrl: meta.donationUrl,
|
||||
repositoryUrl: meta.repositoryUrl,
|
||||
feedbackUrl: meta.feedbackUrl,
|
||||
disableRegistration: meta.disableRegistration,
|
||||
|
|
|
@ -415,6 +415,10 @@ export const meta = {
|
|||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
donationUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
maintainerEmail: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
|
@ -498,6 +502,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
repositoryUrl: instance.repositoryUrl,
|
||||
feedbackUrl: instance.feedbackUrl,
|
||||
impressumUrl: instance.impressumUrl,
|
||||
donationUrl: instance.donationUrl,
|
||||
privacyPolicyUrl: instance.privacyPolicyUrl,
|
||||
disableRegistration: instance.disableRegistration,
|
||||
emailRequiredForSignup: instance.emailRequiredForSignup,
|
||||
|
|
|
@ -105,6 +105,7 @@ export const paramDef = {
|
|||
repositoryUrl: { type: 'string' },
|
||||
feedbackUrl: { type: 'string' },
|
||||
impressumUrl: { type: 'string', nullable: true },
|
||||
donationUrl: { type: 'string', nullable: true },
|
||||
privacyPolicyUrl: { type: 'string', nullable: true },
|
||||
useObjectStorage: { type: 'boolean' },
|
||||
objectStorageBaseUrl: { type: 'string', nullable: true },
|
||||
|
@ -406,6 +407,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
set.impressumUrl = ps.impressumUrl;
|
||||
}
|
||||
|
||||
if (ps.donationUrl !== undefined) {
|
||||
set.donationUrl = ps.donationUrl;
|
||||
}
|
||||
|
||||
if (ps.privacyPolicyUrl !== undefined) {
|
||||
set.privacyPolicyUrl = ps.privacyPolicyUrl;
|
||||
}
|
||||
|
|
|
@ -291,6 +291,10 @@ export const meta = {
|
|||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
donationUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
logoImageUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
|
@ -365,6 +369,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
repositoryUrl: instance.repositoryUrl,
|
||||
feedbackUrl: instance.feedbackUrl,
|
||||
impressumUrl: instance.impressumUrl,
|
||||
donationUrl: instance.donationUrl,
|
||||
privacyPolicyUrl: instance.privacyPolicyUrl,
|
||||
disableRegistration: instance.disableRegistration,
|
||||
emailRequiredForSignup: instance.emailRequiredForSignup,
|
||||
|
|
|
@ -26,6 +26,16 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkLink target="_blank" url="https://ko-fi.com/transfem">{{ i18n.ts.learnMore }}</MkLink>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="instance.donationUrl" :class="$style.text">
|
||||
<I18n :src="i18n.ts.pleaseDonateInstance" tag="span">
|
||||
<template #host>
|
||||
{{ instance.name ?? host }}
|
||||
</template>
|
||||
</I18n>
|
||||
<div style="margin-top: 0.2em;">
|
||||
<MkLink target="_blank" :url="instance.donationUrl">{{ i18n.ts.learnMore }}</MkLink>
|
||||
</div>
|
||||
</div>
|
||||
<div class="_buttons">
|
||||
<MkButton @click="close">{{ i18n.ts.remindMeLater }}</MkButton>
|
||||
<MkButton @click="neverShow">{{ i18n.ts.neverShow }}</MkButton>
|
||||
|
|
|
@ -123,7 +123,13 @@ function showMenu(ev) {
|
|||
action: () => {
|
||||
window.open(instance.privacyPolicyUrl, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : { type: 'divider' }, {
|
||||
} : undefined, (instance.donationUrl) ? {
|
||||
text: i18n.ts.donation,
|
||||
icon: 'ph-hand-coins ph-bold ph-lg',
|
||||
action: () => {
|
||||
window.open(instance.donationUrl, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl && !instance.donationUrl) ? undefined : { type: 'divider' }, {
|
||||
text: i18n.ts.help,
|
||||
icon: 'ph-question ph-bold ph-lg',
|
||||
action: () => {
|
||||
|
|
|
@ -47,6 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</MkKeyValue>
|
||||
</FormSplit>
|
||||
<FormLink v-if="instance.impressumUrl" :to="instance.impressumUrl" external>{{ i18n.ts.impressum }}</FormLink>
|
||||
<FormLink v-if="instance.donationUrl" :to="instance.donationUrl" external>{{ i18n.ts.donation }}</FormLink>
|
||||
<div class="_gaps_s">
|
||||
<MkFolder v-if="instance.serverRules.length > 0">
|
||||
<template #label>{{ i18n.ts.serverRules }}</template>
|
||||
|
|
|
@ -40,6 +40,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #caption>{{ i18n.ts.impressumDescription }}</template>
|
||||
</MkInput>
|
||||
|
||||
<MkInput v-model="donationUrl" type="url">
|
||||
<template #label>{{ i18n.ts.donationUrl }}</template>
|
||||
<template #prefix><i class="ph-link ph-bold ph-lg"></i></template>
|
||||
</MkInput>
|
||||
|
||||
<MkTextarea v-model="pinnedUsers">
|
||||
<template #label>{{ i18n.ts.pinnedUsers }}</template>
|
||||
<template #caption>{{ i18n.ts.pinnedUsersDescription }}</template>
|
||||
|
@ -170,6 +175,7 @@ const description = ref<string | null>(null);
|
|||
const maintainerName = ref<string | null>(null);
|
||||
const maintainerEmail = ref<string | null>(null);
|
||||
const impressumUrl = ref<string | null>(null);
|
||||
const donationUrl = ref<string | null>(null);
|
||||
const pinnedUsers = ref<string>('');
|
||||
const cacheRemoteFiles = ref<boolean>(false);
|
||||
const cacheRemoteSensitiveFiles = ref<boolean>(false);
|
||||
|
@ -192,6 +198,7 @@ async function init(): Promise<void> {
|
|||
maintainerName.value = meta.maintainerName;
|
||||
maintainerEmail.value = meta.maintainerEmail;
|
||||
impressumUrl.value = meta.impressumUrl;
|
||||
donationUrl.value = meta.donationUrl;
|
||||
pinnedUsers.value = meta.pinnedUsers.join('\n');
|
||||
cacheRemoteFiles.value = meta.cacheRemoteFiles;
|
||||
cacheRemoteSensitiveFiles.value = meta.cacheRemoteSensitiveFiles;
|
||||
|
@ -215,6 +222,7 @@ async function save(): void {
|
|||
maintainerName: maintainerName.value,
|
||||
maintainerEmail: maintainerEmail.value,
|
||||
impressumUrl: impressumUrl.value,
|
||||
donationUrl: donationUrl.value,
|
||||
pinnedUsers: pinnedUsers.value.split('\n'),
|
||||
cacheRemoteFiles: cacheRemoteFiles.value,
|
||||
cacheRemoteSensitiveFiles: cacheRemoteSensitiveFiles.value,
|
||||
|
|
|
@ -102,7 +102,13 @@ export function openInstanceMenu(ev: MouseEvent) {
|
|||
action: () => {
|
||||
window.open(instance.privacyPolicyUrl, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : { type: 'divider' }, {
|
||||
} : undefined, (instance.donationUrl) ? {
|
||||
text: i18n.ts.donation,
|
||||
icon: 'ph-hand-coins ph-bold ph-lg',
|
||||
action: () => {
|
||||
window.open(instance.donationUrl, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl && !instance.donationUrl) ? undefined : { type: 'divider' }, {
|
||||
text: i18n.ts.help,
|
||||
icon: 'ph-question ph-bold ph-lg',
|
||||
action: () => {
|
||||
|
|
|
@ -4631,6 +4631,7 @@ export type operations = {
|
|||
description: string | null;
|
||||
disableRegistration: boolean;
|
||||
impressumUrl: string | null;
|
||||
donationUrl: string | null;
|
||||
maintainerEmail: string | null;
|
||||
maintainerName: string | null;
|
||||
name: string | null;
|
||||
|
@ -8650,6 +8651,7 @@ export type operations = {
|
|||
repositoryUrl?: string;
|
||||
feedbackUrl?: string;
|
||||
impressumUrl?: string | null;
|
||||
donationUrl?: string | null;
|
||||
privacyPolicyUrl?: string | null;
|
||||
useObjectStorage?: boolean;
|
||||
objectStorageBaseUrl?: string | null;
|
||||
|
@ -19400,6 +19402,7 @@ export type operations = {
|
|||
};
|
||||
backgroundImageUrl: string | null;
|
||||
impressumUrl: string | null;
|
||||
donationUrl: string | null;
|
||||
logoImageUrl: string | null;
|
||||
privacyPolicyUrl: string | null;
|
||||
serverRules: string[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue