Update oauth.vue

This commit is contained in:
Kagami Sascha Rosylight 2023-06-26 23:15:07 +02:00
parent 833df85457
commit deb9ba146f

View file

@ -1,13 +1,13 @@
<template> <template>
<MkStickyContainer> <MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader/></template>
<MkSpacer :contentMax="800"> <MkSpacer :contentMax="800">
<div v-if="$i"> <div v-if="$i">
<div v-if="_permissions.length > 0"> <div v-if="permissions.length > 0">
<p v-if="name">{{ i18n.t('_auth.permission', { name }) }}</p> <p v-if="name">{{ i18n.t('_auth.permission', { name }) }}</p>
<p v-else>{{ i18n.ts._auth.permissionAsk }}</p> <p v-else>{{ i18n.ts._auth.permissionAsk }}</p>
<ul> <ul>
<li v-for="p in _permissions" :key="p">{{ i18n.t(`_permissions.${p}`) }}</li> <li v-for="p in permissions" :key="p">{{ i18n.t(`_permissions.${p}`) }}</li>
</ul> </ul>
</div> </div>
<div v-if="name">{{ i18n.t('_auth.shareAccess', { name }) }}</div> <div v-if="name">{{ i18n.t('_auth.shareAccess', { name }) }}</div>
@ -28,7 +28,6 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { } from 'vue';
import MkSignin from '@/components/MkSignin.vue'; import MkSignin from '@/components/MkSignin.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { $i, login } from '@/account'; import { $i, login } from '@/account';
@ -41,16 +40,12 @@ if (transactionIdMeta) {
} }
const name = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:client-name"]')?.content; const name = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:client-name"]')?.content;
const _permissions = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:scope"]')?.content.split(' ') ?? []; const permissions = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:scope"]')?.content.split(' ') ?? [];
function onLogin(res): void { function onLogin(res): void {
login(res.i); login(res.i);
} }
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
definePageMetadata({ definePageMetadata({
title: 'OAuth', title: 'OAuth',
icon: 'ti ti-apps', icon: 'ti ti-apps',