From d044364c689e97ea3b3047dee84814f01fc17ba3 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 17 Nov 2024 15:58:29 +0800 Subject: [PATCH] =?UTF-8?q?fix=20115=E6=89=AB=E7=A0=81=E5=90=8E=E8=A6=81?= =?UTF-8?q?=E9=87=8D=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/filemanager/storages/u115.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/modules/filemanager/storages/u115.py b/app/modules/filemanager/storages/u115.py index 7f4fa160..ac6cbf5f 100644 --- a/app/modules/filemanager/storages/u115.py +++ b/app/modules/filemanager/storages/u115.py @@ -28,7 +28,7 @@ class U115Pan(StorageBase, metaclass=Singleton): fs: P115FileSystem = None session_info: dict = None - def __init_cloud(self) -> bool: + def __init_cloud(self, force: bool = False) -> bool: """ 初始化Cloud """ @@ -37,7 +37,7 @@ class U115Pan(StorageBase, metaclass=Singleton): logger.warn("115未登录,请先登录!") return False try: - if not self.client or not self.client.cookies: + if not self.client or not self.client.cookies or force: self.client = P115Client(credential) self.fs = P115FileSystem(self.client) except Exception as err: @@ -113,7 +113,9 @@ class U115Pan(StorageBase, metaclass=Singleton): resp = self.client.login_qrcode_scan_result(uid=self.session_info.get("uid"), app="alipaymini") if resp: + # 保存认证信息 self.__save_credential(resp["data"]["cookie"]) + self.__init_cloud(force=True) result = { "status": 2, "tip": "登录成功!"