|
@@ -3,6 +3,8 @@
|
|
|
# github https://github.com/runhey
|
|
# github https://github.com/runhey
|
|
|
from fastapi import APIRouter
|
|
from fastapi import APIRouter
|
|
|
|
|
|
|
|
|
|
+from module.logger import logger
|
|
|
|
|
+
|
|
|
|
|
|
|
|
home_app = APIRouter(
|
|
home_app = APIRouter(
|
|
|
prefix="/home",
|
|
prefix="/home",
|
|
@@ -17,4 +19,19 @@ async def home_test():
|
|
|
async def home_menu():
|
|
async def home_menu():
|
|
|
return {'Home': [], 'Updater': [], 'Tool': []}
|
|
return {'Home': [], 'Updater': [], 'Tool': []}
|
|
|
|
|
|
|
|
|
|
+@home_app.post('/notify_test')
|
|
|
|
|
+async def notify_test(setting: str, title: str, content: str):
|
|
|
|
|
+ from module.notify.notify import Notifier
|
|
|
|
|
+ try:
|
|
|
|
|
+ notifier = Notifier(setting, True)
|
|
|
|
|
+ if notifier.push(title=title, content=content):
|
|
|
|
|
+ del notifier
|
|
|
|
|
+ return True
|
|
|
|
|
+ else:
|
|
|
|
|
+ del notifier
|
|
|
|
|
+ return False
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ logger.exception(e)
|
|
|
|
|
+ return str(e)
|
|
|
|
|
+
|
|
|
|
|
|