From 84630611cdcc60e83d3f76734c9dce7dd41cd03c Mon Sep 17 00:00:00 2001 From: thsrite Date: Wed, 22 Nov 2023 09:51:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=8F=92=E4=BB=B6=E5=BC=BA=E5=88=B6?= =?UTF-8?q?=E9=87=8D=E8=A3=851.2=E6=94=AF=E6=8C=81=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E4=BB=93=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 64 +++++---- package.json | 2 +- plugins/pluginreinstall/__init__.py | 205 +++++++++++++++++----------- 3 files changed, 164 insertions(+), 107 deletions(-) diff --git a/README.md b/README.md index 84450b8..0915c50 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,43 @@ # MoviePilot-Plugin-Market + MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/ # 保持插件最新 + - 安装并开启`插件自动更新`插件,每次重启会更新已安装插件最新版本。也可设置cron定时任务更新插件。 - 如未刷新到插件更新,或者插件更新版本未变,可用`插件强制重装`插件进行重装。 ### 插件新增 -- 站点数据统计 - - 1.0 自动统计和展示站点数据(无站点未读消息) -- 站点未读消息 - - 1.0 定时获取站点消息 - - 1.1 防止同一消息重复发送 - - 1.2 站点消息历史存库 -- 云盘strm生成 - - 1.0 监控文件创建,生成strm文件 - - 1.1 支持alist链接模式 - - 1.2 支持本地模式 - - 1.3 支持全量运行一次 - - 1.4 异步开启目录监控 - - 1.5 优化异步执行 - - 1.6 支持开启监控延迟 -- 清理订阅缓存 - - 1.0 清理订阅已下载集数 -- 下载种子 - - 1.0 选择下载器,添加种子任务 -- 安全删除站点 - - 1.0 删除下载器中该站点辅种,保留该站点没有辅种的种子 -- 插件自动更新 - - 1.0 监测已安装插件,自动更新最新版本 - - 1.1 修复插件重载 - - 1.2 重启后立即执行一遍更新插件 -- 插件强制重装 - - 1.0 卸载当前插件,强制重装 - - 1.1 修复插件重载 -- 群辉Webhook通知 - - 1.0 接收群辉webhook通知并推送 - - 1.1 修复bug + +- 站点数据统计 + - 1.0 自动统计和展示站点数据(无站点未读消息) +- 站点未读消息 + - 1.0 定时获取站点消息 + - 1.1 防止同一消息重复发送 + - 1.2 站点消息历史存库 +- 云盘strm生成 + - 1.0 监控文件创建,生成strm文件 + - 1.1 支持alist链接模式 + - 1.2 支持本地模式 + - 1.3 支持全量运行一次 + - 1.4 异步开启目录监控 + - 1.5 优化异步执行 + - 1.6 支持开启监控延迟 +- 清理订阅缓存 + - 1.0 清理订阅已下载集数 +- 下载种子 + - 1.0 选择下载器,添加种子任务 +- 安全删除站点 + - 1.0 删除下载器中该站点辅种,保留该站点没有辅种的种子 +- 插件自动更新 + - 1.0 监测已安装插件,自动更新最新版本 + - 1.1 修复插件重载 + - 1.2 重启后立即执行一遍更新插件 +- 插件强制重装 + - 1.0 卸载当前插件,强制重装 + - 1.1 修复插件重载 + - 1.2 支持指定插件仓库地址 +- 群辉Webhook通知 + - 1.0 接收群辉webhook通知并推送 + - 1.1 修复bug diff --git a/package.json b/package.json index 46c6a03..f7be468 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "PluginReInstall": { "name": "插件强制重装", "description": "卸载当前插件,强制重装。", - "version": "1.1", + "version": "1.2", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/reinstall.png", "color": "#3c78d8", "author": "thsrite", diff --git a/plugins/pluginreinstall/__init__.py b/plugins/pluginreinstall/__init__.py index d00297b..fd1e93e 100644 --- a/plugins/pluginreinstall/__init__.py +++ b/plugins/pluginreinstall/__init__.py @@ -1,3 +1,5 @@ +import re + from app.core.config import settings from app.core.plugin import PluginManager from app.db.systemconfig_oper import SystemConfigOper @@ -19,7 +21,7 @@ class PluginReInstall(_PluginBase): # 主题色 plugin_color = "#3c78d8" # 插件版本 - plugin_version = "1.1" + plugin_version = "1.2" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -33,14 +35,25 @@ class PluginReInstall(_PluginBase): # 私有属性 _plugin_ids = [] + _plugin_url = [] def init_plugin(self, config: dict = None): if config: self._plugin_ids = config.get("plugin_ids") or [] if not self._plugin_ids: return + self._plugin_url = config.get("plugin_url") - self.update_config({}) + # 校验插件仓库格式 + pattern = "https://raw.githubusercontent.com/(.*?)/(.*?)/main/" + matches = re.findall(pattern, str(self._plugin_url)) + if not matches: + logger.error(f"指定插件仓库地址 {self._plugin_url} 错误,将使用插件默认地址重装") + self._plugin_url = "" + + self.update_config({ + "plugin_url": self._plugin_url + }) # 本地插件 local_plugins = self.get_local_plugins() @@ -54,7 +67,7 @@ class PluginReInstall(_PluginBase): # 开始安装线上插件 state, msg = PluginHelper().install(pid=plugin_id, - repo_url=local_plugin.get("repo_url")) + repo_url=str(self._plugin_url) or local_plugin.get("repo_url")) # 安装失败 if not state: logger.error( @@ -96,79 +109,119 @@ class PluginReInstall(_PluginBase): "value": local_plugin.get("id") }) return [ - { - 'component': 'VForm', - 'content': [ - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12 - }, - 'content': [ - { - 'component': 'VSelect', - 'props': { - 'multiple': True, - 'chips': True, - 'model': 'plugin_ids', - 'label': '重装插件', - 'items': pluginOptions - } - } - ] - } - ] - }, - { - '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': '点击保存卡住请稍等一会,等其他线程执行完先。重载完有提示。' - } - } - ] - } - ] - } - ] - } - ], { - "plugin_ids": [] - } + { + '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://raw.githubusercontent.com/%s/%s/main/' + } + } + ] + } + ] + }, + { + '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://raw.githubusercontent.com/%s/%s/main/)' + } + } + ] + } + ] + }, + { + '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():