diff --git a/icons/m-team.png b/icons/m-team.png new file mode 100644 index 0000000..c69ed72 Binary files /dev/null and b/icons/m-team.png differ diff --git a/package.json b/package.json index 30a9a5c..e3083b1 100644 --- a/package.json +++ b/package.json @@ -226,6 +226,18 @@ "v1.2": "增强API安全性" } }, + "MTeamHelper": { + "name": "馒头辅助工具", + "description": "用于解决MP不支持馒头新架构更新导致的一些异常。", + "labels": "馒头,MTeam", + "version": "1.0", + "icon": "m-team.png", + "author": "goo4it", + "level": 1, + "history": { + "v1.0": "支持馒头新架构辅种" + } + }, "IYUUAutoSeed": { "name": "IYUU自动辅种", "description": "基于IYUU官方Api实现自动辅种。", diff --git a/plugins/mteamhelper/__init__.py b/plugins/mteamhelper/__init__.py new file mode 100644 index 0000000..ce9758d --- /dev/null +++ b/plugins/mteamhelper/__init__.py @@ -0,0 +1,118 @@ +import os +import re +from datetime import datetime, timedelta +from threading import Event +from typing import Any, List, Dict, Tuple, Optional + +from app.log import logger +from app.plugins import _PluginBase + +class MTeamHelper(_PluginBase): + # 插件名称 + plugin_name = "馒头辅助工具" + # 插件描述 + plugin_desc = "用于解决MP不支持馒头新架构更新导致的一些异常。" + # 插件图标 + plugin_icon = "m-team.png" + # 插件版本 + plugin_version = "1.0" + # 插件作者 + plugin_author = "goo4it" + # 作者主页 + author_url = "https://github.com/goo4it" + # 插件配置项ID前缀 + plugin_config_prefix = "mteamhelper_" + # 加载顺序 + plugin_order = 17 + # 可使用的用户级别 + auth_level = 1 + + # 私有属性 + _scheduler = None + # 开关 + _enabled = False + _apikey = "" + + def init_plugin(self, config: dict = None): + if not config: + return + logger.info(f"正在应用馒头配置:{config}") + self._enabled = config.get("enabled") + self._apikey = config.get("apikey") + if not self._enabled: + return + + def get_state(self) -> bool: + return self._enabled + + @staticmethod + def get_command() -> List[Dict[str, Any]]: + pass + + def get_api(self) -> List[Dict[str, Any]]: + pass + + def get_form(self) -> Tuple[List[dict], Dict[str, Any]]: + """ + 拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构 + """ + return [ + { + 'component': 'VForm', + 'content': [ + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'enabled', + 'label': '启用插件', + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + "component": "VCol", + "props": { + "cols": 12, + }, + "content": [ + { + "component": "VTextField", + "props": { + "model": "apiKey", + "label": "APIKEY" + } + } + ] + } + ] + }, + ] + } + ], { + "enabled": False, + "apikey": "" + } + + def get_page(self) -> List[dict]: + pass + + def stop_service(self): + """ + 退出插件 + """ + pass