Compare commits

..

8 Commits

10 changed files with 109 additions and 62 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "ezpplauncher", "name": "ezpplauncher",
"version": "3.2.2", "version": "3.2.3",
"description": "", "description": "",
"type": "module", "type": "module",
"scripts": { "scripts": {
+3
View File
@@ -34,4 +34,7 @@ function run(cmd: string, args: string[]): Promise<void> {
await run('bun', ['./scripts/sync-version.ts']); await run('bun', ['./scripts/sync-version.ts']);
await runVite(); await runVite();
//set NO_STRIP=1 in env for linux to prevent stripping of debug symbols in tauri builds, which causes issues with source maps
if (process.platform === 'linux') process.env.NO_STRIP = '1';
await run('bunx', ['tauri', 'build']); await run('bunx', ['tauri', 'build']);
+1 -1
View File
@@ -1239,7 +1239,7 @@ dependencies = [
[[package]] [[package]]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.2" version = "3.2.3"
dependencies = [ dependencies = [
"aes-gcm", "aes-gcm",
"anyhow", "anyhow",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.2" version = "3.2.3"
description = "EZPPLauncher redefined." description = "EZPPLauncher redefined."
authors = ["HorizonCode"] authors = ["HorizonCode"]
edition = "2024" edition = "2024"
+9 -7
View File
@@ -79,7 +79,6 @@ pub fn valid_osu_folder(folder: String) -> bool {
check_folder_completeness(path, &osu_folder_files) >= 70.0 check_folder_completeness(path, &osu_folder_files) >= 70.0
} }
#[cfg(windows)]
#[tauri::command] #[tauri::command]
pub fn find_osu_installation() -> Option<String> { pub fn find_osu_installation() -> Option<String> {
#[cfg(windows)] #[cfg(windows)]
@@ -450,8 +449,6 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
} }
}; };
#[cfg(windows)]
{
if patch { if patch {
let patcher_exe_path = PathBuf::from(&folder) let patcher_exe_path = PathBuf::from(&folder)
.join("EZPPLauncher") .join("EZPPLauncher")
@@ -459,8 +456,6 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
.join("osu!.patcher.exe"); .join("osu!.patcher.exe");
if patcher_exe_path.exists() { if patcher_exe_path.exists() {
#[cfg(windows)]
{
let mut sys = System::new_all(); let mut sys = System::new_all();
loop { loop {
@@ -486,12 +481,20 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
sleep(Duration::from_millis(500)).await; sleep(Duration::from_millis(500)).await;
} }
#[cfg(windows)]
{
let _ = Command::new(&patcher_exe_path) let _ = Command::new(&patcher_exe_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP) .creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn() .spawn()
.map_err(|e| format!("Failed to run patcher: {e}"))?; .map_err(|e| format!("Failed to run patcher: {e}"))?;
} }
#[cfg(not(windows))]
{
let _ = Command::new("osu-wine")
.arg("--wine")
.arg(&patcher_exe_path)
.spawn()
.map_err(|e| format!("Failed to run patcher: {}", e))?;
} }
} }
} }
@@ -958,7 +961,6 @@ pub async fn download_ezpp_launcher_update(app: AppHandle, url: String) -> Resul
Ok(()) Ok(())
} }
#[cfg(windows)]
#[tauri::command] #[tauri::command]
pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String> { pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String> {
#[cfg(windows)] #[cfg(windows)]
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "EZPPLauncher", "productName": "EZPPLauncher",
"version": "3.2.2", "version": "3.2.3",
"identifier": "farm.EZPPFarm.Launcher", "identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher", "mainBinaryName": "ezpplauncher",
"build": { "build": {
+2 -1
View File
@@ -1,5 +1,5 @@
import { active_custom_theme, custom_themes } from './global'; import { active_custom_theme, custom_themes } from './global';
import { setGlobalVolume } from './utils'; import { disableMediaControls, setGlobalVolume } from './utils';
import { betterFetch } from '@better-fetch/fetch'; import { betterFetch } from '@better-fetch/fetch';
import { convertFileSrc } from '@tauri-apps/api/core'; import { convertFileSrc } from '@tauri-apps/api/core';
import { invoke } from '@tauri-apps/api/core'; import { invoke } from '@tauri-apps/api/core';
@@ -268,6 +268,7 @@ export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volum
themeScript.mountTheme(themeContainer, { assets: theme.assets }); themeScript.mountTheme(themeContainer, { assets: theme.assets });
} }
setGlobalVolume(volume); setGlobalVolume(volume);
disableMediaControls();
}; };
export const deleteTheme = async (themeToUninstall: Theme) => { export const deleteTheme = async (themeToUninstall: Theme) => {
+2
View File
@@ -1,3 +1,5 @@
export type LaunchView = 'HOME' | 'LOGIN' | 'SETTINGS' | 'THEMES';
export type EZPPUserResponse = { export type EZPPUserResponse = {
code: number; code: number;
message: string; message: string;
+37
View File
@@ -203,6 +203,43 @@ export function trackMediaContainer(node: HTMLElement) {
}; };
} }
const MEDIA_ACTIONS: MediaSessionAction[] = [
'play',
'pause',
'stop',
'previoustrack',
'nexttrack',
'seekbackward',
'seekforward',
];
export function disableMediaControls() {
const mediaElements: NodeListOf<HTMLMediaElement> = document.querySelectorAll('audio, video');
if ('mediaSession' in navigator) {
MEDIA_ACTIONS.forEach((action) => {
try {
navigator.mediaSession.setActionHandler(action, () => {});
} catch {}
});
}
document.addEventListener(
'keydown',
(e: KeyboardEvent) => {
if (e.key.startsWith('Media')) {
e.preventDefault();
e.stopPropagation();
}
},
true
);
mediaElements.forEach((el) => {
el.disableRemotePlayback = true;
});
}
export function calculateGitBlobSha(fileBuffer: Buffer): string { export function calculateGitBlobSha(fileBuffer: Buffer): string {
const header = Buffer.from(`blob ${fileBuffer.length}\0`); const header = Buffer.from(`blob ${fileBuffer.length}\0`);
const store = Buffer.concat([header, fileBuffer]); const store = Buffer.concat([header, fileBuffer]);
+23 -21
View File
@@ -88,7 +88,7 @@
loadTheme, loadTheme,
type ThemeInfo, type ThemeInfo,
} from '$lib/themes'; } from '$lib/themes';
import { EZPPActionStatus } from '$lib/types'; import { EZPPActionStatus, type LaunchView } from '$lib/types';
import { currentUser } from '$lib/userAuthentication'; import { currentUser } from '$lib/userAuthentication';
import { import {
cursorSmoothening, cursorSmoothening,
@@ -141,7 +141,7 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { fade, fly, scale } from 'svelte/transition'; import { fade, fly, scale } from 'svelte/transition';
let selectedView = $state('home'); let selectedView = $state<LaunchView>('HOME');
let progress = $state(-1); let progress = $state(-1);
let launchInfo = $state(''); let launchInfo = $state('');
let launchError = $state<Error | undefined>(undefined); let launchError = $state<Error | undefined>(undefined);
@@ -304,7 +304,9 @@
try { try {
launchInfo = 'Looking for file updates...'; launchInfo = 'Looking for file updates...';
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, $launcherStream); let launchStream = $launcherStream;
if ($platform !== 'windows') launchStream = 'stable'; //fallback to stable for non windows systems
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, launchStream);
if (updateResult) { if (updateResult) {
if (updateResult.filesToDownload.length > 0) { if (updateResult.filesToDownload.length > 0) {
@@ -710,7 +712,7 @@
]); ]);
currentUser.set(loginResult.user); currentUser.set(loginResult.user);
selectedView = 'home'; selectedView = 'HOME';
} else { } else {
sileo.error({ sileo.error({
title: 'Login failed!', title: 'Login failed!',
@@ -1149,36 +1151,36 @@
<Badge class="text-[0.5rem] py-0 px-2">{$launcherVersion || 'dev'}</Badge> <Badge class="text-[0.5rem] py-0 px-2">{$launcherVersion || 'dev'}</Badge>
<Button <Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView === class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'home' 'HOME'
? 'bg-primary/50' ? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3" : 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching} disabled={$launching}
onclick={() => { onclick={() => {
if (!$launching) selectedView = 'home'; if (!$launching) selectedView = 'HOME';
}} }}
> >
<House class="text-theme-200 size-5!" /> <House class="text-theme-200 size-5!" />
</Button> </Button>
<Button <Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView === class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'themes' 'THEMES'
? 'bg-primary/50' ? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3" : 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching} disabled={$launching}
onclick={() => { onclick={() => {
if (!$launching) selectedView = 'themes'; if (!$launching) selectedView = 'THEMES';
}} }}
> >
<Paintbrush class="text-theme-200 size-5!" /> <Paintbrush class="text-theme-200 size-5!" />
</Button> </Button>
<Button <Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView === class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'settings' 'SETTINGS'
? 'bg-primary/50' ? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3" : 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching} disabled={$launching}
onclick={() => { onclick={() => {
if (!$launching) selectedView = 'settings'; if (!$launching) selectedView = 'SETTINGS';
}} }}
> >
<Settings class="text-theme-200 size-5!" /> <Settings class="text-theme-200 size-5!" />
@@ -1209,14 +1211,14 @@
}); });
currentUser.set(undefined); currentUser.set(undefined);
currentUserInfo.set(undefined); currentUserInfo.set(undefined);
selectedView = 'home'; selectedView = 'HOME';
}} }}
> >
<LogOut class="size-3.5 mr-2" /> <LogOut class="size-3.5 mr-2" />
Logout Logout
</DropdownMenu.Item> </DropdownMenu.Item>
{:else} {:else}
<DropdownMenu.Item class="text-xs" onclick={() => (selectedView = 'login')}> <DropdownMenu.Item class="text-xs" onclick={() => (selectedView = 'LOGIN')}>
<LogIn class="size-3.5 mr-2" /> <LogIn class="size-3.5 mr-2" />
Login Login
</DropdownMenu.Item> </DropdownMenu.Item>
@@ -1226,7 +1228,7 @@
</div> </div>
</div> </div>
<div class="z-10 h-full overflow-hidden"> <div class="z-10 h-full overflow-hidden">
{#if selectedView === 'home'} {#if selectedView === 'HOME'}
<div <div
class="flex flex-col-reverse h-full" class="flex flex-col-reverse h-full"
in:fly={{ in:fly={{
@@ -1522,7 +1524,7 @@
<Button <Button
class="flex-1 h-7 text-xs" class="flex-1 h-7 text-xs"
onclick={() => { onclick={() => {
selectedView = 'login'; selectedView = 'LOGIN';
}}>Log In</Button }}>Log In</Button
> >
<Button <Button
@@ -1543,7 +1545,7 @@
> >
</div> </div>
</div> </div>
{:else if selectedView === 'settings'} {:else if selectedView === 'SETTINGS'}
<div <div
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm" class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
in:fly={{ in:fly={{
@@ -1558,17 +1560,16 @@
<div class="flex flex-col"> <div class="flex flex-col">
<Label class="text-sm" for="setting-patch">Patching</Label> <Label class="text-sm" for="setting-patch">Patching</Label>
<div class="text-muted-foreground text-xs"> <div class="text-muted-foreground text-xs">
Shows misses in Relax and Autopilot {#if $platform !== 'windows'}<span Shows misses in Relax and Autopilot {#if $platform !== 'windows'}<!-- <span
class="text-red-500 bg-red-800/20 border border-red-600/20 p-0.5 mx-1 px-2 rounded-lg text-[0.55rem]!" class="text-red-500 bg-red-800/20 border border-red-600/20 p-0.5 mx-1 px-2 rounded-lg text-[0.55rem]!"
>currently only on windows!</span >currently only on windows!</span
> > -->
{/if} {/if}
</div> </div>
</div> </div>
<Checkbox <Checkbox
id="setting-patch" id="setting-patch"
checked={$platform === 'windows' ? $patch : false} checked={$patch}
disabled={$platform !== 'windows'}
onCheckedChange={async (e) => { onCheckedChange={async (e) => {
patch.set(e); patch.set(e);
}} }}
@@ -1717,6 +1718,7 @@
</div> </div>
</div> </div>
<div class="flex flex-row w-full"> <div class="flex flex-row w-full">
<!-- only stable release stream for linux -->
<Select.Root <Select.Root
type="single" type="single"
bind:value={$launcherStream} bind:value={$launcherStream}
@@ -1762,7 +1764,7 @@
{/if} {/if}
</div> </div>
</div> </div>
{:else if selectedView === 'login'} {:else if selectedView === 'LOGIN'}
<div <div
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm" class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
in:fly={{ in:fly={{
@@ -1813,7 +1815,7 @@
</Button> </Button>
</form> </form>
</div> </div>
{:else if selectedView === 'themes'} {:else if selectedView === 'THEMES'}
<div <div
class="h-screen w-full flex flex-col items-center bg-black/20 backdrop-blur-sm" class="h-screen w-full flex flex-col items-center bg-black/20 backdrop-blur-sm"
in:fly={{ in:fly={{