适配官方新的分享子目录链接格式
Some checks failed
Docker Publish / build-and-push (push) Has been cancelled

This commit is contained in:
Cp0204 2025-09-05 16:18:30 +08:00
parent 33215957bf
commit 5cc955f590
3 changed files with 16 additions and 6 deletions

View File

@ -323,7 +323,9 @@ def get_share_detail():
return jsonify( return jsonify(
{"success": False, "data": {"error": get_stoken.get("message")}} {"success": False, "data": {"error": get_stoken.get("message")}}
) )
share_detail = account.get_detail(pwd_id, stoken, pdir_fid, _fetch_share=1) share_detail = account.get_detail(
pwd_id, stoken, pdir_fid, _fetch_share=1, fetch_share_full_path=1
)
if share_detail.get("code") != 0: if share_detail.get("code") != 0:
return jsonify( return jsonify(
@ -331,7 +333,10 @@ def get_share_detail():
) )
data = share_detail["data"] data = share_detail["data"]
data["paths"] = paths data["paths"] = [
{"fid": i["fid"], "name": i["file_name"]}
for i in share_detail["data"].get("full_path", [])
] or paths
data["stoken"] = stoken data["stoken"] = stoken
# 正则处理预览 # 正则处理预览

View File

@ -1220,9 +1220,9 @@
} else if (shareurl.includes(dir.fid)) { } else if (shareurl.includes(dir.fid)) {
shareurl = shareurl.match(`.*/${dir.fid}[^/]*`)[0] shareurl = shareurl.match(`.*/${dir.fid}[^/]*`)[0]
} else if (shareurl.includes('#/list/share')) { } else if (shareurl.includes('#/list/share')) {
shareurl = `${shareurl}/${dir.fid}-${dir.name?.replace('-', '*101')}` shareurl = `${shareurl.split('#')[0]}#/list/share/${dir.fid}`
} else { } else {
shareurl = `${shareurl}#/list/share/${dir.fid}-${dir.name?.replace('-', '*101')}` shareurl = `${shareurl.split('#')[0]}#/list/share/${dir.fid}`
} }
return shareurl; return shareurl;
}, },

View File

@ -1,6 +1,6 @@
# !/usr/bin/env python3 # !/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Modify: 2024-11-13 # Modify: 2025-09-05
# Repo: https://github.com/Cp0204/quark_auto_save # Repo: https://github.com/Cp0204/quark_auto_save
# ConfigFile: quark_config.json # ConfigFile: quark_config.json
""" """
@ -497,7 +497,9 @@ class Quark:
).json() ).json()
return response return response
def get_detail(self, pwd_id, stoken, pdir_fid, _fetch_share=0): def get_detail(
self, pwd_id, stoken, pdir_fid, _fetch_share=0, fetch_share_full_path=0
):
list_merge = [] list_merge = []
page = 1 page = 1
while True: while True:
@ -515,6 +517,8 @@ class Quark:
"_fetch_share": _fetch_share, "_fetch_share": _fetch_share,
"_fetch_total": "1", "_fetch_total": "1",
"_sort": "file_type:asc,updated_at:desc", "_sort": "file_type:asc,updated_at:desc",
"ver": "2",
"fetch_share_full_path": fetch_share_full_path,
} }
response = self._send_request("GET", url, params=querystring).json() response = self._send_request("GET", url, params=querystring).json()
if response["code"] != 0: if response["code"] != 0:
@ -709,6 +713,7 @@ class Quark:
match_pwd = re.search(r"pwd=(\w+)", url) match_pwd = re.search(r"pwd=(\w+)", url)
passcode = match_pwd.group(1) if match_pwd else "" passcode = match_pwd.group(1) if match_pwd else ""
# path: fid-name # path: fid-name
# Legacy 20250905
paths = [] paths = []
matches = re.findall(r"/(\w{32})-?([^/]+)?", url) matches = re.findall(r"/(\w{32})-?([^/]+)?", url)
for match in matches: for match in matches: