Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher
This commit is contained in:
commit
474f1f0c33
6 files changed
+86
-20
No files matched your search
@@ -14,6 +14,7 @@ It enhances the osu! experience with quality-of-life features and integration sp
|
|||||||
## 🚀 Features
|
## 🚀 Features
|
||||||
|
|
||||||
- [x] Automatically updates osu! before launching
|
- [x] Automatically updates osu! before launching
|
||||||
|
- [x] Automatically start/stop the OpenTabletDriver Daemon
|
||||||
- [x] Automatic ingame login
|
- [x] Automatic ingame login
|
||||||
- [x] Patches the osu! client to show misses in Relax and Autopilot
|
- [x] Patches the osu! client to show misses in Relax and Autopilot
|
||||||
- [x] Displays your EZPPFarm stats in the launcher
|
- [x] Displays your EZPPFarm stats in the launcher
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use serde_json::Value;
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::process::Stdio;
|
||||||
use sysinfo::System;
|
use sysinfo::System;
|
||||||
use tauri::AppHandle;
|
use tauri::AppHandle;
|
||||||
use tauri::Emitter;
|
use tauri::Emitter;
|
||||||
@@ -996,10 +997,13 @@ pub async fn run_open_tablet_driver(path: String) -> Result<(), String> {
|
|||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
const DETACHED_PROCESS: u32 = 0x00000008;
|
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||||
const CREATE_NEW_PROCESS_GROUP: u32 = 0x00000200;
|
|
||||||
Command::new(&otd_path)
|
Command::new(&otd_path)
|
||||||
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|e| format!("Failed to start OpenTabletDriver: {}", e))?;
|
.map_err(|e| format!("Failed to start OpenTabletDriver: {}", e))?;
|
||||||
}
|
}
|
||||||
@@ -1044,6 +1048,21 @@ pub fn is_open_tablet_driver_running() -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn is_open_tablet_driver_path_valid(app: AppHandle, path: String) -> bool {
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
app.fs_scope().allow_file(&path).ok();
|
||||||
|
let otd_path = PathBuf::from(&path);
|
||||||
|
otd_path.exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
{
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct ExtractProgress {
|
pub struct ExtractProgress {
|
||||||
pub theme_name: String,
|
pub theme_name: String,
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ use crate::{
|
|||||||
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
|
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
|
||||||
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
|
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
|
||||||
get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl,
|
get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl,
|
||||||
install_ezpp_launcher_update, is_osu_running, open_url_in_browser, opened_urls,
|
install_ezpp_launcher_update, is_open_tablet_driver_path_valid,
|
||||||
|
is_open_tablet_driver_running, is_osu_running, open_url_in_browser, opened_urls,
|
||||||
presence_connect, presence_disconnect, presence_is_connected, presence_update_button,
|
presence_connect, presence_disconnect, presence_is_connected, presence_update_button,
|
||||||
presence_update_status, presence_update_user, read_theme_info, replace_ui_files, run_osu,
|
presence_update_status, presence_update_user, read_theme_info, replace_ui_files,
|
||||||
run_osu_updater, set_osu_config_values, set_osu_user_config_values, valid_osu_folder,
|
run_open_tablet_driver, run_osu, run_osu_updater, set_osu_config_values,
|
||||||
|
set_osu_user_config_values, stop_open_tablet_driver, valid_osu_folder,
|
||||||
},
|
},
|
||||||
state::AppState,
|
state::AppState,
|
||||||
};
|
};
|
||||||
@@ -144,6 +146,10 @@ pub fn run() {
|
|||||||
config_delete,
|
config_delete,
|
||||||
config_clear,
|
config_clear,
|
||||||
config_all,
|
config_all,
|
||||||
|
run_open_tablet_driver,
|
||||||
|
stop_open_tablet_driver,
|
||||||
|
is_open_tablet_driver_running,
|
||||||
|
is_open_tablet_driver_path_valid
|
||||||
])
|
])
|
||||||
.plugin(tauri_plugin_fs::init())
|
.plugin(tauri_plugin_fs::init())
|
||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
|
|||||||
@@ -26,7 +26,20 @@
|
|||||||
],
|
],
|
||||||
"withGlobalTauri": true,
|
"withGlobalTauri": true,
|
||||||
"security": {
|
"security": {
|
||||||
"csp": "default-src 'self' tauri: asset:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' asset: data: blob: https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct; connect-src 'self' https://ez-pp.farm https://api.ez-pp.farm https://c.ez-pp.farm https://analytics.ez-pp.farm https://git.ez-pp.farm https://osu.direct; media-src 'self' asset: blob:;",
|
"csp": {
|
||||||
|
"default-src": "'self' tauri: customprotocol: asset:",
|
||||||
|
"script-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost https://analytics.ez-pp.farm",
|
||||||
|
"style-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost",
|
||||||
|
"img-src": "'self' asset: http://asset.localhost https://asset.localhost blob: data: https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct",
|
||||||
|
"connect-src": "'self' ipc: http://ipc.localhost https://ez-pp.farm https://api.ez-pp.farm https://c.ez-pp.farm https://analytics.ez-pp.farm https://git.ez-pp.farm https://osu.direct https://osu.ppy.sh",
|
||||||
|
"media-src": "'self' asset: http://asset.localhost https://asset.localhost blob:",
|
||||||
|
"font-src": [
|
||||||
|
"'self'",
|
||||||
|
"asset:",
|
||||||
|
"http://asset.localhost",
|
||||||
|
"https://asset.localhost"
|
||||||
|
]
|
||||||
|
},
|
||||||
"assetProtocol": {
|
"assetProtocol": {
|
||||||
"enable": true,
|
"enable": true,
|
||||||
"scope": [
|
"scope": [
|
||||||
|
|||||||
@@ -149,3 +149,6 @@ export const getSkins = async (folder: string) =>
|
|||||||
export const startOpenTabletDriver = async (otdDaemonPath: string) =>
|
export const startOpenTabletDriver = async (otdDaemonPath: string) =>
|
||||||
await invoke('run_open_tablet_driver', { path: otdDaemonPath });
|
await invoke('run_open_tablet_driver', { path: otdDaemonPath });
|
||||||
export const stopOpenTabletDriver = async () => await invoke('stop_open_tablet_driver');
|
export const stopOpenTabletDriver = async () => await invoke('stop_open_tablet_driver');
|
||||||
|
export const isOpenTabletDriverRunning = async () => await invoke('is_open_tablet_driver_running');
|
||||||
|
export const isOpenTabletDriverPathValid = async (path: string) =>
|
||||||
|
await invoke('is_open_tablet_driver_path_valid', { path });
|
||||||
+37
-13
@@ -66,6 +66,8 @@
|
|||||||
hasOsuWinello,
|
hasOsuWinello,
|
||||||
hasWMCTRL,
|
hasWMCTRL,
|
||||||
installUpdate,
|
installUpdate,
|
||||||
|
isOpenTabletDriverPathValid,
|
||||||
|
isOpenTabletDriverRunning,
|
||||||
isOsuCorrupted,
|
isOsuCorrupted,
|
||||||
isOsuRunning,
|
isOsuRunning,
|
||||||
isValidOsuFolder,
|
isValidOsuFolder,
|
||||||
@@ -200,6 +202,8 @@
|
|||||||
directory: true,
|
directory: true,
|
||||||
multiple: false,
|
multiple: false,
|
||||||
title: 'Select osu! Installation Folder',
|
title: 'Select osu! Installation Folder',
|
||||||
|
canCreateDirectories: false,
|
||||||
|
defaultPath: $osuInstallationPath ?? undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof selectedPath === 'string') {
|
if (typeof selectedPath === 'string') {
|
||||||
@@ -454,6 +458,35 @@
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let otd_run = false;
|
||||||
|
if ($openTabletDriverEnabled && $openTabletDriverPath.length > 0) {
|
||||||
|
const otdRunning = await isOpenTabletDriverRunning();
|
||||||
|
if (!otdRunning) {
|
||||||
|
launchInfo = 'Starting OpenTabletDriver...';
|
||||||
|
const validDaemon = await isOpenTabletDriverPathValid($openTabletDriverPath);
|
||||||
|
if (!validDaemon) {
|
||||||
|
sileo.error({
|
||||||
|
title: 'Hmmm...',
|
||||||
|
description: 'Failed to start OpenTabletDriver, executable not found.',
|
||||||
|
});
|
||||||
|
launching.set(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await startOpenTabletDriver($openTabletDriverPath);
|
||||||
|
otd_run = true;
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Failed to start OpenTabletDriver:', err);
|
||||||
|
sileo.error({
|
||||||
|
title: 'Hmmm...',
|
||||||
|
description: 'Failed to start OpenTabletDriver.',
|
||||||
|
});
|
||||||
|
launching.set(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await new Promise((res) => setTimeout(res, 1500));
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
launchInfo = 'Launching osu!...';
|
launchInfo = 'Launching osu!...';
|
||||||
|
|
||||||
@@ -575,17 +608,6 @@
|
|||||||
}, 1000 * 2);
|
}, 1000 * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
let otd_run = false;
|
|
||||||
|
|
||||||
if ($openTabletDriverEnabled && $openTabletDriverPath.length > 0) {
|
|
||||||
try {
|
|
||||||
await startOpenTabletDriver($openTabletDriverPath);
|
|
||||||
otd_run = true;
|
|
||||||
} catch (err) {
|
|
||||||
console.log('Failed to start OpenTabletDriver:', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await runOsu(osuPath, true);
|
await runOsu(osuPath, true);
|
||||||
if ($trackingEnabled) umami.track('app_exit_osu');
|
if ($trackingEnabled) umami.track('app_exit_osu');
|
||||||
cleanup = true;
|
cleanup = true;
|
||||||
@@ -793,12 +815,14 @@
|
|||||||
const selectedPath = await open({
|
const selectedPath = await open({
|
||||||
directory: false,
|
directory: false,
|
||||||
multiple: false,
|
multiple: false,
|
||||||
title: 'Select OpenTabletDriver Executable',
|
title: 'Select OpenTabletDriver.Daemon Executable',
|
||||||
|
defaultPath: $openTabletDriverPath ?? undefined,
|
||||||
|
canCreateDirectories: false,
|
||||||
filters:
|
filters:
|
||||||
$platform === 'windows'
|
$platform === 'windows'
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
name: 'OpenTabletDriver',
|
name: 'OpenTabletDriver.Daemon.exe',
|
||||||
extensions: ['exe'],
|
extensions: ['exe'],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in new issue
Block a user