From 96bf4ef3febee8af318b999e3f499dc7d5f25fdc Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sat, 16 Sep 2023 15:10:55 -0600 Subject: [PATCH] Checks for localhost Linting --- src-tauri/src/system_helpers.rs | 2 +- src/ui/components/ServerLaunchSection.tsx | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index aa0cf74..15b82c9 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -214,7 +214,7 @@ pub fn run_jar(path: String, execute_in: String, java_path: String) { #[cfg(not(target_os = "linux"))] #[tauri::command] -pub fn run_jar_root(path: String, execute_in: String, java_path: String) { +pub fn run_jar_root(_path: String, _execute_in: String, _java_path: String) { panic!("Not implemented"); } diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index ed41eff..adf3fc7 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -16,6 +16,7 @@ import { GrasscutterElevation } from './menu/Options' import { getGameExecutable, getGameVersion, getGrasscutterJar } from '../../utils/game' import { patchGame, unpatchGame } from '../../utils/rsa' import { listen } from '@tauri-apps/api/event' +import { confirm } from '@tauri-apps/api/dialog' interface IProps { openExtras: (playGame: () => void) => void @@ -118,6 +119,24 @@ export default class ServerLaunchSection extends React.Component return } + // Check for HTTPS on local + if (this.state.httpsEnabled) { + if (this.state.ip == 'localhost') { + if ( + await confirm( + "Oops! HTTPS is enabled but you're connecting to localhost! \nHTTPS MUST be disabled for localhost. \n\nWould you like to disable HTTPS and continue?", + { title: 'WARNING!!', type: 'warning' } + ) + ) { + this.toggleHttps() + } else { + if (!(await confirm('You have chosen to keep HTTPS enabled! \n\nYOU WILL ERROR ON LOGIN.'))) { + return + } + } + } + } + // Connect to proxy if (config.toggle_grasscutter) { const game_exe = await getGameExecutable()