-
-
Notifications
You must be signed in to change notification settings - Fork 124
auto pick server and rejoin when session end #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
liwa-dev
wants to merge
17
commits into
OpenCloudGaming:dev
Choose a base branch
from
liwa-dev:feat/smart-auto-rejoin
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ba4203e
merge dev -> main
zortos293 a599e19
Merge branch 'dev' into main
zortos293 cce3f84
chore(release): prepare v0.5.2
github-actions[bot] 8faa6d5
docs(readme): point Android downloads to Google Play
zortos293 94e39c9
feat: smart auto-rejoin with TCP ping-based server selection
liwa-dev f6c3c42
fix(updater): Preserve nested macOS signatures (#631)
luizkowalski 5c098d3
fix(smart-auto-rejoin): update for current dev — use proxyFetch, filt…
liwa-dev e15cb06
fix(smart-auto-rejoin): address CodeRabbit review feedback
liwa-dev 8cb0dfb
Merge branch 'main' into feat/smart-auto-rejoin
Kief5555 5198e23
fix(smart-auto-rejoin): address Kief5555 review feedback
liwa-dev 56869a0
fix(smart-auto-rejoin): translate settings label and hint
liwa-dev f213607
fix(smart-auto-rejoin): share server picker logic and handle stale state
liwa-dev 60d2e95
fix(smart-auto-rejoin): reset rejoin counter on web streaming success
liwa-dev 59e9451
fix(smart-auto-rejoin): fix CI failures and address Codex review edge…
liwa-dev 57a0a85
fix(smart-auto-rejoin): dedupe rejoin calls and preserve alliance/pro…
liwa-dev 0d29ca5
Deleted auto-generated file
Kief5555 37d25c3
fix(smart-auto-rejoin): ignore stale prefetch results after session r…
liwa-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import assert from "node:assert/strict"; | ||
| import { chmod, mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises"; | ||
| import { tmpdir } from "node:os"; | ||
| import { join } from "node:path"; | ||
| import test from "node:test"; | ||
|
|
||
| import afterSign from "./after-sign-mac.mjs"; | ||
|
|
||
| test("re-signs only the outer macOS app bundle", { skip: process.platform !== "darwin" }, async () => { | ||
| const root = await mkdtemp(join(tmpdir(), "opennow-after-sign-")); | ||
| const binDir = join(root, "bin"); | ||
| const argsFile = join(root, "codesign-args"); | ||
| const appOutDir = join(root, "output"); | ||
| const originalEnv = { ...process.env }; | ||
|
|
||
| try { | ||
| await mkdir(binDir); | ||
| await mkdir(join(appOutDir, "OpenNOW.app"), { recursive: true }); | ||
| await writeFile(join(binDir, "codesign"), '#!/bin/sh\nprintf "%s\\n" "$@" >> "$CODESIGN_ARGS_FILE"\n'); | ||
| await chmod(join(binDir, "codesign"), 0o755); | ||
| process.env.PATH = `${binDir}:${process.env.PATH}`; | ||
| process.env.CODESIGN_ARGS_FILE = argsFile; | ||
| process.env.CSC_IDENTITY_AUTO_DISCOVERY = "false"; | ||
|
|
||
| await afterSign({ | ||
| appOutDir, | ||
| packager: { | ||
| appInfo: { id: "com.zortos.opennow.stable", productFilename: "OpenNOW" }, | ||
| }, | ||
| }); | ||
|
|
||
| const args = (await readFile(argsFile, "utf8")).trim().split("\n"); | ||
| assert.equal(args.length, 6); | ||
| assert.equal(args.includes("--deep"), false); | ||
| assert.deepEqual(args.slice(0, 4), ["--force", "--sign", "-", "--requirements"]); | ||
| assert.equal(args[4], '=designated => identifier "com.zortos.opennow.stable"'); | ||
| assert.equal(args[5], join(appOutDir, "OpenNOW.app")); | ||
| } finally { | ||
| process.env = originalEnv; | ||
| await rm(root, { recursive: true, force: true }); | ||
| } | ||
| }); |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import dns from "node:dns"; | ||
|
|
||
| const originalLookup = dns.lookup; | ||
|
|
||
| const fallbackResolver = new dns.Resolver(); | ||
| fallbackResolver.setServers(["1.1.1.1", "8.8.8.8"]); | ||
|
|
||
| function isNvidiaHostname(hostname: string): boolean { | ||
| if (!hostname) return false; | ||
| const lower = hostname.toLowerCase(); | ||
| return lower.endsWith(".nvidiagrid.net") || lower.endsWith(".nvidia.com"); | ||
| } | ||
|
|
||
| export function initDnsInterceptor(): void { | ||
| // @ts-ignore | ||
| dns.lookup = function ( | ||
| hostname: string, | ||
| options: any, | ||
| callback: (err: NodeJS.ErrnoException | null, address: string | any[], family?: number) => void | ||
| ) { | ||
| let actualOptions = options; | ||
| let actualCallback = callback; | ||
|
|
||
| if (typeof options === "function") { | ||
| actualCallback = options; | ||
| actualOptions = {}; | ||
| } else if (typeof options === "number") { | ||
| actualOptions = { family: options }; | ||
| } else { | ||
| actualOptions = options ?? {}; | ||
| } | ||
|
|
||
| if (isNvidiaHostname(hostname)) { | ||
| const family = actualOptions.family; | ||
| if (family === 6) { | ||
| // Fall back to original for IPv6 lookup | ||
| originalLookup(hostname, actualOptions, actualCallback); | ||
| return; | ||
| } | ||
|
|
||
| // Try original lookup first to respect local network configurations/hosts file | ||
| originalLookup(hostname, actualOptions, (err, address, resolvedFamily) => { | ||
| if (err && (err.code === "ENOTFOUND" || err.code === "EAI_AGAIN")) { | ||
| // If native lookup failed, attempt resolving via Cloudflare/Google public DNS | ||
| fallbackResolver.resolve4(hostname, (fallbackErr, addresses) => { | ||
| if (!fallbackErr && addresses && addresses.length > 0) { | ||
| const ip = addresses[0]; | ||
| console.log(`[DNS Interceptor] Fallback resolved ${hostname} -> ${ip}`); | ||
| if (actualOptions.all) { | ||
| actualCallback(null, [{ address: ip, family: 4 }], 4); | ||
| } else { | ||
| actualCallback(null, ip, 4); | ||
| } | ||
| } else { | ||
| // Return original error if fallback also failed | ||
| actualCallback(err, address, resolvedFamily); | ||
| } | ||
| }); | ||
| } else { | ||
| // Normal success or other errors | ||
| actualCallback(err, address, resolvedFamily); | ||
| } | ||
| }); | ||
| return; | ||
| } | ||
|
|
||
| originalLookup(hostname, actualOptions, actualCallback); | ||
| }; | ||
|
|
||
| // Preserve util.promisify(dns.lookup) compatibility — copy the custom promisify | ||
| // symbol from the original so callers get the correct { address, family } shape. | ||
| const promisifyCustom = Symbol.for("nodejs.util.promisify.custom"); | ||
| if (promisifyCustom in originalLookup) { | ||
| // @ts-ignore | ||
| dns.lookup[promisifyCustom] = originalLookup[promisifyCustom as keyof typeof originalLookup]; | ||
| } | ||
|
|
||
| console.log("[DNS Interceptor] Interceptor initialized successfully with safe fallback resolver."); | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.