fix customHosts插件重载

This commit is contained in:
thsrite
2023-08-15 19:36:47 +08:00
parent b086bbf015
commit 45381d4449
3 changed files with 19 additions and 18 deletions

View File

@ -4,13 +4,12 @@ from typing import Any, List, Dict, Tuple
from app.chain import ChainBase
from app.core.config import settings
from app.core.event import EventManager, eventmanager, Event
from app.core.event import EventManager
from app.db.models import Base
from app.db.plugindata_oper import PluginDataOper
from app.db.systemconfig_oper import SystemConfigOper
from app.helper.message import MessageHelper
from app.schemas import Notification, NotificationType, MessageChannel
from app.schemas.types import EventType
class PluginChian(ChainBase):
@ -182,17 +181,4 @@ class _PluginBase(metaclass=ABCMeta):
self.chain.post_message(Notification(
channel=channel, mtype=mtype, title=title, text=text,
image=image, link=link, userid=userid
))
@eventmanager.register(EventType.PluginReload)
def reload(self, event: Event):
"""
重新加载插件
"""
plugin_id = event.event_data.get("plugin_id")
if not plugin_id:
return
conf = self.get_config(plugin_id)
if not conf:
return
self.init_plugin(conf)
))