diff options
| author | Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> | 2023-08-18 19:36:05 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-18 19:36:05 +0900 |
| commit | ba16abb9f3b4eb6aaca2db8123893b75ac72659c (patch) | |
| tree | b8b6c2063c76735163148e032b5fabfddc49af54 /packages/frontend/src/pages/settings/plugin.install.vue | |
| parent | chore(backend): Resolve `import/no-default-export` rule violations (#11732) (diff) | |
| download | misskey-ba16abb9f3b4eb6aaca2db8123893b75ac72659c.tar.gz misskey-ba16abb9f3b4eb6aaca2db8123893b75ac72659c.tar.bz2 misskey-ba16abb9f3b4eb6aaca2db8123893b75ac72659c.zip | |
fix(frontend): Misskeyプラグインをインストールする際のAiScriptバージョンのチェックが0.14.0以降に対応していない問題を修正 (#11729)
* fix: aiscript version check of plugin
* Update CHANGELOG.md
* docs(CHANGELOG): remove 11420 issue link
* fix(frontend): Possibility of exception in non-semver version format
Diffstat (limited to 'packages/frontend/src/pages/settings/plugin.install.vue')
| -rw-r--r-- | packages/frontend/src/pages/settings/plugin.install.vue | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/frontend/src/pages/settings/plugin.install.vue b/packages/frontend/src/pages/settings/plugin.install.vue index dd070dcb1d..d848f8e21c 100644 --- a/packages/frontend/src/pages/settings/plugin.install.vue +++ b/packages/frontend/src/pages/settings/plugin.install.vue @@ -19,6 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { defineAsyncComponent, nextTick, ref } from 'vue'; +import { compareVersions } from 'compare-versions'; import { Interpreter, Parser, utils } from '@syuilo/aiscript'; import { v4 as uuid } from 'uuid'; import MkTextarea from '@/components/MkTextarea.vue'; @@ -44,6 +45,14 @@ function installPlugin({ id, meta, src, token }) { })); } +function isSupportedAiScriptVersion(version: string): boolean { + try { + return (compareVersions(version, '0.12.0') >= 0); + } catch (err) { + return false; + } +} + async function install() { if (code.value == null) return; @@ -54,7 +63,7 @@ async function install() { text: 'No language version annotation found :(', }); return; - } else if (!(lv.startsWith('0.12.') || lv.startsWith('0.13.'))) { + } else if (!isSupportedAiScriptVersion(lv)) { os.alert({ type: 'error', text: `aiscript version '${lv}' is not supported :(`, |