Skip to content

fix(drivers/lanzou): support new /fn download page structure - #3157

Merged
xrgzs merged 1 commit into
OpenListTeam:mainfrom
rzsgsfm:fix/lanzou-fn-page
Oct 3, 2026
Merged

xrgzs merged 1 commit into
OpenListTeam:mainfrom
rzsgsfm:fix/lanzou-fn-page

Conversation

@rzsgsfm

@rzsgsfm rzsgsfm commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary / 摘要

蓝奏云近期再次改版(约 2026-09 底),文件分享页的下载参数被移入一个 <iframe src="/fn?<token>"> 内页,下载接口从原来的相对路径 '/ajaxm.php?file=N' 改为绝对地址 https://apifile.woozooo.com/ajaxfile.php?file=N,并新增签名参数。现有正则 findFileIDReg 无法匹配新页面,导致所有 Lanzou 存储取直链时报 failed link: failed get link: not find file id(详见 #3155)。

本 PR 在旧版正则匹配失败时回退到新版 /fn 页解析,旧版流程完全保留:

  • parseFnPage:从 /fn 内页提取 domain1/domain2(ajaxfile.php?file=N 绝对地址)、wp_sign、ajaxdata
  • 按页面 JS 的原始请求构造表单:action=downprocess, websignkey=ajaxdata, signs=ajaxdata, sign=wp_sign, websign=2, kd=1, ves=1
  • 新接口返回结构与旧版一致({"zt":1,"dom":"...","url":"?..."}),复用现有 FileShareInfoAndUrlResp[int] 与 GetBaseUrl()/GetDownloadUrl(),后续重定向解析逻辑无需改动

行为变化:仅影响取直链路径,目录列表、密码校验、上传等其他逻辑不变,无配置/兼容性变化。

  • This PR has breaking changes.
  • This PR has NO breaking changes. / 此 PR 不包含破坏性变更。
  • This PR changes public API, config, storage format, or migration behavior.
  • This PR requires corresponding changes in related repositories.

Related repository PRs / 关联仓库 PR:

  • OpenList-Frontend: N/A
  • OpenList-Docs: N/A

Related Issues / 关联 Issue

Fixes #3155

Testing / 测试

  • go build ./drivers/lanzou/(Go 1.27.1, linux/amd64)

  • 针对真实抓取的 /fn 页面 fixture 单测 parseFnPage,正确提取 ajax 地址与签名参数

  • Manual test / 手动测试:使用带提取码的真实蓝奏云分享目录,通过本 PR 代码路径完整执行 GetFolderByShareUrl(列目录)→ GetFilesByShareUrl(取直链),成功返回真实下载地址(https://*.lanosso.com/file/...)。修复前同一流程报 not find file id。

  • 说明:go test ./... 未完整执行(仓库既有代码存在 fmt.Errorf(info) 触发 vet 报错,与本 PR 无关);涉及 lanzou 的验证以上述构建 + 真实环境手动测试代替。

  • Manual test / 手动测试(详见上)

Checklist / 检查清单

  • I have read CONTRIBUTING.
  • I confirm this contribution follows the repository license, contribution policy, and code of conduct.
  • I have formatted the changed code with gofmt (gofmt -l drivers/lanzou/ 无输出).
  • I have requested review from relevant maintainers or code owners where applicable.

AI Disclosure / AI 使用声明

  • This PR includes AI-assisted content.

Tools used / 使用工具:

  • Other (please specify) / 其他(请注明):GLM (ZCode CLI)

Usage scope / 使用范围:

  • Code generation / 代码生成

  • Documentation / 文档

  • I have reviewed and validated all AI-assisted content included in this PR.

  • I have ensured that all AI-assisted commits include Co-Authored-By attribution.

  • I can reproduce all AI-assisted content included in this PR without any AI tools.

Lanzou recently changed the file share page: download params moved
into an iframe (/fn?<token>) inner page, and the download API is now
an absolute URL (https://apifile.woozooo.com/ajaxfile.php?file=N)
with new sign params (wp_sign/ajaxdata, action=downprocess).

The old findFileIDReg ('/ajaxm.php?file=N' relative path) no longer
matches, causing 'failed link: failed get link: not find file id'.

Fall back to parsing the new /fn page structure when the legacy
regex does not match. Legacy flow is kept untouched.

Co-Authored-By: GLM (ZCode CLI) <noreply@z.ai>
Signed-off-by: rzsgsfm <rzsgsfm@users.noreply.github.com>
@xrgzs
xrgzs merged commit e1d88b0 into OpenListTeam:main Oct 3, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants