Skip to content

Add Android support (launcher, on-device server, client mods) - #76

Open
Fokiiiiiii wants to merge 4 commits into
reiserFSs:masterfrom
Fokiiiiiii:android-support-pr
Open

Fokiiiiiii wants to merge 4 commits into
reiserFSs:masterfrom
Fokiiiiiii:android-support-pr

Conversation

@Fokiiiiiii

Copy link
Copy Markdown

Adds Android support (1.0.0): run the server on the phone itself and play the Android client against it. No root needed.

  • Launcher app (Scripts/android/launcher): setup wizard (Termux, then server), PLAY, start/stop, region from the installed client, Export Logs (app, server, relay, MongoDB, game logcat).
  • Server runtime (setup.sh, relay.py): AscNet, MongoDB and a mitmproxy relay inside Termux's proot-distro; the app routes the game to it through a local VpnService.
  • Client MODs (runtime/modctl.py, moddetect, Scripts/pgr_gm_bundle.py, Mods/*): GM Menu / Lua Mods applied through Shizuku. The server sends Client.Debug so the game loads them.
  • Updates: the app checks GitHub Releases on every open (SHA-256 verified) and offers Update server when the server is older than the app. Release workflow: .github/workflows/android-release.yml, tag android-v<version>.
  • Server changes: Android login and region handling (ClientRegions, AccountModule, AccountController, AndroidNotifyLoginSerializer), Debug flag in the remote config.
  • README with manual install, mod-apply, updates and logs.

Tests: launcher unit tests (gradle testDebugUnitTest) and Scripts/android/tests. The only failures are the existing Windows-only ones. Verified on device.

@Fokiiiiiii
Fokiiiiiii force-pushed the android-support-pr branch 2 times, most recently from 1adf0e4 to 68f7baa Compare December 3, 2026 10:16

@reiserFSs reiserFSs left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together — this is a ton of solid work and really nice to see on-device Android support coming together. Before we can merge, there are a few blockers to address:

Required before merge

  1. Reverse-proxy auth bypass / account enumeration (AscNet.SDKServer/Controllers/AccountController.cs:141-155, 240-241):
    /api/AscNet/android/players and /api/AscNet/android/player only check IPAddress.IsLoopback(RemoteIpAddress). On any hosted server behind a local reverse proxy (Nginx/Caddy/cloudflared), remote requests arrive from 127.0.0.1, allowing anyone to enumerate all usernames and hijack Android gate fallback even when ASCNET_GATE_FALLBACK_USERNAME is unset. Please gate both endpoints (and androidPlayUser fallback) behind an explicit opt-in env flag (e.g. ASCNET_ANDROID_LOCAL_MODE=1) that setup.sh sets for on-device runs.
  2. Server update skips extracting payload (Scripts/android/setup.sh:84-108):
    guest_install() returns early when $app/AscNet.dll and mongod already exist, so update-runtime.sh → setup.sh install server-arm64.tar.gz never extracts the new AscNet.dll, relay.py, Configs/, or table/ even though the app marks the update complete. Please ensure updates actually extract the new payload.
  3. Prebuilt binaries checked into git:
    Please remove the prebuilt binaries from the repo and build/fetch them in CI/packaging instead:
    • Scripts/android/runtime/moddetect-aarch64 (the Rust source is already in Scripts/android/moddetect/)
    • Scripts/android/runtime/rish/rish_shizuku.dex
    • Scripts/android/runtime/wheels/unitypy-1.25.2-cp312-cp312-linux_aarch64.whl

Minor cleanups

  • Scripts/android/launcher/gradle.properties:3: default updateRepository to reiserFSs/InfiniteLoop instead of Fokiiiiiii/Cradle.
  • Scripts/android/setup.sh:243: change the default ASCNET_GATE_FALLBACK_USERNAME='foki' to a generic default (e.g. player / android).
  • AscNet.SDKServer/Controllers/AccountController.cs:107-109: ctx.Request.Path != "/api/Login/Login-cn" should also exclude /api/Login/Login-cn-android (or check ClientRegions.FromGatePath).
  • Please add brief AscNet.Test coverage for AndroidNotifyLoginSerializer, /android/config.tab, and the gated /api/AscNet/android/player(s) endpoints so Server CI verifies them on every PR.

Once these are updated and Server CI is green, happy to merge!

@Fokiiiiiii

Copy link
Copy Markdown
Author

Thanks for the review. All three blockers and the minor items are addressed in the updated commit:

Required

  1. /api/AscNet/android/players and /api/AscNet/android/player now return 404 unless ASCNET_ANDROID_LOCAL_MODE=1 is set (loopback is still checked as well). The chosen-account fallback also needs the flag. setup.sh sets it for on-device runs.
  2. guest_install() no longer returns early. An update always extracts the new payload (AscNet.dll, relay.py, Configs/, table/) and swaps the app directory. It reuses the installed MongoDB instead of downloading it again.
  3. The three prebuilt binaries are gone from the repo:
    • moddetect-aarch64 is built in the release workflow on ubuntu-24.04-arm (static musl build).
    • The UnityPy wheel is built from the sdist in the same job, since PyPI has no Linux ARM64 wheel. pack.ps1 writes its hash into the shipped requirements.lock.
    • rish_shizuku.dex is taken from the pinned Shizuku v13.6.0 APK, with both the APK and the dex checked by SHA-256.

Minor

  • updateRepository now defaults to reiserFSs/InfiniteLoop, and the README example uses the same repository.
  • The default ASCNET_GATE_FALLBACK_USERNAME is player.
  • The Login-cn exclusion now goes through ClientRegions.FromGatePath, so Login-cn-android is covered.
  • Added --android-compat-only to AscNet.Test and to server-ci.yml. It covers AndroidNotifyLoginSerializer, /android/config.tab, the gated account endpoints and the gate login.

Not run yet: the new ARM64 jobs of the release workflow (they only run on a release) and the DB-backed tests on my side. Server CI should exercise the latter.

@Fokiiiiiii
Fokiiiiiii requested a review from reiserFSs December 3, 2026 11:58
@reiserFSs

Copy link
Copy Markdown
Owner

Thanks for the quick turnaround — all three previous blockers and the minor cleanups look great! Just two tiny things before I approve CI and merge:

  1. .github/workflows/server-ci.yml:102: There's a literal \n (--login-account-compat-only \n --android-compat-only; do) instead of \ + newline. Bash evaluates unquoted \n as n, which runs dotnet AscNet.Test.dll "n" and falls through to the entire full harness.
  2. Scripts/android/tests/test_distribution.py (test_runtime_replacement_and_failed_build): Still calls guest_install unused without a tarball or tar mock, which will fail on Linux/macOS now that guest_install() always extracts $payload.

Once those two are tweaked, I'll approve the CI workflows and merge as soon as they're green!

The android-compat-only switch was joined with a literal "\n", so bash passed "n" to the test harness. The install test now builds a payload tarball because guest_install always extracts it.
@Fokiiiiiii

Copy link
Copy Markdown
Author

Fixed both in 2a684ae9:

  1. server-ci.yml: \n is now a real line continuation.
  2. test_distribution.py: the install test now builds a payload tarball for guest_install.

That test is skipped on my Windows setup (no real symlinks), so CI is the first real run.

# Conflicts:
#	AscNet.SDKServer/Controllers/AccountController.cs
# Conflicts:
#	AscNet.GameServer/Handlers/AccountModule.cs
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.

2 participants