mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 07:34:36 +01:00
Merge pull request #184 from NotThorny/Redirect-more-2
Update more redirecting
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user