initial link attributions work.
This commit is contained in:
parent
e59a3ad693
commit
ca32c231d0
16 changed files with 228 additions and 3 deletions
|
|
@ -0,0 +1,57 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="_gaps_m">
|
||||
<SearchMarker :keywords="['attribution', 'domains', 'preview', 'url']">
|
||||
<MkTextarea v-model="attributionDomains">
|
||||
<template #label>{{ i18n.ts.attributionDomains }}</template>
|
||||
<template #caption>{{ i18n.ts.attributionDomainsDescription }}
|
||||
<br/>
|
||||
<Mfm :text="i18n.tsx.attributionDomainsTutorial({ user: $i.username, host: host})"/>
|
||||
</template>
|
||||
</MkTextarea>
|
||||
</SearchMarker>
|
||||
<MkButton primary :disabled="!changed" @click="save()"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { host as hostRaw } from '@@/js/config.js'
|
||||
import { toUnicode } from 'punycode.js';
|
||||
import MkTextarea from '@/components/MkTextarea.vue';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { ensureSignin } from '@/i.js';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
const $i = ensureSignin();
|
||||
|
||||
const attributionDomains = ref($i.attributionDomains.join('\n'));
|
||||
const changed = ref(false);
|
||||
const host = toUnicode(hostRaw);
|
||||
|
||||
async function save() {
|
||||
let domains = attributionDomains.value
|
||||
.trim().split('\n')
|
||||
.map(el => el.trim())
|
||||
.filter(el => el);
|
||||
|
||||
await misskeyApi('i/update', {
|
||||
attributionDomains: domains,
|
||||
});
|
||||
|
||||
changed.value = false;
|
||||
|
||||
// Refresh filtered list to signal to the user how they've been saved
|
||||
attributionDomains.value = domains.join('\n');
|
||||
}
|
||||
|
||||
watch(attributionDomains, () => {
|
||||
changed.value = true;
|
||||
});
|
||||
</script>
|
||||
|
|
@ -161,6 +161,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #caption>{{ i18n.ts.flagAsBotDescription }}</template>
|
||||
</MkSwitch>
|
||||
</SearchMarker>
|
||||
|
||||
<AttributionDomainsSettings/>
|
||||
</div>
|
||||
</MkFolder>
|
||||
</SearchMarker>
|
||||
|
|
@ -170,6 +172,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { computed, reactive, ref, watch, defineAsyncComponent } from 'vue';
|
||||
import AttributionDomainsSettings from './attribution-domains-setting.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
|
|
@ -217,6 +220,7 @@ const profile = reactive({
|
|||
isBot: $i.isBot ?? false,
|
||||
isCat: $i.isCat ?? false,
|
||||
speakAsCat: $i.speakAsCat ?? false,
|
||||
attributionDomains: $i.attributionDomains,
|
||||
});
|
||||
|
||||
watch(() => profile, () => {
|
||||
|
|
@ -276,6 +280,7 @@ function save() {
|
|||
isBot: !!profile.isBot,
|
||||
isCat: !!profile.isCat,
|
||||
speakAsCat: !!profile.speakAsCat,
|
||||
attributionDomains: !!profile.attributionDomains,
|
||||
}, undefined, {
|
||||
'0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191': {
|
||||
title: i18n.ts.yourNameContainsProhibitedWords,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue