From 981101b92310271bae96e7d5edcb2d06de0db0a2 Mon Sep 17 00:00:00 2001 From: thsrite Date: Mon, 6 May 2024 21:12:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=8E=86=E5=8F=B2=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/popularsubscribe/__init__.py | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/plugins/popularsubscribe/__init__.py b/plugins/popularsubscribe/__init__.py index a39fb09..7572b6c 100644 --- a/plugins/popularsubscribe/__init__.py +++ b/plugins/popularsubscribe/__init__.py @@ -1,5 +1,6 @@ from datetime import datetime +from app import schemas from app.chain.download import DownloadChain from app.chain.subscribe import SubscribeChain from app.core.config import settings @@ -162,6 +163,21 @@ class PopularSubscribe(_PluginBase): # 保存历史记录 self.save_data('history', history) + def delete_history(self, key: str, apikey: str): + """ + 删除同步历史记录 + """ + if apikey != settings.API_TOKEN: + return schemas.Response(success=False, message="API密钥错误") + # 历史记录 + historys = self.get_data('history') + if not historys: + return schemas.Response(success=False, message="未找到历史记录") + # 删除指定记录 + historys = [h for h in historys if h.get("unique") != key] + self.save_data('history', historys) + return schemas.Response(success=True, message="删除成功") + def get_state(self) -> bool: return self._movie_enabled or self._tv_enabled @@ -388,6 +404,22 @@ class PopularSubscribe(_PluginBase): { 'component': 'VCard', 'content': [ + { + "component": "VDialogCloseBtn", + "props": { + 'innerClass': 'absolute top-0 right-0', + }, + 'events': { + 'click': { + 'api': 'plugin/subscribechain/delete_history', + 'method': 'get', + 'params': { + 'key': f"doubanrank: {title} (DB:{doubanid})", + 'apikey': settings.API_TOKEN + } + } + }, + }, { 'component': 'div', 'props': {