From b39850de012fa7b05959c7f4bbbbade841d186ff Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 18 Jul 2020 14:28:32 +0900 Subject: [PATCH] =?UTF-8?q?feat(client):=20AiScript=E3=83=97=E3=83=A9?= =?UTF-8?q?=E3=82=B0=E3=82=A4=E3=83=B3=E3=81=8B=E3=82=89API=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=BB=E3=82=B9=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 2 + .../components/token-generate-window.vue | 34 ++++++++-- src/client/pages/preferences/plugins.vue | 65 ++++++++++++++++--- src/client/scripts/aiscript/api.ts | 12 +++- src/client/store.ts | 14 ++-- 5 files changed, 107 insertions(+), 20 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c3933a417..a073d789a 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -533,6 +533,8 @@ generateAccessToken: "アクセストークンの発行" permission: "権限" enableAll: "全て有効にする" disableAll: "全て無効にする" +tokenRequested: "アカウントへのアクセス許可" +pluginTokenRequestedDescription: "このプラグインはここで設定した権限を行使できるようになります。" _theme: explore: "テーマを探す" diff --git a/src/client/components/token-generate-window.vue b/src/client/components/token-generate-window.vue index 5486ae92e..e58dcbda7 100644 --- a/src/client/components/token-generate-window.vue +++ b/src/client/components/token-generate-window.vue @@ -2,6 +2,9 @@
+
+ {{ information }} +
{{ $t('name') }}
@@ -9,7 +12,7 @@
{{ $t('permission') }}
{{ $t('disableAll') }} {{ $t('enableAll') }} - {{ $t(`_permissions.${kind}`) }} + {{ $t(`_permissions.${kind}`) }}
@@ -23,6 +26,7 @@ import MkInput from './ui/input.vue'; import MkTextarea from './ui/textarea.vue'; import MkSwitch from './ui/switch.vue'; import MkButton from './ui/button.vue'; +import MkInfo from './ui/info.vue'; export default Vue.extend({ components: { @@ -31,6 +35,7 @@ export default Vue.extend({ MkTextarea, MkSwitch, MkButton, + MkInfo, }, props: { @@ -38,20 +43,41 @@ export default Vue.extend({ type: String, required: false, default: null + }, + information: { + type: String, + required: false, + default: null + }, + initialName: { + type: String, + required: false, + default: null + }, + initialPermissions: { + type: Array, + required: false, + default: null } }, data() { return { - name: null, + name: this.initialName, permissions: {}, kinds }; }, created() { - for (const kind of this.kinds) { - Vue.set(this.permissions, kind, false); + if (this.initialPermissions) { + for (const kind of this.initialPermissions) { + Vue.set(this.permissions, kind, true); + } + } else { + for (const kind of this.kinds) { + Vue.set(this.permissions, kind, false); + } } }, diff --git a/src/client/pages/preferences/plugins.vue b/src/client/pages/preferences/plugins.vue index afe7c8caf..ee0ac3652 100644 --- a/src/client/pages/preferences/plugins.vue +++ b/src/client/pages/preferences/plugins.vue @@ -30,7 +30,10 @@
{{ $t('description') }}:
{{ selectedPlugin.description }}
- {{ $t('uninstall') }} +
+ {{ $t('settings') }} + {{ $t('uninstall') }} +
@@ -39,7 +42,7 @@