From db6f23dbad7d0ccf6aa8f786802f729487028a19 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sun, 25 Jun 2023 11:24:13 -0600 Subject: [PATCH 1/4] Update intercepts --- src-tauri/src/proxy.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/proxy.rs b/src-tauri/src/proxy.rs index a8d97e3..00ff51b 100644 --- a/src-tauri/src/proxy.rs +++ b/src-tauri/src/proxy.rs @@ -171,7 +171,26 @@ impl HttpHandler for ProxyHandler { async fn should_intercept(&mut self, _ctx: &HttpContext, _req: &Request) -> bool { let uri = _req.uri().to_string(); - uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") + let more = get_config().redirect_more; + + match more { + Some(true) => { + uri.contains("hoyoverse.com") + || uri.contains("mihoyo.com") + || uri.contains("yuanshen.com") + || uri.contains("starrails.com") + || uri.contains("bhsr.com") + || uri.contains("bh3.com") + || uri.contains("honkaiimpact3.com") + || uri.contains("zenlesszonezero.com") + } + Some(false) => { + uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") + } + None => { + uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") + } + } } } From 38436472e3e41b4ac3b7ddde75ba909110bb6925 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sun, 25 Jun 2023 12:44:57 -0600 Subject: [PATCH 2/4] Skip patching on other anime games --- src/ui/components/ServerLaunchSection.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index 942a837..ad038a0 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -119,7 +119,11 @@ export default class ServerLaunchSection extends React.Component // Connect to proxy if (config.toggle_grasscutter) { - if (config.patch_rsa) { + const game_exe = await getGameExecutable() + + const patchable = game_exe?.toLowerCase().includes('genshin' || 'yuanshen') + + if (config.patch_rsa && patchable) { const gameVersion = await getGameVersion() console.log(gameVersion) @@ -148,8 +152,6 @@ export default class ServerLaunchSection extends React.Component } } - const game_exe = await getGameExecutable() - // Save last connected server and port await setConfigOption('last_ip', this.state.ip) await setConfigOption('last_port', this.state.port) From 7c9b2f7335efae9ab34fcc4e81a0bc2e993350e9 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:30:15 -0600 Subject: [PATCH 3/4] Auto redirect more when setting other game --- src/ui/components/menu/Options.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index 5d9c59f..61d342a 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -150,6 +150,11 @@ export default class Options extends React.Component { ) } + // If setting any other game, automatically set to redirect more + if (!value.toLowerCase().includes('genshin' || 'yuanshen')) { + this.toggleOption('redirect_more') + } + this.setState({ game_install_path: value, }) From f1ecb1aab0a6a63c6590364ff2b87baee1ec925d Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:36:01 -0600 Subject: [PATCH 4/4] Fix handling --- src/ui/components/menu/Options.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index 61d342a..01b5e73 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -152,7 +152,9 @@ export default class Options extends React.Component { // If setting any other game, automatically set to redirect more if (!value.toLowerCase().includes('genshin' || 'yuanshen')) { - this.toggleOption('redirect_more') + if (!this.state.redirect_more) { + this.toggleOption('redirect_more') + } } this.setState({