2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-02-09 18:18:27 +01:00
|
|
|
<section>
|
|
|
|
<div v-if="app.permission.length > 0">
|
|
|
|
<p>{{ i18n.ts._auth.permissionAsk }}</p>
|
|
|
|
<ul>
|
|
|
|
<li v-for="p in app.permission" :key="p">{{ $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 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2023-02-09 18:18:27 +01:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2022-09-06 11:21:49 +02:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import * as os from '@/os';
|
2023-02-09 18:18:27 +01:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { AuthSession } from 'misskey-js/built/entities';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2023-02-09 18:18:27 +01:00
|
|
|
const props = defineProps<{
|
|
|
|
session: AuthSession;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
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-29 20:37:25 +01:00
|
|
|
});
|
2023-02-09 18:18:27 +01: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-29 20:37:25 +01:00
|
|
|
</script>
|
2023-02-09 18:18:27 +01:00
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.buttons {
|
|
|
|
margin-top: 16px;
|
|
|
|
display: flex;
|
|
|
|
gap: 8px;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
</style>
|