diff options
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/pages/settings/api.vue | 46 | ||||
| -rw-r--r-- | src/client/pages/settings/index.vue | 3 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/client/pages/settings/api.vue b/src/client/pages/settings/api.vue new file mode 100644 index 0000000000..f394c826de --- /dev/null +++ b/src/client/pages/settings/api.vue @@ -0,0 +1,46 @@ +<template> +<section class="_card"> + <div class="_title"><fa :icon="faKey"/> API</div> + <div class="_content"> + <mk-input :value="$store.state.i.token" readonly> + <span>{{ $t('token') }}</span> + </mk-input> + <mk-button @click="regenerateToken"><fa :icon="faSyncAlt"/> {{ $t('regenerate') }}</mk-button> + </div> +</section> +</template> + +<script lang="ts"> +import Vue from 'vue'; +import { faKey, faSyncAlt } from '@fortawesome/free-solid-svg-icons'; +import i18n from '../../i18n'; +import MkButton from '../../components/ui/button.vue'; +import MkInput from '../../components/ui/input.vue'; + +export default Vue.extend({ + i18n, + components: { + MkButton, MkInput + }, + data() { + return { + faKey, faSyncAlt + }; + }, + methods: { + regenerateToken() { + this.$root.dialog({ + title: this.$t('password'), + input: { + type: 'password' + } + }).then(({ canceled, result: password }) => { + if (canceled) return; + this.$root.api('i/regenerate_token', { + password: password + }); + }); + }, + } +}); +</script> diff --git a/src/client/pages/settings/index.vue b/src/client/pages/settings/index.vue index 1a00c65760..aa827aa949 100644 --- a/src/client/pages/settings/index.vue +++ b/src/client/pages/settings/index.vue @@ -14,6 +14,7 @@ <x-security/> <x-2fa/> <x-integration/> + <x-api/> <mk-button @click="cacheClear()" primary class="cacheClear">{{ $t('cacheClear') }}</mk-button> <mk-button @click="$root.signout()" primary class="logout">{{ $t('logout') }}</mk-button> @@ -34,6 +35,7 @@ import XSecurity from './security.vue'; import XTheme from './theme.vue'; import X2fa from './2fa.vue'; import XIntegration from './integration.vue'; +import XApi from './api.vue'; import MkButton from '../../components/ui/button.vue'; export default Vue.extend({ @@ -55,6 +57,7 @@ export default Vue.extend({ XTheme, X2fa, XIntegration, + XApi, MkButton, }, |