Api key setting

This commit is contained in:
syuilo 2020-02-15 03:18:33 +09:00
parent 87451b1223
commit c00ab0fbe2
4 changed files with 51 additions and 0 deletions

View file

@ -7,6 +7,7 @@ unreleased
* アンテナの受信ソースにグループを指定できるように
* 時計ウィジェットを追加
* ログアウトせずに新しいアカウントを追加できるように
* APIキー設定を実装
### 🐛Fixes
* v12アップデート後にトップページアクセスでOops!になっちゃうのを修正

View file

@ -399,6 +399,7 @@ tags: "タグ"
docSource: "このドキュメントのソース"
createAccount: "アカウントを作成"
existingAcount: "既存のアカウント"
regenerate: "再生成"
_ago:
unknown: "謎"

View file

@ -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>

View file

@ -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,
},