download mirror(just for Chinese) - #712
Conversation
Components/containers in the setup wizard download from GitHub (nicholasx417/WinNative-Components) which is unreachable on some networks. Add a 'Download Source (GitHub Mirror)' entry in Other settings: fill a mirror base (e.g. https://gitee.com/yourname) and the wizard rewrites github.com release URLs and raw.githubusercontent.com file URLs through it (gitee keeps /releases/download/{tag}/{file} and /raw/{branch}/{path}). Empty = GitHub direct. Wired into SetupWizard component downloads and the default.json manifest fetch.
Replace the free-text mirror base with a 'use_china_mirror' toggle
(default off) pointing at the user's Gitee fork
(gitee.com/kingokksa/winnative-components-cnfork). Because the fork repo
is renamed, the rewrite maps the GitHub repo path wholesale
(github.com/nicholasx417/WinNative-Components -> mirror base) instead of a
plain host/owner prefix swap, and raw.githubusercontent URLs become
{base}/raw/{branch}/{path}. Input-control profiles now also honor the
mirror. Other GitHub repos (Retro-Consoles, drivers) are untouched.
Replace the Gitee-fork mirroring with a simpler GitHub proxy prefix: when 'use_china_mirror' is on, any https://github.com or raw.githubusercontent.com URL becomes {proxyBase}/<url>. Default proxy gh-proxy.com, editable in Settings (Other). Original URLs untouched when off; non-GitHub repos unaffected. No release/asset migration needed.
…rd colors Add a 'Mirror' switch left of 'Install All Recommended' in the setup wizard, sharing the same use_china_mirror pref as Other settings (kept in sync). Toggling re-runs refreshRecommendedPackageCache so the recommended list re-fetches through the new download source. Also style the Other settings DownloadSource card with the same palette as its neighbours (CardDark/CardBorder/IconBoxBg/Accent/TextPrimary/TextSecondary).
SetupWizardActivity.prefs() returns a custom PREFS_NAME file, but DownloadSource mirrors via PreferenceManager.getDefaultSharedPreferences. The wizard's Mirror switch therefore wrote use_china_mirror into the wrong store: it never affected downloads (still GitHub original) and reset to off after refresh. Write the DEFAULT prefs instead so both switches share one pref. Also route the component catalog fetch (ContentsManager.REMOTE_PROFILES) through the mirror so the list itself uses the accelerated source. Debug log-level change now restarts logcat capture on a background thread so it can't ANR/crash.
Mirror toggle (settings card + wizard switch) is hidden for non-Chinese systems and defaults to enabled for Chinese (zh-*) until explicitly toggled. zh-TW strings added.
The native depot downloader filters out steam_china_only content servers, so the in-Steam download-region setting never applies to it. Add a Downloads-tab toggle (default off) that sets a native flag keeping China-only CDN servers in the usable server list. Wired: PrefManager steamUseChinaCdn (persisted), WnSteamSession.setUseChinaCdn -> JNI nativeSetUseChinaCdn -> depot_downloader::USE_CHINA_CDN global, applied at app start and live on toggle.
setUseChinaCdn calls a static native method, but PluviaApp.onCreate invokes it before any WnSteamSession exists, so libwnsteam.so was not loaded yet -> UnsatisfiedLinkError on every app start. Load the lib via WnSteamClient.ensureLoaded() first and wrap in runCatching so a missing lib can never crash startup.
…lt on Matches the GitHub-mirror behavior: toggle hidden for non-Chinese systems and enabled by default for Chinese (zh-*) until explicitly toggled.
8ff1196 to
39b4354
Compare
|
I built this and ran it on a device against 1. This moves UI for users who aren't affected by the feature. The Install-All row changed from a 2. The Steam China CDN switch doesn't work. On device it renders as clickable, but tapping it does nothing — the checked state never changes and it's still on after restarting the app. I think it's because 3. Traditional Chinese is missing the new Steam CDN strings. 4. The strings say "Off by default" but both toggles default to on. 5. There's unreachable code in 6. Once it's on, a locale change makes it unreachable. Both toggles persist, but both UIs are hidden behind One thing I'd like a maintainer decision on before merging: with the mirror on, component downloads (Wine/Proton builds, DXVK, imagefs) go through a third-party proxy, and there's no checksum or signature check anywhere in that path — Also worth knowing: drivers, retro cores and the in-app updater still go to GitHub directly, so a user with this on may still be unable to download those. Could you post screenshots of: the wizard Recommended tab in English (to show the button position after your fix), the Downloads tab with the CDN toggle being turned off and staying off after an app restart, and the Downloads tab in zh-TW once the strings are added? Finally — the Steam CDN work and the GitHub mirror are independent features and would be much easier to review as two PRs. The description is also a list of nine commit subjects, several describing approaches that were later replaced (the Gitee fork, the free-text base, and a logcat change that isn't in the diff at all). Worth rewriting before merge. |
feat(steam-cdn): show China CDN toggle only for Chinese locale, default on
fix(crash): load libwnsteam before static setUseChinaCdn
feat(steam): toggle for Steam-China-only CDN servers in Downloads tab
feat(mirror): show mirror toggle only for Chinese locale, default on
fix(mirror): wizard toggle wrote wrong prefs file; mirror list fetch too
feat(ui): mirror toggle in wizard install-all row + align settings card colors
feat(settings): wrap GitHub downloads with China accelerator proxy
feat(settings): China mirror toggle for WinNative-Components downloads
feat(settings): user-configurable GitHub download mirror base