From 6097f3d90aca193f417cd3370ddfdff6e258f9e0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 6 Feb 2021 21:05:00 +0900 Subject: [PATCH] Improve plugin setting --- locales/ja-JP.yml | 6 +- src/client/pages/settings/index.vue | 6 +- src/client/pages/settings/plugin.install.vue | 146 +++++++++++++ src/client/pages/settings/plugin.manage.vue | 117 ++++++++++ src/client/pages/settings/plugin.vue | 42 ++++ src/client/pages/settings/plugins.vue | 211 ------------------- src/client/plugin.ts | 2 +- 7 files changed, 315 insertions(+), 215 deletions(-) create mode 100644 src/client/pages/settings/plugin.install.vue create mode 100644 src/client/pages/settings/plugin.manage.vue create mode 100644 src/client/pages/settings/plugin.vue delete mode 100644 src/client/pages/settings/plugins.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d816d76f3..2233fa27f 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -548,7 +548,6 @@ author: "作者" leaveConfirm: "未保存の変更があります。破棄しますか?" manage: "管理" plugins: "プラグイン" -pluginInstallWarn: "信頼できないプラグインはインストールしないでください。" deck: "デッキ" undeck: "デッキ解除" useBlurEffectForModal: "モーダルにぼかし効果を使用" @@ -702,6 +701,11 @@ inUse: "使用中" editCode: "コードを編集" apply: "適用" +_plugin: + install: "プラグインのインストール" + installWarn: "信頼できないプラグインはインストールしないでください。" + manage: "プラグインの管理" + _registry: scope: "スコープ" key: "キー" diff --git a/src/client/pages/settings/index.vue b/src/client/pages/settings/index.vue index 78aee4bfc..df53eb513 100644 --- a/src/client/pages/settings/index.vue +++ b/src/client/pages/settings/index.vue @@ -18,7 +18,7 @@ {{ $ts.theme }} {{ $ts.sidebar }} {{ $ts.sounds }} - {{ $ts.plugins }} + {{ $ts.plugins }} @@ -105,7 +105,9 @@ export default defineComponent({ case 'sidebar': return defineAsyncComponent(() => import('./sidebar.vue')); case 'sounds': return defineAsyncComponent(() => import('./sounds.vue')); case 'deck': return defineAsyncComponent(() => import('./deck.vue')); - case 'plugins': return defineAsyncComponent(() => import('./plugins.vue')); + case 'plugin': return defineAsyncComponent(() => import('./plugin.vue')); + case 'plugin/install': return defineAsyncComponent(() => import('./plugin.install.vue')); + case 'plugin/manage': return defineAsyncComponent(() => import('./plugin.manage.vue')); case 'import-export': return defineAsyncComponent(() => import('./import-export.vue')); case 'account-info': return defineAsyncComponent(() => import('./account-info.vue')); case 'update': return defineAsyncComponent(() => import('./update.vue')); diff --git a/src/client/pages/settings/plugin.install.vue b/src/client/pages/settings/plugin.install.vue new file mode 100644 index 000000000..34c62619a --- /dev/null +++ b/src/client/pages/settings/plugin.install.vue @@ -0,0 +1,146 @@ + + + diff --git a/src/client/pages/settings/plugin.manage.vue b/src/client/pages/settings/plugin.manage.vue new file mode 100644 index 000000000..b6946e30d --- /dev/null +++ b/src/client/pages/settings/plugin.manage.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/client/pages/settings/plugin.vue b/src/client/pages/settings/plugin.vue new file mode 100644 index 000000000..5bc615b16 --- /dev/null +++ b/src/client/pages/settings/plugin.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/src/client/pages/settings/plugins.vue b/src/client/pages/settings/plugins.vue deleted file mode 100644 index 7f3734e34..000000000 --- a/src/client/pages/settings/plugins.vue +++ /dev/null @@ -1,211 +0,0 @@ - - - - - diff --git a/src/client/plugin.ts b/src/client/plugin.ts index 9d1ef87c1..c56ee1eb2 100644 --- a/src/client/plugin.ts +++ b/src/client/plugin.ts @@ -39,7 +39,7 @@ export function install(plugin) { function createPluginEnv(opts) { const config = new Map(); for (const [k, v] of Object.entries(opts.plugin.config || {})) { - config.set(k, jsToVal(opts.plugin.configData[k] || v.default)); + config.set(k, jsToVal(opts.plugin.configData.hasOwnProperty(k) ? opts.plugin.configData[k] : v.default)); } return {