From 2ca8858f4119c47b63fa8437776144aecbd16a32 Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Tue, 12 Aug 2025 15:18:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(qzone=5Futils):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96Cookie=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91,=E6=88=91=E7=9B=B8=E4=BF=A1?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E4=B8=8D=E4=BC=9A=E5=86=8D=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E4=BB=80=E4=B9=88=E5=85=B3=E4=BA=8E=E8=BF=99=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99=E4=BA=86(=3F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/built_in/Maizone/qzone_utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/built_in/Maizone/qzone_utils.py b/src/plugins/built_in/Maizone/qzone_utils.py index a1bd57fcb..88cc99e34 100644 --- a/src/plugins/built_in/Maizone/qzone_utils.py +++ b/src/plugins/built_in/Maizone/qzone_utils.py @@ -28,9 +28,15 @@ class CookieManager: @staticmethod def get_cookie_file_path(uin: str) -> str: """获取Cookie文件路径""" - # .parents 向上追溯四级目录,到达 mmc 根目录 - base_path = Path(__file__).resolve().parents[5] - return str(base_path / 'src' / 'plugins'/ 'built_in' / 'Maizone' / f"cookies-{uin}.json") + # 使用当前文件所在目录作为基础路径,更稳定可靠 + current_dir = Path(__file__).resolve().parent + + # 尝试多种可能的根目录查找方式 + # 方法1:直接在当前插件目录下存储(最稳定) + cookie_dir = current_dir / "cookies" + cookie_dir.mkdir(exist_ok=True) # 确保目录存在 + + return str(cookie_dir / f"cookies-{uin}.json") @staticmethod def parse_cookie_string(cookie_str: str) -> Dict[str, str]: