Compare commits

...
15 Commits
Author SHA1 Message Date
HorizonCode 756638ecf1 fix(ui): hide scrollbars on horizontal chip strips
Define the missing no-scrollbar utility so recent-play and icon-pack strips stop rendering native desktop scrollbars.
2026-11-18 20:37:00 +01:00
HorizonCode 34e93ee29b fix(presence): keep rich presence synced with launcher state
Refresh idle activity from live mode, stats, user, and config changes, replace activity snapshots so cleared buttons and images are removed, and keep retrying Discord IPC until presence is disabled.
2026-11-12 12:59:56 +01:00
HorizonCode e1c04c4f5b fix(build): clean up cross-platform warnings
Scope diagnostics mutability to macOS, pass the Rust LLVM library path to spawned tools, and suppress missing MSVC PDB warnings for cargo-xwin links.
2026-11-12 11:32:36 +01:00
HorizonCode cb117826c7 build(release): remove old build script 2026-11-12 11:19:14 +01:00
HorizonCode 0e295c8425 build(release): add cross-platform release builds
Add host and per-platform release commands, with macOS/Linux-to-Windows NSIS cross-compilation via cargo-xwin and up-front toolchain checks.
2026-11-12 11:16:48 +01:00
HorizonCode 746524d27e Merge branch 'themes-v2' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher into themes-v2 2026-11-04 22:36:53 +01:00
HorizonCode 660fb557a6 fix(logs): include the current session in the viewer
Read the active launcher, osu!, and patcher logs directly so the current session appears before rotation.
2026-11-04 22:36:16 +01:00
HorizonCode 575da8504a Merge branch 'themes-v2' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher into themes-v2 2026-11-04 21:44:22 +01:00
HorizonCode 8616253065 feat(themes): crossfade theme changes and fix window overflow
Crossfade user-selected themes, keep the theme volume popover open while
dragging its slider, and clip the fixed app shell so oversized theme layers
cannot create page scrollbars on Windows. Remove the redundant in-use badge
from the active theme card.
2026-11-04 21:43:24 +01:00
HorizonCode 0105c5975a fix: unsafe use 2026-11-04 21:29:02 +01:00
HorizonCode c2fd265b49 perf(launcher): reduce background resource usage
Make the custom cursor event-driven, pause CSS, theme video, and Lottie work
while the launcher is hidden or unfocused, and reduce presence polling while
osu is running.
2026-11-04 17:00:16 +01:00
HorizonCode 687ab26752 fix(themes): remove enabled/disabled badge in title when logging tab is active 2026-11-04 16:43:48 +01:00
HorizonCode 9d312fb3bb fix(themes): re-add themesV2Css import 2026-11-04 16:42:30 +01:00
HorizonCode ef214d424c feat(themes): add revert for unsynced themes
Restore the published Workshop version after confirmation, keeping a backup of
local edits. Owner reverts send auth headers so themes-service skips the
download counter.
2026-11-04 14:50:03 +01:00
HorizonCode d4be3f845d feat(themes): confirm uninstalls and restore tab padding
Add a confirmation dialog before removing an installed theme, warning
that local edits are deleted. Apply content padding to the absolute tab
panels so the workshop and library views stay inset from the frame.
2026-11-04 13:50:05 +01:00
22 changed files with 1140 additions and 268 deletions

No files matched your search

+24
View File
@@ -183,6 +183,30 @@ src-tauri/target/release/bundle/deb/
src-tauri/target/release/bundle/appimage/
```
### Cross-platform Releases
Use the release scripts to build a specific platform:
```bash
bun run release:macos
bun run release:windows
bun run release:linux
```
Windows installers can be cross-compiled from macOS with NSIS and `cargo-xwin`:
```bash
brew install nsis llvm cmake nasm ninja
rustup target add x86_64-pc-windows-msvc
cargo install --locked cargo-xwin
bun run release:windows
```
The Windows installer is written to
`src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/`. Cross-compiled
Windows builds are unsigned. macOS releases must be built on macOS, and Linux
releases must be built on Linux.
---
## 📁 Project Structure (Overview)
+4 -1
View File
@@ -5,7 +5,10 @@
"type": "module",
"scripts": {
"debug": "bun run tauri dev",
"build": "bun ./scripts/build.ts",
"release": "bun ./scripts/release.ts",
"release:macos": "bun ./scripts/release.ts macos",
"release:windows": "bun ./scripts/release.ts windows",
"release:linux": "bun ./scripts/release.ts linux",
"vite:dev": "vite dev",
"vite:build": "vite build && exit 0",
"tauri:build": "tauri build",
-40
View File
@@ -1,40 +0,0 @@
import { spawn } from 'child_process';
function runVite(): Promise<void> {
return new Promise((resolve, reject) => {
const proc = spawn('bunx', ['--bun', 'vite', 'build'], { stdio: ['inherit', 'pipe', 'pipe'] });
proc.stdout?.on('data', (data: Buffer) => {
process.stdout.write(data);
if (data.toString().includes('✔ done')) {
setTimeout(() => {
proc.kill();
resolve();
}, 500);
}
});
proc.stderr?.on('data', (data: Buffer) => process.stderr.write(data));
proc.on('close', (code) => {
if (code === 0 || code === null) resolve();
else reject(new Error(`vite build exited with code ${code}`));
});
});
}
function run(cmd: string, args: string[]): Promise<void> {
return new Promise((resolve, reject) => {
const proc = spawn(cmd, args, { stdio: 'inherit' });
proc.on('close', (code) => {
if (code === 0) resolve();
else reject(new Error(`${cmd} exited with code ${code}`));
});
});
}
await run('bun', ['./scripts/sync-version.ts']);
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']);
+301
View File
@@ -0,0 +1,301 @@
import { spawn, execFileSync } from 'node:child_process';
import { accessSync, constants, existsSync } from 'node:fs';
import path from 'node:path';
const WINDOWS_TARGET = 'x86_64-pc-windows-msvc';
const TARGETS = ['macos', 'windows', 'linux'] as const;
type Target = (typeof TARGETS)[number];
function hostTarget(): Target {
if (process.platform === 'darwin') return 'macos';
if (process.platform === 'win32') return 'windows';
if (process.platform === 'linux') return 'linux';
throw new Error(`Unsupported build host: ${process.platform}`);
}
function findCommand(command: string, envPath: string): string | undefined {
const extensions =
process.platform === 'win32'
? ['', ...(process.env.PATHEXT ?? '.EXE;.CMD;.BAT').split(';')]
: [''];
for (const directory of envPath.split(path.delimiter)) {
if (!directory) continue;
for (const extension of extensions) {
const candidate = path.join(directory, `${command}${extension.toLowerCase()}`);
try {
accessSync(candidate, constants.X_OK);
return candidate;
} catch {
// Keep looking through PATH.
}
}
}
}
function prependExistingPath(env: NodeJS.ProcessEnv, directory: string) {
if (existsSync(directory)) env.PATH = `${directory}${path.delimiter}${env.PATH ?? ''}`;
}
function ensureUtf8Locale(env: NodeJS.ProcessEnv) {
const current = env.LC_ALL || env.LC_CTYPE || env.LANG || '';
if (current && current !== 'C' && current !== 'POSIX') return;
// makeNSIS 3.13 crashes with std::bad_alloc on POSIX under the C locale.
const locale = process.platform === 'darwin' ? 'en_US.UTF-8' : 'C.UTF-8';
env.LC_ALL = locale;
env.LANG = locale;
}
function selectRustupToolchain(env: NodeJS.ProcessEnv) {
const rustup =
findCommand('rustup', env.PATH ?? '') ??
['/opt/homebrew/opt/rustup/bin/rustup', '/usr/local/opt/rustup/bin/rustup'].find((candidate) =>
existsSync(candidate)
);
if (!rustup) return;
try {
const cargo = execFileSync(rustup, ['which', 'cargo'], {
encoding: 'utf8',
env,
stdio: ['ignore', 'pipe', 'ignore'],
}).trim();
env.PATH = `${path.dirname(cargo)}${path.delimiter}${env.PATH ?? ''}`;
if (process.platform === 'darwin') {
const libDir = path.join(path.dirname(path.dirname(cargo)), 'lib');
env.DYLD_FALLBACK_LIBRARY_PATH = [libDir, env.DYLD_FALLBACK_LIBRARY_PATH]
.filter(Boolean)
.join(path.delimiter);
}
} catch {
// Fall back to the cargo already on PATH.
}
}
function hasRustTarget(target: string, env: NodeJS.ProcessEnv): boolean {
try {
const libdir = execFileSync('rustc', ['--print', 'target-libdir', '--target', target], {
encoding: 'utf8',
env,
stdio: ['ignore', 'pipe', 'ignore'],
}).trim();
return existsSync(libdir);
} catch {
return false;
}
}
function configureCrossWindowsLinker(env: NodeJS.ProcessEnv) {
// Microsoft's prebuilt CRT libraries reference PDBs that are not shipped
// with cargo-xwin, so lld-link emits LNK4099 for every library. The debug
// info is unavailable either way, so suppress only that specific warning.
const key = 'CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS';
env[key] = [env[key], '-C', 'link-arg=/ignore:4099'].filter(Boolean).join(' ');
}
function windowsPrerequisites(env: NodeJS.ProcessEnv): string[] {
const missing: string[] = [];
if (!findCommand('cargo-xwin', env.PATH ?? '')) {
missing.push('cargo-xwin (install with: cargo install --locked cargo-xwin)');
}
if (!findCommand('cmake', env.PATH ?? '')) {
missing.push(
process.platform === 'darwin'
? 'CMake (install with: brew install cmake)'
: 'CMake (install cmake and add it to PATH)'
);
}
if (!findCommand('nasm', env.PATH ?? '')) {
missing.push(
process.platform === 'darwin'
? 'NASM (install with: brew install nasm)'
: 'NASM (install nasm and add it to PATH)'
);
}
if (!findCommand('ninja', env.PATH ?? '')) {
missing.push(
process.platform === 'darwin'
? 'Ninja (install with: brew install ninja)'
: 'Ninja (install ninja and add it to PATH)'
);
}
if (!hasRustTarget(WINDOWS_TARGET, env)) {
missing.push(
`${WINDOWS_TARGET} Rust target (install with: rustup target add ${WINDOWS_TARGET})`
);
}
if (process.platform !== 'win32') {
if (!findCommand('llvm-rc', env.PATH ?? '')) {
missing.push(
process.platform === 'darwin'
? 'LLVM (install with: brew install llvm, then add its bin directory to PATH)'
: 'LLVM (install llvm and lld, then add llvm-rc to PATH)'
);
}
if (!findCommand('makensis', env.PATH ?? '')) {
missing.push(
process.platform === 'darwin'
? 'NSIS (install with: brew install nsis)'
: 'NSIS (install makensis and add it to PATH)'
);
}
}
return missing;
}
function artifactDirectory(target: Target): string {
if (target === 'windows') {
const suffix =
process.platform === 'win32'
? path.join('target', 'release')
: path.join('target', WINDOWS_TARGET, 'release');
return path.join('src-tauri', suffix, 'bundle', 'nsis');
}
if (target === 'macos') return path.join('src-tauri', 'target', 'release', 'bundle');
return path.join('src-tauri', 'target', 'release', 'bundle');
}
function run(command: string, args: string[], env: NodeJS.ProcessEnv): Promise<void> {
console.log(`\n$ ${[command, ...args].join(' ')}`);
return new Promise((resolve, reject) => {
const child = spawn(command, args, { env, stdio: 'inherit' });
child.on('error', reject);
child.on('close', (code) => {
if (code === 0) resolve();
else reject(new Error(`${command} exited with code ${code ?? 'unknown'}`));
});
});
}
/**
* Vite's static-adapter build can leave the process alive after writing the
* output. Stop it once the adapter confirms the build is complete.
*/
function buildFrontend(command: string, env: NodeJS.ProcessEnv): Promise<void> {
console.log(`\n$ ${command} x --bun vite build`);
return new Promise((resolve, reject) => {
const child = spawn(command, ['x', '--bun', 'vite', 'build'], {
env,
stdio: ['inherit', 'pipe', 'pipe'],
});
let completed = false;
const finish = (error?: Error) => {
if (completed) return;
completed = true;
if (error) reject(error);
else resolve();
};
child.stdout?.on('data', (data: Buffer) => {
process.stdout.write(data);
if (!completed && data.toString().includes('✔ done')) {
setTimeout(() => {
child.kill();
finish();
}, 500);
}
});
child.stderr?.on('data', (data: Buffer) => process.stderr.write(data));
child.on('error', finish);
child.on('close', (code) => {
if (code === 0) finish();
else finish(new Error(`vite build exited with code ${code ?? 'unknown'}`));
});
});
}
function usage() {
console.log(`Build an EZPPLauncher release.
Usage:
bun run release Build for the current platform
bun run release:macos Build the macOS app and DMG
bun run release:windows Build the Windows NSIS installer
bun run release:linux Build the Linux package
On macOS, release:windows cross-compiles using cargo-xwin. On Linux, use
release:linux on a Linux host; Linux bundles cannot be built from macOS.`);
}
const requested = process.argv[2]?.toLowerCase();
if (requested === '--help' || requested === '-h') {
usage();
process.exit(0);
}
let target: Target;
try {
target = requested ? (requested as Target) : hostTarget();
} catch (error) {
console.error(error instanceof Error ? error.message : error);
process.exit(1);
}
if (!TARGETS.includes(target)) {
console.error(`Unknown release target: ${requested}`);
usage();
process.exit(1);
}
const host = hostTarget();
if (target === 'macos' && host !== 'macos') {
console.error('macOS releases must be built on macOS.');
process.exit(1);
}
if (target === 'linux' && host !== 'linux') {
console.error('Linux releases must be built on Linux. Use a Linux host or CI runner.');
process.exit(1);
}
const env = { ...process.env };
if (host === 'macos') {
prependExistingPath(env, '/opt/homebrew/opt/llvm/bin');
prependExistingPath(env, '/usr/local/opt/llvm/bin');
prependExistingPath(env, '/opt/homebrew/opt/nsis/bin');
prependExistingPath(env, '/usr/local/opt/nsis/bin');
}
if (host !== 'windows') ensureUtf8Locale(env);
if (target === 'windows') selectRustupToolchain(env);
if (target === 'windows' && host !== 'windows') {
const missing = windowsPrerequisites(env);
if (missing.length > 0) {
console.error('Windows cross-compilation is missing prerequisites:\n');
for (const requirement of missing) console.error(` - ${requirement}`);
process.exit(1);
}
configureCrossWindowsLinker(env);
}
const tauriArgs = ['x', 'tauri', 'build'];
if (target === 'windows') {
tauriArgs.push('--bundles', 'nsis');
if (host !== 'windows') tauriArgs.push('--runner', 'cargo-xwin', '--target', WINDOWS_TARGET);
}
const bun = findCommand('bun', env.PATH ?? '') ?? 'bun';
console.log(`Building the ${target} release from ${host}...`);
try {
await run(bun, ['./scripts/sync-version.ts'], env);
await buildFrontend(bun, env);
if (target === 'linux') env.NO_STRIP = '1';
await run(bun, tauriArgs, env);
console.log(`\n✅ ${target} release built.`);
console.log(`Artifacts: ${artifactDirectory(target)}`);
} catch (error) {
console.error(`\n❌ Release build failed: ${error instanceof Error ? error.message : error}`);
process.exit(1);
}
+56 -31
View File
@@ -3,7 +3,7 @@ use hardware_id::get_id;
use reqwest::Client;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashSet;
use std::collections::{HashMap, HashSet};
use std::io::Read;
use std::path::{Path, PathBuf};
#[cfg(not(target_os = "macos"))]
@@ -265,8 +265,7 @@ pub async fn read_file_chunk(path: String, offset: u64, length: u64) -> Result<V
#[tauri::command]
pub fn get_hwid() -> String {
get_id()
.unwrap_or("recorderinsandybridge".to_string())
get_id().unwrap_or("recorderinsandybridge".to_string())
}
/// Show the native macOS picker, which can select `osu!.app` bundles as files.
@@ -398,6 +397,8 @@ pub async fn installation_diagnostics(app: AppHandle, folder: String) -> Install
.map(patcher_file_stats)
.unwrap_or_default();
// macOS fills in the Wine and FFmpeg fields below.
#[cfg_attr(not(target_os = "macos"), allow(unused_mut))]
let mut diagnostics = InstallationDiagnostics {
platform: std::env::consts::OS.to_string(),
os_version: System::long_os_version(),
@@ -551,7 +552,8 @@ pub async fn get_skins_count(folder: String) -> Option<u64> {
if let Ok(mut entries) = fs::read_dir(skins_folder).await {
while let Ok(Some(entry)) = entries.next_entry().await {
if let Ok(ft) = entry.file_type().await
&& ft.is_dir() {
&& ft.is_dir()
{
let dir_path = entry.path();
let has_ini = tokio::fs::try_exists(dir_path.join("skin.ini"))
.await
@@ -759,7 +761,7 @@ pub async fn run_osu(
#[cfg(windows)]
if optimize {
#[link(name = "winmm")]
extern "system" {
unsafe extern "system" {
fn timeBeginPeriod(uPeriod: u32) -> u32;
}
unsafe {
@@ -906,7 +908,7 @@ pub async fn run_osu(
#[cfg(windows)]
if optimize {
#[link(name = "winmm")]
extern "system" {
unsafe extern "system" {
fn timeEndPeriod(uPeriod: u32) -> u32;
}
unsafe {
@@ -1062,7 +1064,10 @@ pub async fn download_ezpp_launcher_update_files(
#[cfg(target_os = "macos")]
{
let patcher_exe = osu_path.join("EZPPLauncher").join("patcher").join("osu!.patcher.exe");
let patcher_exe = osu_path
.join("EZPPLauncher")
.join("patcher")
.join("osu!.patcher.exe");
if patcher_exe.is_file() {
let _ = crate::utils::ensure_patcher_compatibility(&patcher_exe);
}
@@ -1324,24 +1329,24 @@ pub struct PresenceButton {
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PresenceActivityPayload {
pub state: Option<String>,
pub details: Option<String>,
pub large_image_key: Option<String>,
pub large_image_text: Option<String>,
pub small_image_key: Option<Option<String>>,
pub small_image_text: Option<Option<String>>,
pub button1: Option<Option<presence::PresenceButton>>,
pub button2: Option<Option<presence::PresenceButton>>,
pub show_timestamp: Option<bool>,
pub state: String,
pub details: String,
pub large_image_key: String,
pub large_image_text: String,
pub small_image_key: Option<String>,
pub small_image_text: Option<String>,
pub button1: Option<presence::PresenceButton>,
pub button2: Option<presence::PresenceButton>,
pub show_timestamp: bool,
}
#[tauri::command]
pub async fn presence_update_activity(activity: PresenceActivityPayload) {
presence::update_activity(
activity.state.as_deref(),
activity.details.as_deref(),
activity.large_image_key.as_deref(),
activity.large_image_text.as_deref(),
&activity.state,
&activity.details,
&activity.large_image_key,
&activity.large_image_text,
activity.small_image_key,
activity.small_image_text,
activity.button1,
@@ -1688,14 +1693,19 @@ pub async fn download_and_extract_community_theme(
download_url: String,
theme_folder: String,
theme_name: String,
request_headers: Option<HashMap<String, String>>,
) -> Result<(), String> {
let client = reqwest::Client::new();
let response = client
.get(&download_url)
.header(
let mut request = client.get(&download_url).header(
"User-Agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
)
);
if let Some(headers) = request_headers {
for (name, value) in headers {
request = request.header(name.as_str(), value.as_str());
}
}
let response = request
.send()
.await
.map_err(|e| format!("Failed to download theme: {}", e))?;
@@ -1933,7 +1943,8 @@ pub(crate) fn theme_root() -> Result<PathBuf, String> {
#[cfg(any(target_os = "linux", target_os = "macos"))]
fn loopback_theme_asset_base() -> String {
if crate::theme_server::base_url().is_none()
&& let Ok(root) = theme_root() {
&& let Ok(root) = theme_root()
{
match crate::theme_server::media_root() {
Ok(media) => {
if let Err(error) = crate::theme_server::start(root, media) {
@@ -2092,7 +2103,14 @@ pub async fn optimize_theme_media(app: AppHandle, source_url: String) -> Result<
};
tokio::task::spawn_blocking(move || {
optimize_theme_media_blocking(&ffmpeg, &source, &original, &cache_name, &destination, on_progress)
optimize_theme_media_blocking(
&ffmpeg,
&source,
&original,
&cache_name,
&destination,
on_progress,
)
})
.await
.map_err(|error| format!("Theme media optimizer thread failed: {error}"))?
@@ -2253,8 +2271,11 @@ async fn download_ffmpeg(app: &AppHandle) -> Result<PathBuf, String> {
.await
.map_err(|error| format!("Could not write the FFmpeg archive: {error}"))?;
if let Some(percent) = (received.min(total) * 100).checked_div(total).map(|v| v as u8)
&& percent != last_percent {
if let Some(percent) = (received.min(total) * 100)
.checked_div(total)
.map(|v| v as u8)
&& percent != last_percent
{
last_percent = percent;
let _ = app.emit(
"theme-media-progress",
@@ -2710,8 +2731,11 @@ pub async fn open_presence_editor(app: AppHandle) -> Result<(), String> {
return Ok(());
}
let window =
WebviewWindowBuilder::new(&app, "presence-editor", WebviewUrl::App("index.html".into()))
let window = WebviewWindowBuilder::new(
&app,
"presence-editor",
WebviewUrl::App("index.html".into()),
)
.title("EZPPLauncher — Discord Rich Presence Editor")
.inner_size(1200.0, 800.0)
.min_inner_size(980.0, 650.0)
@@ -3113,7 +3137,8 @@ fn collect_theme_asset_refs(value: &Value, assets: &mut HashSet<String>) {
for (key, value) in object {
if (key == "src" || key == "preview")
&& let Some(src) = value.as_str()
&& let Some(path) = theme_asset_reference(src) {
&& let Some(path) = theme_asset_reference(src)
{
assets.insert(path);
}
collect_theme_asset_refs(value, assets);
+130 -23
View File
@@ -393,7 +393,97 @@ pub struct LogBundleEntry {
pub content: String,
}
/// List the rotating ZIP bundles, newest first, for the in-app log viewer.
const MAX_LOG_VIEW_BYTES: u64 = 2 * 1024 * 1024;
fn modified_millis(metadata: &fs::Metadata) -> u64 {
metadata
.modified()
.ok()
.and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok())
.map(|duration| duration.as_millis() as u64)
.unwrap_or(0)
}
/// Describe the active session. Unlike archived bundles, these files are still
/// being written and appear in the viewer without waiting for a rotation.
fn current_log_bundle(dir: &Path) -> Option<LogBundleInfo> {
let mut size = 0;
let mut modified = 0;
let mut has_logs = false;
for stream in Stream::ALL {
let Ok(metadata) = fs::metadata(dir.join(stream.file_name())) else {
continue;
};
if metadata.len() == 0 {
continue;
}
has_logs = true;
size += metadata.len();
modified = modified.max(modified_millis(&metadata));
}
has_logs.then(|| LogBundleInfo {
path: dir.to_string_lossy().into_owned(),
name: "Current session".to_string(),
size,
modified,
})
}
fn read_log_entry(
name: String,
reader: &mut impl Read,
size: u64,
) -> Result<LogBundleEntry, String> {
let mut bytes = Vec::new();
reader
.take(MAX_LOG_VIEW_BYTES)
.read_to_end(&mut bytes)
.map_err(|error| format!("Could not read a log entry: {error}"))?;
let mut content = String::from_utf8_lossy(&bytes).into_owned();
if size > bytes.len() as u64 {
content.push_str("\n… log truncated in the viewer …\n");
}
Ok(LogBundleEntry { name, content })
}
fn read_current_logs(root: &Path) -> Result<Vec<LogBundleEntry>, String> {
let mut entries = Vec::new();
for stream in Stream::ALL {
let path = root.join(stream.file_name());
let metadata = match fs::metadata(&path) {
Ok(metadata) => metadata,
Err(error) if error.kind() == io::ErrorKind::NotFound => continue,
Err(error) => {
return Err(format!(
"Could not read the current {}: {error}",
stream.file_name()
));
}
};
if metadata.len() == 0 {
continue;
}
let mut file = File::open(&path).map_err(|error| {
format!("Could not read the current {}: {error}", stream.file_name())
})?;
entries.push(read_log_entry(
stream.file_name().to_string(),
&mut file,
metadata.len(),
)?);
}
entries.sort_by(|a, b| a.name.cmp(&b.name));
Ok(entries)
}
/// List the active session followed by the rotating ZIP bundles, newest first,
/// for the in-app log viewer.
#[tauri::command]
pub fn list_log_bundles() -> Result<Vec<LogBundleInfo>, String> {
let dir = logs_directory();
@@ -401,6 +491,7 @@ pub fn list_log_bundles() -> Result<Vec<LogBundleInfo>, String> {
return Ok(Vec::new());
}
let current = current_log_bundle(&dir);
let mut bundles = fs::read_dir(&dir)
.map_err(|error| format!("Could not read the logs folder: {error}"))?
.filter_map(|entry| entry.ok())
@@ -411,26 +502,23 @@ pub fn list_log_bundles() -> Result<Vec<LogBundleInfo>, String> {
return None;
}
let metadata = entry.metadata().ok()?;
let modified = metadata
.modified()
.ok()
.and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok())
.map(|duration| duration.as_millis() as u64)
.unwrap_or(0);
Some(LogBundleInfo {
path: path.to_string_lossy().into_owned(),
name,
size: metadata.len(),
modified,
modified: modified_millis(&metadata),
})
})
.collect::<Vec<_>>();
bundles.sort_by_key(|b| std::cmp::Reverse(b.modified));
if let Some(current) = current {
bundles.insert(0, current);
}
Ok(bundles)
}
/// Read the launcher/osu/patcher logs out of one bundle.
/// Read the active logs or the launcher/osu/patcher logs out of an archive.
#[tauri::command]
pub fn read_log_bundle(path: String) -> Result<Vec<LogBundleEntry>, String> {
let dir = logs_directory();
@@ -441,6 +529,9 @@ pub fn read_log_bundle(path: String) -> Result<Vec<LogBundleEntry>, String> {
if !requested.starts_with(&root) {
return Err("The log bundle is outside the logs folder".to_string());
}
if requested == root {
return read_current_logs(&root);
}
let file = File::open(&requested)
.map_err(|error| format!("Could not read the log bundle: {error}"))?;
@@ -456,20 +547,9 @@ pub fn read_log_bundle(path: String) -> Result<Vec<LogBundleEntry>, String> {
continue;
}
let mut bytes = Vec::new();
entry
.by_ref()
.take(2 * 1024 * 1024)
.read_to_end(&mut bytes)
.map_err(|error| format!("Could not read a log entry: {error}"))?;
let mut content = String::from_utf8_lossy(&bytes).into_owned();
if entry.size() > bytes.len() as u64 {
content.push_str("\n… log truncated in the viewer …\n");
}
entries.push(LogBundleEntry {
name: entry.name().to_string(),
content,
});
let name = entry.name().to_string();
let size = entry.size();
entries.push(read_log_entry(name, &mut entry, size)?);
}
entries.sort_by(|a, b| a.name.cmp(&b.name));
@@ -634,4 +714,31 @@ mod tests {
drop(current);
fs::remove_dir_all(dir).unwrap();
}
#[test]
fn current_session_includes_active_logs() {
let dir = temp_dir("current");
let logs = Arc::new(LogSet::new(dir.clone()));
write_line(&logs, Stream::Launcher, "launcher current\n");
write_line(&logs, Stream::Osu, "osu current\n");
let current = current_log_bundle(&dir).expect("active logs should have a session");
assert_eq!(current.name, "Current session");
assert_eq!(current.path, dir.to_string_lossy());
assert!(current.size > 0);
let entries = read_current_logs(&dir).unwrap();
assert_eq!(
entries
.iter()
.map(|entry| entry.name.as_str())
.collect::<Vec<_>>(),
["launcher.log", "osu.log"]
);
assert_eq!(entries[0].content, "launcher current\n");
assert_eq!(entries[1].content, "osu current\n");
drop(logs);
fs::remove_dir_all(dir).unwrap();
}
}
+47 -64
View File
@@ -4,6 +4,7 @@ use std::sync::Mutex as StdMutex;
use std::time::{SystemTime, UNIX_EPOCH};
use tauri::{AppHandle, RunEvent};
use tokio::sync::{mpsc, oneshot};
use tokio::task::JoinHandle;
use tokio::time::{Duration, interval};
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -57,19 +58,15 @@ enum PresenceCommand {
IsConnected(oneshot::Sender<bool>),
}
enum ReconnectResult {
Connected(Box<AsyncDiscordIpcClient>),
Failed,
}
struct PresenceActor {
receiver: mpsc::Receiver<PresenceCommand>,
reconnect_rx: mpsc::Receiver<ReconnectResult>,
reconnect_tx: mpsc::Sender<ReconnectResult>,
reconnect_rx: mpsc::Receiver<Box<AsyncDiscordIpcClient>>,
reconnect_tx: mpsc::Sender<Box<AsyncDiscordIpcClient>>,
reconnect_task: Option<JoinHandle<()>>,
client: Option<AsyncDiscordIpcClient>,
data: PresenceData,
start_timestamp: i64,
reconnecting: bool,
should_connect: bool,
}
impl PresenceActor {
@@ -85,10 +82,11 @@ impl PresenceActor {
receiver,
reconnect_rx,
reconnect_tx,
reconnect_task: None,
client: None,
data: PresenceData::default(),
start_timestamp: start,
reconnecting: false,
should_connect: false,
}
}
@@ -112,18 +110,13 @@ impl PresenceActor {
}
}
Some(result) = self.reconnect_rx.recv() => {
self.reconnecting = false;
match result {
ReconnectResult::Connected(client) => {
Some(client) = self.reconnect_rx.recv() => {
self.reconnect_task = None;
if self.should_connect {
log::info!(target: "launcher", "Presence: reconnect succeeded");
self.client = Some(*client);
self.push_presence().await;
}
ReconnectResult::Failed => {
log::warn!(target: "launcher", "Presence: all reconnect attempts exhausted");
}
}
}
_ = heartbeat.tick() => {
@@ -134,15 +127,19 @@ impl PresenceActor {
}
async fn cmd_connect(&mut self, resp: oneshot::Sender<bool>) {
self.should_connect = true;
if self.client.is_some() {
let _ = resp.send(true);
return;
}
if self.reconnect_task.is_some() {
let _ = resp.send(false);
return;
}
match try_connect_once().await {
Some(client) => {
self.client = Some(client);
self.reconnecting = false;
self.push_presence().await;
let _ = resp.send(true);
}
@@ -158,6 +155,10 @@ impl PresenceActor {
}
async fn cmd_disconnect(&mut self, resp: oneshot::Sender<()>) {
self.should_connect = false;
if let Some(task) = self.reconnect_task.take() {
task.abort();
}
if let Some(mut client) = self.client.take() {
let _ = client.clear_activity().await;
log::info!(target: "launcher", "Presence: disconnected");
@@ -206,37 +207,37 @@ impl PresenceActor {
e
);
self.client = None;
self.should_connect = true;
self.spawn_reconnect_task();
}
}
fn spawn_reconnect_task(&mut self) {
if self.reconnecting {
if self.reconnect_task.is_some() || !self.should_connect {
return;
}
self.reconnecting = true;
let tx = self.reconnect_tx.clone();
tokio::spawn(async move {
const MAX_ATTEMPTS: u32 = 5;
for attempt in 1..=MAX_ATTEMPTS {
let delay = Duration::from_secs(5 * attempt as u64);
let task = tokio::spawn(async move {
let mut attempt: u32 = 0;
loop {
attempt = attempt.saturating_add(1);
let delay = Duration::from_secs((5 * u64::from(attempt)).min(30));
log::info!(
target: "launcher",
"Presence: reconnect attempt {}/{} in {:?}…",
"Presence: reconnect attempt {} in {:?}…",
attempt,
MAX_ATTEMPTS,
delay
);
tokio::time::sleep(delay).await;
if let Some(client) = try_connect_once().await {
let _ = tx.send(ReconnectResult::Connected(Box::new(client))).await;
let _ = tx.send(Box::new(client)).await;
return;
}
}
let _ = tx.send(ReconnectResult::Failed).await;
});
self.reconnect_task = Some(task);
}
}
@@ -302,45 +303,27 @@ pub async fn has_presence() -> bool {
#[allow(clippy::too_many_arguments)]
pub fn update_activity(
state: Option<&str>,
details: Option<&str>,
large_image_key: Option<&str>,
large_image_text: Option<&str>,
small_image_key: Option<Option<String>>,
small_image_text: Option<Option<String>>,
button1: Option<Option<PresenceButton>>,
button2: Option<Option<PresenceButton>>,
show_timestamp: Option<bool>,
state: &str,
details: &str,
large_image_key: &str,
large_image_text: &str,
small_image_key: Option<String>,
small_image_text: Option<String>,
button1: Option<PresenceButton>,
button2: Option<PresenceButton>,
show_timestamp: bool,
) {
let data = {
let mut guard = PRESENCE_DATA.lock().unwrap();
if let Some(s) = state {
guard.state = s.to_string();
}
if let Some(d) = details {
guard.details = d.to_string();
}
if let Some(img) = large_image_key {
guard.large_image_key = img.to_string();
}
if let Some(txt) = large_image_text {
guard.large_image_text = txt.to_string();
}
if let Some(key) = small_image_key {
guard.small_image_key = key;
}
if let Some(text) = small_image_text {
guard.small_image_text = text;
}
if let Some(b1) = button1 {
guard.dynamic_button = b1;
}
if let Some(b2) = button2 {
guard.secondary_button = b2;
}
if let Some(ts) = show_timestamp {
guard.show_timestamp = ts;
}
guard.state = state.to_string();
guard.details = details.to_string();
guard.large_image_key = large_image_key.to_string();
guard.large_image_text = large_image_text.to_string();
guard.small_image_key = small_image_key;
guard.small_image_text = small_image_text;
guard.dynamic_button = button1;
guard.secondary_button = button2;
guard.show_timestamp = show_timestamp;
guard.clone()
};
+48 -1
View File
@@ -162,7 +162,10 @@
-ms-user-select: none;
user-select: none;
}
html {
html,
body {
height: 100%;
overflow: hidden;
overscroll-behavior: none;
}
body {
@@ -174,6 +177,22 @@
}
}
.no-scrollbar {
-ms-overflow-style: none;
scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
display: none;
}
/* Pause continuous visual work while the launcher is hidden or in the background. */
main.app-inactive *,
main.app-inactive *::before,
main.app-inactive *::after {
animation-play-state: paused !important;
}
/* Suppress browser and WebKit native media controls and overlay play buttons on theme videos */
video::-webkit-media-controls,
video::-webkit-media-controls-enclosure,
@@ -190,3 +209,31 @@ video::-webkit-media-controls-overlay-enclosure {
width: 0 !important;
height: 0 !important;
}
/* Crossfade the rendered page when switching themes via the View Transitions API. */
::view-transition-old(root) {
animation: 320ms cubic-bezier(0.4, 0, 0.2, 1) both theme-crossfade-out;
}
::view-transition-new(root) {
animation: 320ms cubic-bezier(0.4, 0, 0.2, 1) both theme-crossfade-in;
}
@keyframes theme-crossfade-out {
to {
opacity: 0;
}
}
@keyframes theme-crossfade-in {
from {
opacity: 0;
}
}
@media (prefers-reduced-motion: reduce) {
::view-transition-old(root),
::view-transition-new(root) {
animation: none !important;
}
}
+8 -8
View File
@@ -154,9 +154,9 @@
<Terminal class="size-4" />
</div>
<div class="min-w-0">
<h2 id="log-viewer-title" class="text-sm font-semibold">Log bundles</h2>
<h2 id="log-viewer-title" class="text-sm font-semibold">Logs</h2>
<p class="truncate text-[10px] text-muted-foreground">
Launcher, osu! and patcher output, grouped by session
Current session plus archived launcher, osu! and patcher output
</p>
</div>
</div>
@@ -191,7 +191,7 @@
<div
class="flex shrink-0 items-center justify-between border-b border-theme-800 px-3 py-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
>
<span>Bundles</span>
<span>Sessions</span>
<span>{bundles.length}</span>
</div>
<div class="min-h-0 flex-1 overflow-y-auto p-1.5">
@@ -202,8 +202,8 @@
</div>
{:else if bundles.length === 0}
<div class="p-3 text-[11px] leading-relaxed text-muted-foreground">
No bundles yet. Logs are zipped on the next launcher restart or when a log reaches 5
MiB.
No logs yet. The current session appears once the launcher writes its first line;
archived bundles are created when logs rotate.
</div>
{:else}
{#each bundles as bundle (bundle.path)}
@@ -291,14 +291,14 @@
class="flex h-full items-center justify-center gap-2 text-xs text-muted-foreground"
>
<LoaderCircle class="size-4 animate-spin" />
Reading bundle…
Reading logs…
</div>
{:else if !selectedBundle}
<div
class="flex h-full flex-col items-center justify-center gap-2 text-center text-muted-foreground"
>
<Terminal class="size-8 opacity-40" />
<p class="text-xs">Choose a log bundle to inspect it.</p>
<p class="text-xs">Choose a log session to inspect it.</p>
</div>
{:else if filteredLines.length === 0}
<div
@@ -328,7 +328,7 @@
<span>
{selectedBundle
? `${selectedBundle.name} · ${formatBytes(selectedBundle.size)}`
: 'No bundle selected'}
: 'No session selected'}
</span>
</footer>
</main>
@@ -12,13 +12,11 @@
DISCORD_PRESENCE_PRESETS,
interpolatePresenceString,
loadDiscordPresenceConfig,
pushIdlePresenceFromConfig,
saveDiscordPresenceConfig,
type DiscordPresenceConfig,
type PresenceVariableContext,
} from '$lib/discordPresenceConfig';
import { discordPresence, launcherVersion } from '$lib/global';
import * as presence from '$lib/presence';
import { currentUser } from '$lib/userAuthentication';
import {
Check,
@@ -206,10 +204,14 @@
user?: Parameters<typeof currentUser.set>[0];
info?: Parameters<typeof currentUserInfo.set>[0];
launcherVersion?: string;
discordPresence?: boolean;
}>('sync-theme-editor-global-data', (event) => {
if (event.payload?.user) currentUser.set(event.payload.user);
if (event.payload?.info) currentUserInfo.set(event.payload.info);
if (event.payload?.launcherVersion) launcherVersion.set(event.payload.launcherVersion);
if (typeof event.payload?.discordPresence === 'boolean') {
discordPresence.set(event.payload.discordPresence);
}
});
await emit('request-theme-editor-global-data');
} catch (err) {
@@ -469,18 +471,9 @@
try {
await saveDiscordPresenceConfig(workingConfig);
initialConfigJson = JSON.stringify(workingConfig);
if ($discordPresence && (await presence.isConnected())) {
await pushIdlePresenceFromConfig(
{
user: $currentUser,
version: $launcherVersion || undefined,
rank: simRank,
pp: simPp,
accuracy: simAccuracy,
},
workingConfig
);
}
// The main window owns the live player stats and its presence config
// store, so let it refresh and push the updated activity immediately.
await emit('discord-presence-config-saved');
sileo.success({ title: 'Discord Rich Presence Saved', description: 'Activity updated' });
await handleClose();
} catch (err) {
@@ -17,12 +17,38 @@
let container = $state<HTMLDivElement | undefined>(undefined);
let animation: AnimationItem | undefined;
let reducedMotion = false;
let windowActive = true;
function syncPlayback() {
if (!animation) return;
animation.loop = loop;
animation.setSpeed(speed);
if (autoplay && !reducedMotion && windowActive && document.visibilityState === 'visible') {
animation.play();
} else {
animation.pause();
}
}
onMount(() => {
if (!container || !src) return;
reducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
let cancelled = false;
const onBlur = () => {
windowActive = false;
syncPlayback();
};
const onFocus = () => {
windowActive = true;
syncPlayback();
};
const onVisibilityChange = () => syncPlayback();
window.addEventListener('blur', onBlur);
window.addEventListener('focus', onFocus);
document.addEventListener('visibilitychange', onVisibilityChange);
const start = (animationData?: unknown) => {
if (cancelled || !container) return;
try {
@@ -30,7 +56,8 @@
container,
renderer: 'svg',
loop,
autoplay: autoplay && !reducedMotion,
autoplay:
autoplay && !reducedMotion && windowActive && document.visibilityState === 'visible',
...(animationData ? { animationData } : { path: src }),
rendererSettings: { preserveAspectRatio: 'xMidYMid meet' },
});
@@ -52,15 +79,14 @@
return () => {
cancelled = true;
window.removeEventListener('blur', onBlur);
window.removeEventListener('focus', onFocus);
document.removeEventListener('visibilitychange', onVisibilityChange);
};
});
$effect(() => {
if (!animation) return;
animation.loop = loop;
animation.setSpeed(speed);
if (autoplay && !reducedMotion) animation.play();
else animation.pause();
syncPlayback();
});
onDestroy(() => {
@@ -48,6 +48,7 @@
opacity:{$reduceAnimations ? 0 : s.opacity};
animation-duration:{s.duration}s;
animation-delay:-{s.delay}s;
animation-play-state:{$reduceAnimations ? 'paused' : 'running'};
"
></div>
{/each}
@@ -34,6 +34,7 @@
let velocityAccumX = 0;
let velocityAccumY = 0;
let rotateSpringAnim: ReturnType<typeof animate> | null = null;
let scheduleCursorFrame = () => {};
let cursor: HTMLElement;
let cursorRotateWrapper: HTMLDivElement;
@@ -41,20 +42,15 @@
let cursorAdditive: HTMLImageElement;
function isInteractive(el: Element | null): boolean {
while (el) {
const tag = el.tagName.toLowerCase();
const role = el.getAttribute('role');
const computed = getComputedStyle(el);
if (!el) return false;
if (
['button', 'a', 'input', 'select', 'textarea', 'label', 'option'].includes(tag) ||
(role && ['button', 'link', 'checkbox', 'combobox', 'menuitem', 'option'].includes(role)) ||
computed.cursor === 'pointer'
el.closest(
'button, a, input, select, textarea, label, option, [role="button"], [role="link"], [role="checkbox"], [role="combobox"], [role="menuitem"], [role="option"]'
)
) {
return true;
}
el = el.parentElement;
}
return false;
return getComputedStyle(el).cursor === 'pointer';
}
function dampContinuously(current: number, target: number, halfLife: number, dt: number): number {
@@ -133,6 +129,7 @@
}
}
scheduleCursorFrame();
lastMouseX = targetX;
lastMouseY = targetY;
};
@@ -147,6 +144,7 @@
lastVelocityTime = performance.now();
isMouseDown = true;
scheduleCursorFrame();
if (rotateSpringAnim) {
rotateSpringAnim.pause();
@@ -213,12 +211,17 @@
document.addEventListener('mouseleave', handleMouseLeave);
document.addEventListener('mouseenter', handleMouseEnter);
let animationFrameId: number;
let animationFrameId: number | undefined;
let lastFrameTime = performance.now();
let paused = false;
const tick = (now: number) => {
animationFrameId = undefined;
if (paused) return;
const dt = Math.min(Math.max(now - lastFrameTime, 0), 64);
lastFrameTime = now;
let needsAnotherFrame = false;
if (hasMoved && cursor) {
if (!smoothCursor) {
@@ -229,6 +232,8 @@
const halfLife = $cursorSmoothness > 50 ? 14 : Math.max(1, $cursorSmoothness || 14);
currentX = dampContinuously(currentX, targetX, halfLife, dt);
currentY = dampContinuously(currentY, targetY, halfLife, dt);
needsAnotherFrame =
Math.abs(targetX - currentX) >= 0.05 || Math.abs(targetY - currentY) >= 0.05;
}
if (Math.abs(targetX - currentX) < 0.05) currentX = targetX;
@@ -244,19 +249,62 @@
const rotFactor = 1 - Math.pow(0.5, dt / 25);
currentDegrees += (targetDegrees - currentDegrees) * rotFactor;
cursorRotateWrapper.style.transform = `rotate(${currentDegrees}deg)`;
needsAnotherFrame = true;
}
}
if (needsAnotherFrame) {
animationFrameId = requestAnimationFrame(tick);
}
};
scheduleCursorFrame = () => {
if (paused || animationFrameId !== undefined) return;
lastFrameTime = performance.now();
animationFrameId = requestAnimationFrame(tick);
};
animationFrameId = requestAnimationFrame(tick);
const suspendCursor = () => {
paused = true;
if (animationFrameId !== undefined) {
cancelAnimationFrame(animationFrameId);
animationFrameId = undefined;
}
if (cursor) cursor.style.opacity = '0';
};
const resumeCursor = () => {
if (!paused) return;
paused = false;
lastFrameTime = performance.now();
if (!hasMoved) return;
if (cursor) cursor.style.opacity = '1';
scheduleCursorFrame();
};
const onVisibilityChange = () => {
if (document.visibilityState === 'hidden') suspendCursor();
else if (document.hasFocus()) resumeCursor();
};
const onWindowBlur = () => suspendCursor();
const onWindowFocus = () => {
if (document.visibilityState !== 'hidden') resumeCursor();
};
document.addEventListener('visibilitychange', onVisibilityChange);
window.addEventListener('blur', onWindowBlur);
window.addEventListener('focus', onWindowFocus);
onVisibilityChange();
return () => {
document.documentElement.classList.remove('hiddenCursor');
document.removeEventListener('mouseleave', handleMouseLeave);
document.removeEventListener('mouseenter', handleMouseEnter);
cancelAnimationFrame(animationFrameId);
document.removeEventListener('visibilitychange', onVisibilityChange);
window.removeEventListener('blur', onWindowBlur);
window.removeEventListener('focus', onWindowFocus);
scheduleCursorFrame = () => {};
suspendCursor();
if (rotateSpringAnim) {
rotateSpringAnim.pause();
}
+42 -3
View File
@@ -16,6 +16,34 @@
const iconSet = $derived($active_custom_theme?.definition?.iconSet ?? DEFAULT_THEME_ICON_SET);
let volumeOpen = $state(false);
let volumeDragging = $state(false);
let volumeControl: HTMLDivElement | undefined = $state();
function openVolume() {
volumeOpen = true;
}
function closeVolume() {
if (!volumeDragging) volumeOpen = false;
}
function startVolumeDrag(event: PointerEvent) {
if (event.button !== 0) return;
volumeDragging = true;
volumeOpen = true;
}
function endVolumeDrag(event: PointerEvent) {
if (!volumeDragging) return;
volumeDragging = false;
const element = document.elementFromPoint(event.clientX, event.clientY);
if (!element || !volumeControl?.contains(element)) {
volumeOpen = false;
}
}
onMount(() => {
const appWindow = getCurrentWindow();
@@ -26,9 +54,18 @@
});
</script>
<svelte:window onpointerup={endVolumeDrag} onpointercancel={endVolumeDrag} />
<div data-tauri-drag-region class="titlebar z-[100]" class:macos-window={$platform === 'macos'}>
{#if $custom_theme_audio_playing || ($active_custom_theme && $active_custom_theme.name !== 'Default')}
<div class="relative flex items-center justify-center group">
<div
class="relative flex items-center justify-center group"
role="group"
aria-label="Theme volume"
bind:this={volumeControl}
onpointerenter={openVolume}
onpointerleave={closeVolume}
>
<div class="relative flex items-center justify-center p-1 cursor-pointer">
<div
class="absolute inset-0 bg-background rounded
@@ -51,8 +88,9 @@
<div
class="absolute top-full right-0 translate-x-[7px]
opacity-0 invisible pointer-events-none -translate-y-2
group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto group-hover:translate-y-0
{volumeOpen
? 'opacity-100 visible pointer-events-auto translate-y-0'
: 'opacity-0 invisible pointer-events-none -translate-y-2'}
{$reduceAnimations ? '' : 'transition-all duration-200 ease-out'}
z-50"
>
@@ -68,6 +106,7 @@
max="1"
step="0.01"
bind:value={$custom_theme_volume}
onpointerdown={startVolumeDrag}
oninput={() => {
config.value<number>('volume').set($custom_theme_volume);
}}
+4
View File
@@ -247,6 +247,8 @@ export type IdlePresenceParams = {
rank?: number | string;
pp?: number | string;
accuracy?: number | string;
mode?: string;
action?: string;
};
export type PlayingPresenceParams = {
@@ -282,6 +284,8 @@ export const pushIdlePresenceFromConfig = async (
rank: params?.rank,
pp: params?.pp,
accuracy: params?.accuracy,
mode: params?.mode,
action: params?.action ?? 'In Launcher',
version: params?.version,
profileUrl: params?.user?.id ? `https://ez-pp.farm/u/${params.user.id}` : 'https://ez-pp.farm',
};
+9 -9
View File
@@ -6,15 +6,15 @@ export type PresenceButtonPayload = {
};
export type PresenceActivityPayload = {
state?: string;
details?: string;
largeImageKey?: string;
largeImageText?: string;
smallImageKey?: string | null;
smallImageText?: string | null;
button1?: PresenceButtonPayload | null;
button2?: PresenceButtonPayload | null;
showTimestamp?: boolean;
state: string;
details: string;
largeImageKey: string;
largeImageText: string;
smallImageKey: string | null;
smallImageText: string | null;
button1: PresenceButtonPayload | null;
button2: PresenceButtonPayload | null;
showTimestamp: boolean;
};
export const connect = async () => await invoke('presence_connect');
+18 -2
View File
@@ -953,12 +953,27 @@ export async function reviewCommunityTheme(
export async function downloadAndInstallCommunityTheme(
theme: CommunityTheme,
onProgress?: (status: string, percentage: number) => void,
options?: { folderName?: string }
options?: { folderName?: string; skipDownloadCount?: boolean }
): Promise<{ success: boolean; folderName: string }> {
const { onProgress: reportProgress = () => {} } = { onProgress };
const baseThemesDir = await themesDirectory();
const folderName = options?.folderName?.trim() || theme.id;
const targetFolder = await path.join(baseThemesDir, folderName);
const skipDownloadCount = options?.skipDownloadCount === true;
const downloadUrl = skipDownloadCount
? (() => {
const url = new URL(theme.downloadUrl);
url.searchParams.set('skipDownloadCount', '1');
return url.toString();
})()
: theme.downloadUrl;
let requestHeaders: Record<string, string> | undefined;
if (skipDownloadCount) {
requestHeaders = await getAuthHeaders();
if (!requestHeaders['X-Username'] || !requestHeaders['X-Password']) {
throw new Error('Please log in again before reverting this theme.');
}
}
reportProgress('Downloading theme package...', 10);
@@ -987,9 +1002,10 @@ export async function downloadAndInstallCommunityTheme(
try {
try {
await invoke('download_and_extract_community_theme', {
downloadUrl: theme.downloadUrl,
downloadUrl,
themeFolder: targetFolder,
themeName: theme.name,
...(requestHeaders ? { requestHeaders } : {}),
});
} catch (err) {
// Fallback for legacy themes directly to git repo
+19 -4
View File
@@ -532,12 +532,13 @@ export function themeMediaSuspension(node: HTMLElement) {
/**
* Manage background video playback across document visibility changes.
* Videos continue playing when the launcher window loses focus. Muted background
* videos pause only when the document is hidden/minimized to save GPU decoding
* cycles without interrupting theme music or audio.
* Muted background videos pause when the document is hidden/minimized or the
* launcher loses focus, which saves GPU decoding cycles behind a running game
* without interrupting unmuted theme music or audio.
*/
export function themeVideoLifecycle(node: HTMLVideoElement) {
let pausedByLifecycle = false;
let focused = true;
const pause = () => {
if (node.paused) return;
@@ -551,12 +552,22 @@ export function themeVideoLifecycle(node: HTMLVideoElement) {
playThemeMedia(node);
};
const onBlur = () => {
focused = false;
sync();
};
const onFocus = () => {
focused = true;
sync();
};
const sync = () => {
if (!node.isConnected) {
document.removeEventListener('visibilitychange', sync);
window.removeEventListener('blur', onBlur);
window.removeEventListener('focus', onFocus);
return;
}
if (document.visibilityState === 'visible') {
if (document.visibilityState === 'visible' && focused) {
resume();
} else if (node.muted || node.volume === 0) {
pause();
@@ -564,11 +575,15 @@ export function themeVideoLifecycle(node: HTMLVideoElement) {
};
document.addEventListener('visibilitychange', sync);
window.addEventListener('blur', onBlur);
window.addEventListener('focus', onFocus);
sync();
return {
destroy() {
document.removeEventListener('visibilitychange', sync);
window.removeEventListener('blur', onBlur);
window.removeEventListener('focus', onFocus);
},
};
}
+35 -1
View File
@@ -7,6 +7,7 @@ import { convertFileSrc, invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';
import * as path from '@tauri-apps/api/path';
import * as fs from '@tauri-apps/plugin-fs';
import { tick } from 'svelte';
export type Theme = {
folder_name: string;
@@ -486,7 +487,18 @@ export const downloadTheme = async (
return { success: true };
};
export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volume = 0.15) => {
type LoadThemeOptions = {
/** Crossfade the rendered page when switching themes. */
animate?: boolean;
};
export const loadTheme = async (
theme: Theme,
themeContainer: HTMLElement,
volume = 0.15,
options: LoadThemeOptions = {}
) => {
const applyTheme = async () => {
// Theme media is buffered as blob URLs; the previous theme's URLs are no
// longer needed once it is replaced.
clearThemeMediaCache();
@@ -516,6 +528,28 @@ export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volum
void invoke('unlock_media_autoplay').catch(() => {});
};
const canAnimate =
options.animate &&
typeof document !== 'undefined' &&
typeof document.startViewTransition === 'function';
if (!canAnimate) {
await applyTheme();
return;
}
const transition = document.startViewTransition(async () => {
await applyTheme();
// Let Svelte paint the new theme before the transition takes its snapshot.
await tick();
});
// Theme activation must not wait for, or fail because of, the visual
// transition. `finished` can reject when a transition is skipped.
void transition.finished.catch(() => {});
await transition.updateCallbackDone;
};
export const deleteTheme = async (themeToUninstall: Theme) => {
if (themeToUninstall.status !== 'installed') {
return false;
+1 -1
View File
@@ -133,7 +133,7 @@ export const urlIsValidImage = async (url: string) => {
const request = await fetch(url);
if (!request.ok) return false;
const contentType = request.headers.get('content-type');
return contentType?.startsWith('image/');
return contentType?.startsWith('image/') === true;
} catch {
return false;
}
+35
View File
@@ -45,6 +45,7 @@
} from '$lib/theme/themeMedia';
import { themeParallax } from '$lib/theme/themeParallax';
import { isThemeTrusted } from '$lib/theme/themeTrust';
import { themeV2Css } from '$lib/theme/themeV2';
import { getThemes, loadTheme } from '$lib/theme/themes';
import { currentUser } from '$lib/userAuthentication';
import {
@@ -70,6 +71,37 @@
let { children } = $props();
function appActivity(node: HTMLElement) {
let focused = true;
const sync = () => {
node.classList.toggle('app-inactive', document.hidden || !focused);
};
const onBlur = () => {
focused = false;
sync();
};
const onFocus = () => {
focused = true;
sync();
};
const onVisibilityChange = () => sync();
window.addEventListener('blur', onBlur);
window.addEventListener('focus', onFocus);
document.addEventListener('visibilitychange', onVisibilityChange);
sync();
return {
destroy() {
window.removeEventListener('blur', onBlur);
window.removeEventListener('focus', onFocus);
document.removeEventListener('visibilitychange', onVisibilityChange);
node.classList.remove('app-inactive');
},
};
}
let unlistenEditorState: (() => void) | undefined;
let unlistenRequestEditorData: (() => void) | undefined;
let unlistenPresenceEditorState: (() => void) | undefined;
@@ -216,6 +248,7 @@
osuStream: get(osuStream),
serverPing: get(serverPing),
launcherVersion: get(launcherVersion),
discordPresence: get(discordPresence),
});
} catch {}
};
@@ -551,6 +584,8 @@
</AlertDialog.Root>
<main
class="relative h-screen w-full overflow-hidden"
use:appActivity
use:themeMediaSuspension
use:themeParallax={{
enabled: $active_custom_theme?.definition?.parallax?.enabled === true,
+258 -47
View File
@@ -21,6 +21,7 @@
import { config } from '$lib/config';
import { currentUserInfo } from '$lib/data';
import {
discordPresenceCustomConfig,
loadDiscordPresenceConfig,
pushIdlePresenceFromConfig,
pushPlayingPresenceFromConfig,
@@ -90,7 +91,6 @@
startOpenTabletDriver,
stopOpenTabletDriver,
} from '$lib/osuUtil';
import * as presence from '$lib/presence';
import {
downloadAndInstallCommunityTheme,
fetchCommunityThemeDetails,
@@ -297,6 +297,10 @@
let activeThemesTab = $state<'library' | 'workshop'>('library');
let themeSavedUnlisten: (() => void) | undefined;
let themePublishedUnlisten: (() => void) | undefined;
let presenceConfigUnlisten: (() => void) | undefined;
let presenceConfigReady = $state(false);
let idlePresenceTimer: ReturnType<typeof setTimeout> | undefined;
let lastIdlePresenceSignature = '';
let refreshingThemes = $state(false);
let reloadingActiveTheme = $state(false);
let revealedNsfw = $state<string[]>([]);
@@ -313,6 +317,9 @@
};
let restoreCandidate = $state<{ theme: Theme; backup: ThemeBackup } | undefined>(undefined);
let restoringTheme = $state(false);
let uninstallCandidate = $state<Theme | undefined>(undefined);
let uninstallingTheme = $state(false);
let revertCandidate = $state<Theme | undefined>(undefined);
let installedReportOpen = $state(false);
let installedReportTarget = $state<CommunityTheme | null>(null);
let installedReportLoading = $state(false);
@@ -523,11 +530,16 @@
return;
}
loadTheme(theme, $custom_theme_container, $custom_theme_volume);
await loadTheme(theme, $custom_theme_container, $custom_theme_volume, {
animate: !$reduceAnimations,
});
await config.value<string>('theme').set(theme.name);
};
const uninstallInstalledTheme = async (theme: Theme) => {
if (uninstallingTheme) return false;
uninstallingTheme = true;
try {
const deleteResult = await deleteTheme(theme);
if (deleteResult) {
@@ -535,18 +547,36 @@
title: 'Theme uninstalled',
description: `"${theme.name}" was removed from your library.`,
});
} else {
return true;
}
sileo.error({
title: 'Could not uninstall theme',
description: 'The theme files could not be removed.',
});
}
return false;
} catch (err) {
console.error(err);
sileo.error({
title: 'Could not uninstall theme',
description: err instanceof Error ? err.message : String(err),
});
return false;
} finally {
uninstallingTheme = false;
}
};
const requestThemeUninstall = (theme: Theme) => {
if (theme.status !== 'installed' || theme.name === 'Default' || uninstallingTheme) return;
uninstallCandidate = theme;
};
const confirmThemeUninstall = async () => {
const theme = uninstallCandidate;
if (!theme) return;
if (await uninstallInstalledTheme(theme)) {
uninstallCandidate = undefined;
}
};
@@ -745,8 +775,8 @@
}
};
const updateInstalledTheme = async (theme: Theme) => {
if (theme.status !== 'installed' || updatingThemeFolder) return;
const updateInstalledTheme = async (theme: Theme, mode: 'update' | 'revert' = 'update') => {
if (theme.status !== 'installed' || updatingThemeFolder) return false;
const wasActive = $active_custom_theme?.folder_name === theme.folder_name;
updatingThemeFolder = theme.folder_name;
@@ -762,12 +792,19 @@
try {
backup = await invoke<string>('backup_theme_folder', { themeFolder });
} catch (error) {
if (mode === 'revert') {
throw new Error(
'Could not back up the current theme before reverting. Your local changes were left untouched.',
{ cause: error }
);
}
console.warn('Could not back up the theme before updating it', error);
}
try {
await downloadAndInstallCommunityTheme(target, () => {}, {
folderName: theme.folder_name,
skipDownloadCount: mode === 'revert',
});
} catch (error) {
if (backup) {
@@ -797,21 +834,40 @@
themeContentHashCache.delete(theme.folder_name);
communityThemeCache.delete(theme.folder_name);
await refreshThemeSyncState(theme.folder_name);
sileo.success({
title: 'Yaay!',
description: 'Theme updated successfully!',
title: mode === 'revert' ? 'Theme reverted' : 'Yaay!',
description:
mode === 'revert'
? `"${theme.name}" was restored to the published Workshop version.`
: 'Theme updated successfully!',
});
return true;
} catch (error) {
console.error(error);
sileo.error({
title: 'Could not update theme',
title: mode === 'revert' ? 'Could not revert theme' : 'Could not update theme',
description: error instanceof Error ? error.message : String(error),
});
return false;
} finally {
updatingThemeFolder = undefined;
}
};
const requestThemeRevert = (theme: Theme) => {
if (theme.status !== 'installed' || !theme.workshopId || updatingThemeFolder) return;
revertCandidate = theme;
};
const confirmThemeRevert = async () => {
const theme = revertCandidate;
if (!theme) return;
if (await updateInstalledTheme(theme, 'revert')) {
revertCandidate = undefined;
}
};
$effect(() => {
const userId = $currentUser?.id;
const themeCount = $custom_themes.length;
@@ -1073,6 +1129,46 @@
};
const currentStats = $derived($currentUserInfo?.stats?.[selectedGamemode]);
const currentPresenceContext = () => ({
rank: currentStats?.rank,
pp: currentStats?.pp,
accuracy: currentStats ? `${currentStats.acc.toFixed(2)}%` : undefined,
mode: getGamemodeName(modeIntToStr(selectedMode), typeIntToStr(selectedType)),
action: 'In Launcher',
});
$effect(() => {
if (!$discordPresence || !presenceConfigReady || $launching) {
lastIdlePresenceSignature = '';
return;
}
const user = $currentUser;
const version = $launcherVersion || undefined;
const context = currentPresenceContext();
const cfg = $discordPresenceCustomConfig;
const signature = JSON.stringify({
userId: user?.id,
username: user?.name,
version,
context,
config: cfg,
});
if (signature === lastIdlePresenceSignature) return;
idlePresenceTimer = setTimeout(() => {
idlePresenceTimer = undefined;
lastIdlePresenceSignature = signature;
void pushIdlePresenceFromConfig({ user, version, ...context }, cfg);
}, 100);
return () => {
if (idlePresenceTimer !== undefined) {
clearTimeout(idlePresenceTimer);
idlePresenceTimer = undefined;
}
};
});
let recentActivityIndex = $state(0);
const userEvents = $derived($currentUserInfo?.events ?? []);
const safeEventIndex = $derived(
@@ -1530,10 +1626,9 @@
await getCurrentWindow().hide();
let presenceUpdater: number | undefined = undefined;
const beatmapCoverValidity = new SvelteMap<string, boolean>();
const isPresenceConnected = await presence.isConnected();
if ($discordPresence && isPresenceConnected) {
if ($discordPresence) {
let osuDetected = false;
presenceUpdater = window.setInterval(async () => {
if (!osuDetected) {
@@ -1542,8 +1637,10 @@
return;
}
if ($currentUser) {
const userStats = await ezppfarm.getUserInfo($currentUser.id, 'stats');
const userStatus = await ezppfarm.getUserStatus($currentUser.id);
const [userStats, userStatus] = await Promise.all([
ezppfarm.getUserInfo($currentUser.id, 'stats'),
ezppfarm.getUserStatus($currentUser.id),
]);
if (userStatus?.player_status.online) {
let actionName = 'Idle...';
const gamemode = getModeAndTypeFromGamemode(userStatus.player_status.status.mode);
@@ -1598,7 +1695,15 @@
if (beatmap !== null) {
beatmapString = `${beatmap.artist} - ${beatmap.title} [${beatmap.version}]`;
const coverCandidate = `https://assets.ppy.sh/beatmaps/${beatmap.set_id}/covers/[email protected]`;
const isValidImage = await urlIsValidImage(coverCandidate);
const cachedCoverValidity = beatmapCoverValidity.get(coverCandidate);
let isValidImage: boolean;
if (cachedCoverValidity === undefined) {
isValidImage = await urlIsValidImage(coverCandidate);
if (beatmapCoverValidity.size >= 32) beatmapCoverValidity.clear();
beatmapCoverValidity.set(coverCandidate, isValidImage);
} else {
isValidImage = cachedCoverValidity;
}
if (isValidImage) beatmapCoverImage = coverCandidate;
}
@@ -1628,7 +1733,7 @@
}
}
}
}, 1000 * 2);
}, 5000);
}
await runOsu(osuPath, $patch, $gameOptimization);
@@ -1646,14 +1751,6 @@
fadeGlobalVolume(0, $custom_theme_volume, 1500);
if (presenceUpdater) {
window.clearInterval(presenceUpdater);
try {
await pushIdlePresenceFromConfig({
user: $currentUser,
version: $launcherVersion || undefined,
});
} catch (err) {
console.log(err);
}
}
await new Promise((res) => setTimeout(res, 1000));
/* await replaceUIFiles(osuPath, true); */
@@ -1946,18 +2043,14 @@
}
})();
loadDiscordPresenceConfig().then((cfg) => {
if ($discordPresence) {
pushIdlePresenceFromConfig(
{
user: $currentUser,
version: $launcherVersion || undefined,
},
cfg
).catch(() => {});
}
loadDiscordPresenceConfig().then(() => {
presenceConfigReady = true;
});
listen('discord-presence-config-saved', async () => {
await loadDiscordPresenceConfig();
}).then((unlisten) => (presenceConfigUnlisten = unlisten));
animate(ezppLogo, {
opacity: [0, 1],
scale: [0.95, 1],
@@ -2012,6 +2105,7 @@
window.clearInterval(animateInterval);
themeSavedUnlisten?.();
themePublishedUnlisten?.();
presenceConfigUnlisten?.();
stopThemeScript();
};
});
@@ -2404,6 +2498,110 @@
</AlertDialog.Content>
</AlertDialog.Root>
<AlertDialog.Root
open={uninstallCandidate !== undefined}
onOpenChange={(open) => {
if (!open && !uninstallingTheme) uninstallCandidate = undefined;
}}
>
<AlertDialog.Content class="max-w-md border-theme-800 bg-theme-950 text-white">
<AlertDialog.Header>
<AlertDialog.Title class="flex items-center gap-2 text-base">
<ThemeIcon name="trash" set={iconSet} class="size-4 text-red-400" />
Uninstall theme?
</AlertDialog.Title>
<AlertDialog.Description class="text-[11px] leading-relaxed text-muted-foreground">
Remove <span class="font-medium text-theme-100">{uninstallCandidate?.name}</span> from your library?
This deletes the local theme files from this computer.
</AlertDialog.Description>
</AlertDialog.Header>
{#if uninstallCandidate && uninstallCandidate.workshopId && isOwnInstalledTheme(uninstallCandidate)}
<p
class="flex items-start gap-2 rounded-md border border-theme-800 bg-theme-900/50 p-2.5 text-[11px] leading-relaxed text-muted-foreground"
>
<Globe class="mt-0.5 size-3.5 shrink-0 text-cyan-300" />
<span>
Your published Workshop copy stays online. Only this local copy and any unpublished
changes are removed.
</span>
</p>
{/if}
<AlertDialog.Footer class="gap-2">
<Button
variant="ghost"
size="sm"
disabled={uninstallingTheme}
onclick={() => (uninstallCandidate = undefined)}
>
Cancel
</Button>
<Button
variant="destructive"
size="sm"
class="gap-1.5"
disabled={uninstallingTheme}
onclick={confirmThemeUninstall}
>
{#if uninstallingTheme}
<ThemeIcon name="loader" set={iconSet} class="size-3.5 animate-spin" />
Uninstalling...
{:else}
<ThemeIcon name="trash" set={iconSet} class="size-3.5" />
Uninstall theme
{/if}
</Button>
</AlertDialog.Footer>
</AlertDialog.Content>
</AlertDialog.Root>
<AlertDialog.Root
open={revertCandidate !== undefined}
onOpenChange={(open) => {
if (!open && updatingThemeFolder !== revertCandidate?.folder_name) revertCandidate = undefined;
}}
>
<AlertDialog.Content class="max-w-md border-theme-800 bg-theme-950 text-white">
<AlertDialog.Header>
<AlertDialog.Title class="flex items-center gap-2 text-base">
<ThemeIcon name="rotate" set={iconSet} class="size-4 text-amber-300" />
Revert unsynced changes?
</AlertDialog.Title>
<AlertDialog.Description class="text-[11px] leading-relaxed text-muted-foreground">
Replace the local files for <span class="font-medium text-theme-100"
>{revertCandidate?.name}</span
> with the published Workshop version? Any unpublished changes will be removed. A backup of the
current local copy will be created first.
</AlertDialog.Description>
</AlertDialog.Header>
<AlertDialog.Footer class="gap-2">
<Button
variant="ghost"
size="sm"
disabled={updatingThemeFolder === revertCandidate?.folder_name}
onclick={() => (revertCandidate = undefined)}
>
Cancel
</Button>
<Button
size="sm"
class="gap-1.5"
disabled={updatingThemeFolder === revertCandidate?.folder_name}
onclick={confirmThemeRevert}
>
{#if updatingThemeFolder === revertCandidate?.folder_name}
<ThemeIcon name="loader" set={iconSet} class="size-3.5 animate-spin" />
Reverting...
{:else}
<ThemeIcon name="rotate" set={iconSet} class="size-3.5" />
Revert changes
{/if}
</Button>
</AlertDialog.Footer>
</AlertDialog.Content>
</AlertDialog.Root>
<AlertDialog.Root open={pendingExternalUrl !== undefined}>
<AlertDialog.Content
class="bg-theme-950 border-theme-800 p-0 max-w-xl"
@@ -3448,11 +3646,6 @@
<div class="min-w-0">
<div class="flex items-center gap-2">
<h1 class="text-lg font-semibold tracking-tight">Settings</h1>
{#if activeSettingsTab === 'logging'}
<Badge variant={$loggingEnabled ? 'secondary' : 'outline'} class="text-[9px]">
{$loggingEnabled ? 'Enabled' : 'Disabled'}
</Badge>
{/if}
</div>
<p class="mt-0.5 truncate text-[11px] text-muted-foreground">
{#if $reduceAnimations}
@@ -4225,10 +4418,10 @@
{/if}
</header>
<div class="relative min-h-0 flex-1 px-5 pt-4 pb-1">
<div class="relative min-h-0 flex-1">
{#if activeThemesTab === 'workshop'}
<div
class="absolute inset-0"
class="absolute inset-0 px-5 pt-4 pb-1"
in:fly={{ duration: $reduceAnimations ? 0 : 240, y: 8, opacity: 0 }}
out:fade={{ duration: $reduceAnimations ? 0 : 160 }}
>
@@ -4249,7 +4442,7 @@
</div>
{:else}
<div
class="absolute inset-0"
class="absolute inset-0 px-5 pt-4 pb-1"
in:fly={{ duration: $reduceAnimations ? 0 : 240, y: 8, opacity: 0 }}
out:fade={{ duration: $reduceAnimations ? 0 : 160 }}
>
@@ -4275,6 +4468,10 @@
workshopVersion !== localVersion}
{@const isNotSynced =
isOwnTheme && (theme.isNotSynced === true || versionMismatch)}
{@const canRevertTheme =
isNotSynced &&
theme.status === 'installed' &&
Boolean(theme.workshopId)}
{@const canReportTheme =
Boolean($currentUser && ownedWorkshopLoaded) &&
!isOwnTheme &&
@@ -4289,6 +4486,7 @@
canEditTheme ||
canRestoreTheme ||
canUpdateTheme ||
canRevertTheme ||
canReportTheme ||
canUninstallTheme}
<div
@@ -4346,9 +4544,6 @@
<div
class="absolute top-1.5 left-1.5 flex max-w-[calc(100%-4.5rem)] flex-wrap items-center gap-1"
>
{#if isActive}
<Badge class="text-[9px]">In use</Badge>
{/if}
{#if theme.name !== 'Default' && theme.folder_name !== 'default' && theme.apiVersion}
<Badge
variant="secondary"
@@ -4565,7 +4760,7 @@
Restore previous version
</DropdownMenu.Item>
{/if}
{#if canUpdateTheme}
{#if canUpdateTheme && !canRevertTheme}
<DropdownMenu.Item
class="gap-2 text-[11px]"
disabled={updatingThemeFolder === theme.folder_name}
@@ -4579,6 +4774,20 @@
Update theme
</DropdownMenu.Item>
{/if}
{#if canRevertTheme}
<DropdownMenu.Item
class="gap-2 text-[11px] text-amber-200 data-[highlighted]:bg-amber-500/10 data-[highlighted]:text-amber-100"
disabled={updatingThemeFolder === theme.folder_name}
onclick={() => requestThemeRevert(theme)}
>
<ThemeIcon
name="rotate"
set={iconSet}
class="size-3.5"
/>
Revert unsynced changes
</DropdownMenu.Item>
{/if}
{#if canReportTheme}
<DropdownMenu.Item
class="gap-2 text-[11px]"
@@ -4590,11 +4799,13 @@
</DropdownMenu.Item>
{/if}
{#if canUninstallTheme}
{#if canEditTheme || canRestoreTheme || canUpdateTheme || canRevertTheme || canReportTheme}
<DropdownMenu.Separator class="my-1 bg-theme-800" />
{/if}
<DropdownMenu.Item
class="gap-2 text-[11px] text-red-300 data-[highlighted]:bg-red-500/15 data-[highlighted]:text-red-200"
disabled={theme.status !== 'installed'}
onclick={() => void uninstallInstalledTheme(theme)}
onclick={() => requestThemeUninstall(theme)}
>
{#if theme.status === 'deleting'}
<ThemeIcon