feat(pikpak): make API and download-link domains configurable#9564
Open
okatu-loli wants to merge 1 commit into
Open
feat(pikpak): make API and download-link domains configurable#9564okatu-loli wants to merge 1 commit into
okatu-loli wants to merge 1 commit into
Conversation
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
JoaHuang
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
需求 / 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.com→dl-a.mypikpak.net),用于提速。custom_*非空时覆盖下拉选择。下拉选项 key 用无点形式(mypikpak_net等)以便前端 label 回退可读,Go 侧映射回真实域名,并兼容直接填原始域名。OSS 上传 endpoint 保持不变。验证 / Verification
go build ./...、go test ./drivers/pikpak/(URL 构建 + 直链重写单测)通过。默认值保持现状,零回归。Closes #9559