feat 插件强制重装1.2支持指定插件仓库地址

This commit is contained in:
thsrite
2023-11-22 09:51:32 +08:00
parent bc3fa1fe70
commit 84630611cd
3 changed files with 164 additions and 107 deletions

View File

@@ -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

View File

@@ -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",

View File

@@ -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():