upd: add sponsors to instance information

This commit is contained in:
Marie 2024-10-02 18:25:23 +02:00
parent 3529042cb1
commit cc1017b2af
No known key found for this signature in database
GPG key ID: 7ADF6C9CD9A28555
3 changed files with 60 additions and 5 deletions

View file

@ -116,6 +116,22 @@ SPDX-License-Identifier: AGPL-3.0-only
</FormSection> </FormSection>
</FormSuspense> </FormSuspense>
<FormSection v-if="sponsors[0].length > 0">
<template #label>Our lovely Sponsors</template>
<div :class="$style.contributors">
<span
v-for="sponsor in sponsors[0]"
:key="sponsor"
style="margin-bottom: 0.5rem;"
>
<a :href="sponsor.website || sponsor.profile" target="_blank" :class="$style.contributor">
<img :src="sponsor.image || `https://ui-avatars.com/api/?background=0D8ABC&color=fff&name=${sponsor.name}`" :class="$style.contributorAvatar">
<span :class="$style.contributorUsername">{{ sponsor.name }}</span>
</a>
</span>
</div>
</FormSection>
<FormSection> <FormSection>
<template #label>Well-known resources</template> <template #label>Well-known resources</template>
<div class="_gaps_s"> <div class="_gaps_s">
@ -130,6 +146,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue';
import sanitizeHtml from '@/scripts/sanitize-html.js'; import sanitizeHtml from '@/scripts/sanitize-html.js';
import { host, version } from '@/config.js'; import { host, version } from '@/config.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -144,7 +161,10 @@ import MkFolder from '@/components/MkFolder.vue';
import MkKeyValue from '@/components/MkKeyValue.vue'; import MkKeyValue from '@/components/MkKeyValue.vue';
import MkLink from '@/components/MkLink.vue'; import MkLink from '@/components/MkLink.vue';
const sponsors = ref([]);
const initStats = () => misskeyApi('stats', {}); const initStats = () => misskeyApi('stats', {});
await misskeyApi('sponsors', { instance: true }).then((res) => sponsors.value.push(res.sponsor_data));
</script> </script>
<style lang="scss" module> <style lang="scss" module>
@ -207,4 +227,37 @@ const initStats = () => misskeyApi('stats', {});
.ruleText { .ruleText {
padding-top: 6px; padding-top: 6px;
} }
.contributors {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
grid-gap: 12px;
}
.contributor {
display: flex;
align-items: center;
padding: 12px;
background: var(--buttonBg);
border-radius: var(--radius-sm);
&:hover {
text-decoration: none;
background: var(--buttonHoverBg);
}
&.active {
color: var(--accent);
background: var(--buttonHoverBg);
}
}
.contributorAvatar {
width: 30px;
border-radius: var(--radius-full);
}
.contributorUsername {
margin-left: 12px;
}
</style> </style>

View file

@ -4258,7 +4258,7 @@ declare module '../api.js' {
): Promise<SwitchCaseResponseType<E, P>>; ): Promise<SwitchCaseResponseType<E, P>>;
/** /**
* Get Sharkey GH Sponsors * Get Sharkey Sponsors or Instance Sponsors
* *
* **Credential required**: *No* * **Credential required**: *No*
*/ */

View file

@ -3673,7 +3673,7 @@ export type paths = {
'/sponsors': { '/sponsors': {
/** /**
* sponsors * sponsors
* @description Get Sharkey GH Sponsors * @description Get Sharkey Sponsors or Instance Sponsors
* *
* **Credential required**: *No* * **Credential required**: *No*
*/ */
@ -5191,9 +5191,9 @@ export type operations = {
infoImageUrl: string | null; infoImageUrl: string | null;
notFoundImageUrl: string | null; notFoundImageUrl: string | null;
iconUrl: string | null; iconUrl: string | null;
sidebarLogoUrl: string | null;
app192IconUrl: string | null; app192IconUrl: string | null;
app512IconUrl: string | null; app512IconUrl: string | null;
sidebarLogoUrl: string | null;
enableEmail: boolean; enableEmail: boolean;
enableServiceWorker: boolean; enableServiceWorker: boolean;
translatorAvailable: boolean; translatorAvailable: boolean;
@ -9705,9 +9705,9 @@ export type operations = {
infoImageUrl?: string | null; infoImageUrl?: string | null;
notFoundImageUrl?: string | null; notFoundImageUrl?: string | null;
iconUrl?: string | null; iconUrl?: string | null;
sidebarLogoUrl?: string | null;
app192IconUrl?: string | null; app192IconUrl?: string | null;
app512IconUrl?: string | null; app512IconUrl?: string | null;
sidebarLogoUrl?: string | null;
backgroundImageUrl?: string | null; backgroundImageUrl?: string | null;
logoImageUrl?: string | null; logoImageUrl?: string | null;
name?: string | null; name?: string | null;
@ -27990,7 +27990,7 @@ export type operations = {
}; };
/** /**
* sponsors * sponsors
* @description Get Sharkey GH Sponsors * @description Get Sharkey Sponsors or Instance Sponsors
* *
* **Credential required**: *No* * **Credential required**: *No*
*/ */
@ -28000,6 +28000,8 @@ export type operations = {
'application/json': { 'application/json': {
/** @default false */ /** @default false */
forceUpdate?: boolean; forceUpdate?: boolean;
/** @default false */
instance?: boolean;
}; };
}; };
}; };