Skip to content

feat(pikpak): make API and download-link domains configurable#9564

Open
okatu-loli wants to merge 1 commit into
AlistGo:mainfrom
okatu-loli:feat/pikpak-optional-domain
Open

feat(pikpak): make API and download-link domains configurable#9564
okatu-loli wants to merge 1 commit into
AlistGo:mainfrom
okatu-loli:feat/pikpak-optional-domain

Conversation

@okatu-loli

Copy link
Copy Markdown
Collaborator

需求 / Motivation

PikPak 有多个镜像域名(mypikpak.net / mypikpak.com / pikpak.me / pikpakdrive.com),不同域名的下载/播放速度差异很大;但驱动把所有 api-drive/user 主机硬编码成 mypikpak.net,且从不改写接口返回的直链域名。对应 #9559

改动 / Change

新增两组「内置可选 + 手动填写」的域名配置(沿用 Onedrive 的 region + custom_host 模式):

  • api_domain(下拉) / custom_api_domain(手填):所有 API/登录/验证码请求域名,用于构建 api-drive.<domain>user.<domain>。默认保持 mypikpak.net(现有行为)。
  • download_domain(下拉,默认 original=不改写) / custom_download_domain(手填):开启后把接口返回的下载/播放直链主机改写为所选域名(保留子域前缀,如 dl-a.mypikpak.comdl-a.mypikpak.net),用于提速。

custom_* 非空时覆盖下拉选择。下拉选项 key 用无点形式(mypikpak_net 等)以便前端 label 回退可读,Go 侧映射回真实域名,并兼容直接填原始域名。OSS 上传 endpoint 保持不变。

验证 / Verification

go build ./...go test ./drivers/pikpak/(URL 构建 + 直链重写单测)通过。默认值保持现状,零回归。

Closes #9559

PikPak is reachable under several mirror domains (mypikpak.net,
mypikpak.com, pikpak.me, pikpakdrive.com) and download/playback speed can
differ a lot between them, but the driver hardcoded mypikpak.net for all
api-drive/user hosts and never touched the returned link domain.

Add settings that can be picked from the built-in list or overridden by
a manually entered custom value (same pattern as Onedrive region +
custom_host):
- api_domain (select) / custom_api_domain (text): domain used to build
  api-drive.<domain> and user.<domain> for all API/auth/captcha requests.
  Default keeps mypikpak.net (current behavior).
- download_domain (select, default 'original' = no rewrite) /
  custom_download_domain (text): when set, rewrites the host of the
  download/play link returned by the API to this PikPak domain (keeping
  the original subdomain prefix, e.g. dl-a.mypikpak.com ->
  dl-a.mypikpak.net) so streaming can use a faster domain.

The custom_* field overrides the selected one when non-empty. Select
options use dot-free keys (mypikpak_net, ...) mapped to real domains so
the web UI renders readable labels without extra i18n; raw domain values
are still accepted. The OSS upload endpoint is left unchanged. Add unit
tests for URL building and link rewriting.

Closes AlistGo#9559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pikpak挂载驱动是否可选域名,希望可选切换到 pikpak.net

2 participants