2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-03-28 11:33:11 +01:00
|
|
|
<template>
|
2023-01-06 05:40:17 +01:00
|
|
|
<div class="_gaps_m">
|
2021-11-19 11:36:12 +01:00
|
|
|
<FormPagination ref="list" :pagination="pagination">
|
2020-03-28 11:33:11 +01:00
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
2023-06-09 07:00:53 +02:00
|
|
|
<img :src="infoImageUrl" class="_ghost"/>
|
2022-05-04 03:15:24 +02:00
|
|
|
<div>{{ i18n.ts.nothing }}</div>
|
2020-03-28 11:33:11 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #default="{items}">
|
2023-04-10 11:56:38 +02:00
|
|
|
<div class="_gaps">
|
2023-05-24 10:50:15 +02:00
|
|
|
<div v-for="token in items" :key="token.id" class="_panel" :class="$style.app">
|
|
|
|
<img v-if="token.iconUrl" :class="$style.appIcon" :src="token.iconUrl" alt=""/>
|
|
|
|
<div :class="$style.appBody">
|
|
|
|
<div :class="$style.appName">{{ token.name }}</div>
|
|
|
|
<div>{{ token.description }}</div>
|
2023-04-10 11:56:38 +02:00
|
|
|
<MkKeyValue oneline>
|
|
|
|
<template #key>{{ i18n.ts.installedDate }}</template>
|
|
|
|
<template #value><MkTime :time="token.createdAt"/></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline>
|
|
|
|
<template #key>{{ i18n.ts.lastUsedDate }}</template>
|
|
|
|
<template #value><MkTime :time="token.lastUsedAt"/></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<details>
|
|
|
|
<summary>{{ i18n.ts.details }}</summary>
|
|
|
|
<ul>
|
|
|
|
<li v-for="p in token.permission" :key="p">{{ i18n.t(`_permissions.${p}`) }}</li>
|
|
|
|
</ul>
|
|
|
|
</details>
|
2023-05-24 10:50:15 +02:00
|
|
|
<div>
|
2023-04-10 11:56:38 +02:00
|
|
|
<MkButton inline danger @click="revoke(token)"><i class="ti ti-trash"></i></MkButton>
|
|
|
|
</div>
|
2023-01-05 11:50:52 +01:00
|
|
|
</div>
|
2020-03-28 11:33:11 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2020-11-25 13:31:34 +01:00
|
|
|
</FormPagination>
|
2022-01-04 10:21:00 +01:00
|
|
|
</div>
|
2020-03-28 11:33:11 +01:00
|
|
|
</template>
|
|
|
|
|
2022-05-04 03:15:24 +02:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { ref, computed } from 'vue';
|
2023-12-27 07:55:09 +01:00
|
|
|
import FormPagination from '@/components/MkPagination.vue';
|
2024-01-04 10:32:46 +01:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2023-01-05 11:50:52 +01:00
|
|
|
import MkKeyValue from '@/components/MkKeyValue.vue';
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { infoImageUrl } from '@/instance.js';
|
2020-03-28 11:33:11 +01:00
|
|
|
|
2023-12-26 06:19:35 +01:00
|
|
|
const list = ref<InstanceType<typeof FormPagination>>();
|
2020-03-28 11:33:11 +01:00
|
|
|
|
2022-05-04 03:15:24 +02:00
|
|
|
const pagination = {
|
|
|
|
endpoint: 'i/apps' as const,
|
|
|
|
limit: 100,
|
2023-04-10 11:56:38 +02:00
|
|
|
noPaging: true,
|
2022-05-04 03:15:24 +02:00
|
|
|
params: {
|
2022-06-20 10:38:49 +02:00
|
|
|
sort: '+lastUsedAt',
|
|
|
|
},
|
2023-12-27 07:55:09 +01:00
|
|
|
};
|
2020-11-25 13:31:34 +01:00
|
|
|
|
2022-05-04 03:15:24 +02:00
|
|
|
function revoke(token) {
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApi('i/revoke-token', { tokenId: token.id }).then(() => {
|
2022-05-04 03:15:24 +02:00
|
|
|
list.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-03-28 11:33:11 +01:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.installedApps,
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-plug',
|
2020-03-28 11:33:11 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-05-24 10:50:15 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.app {
|
2020-11-25 13:31:34 +01:00
|
|
|
display: flex;
|
|
|
|
padding: 16px;
|
2023-05-24 10:50:15 +02:00
|
|
|
}
|
2020-03-28 11:33:11 +01:00
|
|
|
|
2023-05-24 10:50:15 +02:00
|
|
|
.appIcon {
|
|
|
|
display: block;
|
|
|
|
flex-shrink: 0;
|
|
|
|
margin: 0 12px 0 0;
|
|
|
|
width: 50px;
|
|
|
|
height: 50px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
2020-03-28 11:33:11 +01:00
|
|
|
|
2023-05-24 10:50:15 +02:00
|
|
|
.appBody {
|
|
|
|
width: calc(100% - 62px);
|
|
|
|
position: relative;
|
|
|
|
}
|
2020-03-28 11:33:11 +01:00
|
|
|
|
2023-05-24 10:50:15 +02:00
|
|
|
.appName {
|
|
|
|
font-weight: bold;
|
2020-03-28 11:33:11 +01:00
|
|
|
}
|
|
|
|
</style>
|