2023-07-26 22:31:52 -07:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2023-03-31 22:01:57 -07: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-29 11:37:25 -08:00
|
|
|
</template>
|
|
|
|
|
2023-02-09 09:18:27 -08:00
|
|
|
<script lang="ts" setup>
|
2023-12-06 21:42:09 -08:00
|
|
|
import { computed } from 'vue';
|
2023-09-03 21:33:38 -07:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-09-06 02:21:49 -07:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2024-01-04 01:32:46 -08:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 00:37:43 -07:00
|
|
|
import { i18n } from '@/i18n.js';
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2023-02-09 09:18:27 -08:00
|
|
|
const props = defineProps<{
|
2023-12-02 04:00:05 -08:00
|
|
|
session: Misskey.entities.AuthSessionShowResponse;
|
2023-02-09 09:18:27 -08:00
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(event: 'accepted'): void;
|
|
|
|
(event: 'denied'): void;
|
|
|
|
}>();
|
|
|
|
|
2023-12-06 21:42:09 -08:00
|
|
|
const app = computed(() => props.session.app);
|
2023-02-09 09:18:27 -08:00
|
|
|
|
2023-12-06 21:42:09 -08:00
|
|
|
const name = computed(() => {
|
2023-02-09 09:18:27 -08:00
|
|
|
const el = document.createElement('div');
|
2023-12-06 21:42:09 -08:00
|
|
|
el.textContent = app.value.name;
|
2023-02-09 09:18:27 -08:00
|
|
|
return el.innerHTML;
|
2020-01-29 11:37:25 -08:00
|
|
|
});
|
2023-02-09 09:18:27 -08:00
|
|
|
|
|
|
|
function cancel() {
|
2024-01-04 01:32:46 -08:00
|
|
|
misskeyApi('auth/deny', {
|
2023-02-09 09:18:27 -08:00
|
|
|
token: props.session.token,
|
|
|
|
}).then(() => {
|
|
|
|
emit('denied');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function accept() {
|
2024-01-04 01:32:46 -08:00
|
|
|
misskeyApi('auth/accept', {
|
2023-02-09 09:18:27 -08:00
|
|
|
token: props.session.token,
|
|
|
|
}).then(() => {
|
|
|
|
emit('accepted');
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
</script>
|
2023-02-09 09:18:27 -08:00
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.buttons {
|
|
|
|
margin-top: 16px;
|
|
|
|
display: flex;
|
|
|
|
gap: 8px;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
</style>
|