Compare commits

...

15 Commits

Author SHA1 Message Date
HorizonCode 03b326e142 Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2026-06-04 16:36:27 +02:00
HorizonCode 2ec8b08983 fix: dont show dynamic beatmap button on direct page 2026-06-04 16:36:20 +02:00
HorizonCode 344f15b8da fix: user config retrival on linux 2026-06-03 20:51:14 +02:00
HorizonCode 554f07412b chore: disable themes on linux for now until fix is found 2026-06-03 19:57:21 +02:00
HorizonCode f8f53c4236 fix: user config retrival on linux 2026-06-03 19:57:00 +02:00
HorizonCode 64f76d95a6 fix: remove platform dependency from patching settings in SetupWizard 2026-06-03 16:38:28 +02:00
HorizonCode 02fecd237c fix: update launcher version retrieval and improve HWID fallback 2026-06-03 16:16:11 +02:00
HorizonCode eaffc35288 fix: build for linux 2026-06-03 01:01:17 +02:00
HorizonCode 78c7fdb756 chore: bump version 2026-06-03 01:01:03 +02:00
HorizonCode ec7ce53016 chore: bump version 2026-06-03 00:51:28 +02:00
HorizonCode 0610d4beef chore: make patch settings available to linux users, force stable patcher stream 2026-06-03 00:49:35 +02:00
HorizonCode 416067f2ea Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2026-06-02 23:46:02 +02:00
HorizonCode e58be09bdb chore: add patcher support for linux 2026-06-02 23:45:43 +02:00
HorizonCode ccb0c467f2 chore: add type usage for views in selectedView 2026-06-01 10:47:58 +02:00
HorizonCode 67bc968497 feat: add disableMediaControls function to prevent media key actions 2026-05-30 00:06:16 +02:00
13 changed files with 282 additions and 203 deletions
+2 -2
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": {
@@ -79,4 +79,4 @@
"vite": "^8.0.14", "vite": "^8.0.14",
"vite-plugin-devtools-json": "^1.0.0" "vite-plugin-devtools-json": "^1.0.0"
} }
} }
+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"
+42 -39
View File
@@ -36,14 +36,15 @@ pub fn opened_urls(app: tauri::AppHandle) -> Vec<PathBuf> {
} }
#[tauri::command] #[tauri::command]
pub fn get_launcher_version() -> String { pub fn get_launcher_version(app: tauri::AppHandle) -> String {
env!("CARGO_PKG_VERSION").to_string() app.package_info().version.to_string()
} }
#[tauri::command] #[tauri::command]
pub fn get_hwid() -> String { pub fn get_hwid() -> String {
let hwid = get_id().unwrap(); get_id()
hwid.into() .unwrap_or("recorderinsandybridge".to_string())
.into()
} }
#[tauri::command(rename_all = "snake_case")] #[tauri::command(rename_all = "snake_case")]
@@ -79,7 +80,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,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)
if patch { .join("EZPPLauncher")
let patcher_exe_path = PathBuf::from(&folder) .join("patcher")
.join("EZPPLauncher") .join("osu!.patcher.exe");
.join("patcher")
.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 {
sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true); sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true);
let mut found = false; let mut found = false;
for (_pid, process) in sys.processes() { for (_pid, process) in sys.processes() {
if process.name() == "osu!.exe" { if process.name() == "osu!.exe" {
let pid = process.pid(); let pid = process.pid();
let title = get_window_title_by_pid(pid); let title = get_window_title_by_pid(pid);
if !title.is_empty() && !title.contains("updater") { if !title.is_empty() && !title.contains("updater") {
found = true; found = true;
break;
}
}
}
if found {
break; 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))?;
} }
} }
} }
@@ -958,7 +962,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)]
+11 -4
View File
@@ -24,10 +24,13 @@ pub fn get_osu_user_config<P: AsRef<Path>>(
return None; return None;
} }
let current_user = std::env::var("USERNAME").unwrap_or_else(|_| "Admin".to_string()); let current_user = std::env::var("USERNAME")
.or_else(|_| std::env::var("USER"))
.unwrap_or_else(|_| "Admin".to_string());
let osu_config_path = osu_folder_path let osu_config_path = osu_folder_path
.as_ref() .as_ref()
.join(format!("osu!.{}.cfg", current_user)); .join(format!("osu!.{}.cfg", current_user));
println!("Looking for user config at: {:?}", osu_config_path);
if !osu_config_path.exists() { if !osu_config_path.exists() {
return None; return None;
} }
@@ -48,7 +51,9 @@ pub fn set_osu_user_config_vals(
osu_folder_path: &str, osu_folder_path: &str,
key_values: &[(&str, Option<&str>)], key_values: &[(&str, Option<&str>)],
) -> Result<bool, String> { ) -> Result<bool, String> {
let current_user = std::env::var("USERNAME").unwrap_or_else(|_| "Admin".to_string()); let current_user = std::env::var("USERNAME")
.or_else(|_| std::env::var("USER"))
.unwrap_or_else(|_| "Admin".to_string());
let osu_config_path = Path::new(osu_folder_path).join(format!("osu!.{}.cfg", current_user)); let osu_config_path = Path::new(osu_folder_path).join(format!("osu!.{}.cfg", current_user));
if !osu_config_path.exists() { if !osu_config_path.exists() {
@@ -310,7 +315,9 @@ pub async fn is_net8_installed() -> bool {
} }
let stdout_str = String::from_utf8_lossy(&output.stdout); let stdout_str = String::from_utf8_lossy(&output.stdout);
stdout_str.lines().any(|line| line.starts_with("Microsoft.WindowsDesktop.App 8.")) stdout_str
.lines()
.any(|line| line.starts_with("Microsoft.WindowsDesktop.App 8."))
} }
Err(_) => false, Err(_) => false,
} }
@@ -385,4 +392,4 @@ pub fn encrypt_password(password: &str, entropy: &str) -> Result<String, String>
let base64_string = general_purpose::STANDARD.encode(&encrypted_data); let base64_string = general_purpose::STANDARD.encode(&encrypted_data);
Ok(base64_string) Ok(base64_string)
} }
+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]);
+1 -1
View File
@@ -135,7 +135,7 @@
const localThemes = await getThemes(); const localThemes = await getThemes();
const lastThemeName = await config_theme.get('Default'); const lastThemeName = await config_theme.get('Default');
const last_theme = localThemes.find((t) => t.name === lastThemeName); const last_theme = localThemes.find((t) => t.name === lastThemeName);
if (!last_theme) { if (!last_theme || $platform === 'linux') {
await config.value<string>('theme').set('Default'); await config.value<string>('theme').set('Default');
loadTheme(localThemes[0], $custom_theme_container!, await config_theme_volume.get(0.15)); loadTheme(localThemes[0], $custom_theme_container!, await config_theme_volume.get(0.15));
} else { } else {
+176 -148
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) {
@@ -573,10 +575,11 @@
const beatmapCoverImage = `https://assets.ppy.sh/beatmaps/${userStatus.player_status.status.beatmap.set_id}/covers/list@2x.jpg`; const beatmapCoverImage = `https://assets.ppy.sh/beatmaps/${userStatus.player_status.status.beatmap.set_id}/covers/list@2x.jpg`;
const isValidImage = await urlIsValidImage(beatmapCoverImage); const isValidImage = await urlIsValidImage(beatmapCoverImage);
if (isValidImage) largeImageKey = beatmapCoverImage; if (isValidImage) largeImageKey = beatmapCoverImage;
customButton = { if (userStatus.player_status.status.action !== EZPPActionStatus.DIRECT)
text: 'View Beatmap', customButton = {
url: `https://ez-pp.farm/beatmapsets/${userStatus.player_status.status.beatmap.set_id}/${userStatus.player_status.status.beatmap.id}`, text: 'View Beatmap',
}; url: `https://ez-pp.farm/beatmapsets/${userStatus.player_status.status.beatmap.set_id}/${userStatus.player_status.status.beatmap.id}`,
};
} }
details = `[${gamemodeName}] ${details}`; details = `[${gamemodeName}] ${details}`;
@@ -710,7 +713,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 +1152,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 +1212,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 +1229,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 +1525,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 +1546,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 +1561,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 +1719,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 +1765,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 +1816,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={{
@@ -1824,148 +1827,173 @@
}} }}
out:fly={{ duration: $reduceAnimations ? 0 : 400, y: -5, opacity: 0 }} out:fly={{ duration: $reduceAnimations ? 0 : 400, y: -5, opacity: 0 }}
> >
<ScrollContainer class="pt-8" topOffset={45}> {#if $platform === 'linux'}
<div class="grid w-full gap-1 grid-cols-3 p-3 pr-5"> <div
{#each $custom_themes as theme (theme.folder_name)} class="flex flex-col items-center gap-4 mt-12 px-6 text-center h-full justify-center"
<div >
class="group overflow-hidden rounded-3xl border {$active_custom_theme && <!-- currently there is a bug when applying themes on Linux, the Launcher freezes, also when trying to load assets via the assetProtocol it fails because it says the asset was loaded insecurely -->
$active_custom_theme.folder_name === theme.folder_name <span class="text-2xl font-bold drop-shadow-lg"
? 'border-primary' >Custom themes are not supported on Linux yet(we are working on it!)</span
: 'border-theme-800'} bg-theme-950 transition hover:border-white/20 h-73.75" >
> <span class="text-muted-foreground font-semibold drop-shadow-lg"
<img >Due to technical limitations on Linux, custom themes are currently not supported.
src={theme.preview || DefaultThemePreview} </span>
alt="Preview of {theme.name}" <span class="text-muted-foreground font-semibold drop-shadow-lg"
class="mb-2 h-40 w-full rounded-t-3xl object-cover object-center pointer-events-none select-none" >We are working on a solution to bring custom themes to Linux in a future update, but
/> we don't have an ETA yet. Stay tuned!</span
<div class="flex flex-col gap-1 p-3"> >
<div class="mb-4 flex items-center justify-between gap-2"> </div>
<div class="flex flex-col items-start"> {:else}
<span class="text-sm font-semibold">{theme.name}</span> <ScrollContainer class="pt-8" topOffset={45}>
<span class="text-xs text-muted-foreground">by {theme.author}</span> <div class="grid w-full gap-1 grid-cols-3 p-3 pr-5">
{#each $custom_themes as theme (theme.folder_name)}
<div
class="group overflow-hidden rounded-3xl border {$active_custom_theme &&
$active_custom_theme.folder_name === theme.folder_name
? 'border-primary'
: 'border-theme-800'} bg-theme-950 transition hover:border-white/20 h-73.75"
>
<img
src={theme.preview || DefaultThemePreview}
alt="Preview of {theme.name}"
class="mb-2 h-40 w-full rounded-t-3xl object-cover object-center pointer-events-none select-none"
/>
<div class="flex flex-col gap-1 p-3">
<div class="mb-4 flex items-center justify-between gap-2">
<div class="flex flex-col items-start">
<span class="text-sm font-semibold">{theme.name}</span>
<span class="text-xs text-muted-foreground">by {theme.author}</span>
</div>
<span class="text-xs text-muted-foreground">v{theme.version}</span>
</div> </div>
<span class="text-xs text-muted-foreground">v{theme.version}</span> <div class="flex items-center gap-1">
</div> <Button
<div class="flex items-center gap-1"> class="w-full"
<Button disabled={($active_custom_theme &&
class="w-full" $active_custom_theme.folder_name === theme.folder_name) ||
disabled={($active_custom_theme && theme.status === 'downloading' ||
$active_custom_theme.folder_name === theme.folder_name) || theme.status === 'extracting' ||
theme.status === 'downloading' || theme.status === 'deleting'}
theme.status === 'extracting' || onclick={async () => {
theme.status === 'deleting'} if (theme.status === 'installed') {
onclick={async () => { if ($custom_theme_container) {
if (theme.status === 'installed') { loadTheme(theme, $custom_theme_container, $custom_theme_volume);
if ($custom_theme_container) { await config.value<string>('theme').set(theme.name);
loadTheme(theme, $custom_theme_container, $custom_theme_volume); } else {
await config.value<string>('theme').set(theme.name);
} else {
sileo.error({
title: 'Uhhm..',
description: 'Failed to apply theme.',
});
}
} else {
const downloadThemeResult = await downloadTheme(theme);
if (!downloadThemeResult.success) {
if (downloadThemeResult.error && downloadThemeResult.error.length > 0) {
sileo.error({ sileo.error({
title: 'Uhhm..', title: 'Uhhm..',
description: downloadThemeResult.error, description: 'Failed to apply theme.',
}); });
} }
} else { } else {
sileo.success({ const downloadThemeResult = await downloadTheme(theme);
title: 'Yaay!', if (!downloadThemeResult.success) {
description: 'Theme installed successfully!', if (
}); downloadThemeResult.error &&
} downloadThemeResult.error.length > 0
} ) {
}} sileo.error({
> title: 'Uhhm..',
{#if $active_custom_theme && $active_custom_theme.folder_name === theme.folder_name} description: downloadThemeResult.error,
Theme in use });
{:else if theme.status !== 'installed'} }
{#if theme.status === 'downloading'} } else {
{theme.updateAvailable ? 'Updating' : 'Downloading'} Theme... ({Math.round( sileo.success({
theme.progress * 100 title: 'Yaay!',
)}%) description: 'Theme installed successfully!',
{:else if theme.status === 'extracting'}
Extracting Theme... ({Math.round(theme.progress * 100)}%)
{:else if theme.status === 'deleting'}
Uninstalling Theme...
{:else}
Download Theme
{/if}
{:else}
Use Theme
{/if}
</Button>
{#if theme.status === 'installed' && theme.updateAvailable}
<Button
class="min-w-10"
size="icon"
variant="secondary"
onclick={async () => {
const defaultTheme = $custom_themes.find((t) => t.name === 'Default');
if (defaultTheme) {
loadTheme(defaultTheme, $custom_theme_container!, $custom_theme_volume);
await config.value<string>('theme').set(defaultTheme.name);
if (!(await downloadTheme(theme, true))) {
sileo.error({
title: 'Uhhm..',
description: 'Failed to update theme.',
}); });
} }
} }
}} }}
> >
<CloudDownload /> {#if $active_custom_theme && $active_custom_theme.folder_name === theme.folder_name}
Theme in use
{:else if theme.status !== 'installed'}
{#if theme.status === 'downloading'}
{theme.updateAvailable ? 'Updating' : 'Downloading'} Theme... ({Math.round(
theme.progress * 100
)}%)
{:else if theme.status === 'extracting'}
Extracting Theme... ({Math.round(theme.progress * 100)}%)
{:else if theme.status === 'deleting'}
Uninstalling Theme...
{:else}
Download Theme
{/if}
{:else}
Use Theme
{/if}
</Button> </Button>
{/if} {#if theme.status === 'installed' && theme.updateAvailable}
{#if (theme.status === 'installed' || theme.status === 'deleting') && $active_custom_theme && $active_custom_theme.folder_name !== theme.folder_name && theme.name !== 'Default'} <Button
<Button class="min-w-10"
class="min-w-10" size="icon"
size="icon" variant="secondary"
variant="destructive" onclick={async () => {
disabled={theme.status !== 'installed'} const defaultTheme = $custom_themes.find((t) => t.name === 'Default');
onclick={async () => { if (defaultTheme) {
try { loadTheme(
const deleteResult = await deleteTheme(theme); defaultTheme,
if (deleteResult) { $custom_theme_container!,
sileo.success({ $custom_theme_volume
title: 'Yaay!', );
description: 'Theme uninstalled successfully!', await config.value<string>('theme').set(defaultTheme.name);
});
} else { if (!(await downloadTheme(theme, true))) {
sileo.error({
title: 'Uhhm..',
description: 'Failed to update theme.',
});
}
}
}}
>
<CloudDownload />
</Button>
{/if}
{#if (theme.status === 'installed' || theme.status === 'deleting') && $active_custom_theme && $active_custom_theme.folder_name !== theme.folder_name && theme.name !== 'Default'}
<Button
class="min-w-10"
size="icon"
variant="destructive"
disabled={theme.status !== 'installed'}
onclick={async () => {
try {
const deleteResult = await deleteTheme(theme);
if (deleteResult) {
sileo.success({
title: 'Yaay!',
description: 'Theme uninstalled successfully!',
});
} else {
sileo.error({
title: 'Uhhm..',
description: 'Failed to uninstall theme.',
});
}
} catch (err) {
console.log(err);
sileo.error({ sileo.error({
title: 'Uhhm..', title: 'Uhhm..',
description: 'Failed to uninstall theme.', description: 'Failed to uninstall theme.',
}); });
} }
} catch (err) { }}
console.log(err); >
sileo.error({ {#if theme.status === 'deleting'}
title: 'Uhhm..', <LoaderCircle class="animate-spin" />
description: 'Failed to uninstall theme.', {:else}
}); <Trash />
} {/if}
}} </Button>
> {/if}
{#if theme.status === 'deleting'} </div>
<LoaderCircle class="animate-spin" />
{:else}
<Trash />
{/if}
</Button>
{/if}
</div> </div>
</div> </div>
</div> {/each}
{/each} </div>
</div> </ScrollContainer>
</ScrollContainer> {/if}
</div> </div>
{/if} {/if}
</div> </div>
+3 -5
View File
@@ -13,7 +13,6 @@
discordPresence, discordPresence,
osuBuild, osuBuild,
osuStream, osuStream,
platform,
presenceLoading, presenceLoading,
skins, skins,
skinsCount, skinsCount,
@@ -266,17 +265,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);
}} }}