mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-21 23:16:47 +00:00
fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import json, requests
|
||||
import json
|
||||
import requests
|
||||
|
||||
from typing import Any, List, Dict, Tuple
|
||||
|
||||
@@ -7,6 +8,7 @@ from app.log import logger
|
||||
from app.plugins import _PluginBase
|
||||
from app.schemas.types import EventType, NotificationType
|
||||
|
||||
|
||||
class NtfyClient:
|
||||
|
||||
def send(self, message: str, title: str = None, format_as_markdown: bool = False):
|
||||
@@ -21,19 +23,21 @@ class NtfyClient:
|
||||
return response
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
topic: str,
|
||||
server: str = "https://ntfy.sh",
|
||||
user: str = "",
|
||||
password: str = "",
|
||||
self,
|
||||
topic: str,
|
||||
server: str = "https://ntfy.sh",
|
||||
user: str = "",
|
||||
password: str = "",
|
||||
):
|
||||
self._server = server
|
||||
self._topic = topic
|
||||
self.__set_url(server, topic)
|
||||
self._auth = (user, password)
|
||||
|
||||
def __set_url(self, server, topic):
|
||||
self.url = server.strip("/") + "/" + topic
|
||||
|
||||
|
||||
class NtfyMsg(_PluginBase):
|
||||
# 插件名称
|
||||
plugin_name = "ntfy 消息通知"
|
||||
@@ -220,11 +224,10 @@ class NtfyMsg(_PluginBase):
|
||||
'msgtypes': [],
|
||||
'server': 'https://ntfy.sh',
|
||||
'topic': 'MoviePilot',
|
||||
'user':'',
|
||||
'password':'',
|
||||
'user': '',
|
||||
'password': '',
|
||||
}
|
||||
|
||||
|
||||
def get_page(self) -> List[dict]:
|
||||
pass
|
||||
|
||||
@@ -264,7 +267,7 @@ class NtfyMsg(_PluginBase):
|
||||
if not self._server or not self._topic:
|
||||
return False, "参数未配置"
|
||||
ntfy = NtfyClient(server=self._server, topic=self._topic, user=self._user, password=self._password)
|
||||
ntfy.send(title=title, message=text,format_as_markdown=True)
|
||||
ntfy.send(title=title, message=text, format_as_markdown=True)
|
||||
|
||||
except Exception as msg_e:
|
||||
logger.error(f"ntfy消息发送失败,错误信息:{str(msg_e)}")
|
||||
|
||||
Reference in New Issue
Block a user