2021-04-22 15:29:33 +02:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<FormSuspense :p="init">
|
|
|
|
<div class="_formRoot">
|
|
|
|
<FormSwitch v-model="enableDiscordIntegration" class="_formBlock">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</FormSwitch>
|
|
|
|
|
|
|
|
<template v-if="enableDiscordIntegration">
|
|
|
|
<FormInfo class="_formBlock"
|
|
|
|
>Callback URL: {{ `${uri}/api/dc/cb` }}</FormInfo
|
|
|
|
>
|
|
|
|
|
|
|
|
<FormInput v-model="discordClientId" class="_formBlock">
|
|
|
|
<template #prefix
|
|
|
|
><i class="ph-key ph-bold ph-lg"></i
|
|
|
|
></template>
|
|
|
|
<template #label>Client ID</template>
|
|
|
|
</FormInput>
|
|
|
|
|
|
|
|
<FormInput v-model="discordClientSecret" class="_formBlock">
|
|
|
|
<template #prefix
|
|
|
|
><i class="ph-key ph-bold ph-lg"></i
|
|
|
|
></template>
|
|
|
|
<template #label>Client Secret</template>
|
|
|
|
</FormInput>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<FormButton primary class="_formBlock" @click="save"
|
|
|
|
><i class="ph-floppy-disk-back ph-bold ph-lg"></i>
|
|
|
|
{{ i18n.ts.save }}</FormButton
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</FormSuspense>
|
2021-04-22 15:29:33 +02:00
|
|
|
</template>
|
|
|
|
|
2022-05-17 18:31:48 +02:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import {} from "vue";
|
|
|
|
import FormSwitch from "@/components/form/switch.vue";
|
|
|
|
import FormInput from "@/components/form/input.vue";
|
|
|
|
import FormButton from "@/components/MkButton.vue";
|
|
|
|
import FormInfo from "@/components/MkInfo.vue";
|
|
|
|
import FormSuspense from "@/components/form/suspense.vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { fetchInstance } from "@/instance";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
|
|
|
|
let uri: string = $ref("");
|
2022-05-17 18:31:48 +02:00
|
|
|
let enableDiscordIntegration: boolean = $ref(false);
|
|
|
|
let discordClientId: string | null = $ref(null);
|
|
|
|
let discordClientSecret: string | null = $ref(null);
|
|
|
|
|
|
|
|
async function init() {
|
2023-04-08 02:01:42 +02:00
|
|
|
const meta = await os.api("admin/meta");
|
2022-05-17 18:31:48 +02:00
|
|
|
uri = meta.uri;
|
|
|
|
enableDiscordIntegration = meta.enableDiscordIntegration;
|
|
|
|
discordClientId = meta.discordClientId;
|
|
|
|
discordClientSecret = meta.discordClientSecret;
|
|
|
|
}
|
|
|
|
|
|
|
|
function save() {
|
2023-04-08 02:01:42 +02:00
|
|
|
os.apiWithDialog("admin/update-meta", {
|
2022-05-17 18:31:48 +02:00
|
|
|
enableDiscordIntegration,
|
|
|
|
discordClientId,
|
|
|
|
discordClientSecret,
|
|
|
|
}).then(() => {
|
|
|
|
fetchInstance();
|
|
|
|
});
|
|
|
|
}
|
2021-04-22 15:29:33 +02:00
|
|
|
</script>
|