2023-07-27 00:31:52 -05:00
|
|
|
<!--
|
2024-02-13 09:59:27 -06:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 00:31:52 -05:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
<template>
|
2023-01-05 22:40:17 -06:00
|
|
|
<div class="_gaps_m">
|
2023-01-05 18:41:14 -06:00
|
|
|
<MkButton primary @click="generateToken">{{ i18n.ts.generateAccessToken }}</MkButton>
|
2023-01-05 06:04:56 -06:00
|
|
|
<FormLink to="/settings/apps">{{ i18n.ts.manageAccessTokens }}</FormLink>
|
|
|
|
<FormLink to="/api-console" :behavior="isDesktop ? 'window' : null">API console</FormLink>
|
2022-01-04 03:21:00 -06:00
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</template>
|
|
|
|
|
2022-05-03 20:15:43 -05:00
|
|
|
<script lang="ts" setup>
|
2023-12-06 23:42:09 -06:00
|
|
|
import { defineAsyncComponent, ref, computed } from 'vue';
|
2022-01-04 03:21:00 -06:00
|
|
|
import FormLink from '@/components/form/link.vue';
|
2023-01-05 18:41:14 -06:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-09-19 02:37:43 -05:00
|
|
|
import * as os from '@/os.js';
|
2024-01-04 03:32:46 -06:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 02:37:43 -05:00
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2022-05-03 20:15:43 -05:00
|
|
|
const isDesktop = ref(window.innerWidth >= 1100);
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2022-05-03 20:15:43 -05:00
|
|
|
function generateToken() {
|
2022-08-30 10:24:33 -05:00
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkTokenGenerateWindow.vue')), {}, {
|
2022-05-03 20:15:43 -05:00
|
|
|
done: async result => {
|
|
|
|
const { name, permissions } = result;
|
2024-01-04 03:32:46 -06:00
|
|
|
const { token } = await misskeyApi('miauth/gen-token', {
|
2022-05-03 20:15:43 -05:00
|
|
|
session: null,
|
|
|
|
name: name,
|
|
|
|
permission: permissions,
|
|
|
|
});
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2022-05-03 20:15:43 -05:00
|
|
|
os.alert({
|
|
|
|
type: 'success',
|
|
|
|
title: i18n.ts.token,
|
2022-06-20 03:38:49 -05:00
|
|
|
text: token,
|
2022-05-03 20:15:43 -05:00
|
|
|
});
|
2020-10-17 06:12:00 -05:00
|
|
|
},
|
2022-05-03 20:15:43 -05:00
|
|
|
}, 'closed');
|
|
|
|
}
|
|
|
|
|
2023-12-06 23:42:09 -06:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 03:38:49 -05:00
|
|
|
|
2023-12-06 23:42:09 -06:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 03:38:49 -05:00
|
|
|
|
2024-02-16 01:17:09 -06:00
|
|
|
definePageMetadata(() => ({
|
2022-06-20 03:38:49 -05:00
|
|
|
title: 'API',
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-api',
|
2024-02-16 01:17:09 -06:00
|
|
|
}));
|
2020-10-17 06:12:00 -05:00
|
|
|
</script>
|