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") + } + } } } 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) diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index 5d9c59f..01b5e73 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -150,6 +150,13 @@ export default class Options extends React.Component { ) } + // If setting any other game, automatically set to redirect more + if (!value.toLowerCase().includes('genshin' || 'yuanshen')) { + if (!this.state.redirect_more) { + this.toggleOption('redirect_more') + } + } + this.setState({ game_install_path: value, })