2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
2024-02-13 15:59:27 +00:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 05:31:52 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2023-01-05 12:04:56 +00:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
2022-06-20 08:38:49 +00:00
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
2023-01-05 12:04:56 +00:00
|
|
|
<FormSuspense :p="init">
|
|
|
|
<MkInfo>{{ i18n.ts.proxyAccountDescription }}</MkInfo>
|
|
|
|
<MkKeyValue>
|
|
|
|
<template #key>{{ i18n.ts.proxyAccount }}</template>
|
|
|
|
<template #value>{{ proxyAccount ? `@${proxyAccount.username}` : i18n.ts.none }}</template>
|
|
|
|
</MkKeyValue>
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2023-01-06 00:41:14 +00:00
|
|
|
<MkButton primary @click="chooseProxyAccount">{{ i18n.ts.selectAccount }}</MkButton>
|
2023-01-05 12:04:56 +00:00
|
|
|
</FormSuspense>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-22 13:29:33 +00:00
|
|
|
</template>
|
|
|
|
|
2022-05-17 16:31:16 +00:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 05:42:09 +00:00
|
|
|
import { ref, computed } from 'vue';
|
2023-12-26 05:19:35 +00:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-08-30 15:24:33 +00:00
|
|
|
import MkKeyValue from '@/components/MkKeyValue.vue';
|
2023-01-06 00:41:14 +00:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2022-01-04 12:16:41 +00:00
|
|
|
import FormSuspense from '@/components/form/suspense.vue';
|
2023-09-19 07:37:43 +00:00
|
|
|
import * as os from '@/os.js';
|
2024-01-04 09:32:46 +00:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 07:37:43 +00:00
|
|
|
import { fetchInstance } from '@/instance.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2023-12-26 05:19:35 +00:00
|
|
|
const proxyAccount = ref<Misskey.entities.UserDetailed | null>(null);
|
|
|
|
const proxyAccountId = ref<string | null>(null);
|
2021-04-22 13:29:33 +00:00
|
|
|
|
2022-05-17 16:31:16 +00:00
|
|
|
async function init() {
|
2024-01-04 09:32:46 +00:00
|
|
|
const meta = await misskeyApi('admin/meta');
|
2023-12-07 05:42:09 +00:00
|
|
|
proxyAccountId.value = meta.proxyAccountId;
|
|
|
|
if (proxyAccountId.value) {
|
2024-01-04 09:32:46 +00:00
|
|
|
proxyAccount.value = await misskeyApi('users/show', { userId: proxyAccountId.value });
|
2022-05-17 16:31:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function chooseProxyAccount() {
|
2024-02-02 07:49:09 +00:00
|
|
|
os.selectUser({ localOnly: true }).then(user => {
|
2023-12-07 05:42:09 +00:00
|
|
|
proxyAccount.value = user;
|
|
|
|
proxyAccountId.value = user.id;
|
2022-05-17 16:31:16 +00:00
|
|
|
save();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function save() {
|
|
|
|
os.apiWithDialog('admin/update-meta', {
|
2023-12-07 05:42:09 +00:00
|
|
|
proxyAccountId: proxyAccountId.value,
|
2022-05-17 16:31:16 +00:00
|
|
|
}).then(() => {
|
2024-02-23 01:47:17 +00:00
|
|
|
fetchInstance(true);
|
2022-05-17 16:31:16 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-12-07 05:42:09 +00:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 08:38:49 +00:00
|
|
|
|
2023-12-07 05:42:09 +00:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 08:38:49 +00:00
|
|
|
|
2024-02-16 07:17:09 +00:00
|
|
|
definePageMetadata(() => ({
|
2022-06-20 08:38:49 +00:00
|
|
|
title: i18n.ts.proxyAccount,
|
2022-12-19 23:35:49 +00:00
|
|
|
icon: 'ti ti-ghost',
|
2024-02-16 07:17:09 +00:00
|
|
|
}));
|
2021-04-22 13:29:33 +00:00
|
|
|
</script>
|