diff --git a/src-tauri/lang/chs.json b/src-tauri/lang/chs.json index b883f67..4cf32e4 100644 --- a/src-tauri/lang/chs.json +++ b/src-tauri/lang/chs.json @@ -33,7 +33,9 @@ "horny_mode": "Horny 模式", "auto_mongodb": "自动启动 MongoDB", "un_elevated": "非提升运行游戏(无管理员)", - "redirect_more": "还可以重定向其他MHY游戏" + "redirect_more": "还可以重定向其他MHY游戏", + "web_cache": "删除 webCaches 文件夹", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "下载 Grasscutter 一体化", diff --git a/src-tauri/lang/cht.json b/src-tauri/lang/cht.json index ae35fb2..672bcbd 100644 --- a/src-tauri/lang/cht.json +++ b/src-tauri/lang/cht.json @@ -33,7 +33,9 @@ "horny_mode": "Horny模式", "auto_mongodb": "自動啟動 MongoDB", "un_elevated": "在不升高的情况下运行游戏(没有管理员)。", - "redirect_more": "同時重定向其他 MHY 遊戲" + "redirect_more": "同時重定向其他 MHY 遊戲", + "web_cache": "刪除 webCaches 文件夾", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "下載Grasscutter多合一下載", diff --git a/src-tauri/lang/de.json b/src-tauri/lang/de.json index 405ee13..eb83f3f 100644 --- a/src-tauri/lang/de.json +++ b/src-tauri/lang/de.json @@ -35,7 +35,9 @@ "un_elevated": "Spiel ohne Administratorrechte ausführen", "redirect_more": "Auch andere miHoYo-Spiele umleiten", "check_aagl": "Für weitere Optionen, schaue weiter", - "grasscutter_elevation": "Methode zur Ausführung von GC auf eingeschränkten Ports" + "grasscutter_elevation": "Methode zur Ausführung von GC auf eingeschränkten Ports", + "web_cache": "WebCaches-Ordner löschen", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Grasscutter All-in-One herunterladen", diff --git a/src-tauri/lang/en.json b/src-tauri/lang/en.json index 9f78410..34a26f2 100644 --- a/src-tauri/lang/en.json +++ b/src-tauri/lang/en.json @@ -35,7 +35,9 @@ "un_elevated": "Run the game non-elevated (no admin)", "redirect_more": "Also redirect other MHY games", "check_aagl": "For more options, check the other launcher", - "grasscutter_elevation": "Method of running GC on restricted ports" + "grasscutter_elevation": "Method of running GC on restricted ports", + "web_cache": "Delete webCaches folder", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Download Grasscutter All-in-One", diff --git a/src-tauri/lang/es.json b/src-tauri/lang/es.json index 11e199d..29dc75a 100644 --- a/src-tauri/lang/es.json +++ b/src-tauri/lang/es.json @@ -33,7 +33,9 @@ "horny_mode": "Modo cachondo", "auto_mongodb": "Iniciar automáticamente MongoDB", "un_elevated": "Ejecutar el juego sin permisos de administrador", - "redirect_more": "También redirigir otros juegos MHY" + "redirect_more": "También redirigir otros juegos MHY", + "web_cache": "Eliminar la carpeta webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Descargar datos todo en uno de Grasscutter", diff --git a/src-tauri/lang/fr.json b/src-tauri/lang/fr.json index 3d72ff0..238ff7b 100644 --- a/src-tauri/lang/fr.json +++ b/src-tauri/lang/fr.json @@ -33,7 +33,9 @@ "horny_mode": "Mode horny", "auto_mongodb": "Démarrer automatiquement MongoDB", "un_elevated": "Exécuter le jeu sans élévation (pas d'administrateur)", - "redirect_more": "Réorienter également les autres jeux MHY" + "redirect_more": "Réorienter également les autres jeux MHY", + "web_cache": "Supprimer le dossier webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Telecharger Grasscutter tout-en-un", diff --git a/src-tauri/lang/id.json b/src-tauri/lang/id.json index a31586c..0497edb 100644 --- a/src-tauri/lang/id.json +++ b/src-tauri/lang/id.json @@ -32,7 +32,9 @@ "horny_mode": "Mode Terangsang", "auto_mongodb": "Mulai MongoDB secara otomatis", "un_elevated": "Jalankan game yang tidak ditinggikan (tanpa admin)", - "redirect_more": "Juga mengarahkan ulang game MHY lainnya" + "redirect_more": "Juga mengarahkan ulang game MHY lainnya", + "web_cache": "Hapus folder webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Sedang Mendownload Grasscutter Semua Dalam Satu", diff --git a/src-tauri/lang/it.json b/src-tauri/lang/it.json index be44e3e..3134157 100644 --- a/src-tauri/lang/it.json +++ b/src-tauri/lang/it.json @@ -33,7 +33,9 @@ "horny_mode": "Modalità Horny", "auto_mongodb": "Avvia Automaticamente MongoDB", "un_elevated": "Avvia il gioco non-elevato (non admin)", - "redirect_more": "Reindirizza anche altri giochi MHY" + "redirect_more": "Reindirizza anche altri giochi MHY", + "web_cache": "Elimina la cartella webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Scarica Grasscutter Tutto-in-Uno", diff --git a/src-tauri/lang/ko.json b/src-tauri/lang/ko.json index 9bdf74c..cab2b1b 100644 --- a/src-tauri/lang/ko.json +++ b/src-tauri/lang/ko.json @@ -33,7 +33,9 @@ "horny_mode": "Horny 모드", "auto_mongodb": "MongoDB 자동 시작", "un_elevated": "게임 비상승 실행(관리자 없음)", - "redirect_more": "다른 MHY 게임도 리디렉션" + "redirect_more": "다른 MHY 게임도 리디렉션", + "web_cache": "webCaches 폴더 삭제", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "올인원 Grasscutter 다운로드", diff --git a/src-tauri/lang/lv.json b/src-tauri/lang/lv.json index 3692813..03caacf 100644 --- a/src-tauri/lang/lv.json +++ b/src-tauri/lang/lv.json @@ -31,7 +31,9 @@ "horny_mode": "Uzbudināts režīms", "auto_mongodb": "Automātiski startējiet MongoDB", "un_elevated": "Palaist spēli bez paaugstinājuma (bez administratora)", - "redirect_more": "Arī novirzīt citas MHY spēles" + "redirect_more": "Arī novirzīt citas MHY spēles", + "web_cache": "Dzēsiet mapi WebCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Lejupielādējiet Grasscutter viss vienā", diff --git a/src-tauri/lang/nl.json b/src-tauri/lang/nl.json index 81e96ca..c539be2 100644 --- a/src-tauri/lang/nl.json +++ b/src-tauri/lang/nl.json @@ -32,7 +32,9 @@ "horny_mode": "Geile modus", "auto_mongodb": "Start automatisch MongoDB", "un_elevated": "Voer het spel uit zonder hoogtevrees (geen admin)", - "redirect_more": "Richt ook andere MHY-spellen" + "redirect_more": "Richt ook andere MHY-spellen", + "web_cache": "Verwijder de webCaches-map", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Grasscutter Alles-in-één Downloaden", diff --git a/src-tauri/lang/pl.json b/src-tauri/lang/pl.json index f520e05..b0031b9 100644 --- a/src-tauri/lang/pl.json +++ b/src-tauri/lang/pl.json @@ -35,7 +35,9 @@ "un_elevated": "Uruchamiaj grę bez uprawnień administratora/roota", "redirect_more": "Przekieruj też inne gry MHY", "check_aagl": "Więcej opcji znajdziesz w drugim launcherze", - "grasscutter_elevation": "Sposób uruchomienia GC na ograniczonym porcie" + "grasscutter_elevation": "Sposób uruchomienia GC na ograniczonym porcie", + "web_cache": "Usuń folder webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Pobierz Grasscutter (wszystko w jednym)", diff --git a/src-tauri/lang/pt-br.json b/src-tauri/lang/pt-br.json index 36af05a..57ea64a 100644 --- a/src-tauri/lang/pt-br.json +++ b/src-tauri/lang/pt-br.json @@ -33,7 +33,9 @@ "horny_mode": "Modo com tesão", "auto_mongodb": "Iniciar MongoDB Automaticamente", "un_elevated": "Executar o jogo não-elevated (sem admin)", - "redirect_more": "Também redirecionar outros jogos MHY" + "redirect_more": "Também redirecionar outros jogos MHY", + "web_cache": "Excluir pasta webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Baixar o Grasscutter Tudo-em-Um", diff --git a/src-tauri/lang/ru.json b/src-tauri/lang/ru.json index d243336..26bb602 100644 --- a/src-tauri/lang/ru.json +++ b/src-tauri/lang/ru.json @@ -32,7 +32,9 @@ "horny_mode": "роговой режим", "auto_mongodb": "Автоматически запускать MongoDB", "un_elevated": "Запустите игру в неэлегантном режиме (без администратора)", - "redirect_more": "Также перенаправьте другие игры MHY" + "redirect_more": "Также перенаправьте другие игры MHY", + "web_cache": "Удалить папку webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Скачать все в одном Grasscutter", diff --git a/src-tauri/lang/vi.json b/src-tauri/lang/vi.json index 2138323..24c128c 100644 --- a/src-tauri/lang/vi.json +++ b/src-tauri/lang/vi.json @@ -33,7 +33,9 @@ "horny_mode": "Chế độ hứng tình", "auto_mongodb": "Tự động khởi động MongoDB", "un_elevated": "Chạy trò chơi không nâng cao (không có quản trị viên)", - "redirect_more": "Đồng thời chuyển hướng các trò chơi MHY khác" + "redirect_more": "Đồng thời chuyển hướng các trò chơi MHY khác", + "web_cache": "Xóa thư mục webCaches", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Tải Grasscutter tất cả trong một", 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..d315bfa 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() @@ -195,9 +214,13 @@ export default class ServerLaunchSection extends React.Component if (config.un_elevated) { await invoke('run_un_elevated', { path: config.game_install_path, + args: config.launch_args, }) } else { - await invoke('run_program_relative', { path: exe || config.game_install_path }) + await invoke('run_program_relative', { + path: exe || config.game_install_path, + args: config.launch_args, + }) } else alert('Game not found! At: ' + (exe || config.game_install_path)) } diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index c1fddc5..f77d5da 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -16,6 +16,8 @@ import DownloadHandler from '../../../utils/download' import * as meta from '../../../utils/rsa' import HelpButton from '../common/HelpButton' import SmallButton from '../common/SmallButton' +import { confirm } from '@tauri-apps/api/dialog' +import TextInput from '../common/TextInput' export enum GrasscutterElevation { None = 'None', @@ -49,6 +51,7 @@ interface IState { platform: string un_elevated: boolean redirect_more: boolean + launch_args: string // Linux stuff grasscutter_elevation: string @@ -84,6 +87,7 @@ export default class Options extends React.Component { platform: '', un_elevated: false, redirect_more: false, + launch_args: '', // Linux stuff grasscutter_elevation: GrasscutterElevation.None, @@ -103,8 +107,10 @@ export default class Options extends React.Component { this.setCustomBackground = this.setCustomBackground.bind(this) this.toggleEncryption = this.toggleEncryption.bind(this) this.removeRSA = this.removeRSA.bind(this) + this.deleteWebCache = this.deleteWebCache.bind(this) this.addMigotoDelay = this.addMigotoDelay.bind(this) this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this) + this.setLaunchArgs = this.setLaunchArgs.bind(this) } async componentDidMount() { @@ -143,6 +149,7 @@ export default class Options extends React.Component { platform, un_elevated: config.un_elevated || false, redirect_more: config.redirect_more || false, + launch_args: config.launch_args, // Linux stuff grasscutter_elevation: config.grasscutter_elevation || GrasscutterElevation.None, @@ -290,6 +297,17 @@ export default class Options extends React.Component { const path = config.grasscutter_path.replace(/\\/g, '/') const folderPath = path.substring(0, path.lastIndexOf('/')) + if (!(await server.encryptionEnabled(folderPath + '/config.json'))) { + if ( + !(await confirm( + 'Cultivation requires encryption DISABLED to connect and play locally. \n\n Are you sure you want to enable encryption?', + 'Warning!' + )) + ) { + return + } + } + await server.toggleEncryption(folderPath + '/config.json') this.setState({ @@ -336,6 +354,20 @@ export default class Options extends React.Component { }) } + async deleteWebCache() { + alert('Cultivation may freeze for a moment while this occurs!') + + // Get webCaches folder path + const pathArr = this.state.game_install_path.replace(/\\/g, '/').split('/') + pathArr.pop() + const path = pathArr.join('/') + '/GenshinImpact_Data/webCaches' + const path2 = pathArr.join('/') + '/Yuanshen_Data/webCaches' + + // Delete the folder + await invoke('dir_delete', { path: path }) + await invoke('dir_delete', { path: path2 }) + } + async toggleOption(opt: keyof Configuration) { const changedVal = !(await getConfigOption(opt)) @@ -347,6 +379,14 @@ export default class Options extends React.Component { }) } + async setLaunchArgs(value: string) { + await setConfigOption('launch_args', value) + + this.setState({ + launch_args: value, + }) + } + render() { return ( @@ -646,6 +686,29 @@ export default class Options extends React.Component { + + + + ) } diff --git a/src/utils/configuration.ts b/src/utils/configuration.ts index 0882daa..9d7e777 100644 --- a/src/utils/configuration.ts +++ b/src/utils/configuration.ts @@ -28,6 +28,7 @@ let defaultConfig: Configuration auto_mongodb: false, un_elevated: false, redirect_more: false, + launch_args: '', // Linux stuff grasscutter_elevation: 'None', @@ -62,6 +63,7 @@ export interface Configuration { auto_mongodb: boolean un_elevated: boolean redirect_more: boolean + launch_args: string // Linux stuff grasscutter_elevation: string