Merge pull request #202 from NotThorny/Settings-LaunchArgs

Settings & QoL Alerts
This commit is contained in:
SpikeHD 2023-09-18 13:25:15 -07:00 committed by GitHub
commit 6d53f344ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 135 additions and 17 deletions

View File

@ -33,7 +33,9 @@
"horny_mode": "Horny 模式", "horny_mode": "Horny 模式",
"auto_mongodb": "自动启动 MongoDB", "auto_mongodb": "自动启动 MongoDB",
"un_elevated": "非提升运行游戏(无管理员)", "un_elevated": "非提升运行游戏(无管理员)",
"redirect_more": "还可以重定向其他MHY游戏" "redirect_more": "还可以重定向其他MHY游戏",
"web_cache": "删除 webCaches 文件夹",
"launch_args": "Launch Args"
}, },
"downloads": { "downloads": {
"grasscutter_fullbuild": "下载 Grasscutter 一体化", "grasscutter_fullbuild": "下载 Grasscutter 一体化",

View File

@ -33,7 +33,9 @@
"horny_mode": "Horny模式", "horny_mode": "Horny模式",
"auto_mongodb": "自動啟動 MongoDB", "auto_mongodb": "自動啟動 MongoDB",
"un_elevated": "在不升高的情况下运行游戏(没有管理员)。", "un_elevated": "在不升高的情况下运行游戏(没有管理员)。",
"redirect_more": "同時重定向其他 MHY 遊戲" "redirect_more": "同時重定向其他 MHY 遊戲",
"web_cache": "刪除 webCaches 文件夾",
"launch_args": "Launch Args"
}, },
"downloads": { "downloads": {
"grasscutter_fullbuild": "下載Grasscutter多合一下載", "grasscutter_fullbuild": "下載Grasscutter多合一下載",

View File

@ -35,7 +35,9 @@
"un_elevated": "Spiel ohne Administratorrechte ausführen", "un_elevated": "Spiel ohne Administratorrechte ausführen",
"redirect_more": "Auch andere miHoYo-Spiele umleiten", "redirect_more": "Auch andere miHoYo-Spiele umleiten",
"check_aagl": "Für weitere Optionen, schaue weiter", "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": { "downloads": {
"grasscutter_fullbuild": "Grasscutter All-in-One herunterladen", "grasscutter_fullbuild": "Grasscutter All-in-One herunterladen",

View File

@ -35,7 +35,9 @@
"un_elevated": "Run the game non-elevated (no admin)", "un_elevated": "Run the game non-elevated (no admin)",
"redirect_more": "Also redirect other MHY games", "redirect_more": "Also redirect other MHY games",
"check_aagl": "For more options, check the other launcher", "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": { "downloads": {
"grasscutter_fullbuild": "Download Grasscutter All-in-One", "grasscutter_fullbuild": "Download Grasscutter All-in-One",

View File

@ -33,7 +33,9 @@
"horny_mode": "Modo cachondo", "horny_mode": "Modo cachondo",
"auto_mongodb": "Iniciar automáticamente MongoDB", "auto_mongodb": "Iniciar automáticamente MongoDB",
"un_elevated": "Ejecutar el juego sin permisos de administrador", "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": { "downloads": {
"grasscutter_fullbuild": "Descargar datos todo en uno de Grasscutter", "grasscutter_fullbuild": "Descargar datos todo en uno de Grasscutter",

View File

@ -33,7 +33,9 @@
"horny_mode": "Mode horny", "horny_mode": "Mode horny",
"auto_mongodb": "Démarrer automatiquement MongoDB", "auto_mongodb": "Démarrer automatiquement MongoDB",
"un_elevated": "Exécuter le jeu sans élévation (pas d'administrateur)", "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": { "downloads": {
"grasscutter_fullbuild": "Telecharger Grasscutter tout-en-un", "grasscutter_fullbuild": "Telecharger Grasscutter tout-en-un",

View File

@ -32,7 +32,9 @@
"horny_mode": "Mode Terangsang", "horny_mode": "Mode Terangsang",
"auto_mongodb": "Mulai MongoDB secara otomatis", "auto_mongodb": "Mulai MongoDB secara otomatis",
"un_elevated": "Jalankan game yang tidak ditinggikan (tanpa admin)", "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": { "downloads": {
"grasscutter_fullbuild": "Sedang Mendownload Grasscutter Semua Dalam Satu", "grasscutter_fullbuild": "Sedang Mendownload Grasscutter Semua Dalam Satu",

View File

@ -33,7 +33,9 @@
"horny_mode": "Modalità Horny", "horny_mode": "Modalità Horny",
"auto_mongodb": "Avvia Automaticamente MongoDB", "auto_mongodb": "Avvia Automaticamente MongoDB",
"un_elevated": "Avvia il gioco non-elevato (non admin)", "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": { "downloads": {
"grasscutter_fullbuild": "Scarica Grasscutter Tutto-in-Uno", "grasscutter_fullbuild": "Scarica Grasscutter Tutto-in-Uno",

View File

@ -33,7 +33,9 @@
"horny_mode": "Horny 모드", "horny_mode": "Horny 모드",
"auto_mongodb": "MongoDB 자동 시작", "auto_mongodb": "MongoDB 자동 시작",
"un_elevated": "게임 비상승 실행(관리자 없음)", "un_elevated": "게임 비상승 실행(관리자 없음)",
"redirect_more": "다른 MHY 게임도 리디렉션" "redirect_more": "다른 MHY 게임도 리디렉션",
"web_cache": "webCaches 폴더 삭제",
"launch_args": "Launch Args"
}, },
"downloads": { "downloads": {
"grasscutter_fullbuild": "올인원 Grasscutter 다운로드", "grasscutter_fullbuild": "올인원 Grasscutter 다운로드",

View File

@ -31,7 +31,9 @@
"horny_mode": "Uzbudināts režīms", "horny_mode": "Uzbudināts režīms",
"auto_mongodb": "Automātiski startējiet MongoDB", "auto_mongodb": "Automātiski startējiet MongoDB",
"un_elevated": "Palaist spēli bez paaugstinājuma (bez administratora)", "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": { "downloads": {
"grasscutter_fullbuild": "Lejupielādējiet Grasscutter viss vienā", "grasscutter_fullbuild": "Lejupielādējiet Grasscutter viss vienā",

View File

@ -32,7 +32,9 @@
"horny_mode": "Geile modus", "horny_mode": "Geile modus",
"auto_mongodb": "Start automatisch MongoDB", "auto_mongodb": "Start automatisch MongoDB",
"un_elevated": "Voer het spel uit zonder hoogtevrees (geen admin)", "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": { "downloads": {
"grasscutter_fullbuild": "Grasscutter Alles-in-één Downloaden", "grasscutter_fullbuild": "Grasscutter Alles-in-één Downloaden",

View File

@ -35,7 +35,9 @@
"un_elevated": "Uruchamiaj grę bez uprawnień administratora/roota", "un_elevated": "Uruchamiaj grę bez uprawnień administratora/roota",
"redirect_more": "Przekieruj też inne gry MHY", "redirect_more": "Przekieruj też inne gry MHY",
"check_aagl": "Więcej opcji znajdziesz w drugim launcherze", "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": { "downloads": {
"grasscutter_fullbuild": "Pobierz Grasscutter (wszystko w jednym)", "grasscutter_fullbuild": "Pobierz Grasscutter (wszystko w jednym)",

View File

@ -33,7 +33,9 @@
"horny_mode": "Modo com tesão", "horny_mode": "Modo com tesão",
"auto_mongodb": "Iniciar MongoDB Automaticamente", "auto_mongodb": "Iniciar MongoDB Automaticamente",
"un_elevated": "Executar o jogo não-elevated (sem admin)", "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": { "downloads": {
"grasscutter_fullbuild": "Baixar o Grasscutter Tudo-em-Um", "grasscutter_fullbuild": "Baixar o Grasscutter Tudo-em-Um",

View File

@ -32,7 +32,9 @@
"horny_mode": "роговой режим", "horny_mode": "роговой режим",
"auto_mongodb": "Автоматически запускать MongoDB", "auto_mongodb": "Автоматически запускать MongoDB",
"un_elevated": "Запустите игру в неэлегантном режиме (без администратора)", "un_elevated": "Запустите игру в неэлегантном режиме (без администратора)",
"redirect_more": "Также перенаправьте другие игры MHY" "redirect_more": "Также перенаправьте другие игры MHY",
"web_cache": "Удалить папку webCaches",
"launch_args": "Launch Args"
}, },
"downloads": { "downloads": {
"grasscutter_fullbuild": "Скачать все в одном Grasscutter", "grasscutter_fullbuild": "Скачать все в одном Grasscutter",

View File

@ -33,7 +33,9 @@
"horny_mode": "Chế độ hứng tình", "horny_mode": "Chế độ hứng tình",
"auto_mongodb": "Tự động khởi động MongoDB", "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)", "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": { "downloads": {
"grasscutter_fullbuild": "Tải Grasscutter tất cả trong một", "grasscutter_fullbuild": "Tải Grasscutter tất cả trong một",

View File

@ -214,7 +214,7 @@ pub fn run_jar(path: String, execute_in: String, java_path: String) {
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
#[tauri::command] #[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"); panic!("Not implemented");
} }

View File

@ -16,6 +16,7 @@ import { GrasscutterElevation } from './menu/Options'
import { getGameExecutable, getGameVersion, getGrasscutterJar } from '../../utils/game' import { getGameExecutable, getGameVersion, getGrasscutterJar } from '../../utils/game'
import { patchGame, unpatchGame } from '../../utils/rsa' import { patchGame, unpatchGame } from '../../utils/rsa'
import { listen } from '@tauri-apps/api/event' import { listen } from '@tauri-apps/api/event'
import { confirm } from '@tauri-apps/api/dialog'
interface IProps { interface IProps {
openExtras: (playGame: () => void) => void openExtras: (playGame: () => void) => void
@ -118,6 +119,24 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
return 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 // Connect to proxy
if (config.toggle_grasscutter) { if (config.toggle_grasscutter) {
const game_exe = await getGameExecutable() const game_exe = await getGameExecutable()
@ -195,9 +214,13 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
if (config.un_elevated) { if (config.un_elevated) {
await invoke('run_un_elevated', { await invoke('run_un_elevated', {
path: config.game_install_path, path: config.game_install_path,
args: config.launch_args,
}) })
} else { } 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)) else alert('Game not found! At: ' + (exe || config.game_install_path))
} }

View File

@ -16,6 +16,8 @@ import DownloadHandler from '../../../utils/download'
import * as meta from '../../../utils/rsa' import * as meta from '../../../utils/rsa'
import HelpButton from '../common/HelpButton' import HelpButton from '../common/HelpButton'
import SmallButton from '../common/SmallButton' import SmallButton from '../common/SmallButton'
import { confirm } from '@tauri-apps/api/dialog'
import TextInput from '../common/TextInput'
export enum GrasscutterElevation { export enum GrasscutterElevation {
None = 'None', None = 'None',
@ -49,6 +51,7 @@ interface IState {
platform: string platform: string
un_elevated: boolean un_elevated: boolean
redirect_more: boolean redirect_more: boolean
launch_args: string
// Linux stuff // Linux stuff
grasscutter_elevation: string grasscutter_elevation: string
@ -84,6 +87,7 @@ export default class Options extends React.Component<IProps, IState> {
platform: '', platform: '',
un_elevated: false, un_elevated: false,
redirect_more: false, redirect_more: false,
launch_args: '',
// Linux stuff // Linux stuff
grasscutter_elevation: GrasscutterElevation.None, grasscutter_elevation: GrasscutterElevation.None,
@ -103,8 +107,10 @@ export default class Options extends React.Component<IProps, IState> {
this.setCustomBackground = this.setCustomBackground.bind(this) this.setCustomBackground = this.setCustomBackground.bind(this)
this.toggleEncryption = this.toggleEncryption.bind(this) this.toggleEncryption = this.toggleEncryption.bind(this)
this.removeRSA = this.removeRSA.bind(this) this.removeRSA = this.removeRSA.bind(this)
this.deleteWebCache = this.deleteWebCache.bind(this)
this.addMigotoDelay = this.addMigotoDelay.bind(this) this.addMigotoDelay = this.addMigotoDelay.bind(this)
this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this) this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this)
this.setLaunchArgs = this.setLaunchArgs.bind(this)
} }
async componentDidMount() { async componentDidMount() {
@ -143,6 +149,7 @@ export default class Options extends React.Component<IProps, IState> {
platform, platform,
un_elevated: config.un_elevated || false, un_elevated: config.un_elevated || false,
redirect_more: config.redirect_more || false, redirect_more: config.redirect_more || false,
launch_args: config.launch_args,
// Linux stuff // Linux stuff
grasscutter_elevation: config.grasscutter_elevation || GrasscutterElevation.None, grasscutter_elevation: config.grasscutter_elevation || GrasscutterElevation.None,
@ -290,6 +297,17 @@ export default class Options extends React.Component<IProps, IState> {
const path = config.grasscutter_path.replace(/\\/g, '/') const path = config.grasscutter_path.replace(/\\/g, '/')
const folderPath = path.substring(0, path.lastIndexOf('/')) 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') await server.toggleEncryption(folderPath + '/config.json')
this.setState({ this.setState({
@ -336,6 +354,20 @@ export default class Options extends React.Component<IProps, IState> {
}) })
} }
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) { async toggleOption(opt: keyof Configuration) {
const changedVal = !(await getConfigOption(opt)) const changedVal = !(await getConfigOption(opt))
@ -347,6 +379,14 @@ export default class Options extends React.Component<IProps, IState> {
}) })
} }
async setLaunchArgs(value: string) {
await setConfigOption('launch_args', value)
this.setState({
launch_args: value,
})
}
render() { render() {
return ( return (
<Menu closeFn={this.props.closeFn} className="Options" heading="Options"> <Menu closeFn={this.props.closeFn} className="Options" heading="Options">
@ -646,6 +686,29 @@ export default class Options extends React.Component<IProps, IState> {
</select> </select>
</div> </div>
</div> </div>
<Divider />
<div className="OptionSection" id="menuOptionsContainerAdvanced">
<div className="OptionLabel" id="menuOptionsLabelWebCache">
<Tr text="options.web_cache" />
</div>
<div className="OptionValue" id="menuOptionsButtondeleteWebcache">
<BigButton onClick={this.deleteWebCache} id="deleteWebcache">
<Tr text="components.delete" />
</BigButton>
</div>
<div className="OptionLabel" id="menuOptionsLaunchArgs">
<Tr text="options.launch_args" />
</div>
<TextInput
id="launch_args"
key="launch_args"
placeholder={'-arg=value'}
onChange={this.setLaunchArgs}
value={this.state.launch_args}
/>
</div>
</Menu> </Menu>
) )
} }

View File

@ -28,6 +28,7 @@ let defaultConfig: Configuration
auto_mongodb: false, auto_mongodb: false,
un_elevated: false, un_elevated: false,
redirect_more: false, redirect_more: false,
launch_args: '',
// Linux stuff // Linux stuff
grasscutter_elevation: 'None', grasscutter_elevation: 'None',
@ -62,6 +63,7 @@ export interface Configuration {
auto_mongodb: boolean auto_mongodb: boolean
un_elevated: boolean un_elevated: boolean
redirect_more: boolean redirect_more: boolean
launch_args: string
// Linux stuff // Linux stuff
grasscutter_elevation: string grasscutter_elevation: string