fix 插件API安全控制

This commit is contained in:
jxxghp
2024-04-25 18:00:31 +08:00
parent 827007fe24
commit b367d1a4f6
25 changed files with 219 additions and 183 deletions

View File

@@ -24,7 +24,7 @@ from app.db.downloadhistory_oper import DownloadHistoryOper
from app.db.transferhistory_oper import TransferHistoryOper
from app.log import logger
from app.plugins import _PluginBase
from app.schemas import Notification, NotificationType, TransferInfo
from app.schemas import NotificationType, TransferInfo
from app.schemas.types import EventType, MediaType, SystemConfigKey
from app.utils.string import StringUtils
from app.utils.system import SystemUtils
@@ -59,7 +59,7 @@ class DirMonitor(_PluginBase):
# 插件图标
plugin_icon = "directory.png"
# 插件版本
plugin_version = "1.9"
plugin_version = "2.0"
# 插件作者
plugin_author = "jxxghp"
# 作者主页
@@ -655,10 +655,12 @@ class DirMonitor(_PluginBase):
}]
return []
def sync(self) -> schemas.Response:
def sync(self, apikey: str) -> schemas.Response:
"""
API调用目录同步
"""
if apikey != settings.API_TOKEN:
return schemas.Response(success=False, message="API密钥错误")
self.sync_all()
return schemas.Response(success=True)