Compare commits
4 Commits
3.2.2
..
416067f2ea
| Author | SHA1 | Date | |
|---|---|---|---|
|
416067f2ea
|
|||
|
e58be09bdb
|
|||
| ccb0c467f2 | |||
|
67bc968497
|
+37
-33
@@ -450,48 +450,52 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
|
||||
}
|
||||
};
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
if patch {
|
||||
let patcher_exe_path = PathBuf::from(&folder)
|
||||
.join("EZPPLauncher")
|
||||
.join("patcher")
|
||||
.join("osu!.patcher.exe");
|
||||
if patch {
|
||||
let patcher_exe_path = PathBuf::from(&folder)
|
||||
.join("EZPPLauncher")
|
||||
.join("patcher")
|
||||
.join("osu!.patcher.exe");
|
||||
|
||||
if patcher_exe_path.exists() {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let mut sys = System::new_all();
|
||||
if patcher_exe_path.exists() {
|
||||
let mut sys = System::new_all();
|
||||
|
||||
loop {
|
||||
sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true);
|
||||
loop {
|
||||
sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true);
|
||||
|
||||
let mut found = false;
|
||||
let mut found = false;
|
||||
|
||||
for (_pid, process) in sys.processes() {
|
||||
if process.name() == "osu!.exe" {
|
||||
let pid = process.pid();
|
||||
let title = get_window_title_by_pid(pid);
|
||||
for (_pid, process) in sys.processes() {
|
||||
if process.name() == "osu!.exe" {
|
||||
let pid = process.pid();
|
||||
let title = get_window_title_by_pid(pid);
|
||||
|
||||
if !title.is_empty() && !title.contains("updater") {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if found {
|
||||
if !title.is_empty() && !title.contains("updater") {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
}
|
||||
|
||||
let _ = Command::new(&patcher_exe_path)
|
||||
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
|
||||
.spawn()
|
||||
.map_err(|e| format!("Failed to run patcher: {e}"))?;
|
||||
}
|
||||
|
||||
if found {
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let _ = Command::new(&patcher_exe_path)
|
||||
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
|
||||
.spawn()
|
||||
.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))?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
import { active_custom_theme, custom_themes } from './global';
|
||||
import { setGlobalVolume } from './utils';
|
||||
import { disableMediaControls, setGlobalVolume } from './utils';
|
||||
import { betterFetch } from '@better-fetch/fetch';
|
||||
import { convertFileSrc } 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 });
|
||||
}
|
||||
setGlobalVolume(volume);
|
||||
disableMediaControls();
|
||||
};
|
||||
|
||||
export const deleteTheme = async (themeToUninstall: Theme) => {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export type LaunchView = 'HOME' | 'LOGIN' | 'SETTINGS' | 'THEMES';
|
||||
|
||||
export type EZPPUserResponse = {
|
||||
code: number;
|
||||
message: string;
|
||||
|
||||
@@ -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 {
|
||||
const header = Buffer.from(`blob ${fileBuffer.length}\0`);
|
||||
const store = Buffer.concat([header, fileBuffer]);
|
||||
|
||||
+16
-16
@@ -88,7 +88,7 @@
|
||||
loadTheme,
|
||||
type ThemeInfo,
|
||||
} from '$lib/themes';
|
||||
import { EZPPActionStatus } from '$lib/types';
|
||||
import { EZPPActionStatus, type LaunchView } from '$lib/types';
|
||||
import { currentUser } from '$lib/userAuthentication';
|
||||
import {
|
||||
cursorSmoothening,
|
||||
@@ -141,7 +141,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { fade, fly, scale } from 'svelte/transition';
|
||||
|
||||
let selectedView = $state('home');
|
||||
let selectedView = $state<LaunchView>('HOME');
|
||||
let progress = $state(-1);
|
||||
let launchInfo = $state('');
|
||||
let launchError = $state<Error | undefined>(undefined);
|
||||
@@ -710,7 +710,7 @@
|
||||
]);
|
||||
|
||||
currentUser.set(loginResult.user);
|
||||
selectedView = 'home';
|
||||
selectedView = 'HOME';
|
||||
} else {
|
||||
sileo.error({
|
||||
title: 'Login failed!',
|
||||
@@ -1149,36 +1149,36 @@
|
||||
<Badge class="text-[0.5rem] py-0 px-2">{$launcherVersion || 'dev'}</Badge>
|
||||
<Button
|
||||
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
|
||||
'home'
|
||||
'HOME'
|
||||
? 'bg-primary/50'
|
||||
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
|
||||
disabled={$launching}
|
||||
onclick={() => {
|
||||
if (!$launching) selectedView = 'home';
|
||||
if (!$launching) selectedView = 'HOME';
|
||||
}}
|
||||
>
|
||||
<House class="text-theme-200 size-5!" />
|
||||
</Button>
|
||||
<Button
|
||||
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
|
||||
'themes'
|
||||
'THEMES'
|
||||
? 'bg-primary/50'
|
||||
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
|
||||
disabled={$launching}
|
||||
onclick={() => {
|
||||
if (!$launching) selectedView = 'themes';
|
||||
if (!$launching) selectedView = 'THEMES';
|
||||
}}
|
||||
>
|
||||
<Paintbrush class="text-theme-200 size-5!" />
|
||||
</Button>
|
||||
<Button
|
||||
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
|
||||
'settings'
|
||||
'SETTINGS'
|
||||
? 'bg-primary/50'
|
||||
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
|
||||
disabled={$launching}
|
||||
onclick={() => {
|
||||
if (!$launching) selectedView = 'settings';
|
||||
if (!$launching) selectedView = 'SETTINGS';
|
||||
}}
|
||||
>
|
||||
<Settings class="text-theme-200 size-5!" />
|
||||
@@ -1209,14 +1209,14 @@
|
||||
});
|
||||
currentUser.set(undefined);
|
||||
currentUserInfo.set(undefined);
|
||||
selectedView = 'home';
|
||||
selectedView = 'HOME';
|
||||
}}
|
||||
>
|
||||
<LogOut class="size-3.5 mr-2" />
|
||||
Logout
|
||||
</DropdownMenu.Item>
|
||||
{: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
|
||||
</DropdownMenu.Item>
|
||||
@@ -1226,7 +1226,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="z-10 h-full overflow-hidden">
|
||||
{#if selectedView === 'home'}
|
||||
{#if selectedView === 'HOME'}
|
||||
<div
|
||||
class="flex flex-col-reverse h-full"
|
||||
in:fly={{
|
||||
@@ -1522,7 +1522,7 @@
|
||||
<Button
|
||||
class="flex-1 h-7 text-xs"
|
||||
onclick={() => {
|
||||
selectedView = 'login';
|
||||
selectedView = 'LOGIN';
|
||||
}}>Log In</Button
|
||||
>
|
||||
<Button
|
||||
@@ -1543,7 +1543,7 @@
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{:else if selectedView === 'settings'}
|
||||
{:else if selectedView === 'SETTINGS'}
|
||||
<div
|
||||
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
|
||||
in:fly={{
|
||||
@@ -1762,7 +1762,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else if selectedView === 'login'}
|
||||
{:else if selectedView === 'LOGIN'}
|
||||
<div
|
||||
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
|
||||
in:fly={{
|
||||
@@ -1813,7 +1813,7 @@
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
{:else if selectedView === 'themes'}
|
||||
{:else if selectedView === 'THEMES'}
|
||||
<div
|
||||
class="h-screen w-full flex flex-col items-center bg-black/20 backdrop-blur-sm"
|
||||
in:fly={{
|
||||
|
||||
Reference in New Issue
Block a user