2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2023-04-01 14:01:57 +09:00
|
|
|
<section>
|
|
|
|
<div v-if="app.permission.length > 0">
|
|
|
|
<p>{{ i18n.t('_auth.permission', { name }) }}</p>
|
|
|
|
<ul>
|
|
|
|
<li v-for="p in app.permission" :key="p">{{ i18n.t(`_permissions.${p}`) }}</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div>{{ i18n.t('_auth.shareAccess', { name: `${name} (${app.id})` }) }}</div>
|
|
|
|
<div :class="$style.buttons">
|
|
|
|
<MkButton inline @click="cancel">{{ i18n.ts.cancel }}</MkButton>
|
|
|
|
<MkButton inline primary @click="accept">{{ i18n.ts.accept }}</MkButton>
|
|
|
|
</div>
|
|
|
|
</section>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2023-02-10 02:18:27 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2023-09-04 13:33:38 +09:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2023-02-10 02:18:27 +09:00
|
|
|
const props = defineProps<{
|
2023-09-04 13:33:38 +09:00
|
|
|
session: Misskey.entities.AuthSession;
|
2023-02-10 02:18:27 +09:00
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(event: 'accepted'): void;
|
|
|
|
(event: 'denied'): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const app = $computed(() => props.session.app);
|
|
|
|
|
|
|
|
const name = $computed(() => {
|
|
|
|
const el = document.createElement('div');
|
|
|
|
el.textContent = app.name;
|
|
|
|
return el.innerHTML;
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
2023-02-10 02:18:27 +09:00
|
|
|
|
|
|
|
function cancel() {
|
|
|
|
os.api('auth/deny', {
|
|
|
|
token: props.session.token,
|
|
|
|
}).then(() => {
|
|
|
|
emit('denied');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function accept() {
|
|
|
|
os.api('auth/accept', {
|
|
|
|
token: props.session.token,
|
|
|
|
}).then(() => {
|
|
|
|
emit('accepted');
|
|
|
|
});
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
</script>
|
2023-02-10 02:18:27 +09:00
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.buttons {
|
|
|
|
margin-top: 16px;
|
|
|
|
display: flex;
|
|
|
|
gap: 8px;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
</style>
|