Merge pull request #184 from NotThorny/Redirect-more-2

Update more redirecting
This commit is contained in:
SpikeHD
2023-06-25 14:35:40 -07:00
committed by GitHub
3 changed files with 32 additions and 4 deletions

View File

@@ -171,7 +171,26 @@ impl HttpHandler for ProxyHandler {
async fn should_intercept(&mut self, _ctx: &HttpContext, _req: &Request<Body>) -> 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")
}
}
}
}

View File

@@ -119,7 +119,11 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
// 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<IProps, IState>
}
}
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)

View File

@@ -150,6 +150,13 @@ export default class Options extends React.Component<IProps, IState> {
)
}
// 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,
})