From 99f90ca6a57d4f8e8ddcf318c76fb5fcfdb616b9 Mon Sep 17 00:00:00 2001 From: thsrite Date: Wed, 3 Jan 2024 21:15:02 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=87=AA=E5=AE=9A=E4=B9=89=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/pluginreinstall/__init__.py | 239 ++++++++++++++-------------- 1 file changed, 118 insertions(+), 121 deletions(-) diff --git a/plugins/pluginreinstall/__init__.py b/plugins/pluginreinstall/__init__.py index 6778eb1..6fb3a47 100644 --- a/plugins/pluginreinstall/__init__.py +++ b/plugins/pluginreinstall/__init__.py @@ -44,18 +44,15 @@ class PluginReInstall(_PluginBase): self._plugin_url = config.get("plugin_url") # 校验插件仓库格式 - pattern = "https://github.com/(.*?)/(.*?)/" - matches = re.findall(pattern, str(self._plugin_url)) - if not matches: - logger.warn(f"指定插件仓库地址 {self._plugin_url} 错误,将使用插件默认地址重装") - self._plugin_url = "" - plugin_url = None if self._plugin_url: - user, repo = self.get_repo_info(self._plugin_url) - if not user or not repo: + pattern = "https://github.com/(.*?)/(.*?)/" + matches = re.findall(pattern, str(self._plugin_url)) + if not matches: logger.warn(f"指定插件仓库地址 {self._plugin_url} 错误,将使用插件默认地址重装") self._plugin_url = "" + + user, repo = self.get_repo_info(self._plugin_url) plugin_url = self._base_url % (user, repo) self.update_config({ @@ -135,119 +132,119 @@ class PluginReInstall(_PluginBase): "value": local_plugin.get("id") }) return [ - { - 'component': 'VForm', - 'content': [ - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 4 - }, - 'content': [ - { - 'component': 'VSelect', - 'props': { - 'multiple': True, - 'chips': True, - 'model': 'plugin_ids', - 'label': '重装插件', - 'items': pluginOptions - } - } - ] - }, - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 8 - }, - 'content': [ - { - 'component': 'VTextField', - 'props': { - 'model': 'plugin_url', - 'label': '仓库地址', - 'placeholder': 'https://github.com/%s/%s/' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '选择已安装的本地插件,强制安装插件市场最新版本。' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '支持指定插件仓库地址(https://github.com/%s/%s/)' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '点击保存卡住请稍等一会,等其他线程执行完先。重载完有提示。' - } - } - ] - } - ] - } - ] - } - ], { - "plugin_ids": [], - "plugin_url": "" - } + { + 'component': 'VForm', + 'content': [ + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 4 + }, + 'content': [ + { + 'component': 'VSelect', + 'props': { + 'multiple': True, + 'chips': True, + 'model': 'plugin_ids', + 'label': '重装插件', + 'items': pluginOptions + } + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 8 + }, + 'content': [ + { + 'component': 'VTextField', + 'props': { + 'model': 'plugin_url', + 'label': '仓库地址', + 'placeholder': 'https://github.com/%s/%s/' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '选择已安装的本地插件,强制安装插件市场最新版本。' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '支持指定插件仓库地址(https://github.com/%s/%s/)' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '点击保存卡住请稍等一会,等其他线程执行完先。重载完有提示。' + } + } + ] + } + ] + } + ] + } + ], { + "plugin_ids": [], + "plugin_url": "" + } @staticmethod def get_local_plugins():