chore: update version to 3.2.7 and refactor skin handling functions

This commit is contained in:
2026-08-09 23:24:50 +02:00
parent 5a06700748
commit 01628e8514
10 changed files with 45 additions and 120 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "ezpplauncher", "name": "ezpplauncher",
"version": "3.2.6", "version": "3.2.7",
"description": "", "description": "",
"type": "module", "type": "module",
"scripts": { "scripts": {
+1 -1
View File
@@ -1239,7 +1239,7 @@ dependencies = [
[[package]] [[package]]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.5" version = "3.2.7"
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.5" version = "3.2.7"
description = "EZPPLauncher redefined." description = "EZPPLauncher redefined."
authors = ["HorizonCode"] authors = ["HorizonCode"]
edition = "2024" edition = "2024"
+12 -78
View File
@@ -186,75 +186,6 @@ pub async fn get_beatmapsets_count(folder: String) -> Option<u64> {
Some(beatmap_sets as u64) Some(beatmap_sets as u64)
} }
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SkinInfo {
pub name: String,
pub author: Option<String>,
pub modified: u64,
}
#[tauri::command]
pub async fn get_skins(folder: String) -> Option<Vec<SkinInfo>> {
use std::path::PathBuf;
use std::time::UNIX_EPOCH;
use tokio::fs;
let skins_folder = PathBuf::from(folder).join("Skins");
if !skins_folder.exists() {
return None;
}
let mut entries = fs::read_dir(skins_folder).await.ok()?;
let mut skins = Vec::new();
while let Some(entry) = entries.next_entry().await.ok()? {
if !entry.file_type().await.ok()?.is_dir() {
continue;
}
let dir_path = entry.path();
let skin_ini = dir_path.join("skin.ini");
if !skin_ini.exists() {
continue;
}
let name = entry.file_name().to_string_lossy().to_string();
let author = fs::read_to_string(&skin_ini)
.await
.ok()
.and_then(|content| {
content.lines().find_map(|line| {
let (key, value) = line.split_once(':')?;
key.trim()
.eq_ignore_ascii_case("Author")
.then(|| value.trim().to_string())
})
});
let modified = entry
.metadata()
.await
.ok()
.and_then(|m| m.modified().ok())
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
.map(|d| d.as_secs())
.unwrap_or(0);
skins.push(SkinInfo {
name,
author,
modified,
});
}
Some(skins)
}
#[tauri::command] #[tauri::command]
pub async fn get_skins_count(folder: String) -> Option<u64> { pub async fn get_skins_count(folder: String) -> Option<u64> {
let path = PathBuf::from(folder); let path = PathBuf::from(folder);
@@ -267,20 +198,23 @@ pub async fn get_skins_count(folder: String) -> Option<u64> {
let mut count = 0; let mut count = 0;
if let Ok(mut entries) = fs::read_dir(skins_folder).await { if let Ok(mut entries) = fs::read_dir(skins_folder).await {
while let Ok(Some(entry)) = entries.next_entry().await { while let Ok(Some(entry)) = entries.next_entry().await {
if entry.file_type().await.map_or(false, |ft| ft.is_dir()) { if let Ok(ft) = entry.file_type().await {
let dir_path = entry.path(); if ft.is_dir() {
if let Ok(mut files) = fs::read_dir(&dir_path).await { let dir_path = entry.path();
while let Ok(Some(file)) = files.next_entry().await { let has_ini = tokio::fs::try_exists(dir_path.join("skin.ini"))
if file.path().extension().map_or(false, |ext| ext == "ini") { .await
count += 1; .unwrap_or(false)
break; || tokio::fs::try_exists(dir_path.join("Skin.ini"))
} .await
.unwrap_or(false);
if has_ini {
count += 1;
} }
} }
} }
} }
} }
return Some(count); Some(count)
} }
#[tauri::command] #[tauri::command]
+7 -8
View File
@@ -18,13 +18,13 @@ use crate::{
download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme, download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme,
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid, find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform, get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl, get_skins_count, has_net8, has_osuwinello, has_wmctrl, install_ezpp_launcher_update,
install_ezpp_launcher_update, is_open_tablet_driver_path_valid, is_open_tablet_driver_path_valid, is_open_tablet_driver_running, is_osu_running,
is_open_tablet_driver_running, is_osu_running, open_url_in_browser, opened_urls, open_url_in_browser, opened_urls, presence_connect, presence_disconnect,
presence_connect, presence_disconnect, presence_is_connected, presence_update_button, presence_is_connected, presence_update_button, presence_update_status,
presence_update_status, presence_update_user, read_theme_info, replace_ui_files, presence_update_user, read_theme_info, replace_ui_files, run_open_tablet_driver, run_osu,
run_open_tablet_driver, run_osu, run_osu_updater, set_osu_config_values, run_osu_updater, set_osu_config_values, set_osu_user_config_values,
set_osu_user_config_values, stop_open_tablet_driver, valid_osu_folder, stop_open_tablet_driver, valid_osu_folder,
}, },
state::AppState, state::AppState,
}; };
@@ -107,7 +107,6 @@ pub fn run() {
find_osu_installation, find_osu_installation,
valid_osu_folder, valid_osu_folder,
get_beatmapsets_count, get_beatmapsets_count,
get_skins,
get_skins_count, get_skins_count,
get_osu_version, get_osu_version,
get_osu_release_stream, get_osu_release_stream,
+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.5", "version": "3.2.7",
"identifier": "farm.EZPPFarm.Launcher", "identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher", "mainBinaryName": "ezpplauncher",
"build": { "build": {
+2 -5
View File
@@ -141,11 +141,8 @@ export const downloadUpdate = async (
} }
}; };
export const installUpdate = async () => await invoke('install_ezpp_launcher_update'); export const installUpdate = async () => await invoke('install_ezpp_launcher_update');
export const getSkins = async (folder: string) => export const getSkinsCount = async (folder: string) =>
await invoke<{ name: string; author: string | undefined; modified: number }[] | undefined>( await invoke<number | undefined>('get_skins_count', { folder });
'get_skins',
{ folder }
);
export const startOpenTabletDriver = async (otdDaemonPath: string) => export const startOpenTabletDriver = async (otdDaemonPath: string) =>
await invoke('run_open_tablet_driver', { path: otdDaemonPath }); await invoke('run_open_tablet_driver', { path: otdDaemonPath });
export const stopOpenTabletDriver = async () => await invoke('stop_open_tablet_driver'); export const stopOpenTabletDriver = async () => await invoke('stop_open_tablet_driver');
+11 -13
View File
@@ -46,7 +46,6 @@
presenceLoading, presenceLoading,
serverConnectionFails, serverConnectionFails,
serverPing, serverPing,
skins,
skinsCount, skinsCount,
trackingEnabled, trackingEnabled,
} from '$lib/global'; } from '$lib/global';
@@ -59,7 +58,7 @@
getEZPPLauncherUpdateFiles, getEZPPLauncherUpdateFiles,
getReleaseStream, getReleaseStream,
getSkin, getSkin,
getSkins, getSkinsCount,
getVersion, getVersion,
hasNet8, hasNet8,
hasOsuWinello, hasOsuWinello,
@@ -70,7 +69,6 @@
isOsuCorrupted, isOsuCorrupted,
isOsuRunning, isOsuRunning,
isValidOsuFolder, isValidOsuFolder,
replaceUIFiles,
runOsu, runOsu,
runUpdater, runUpdater,
setConfigValues, setConfigValues,
@@ -230,10 +228,10 @@
const beatmapSetCount = await getBeatmapSetsCount(selectedPath); const beatmapSetCount = await getBeatmapSetsCount(selectedPath);
if (beatmapSetCount) beatmapSets.set(beatmapSetCount); if (beatmapSetCount) beatmapSets.set(beatmapSetCount);
const skins_list = await getSkins(selectedPath); const skins_count = await getSkinsCount(selectedPath);
if (skins_list) { if (skins_count) {
skins.set(skins_list); /* skins.set(skins_list); */
skinsCount.set(skins_list.length); skinsCount.set(skins_count);
} }
const skin: string = await getSkin(selectedPath); const skin: string = await getSkin(selectedPath);
@@ -500,7 +498,7 @@
fadeGlobalVolume($custom_theme_volume, 0, 2000, pauseGlobalMedia); fadeGlobalVolume($custom_theme_volume, 0, 2000, pauseGlobalMedia);
await replaceUIFiles(osuPath, false); /* await replaceUIFiles(osuPath, false); */
await new Promise((res) => setTimeout(res, 1000)); await new Promise((res) => setTimeout(res, 1000));
await getCurrentWindow().hide(); await getCurrentWindow().hide();
@@ -648,7 +646,7 @@
} }
} }
await new Promise((res) => setTimeout(res, 1000)); await new Promise((res) => setTimeout(res, 1000));
await replaceUIFiles(osuPath, true); /* await replaceUIFiles(osuPath, true); */
const osuReleaseStream = await getReleaseStream(osuPath); const osuReleaseStream = await getReleaseStream(osuPath);
osuStream.set(osuReleaseStream); osuStream.set(osuReleaseStream);
@@ -658,10 +656,10 @@
const beatmapSetCount = await getBeatmapSetsCount(osuPath); const beatmapSetCount = await getBeatmapSetsCount(osuPath);
if (beatmapSetCount) beatmapSets.set(beatmapSetCount); if (beatmapSetCount) beatmapSets.set(beatmapSetCount);
const skinsList = await getSkins(osuPath); const skins_count = await getSkinsCount(osuPath);
if (skinsList) { if (skins_count) {
skins.set(skinsList); /* skins.set(skinsList); */
skinsCount.set(skinsList.length); skinsCount.set(skins_count);
} }
const skin = await getSkin(osuPath); const skin = await getSkin(osuPath);
+4 -6
View File
@@ -17,7 +17,6 @@
newVersion, newVersion,
osuBuild, osuBuild,
osuStream, osuStream,
skins,
skinsCount, skinsCount,
} from '$lib/global'; } from '$lib/global';
import { import {
@@ -25,7 +24,7 @@
getEZPPLauncherStreams, getEZPPLauncherStreams,
getReleaseStream, getReleaseStream,
getSkin, getSkin,
getSkins, getSkinsCount,
getVersion, getVersion,
isValidOsuFolder, isValidOsuFolder,
} from '$lib/osuUtil'; } from '$lib/osuUtil';
@@ -156,10 +155,9 @@
if (beatmapSetCount !== null) beatmapSets.set(beatmapSetCount); if (beatmapSetCount !== null) beatmapSets.set(beatmapSetCount);
currentLoadingInfo.set('Counting skins...'); currentLoadingInfo.set('Counting skins...');
const skins_list = await getSkins($osuInstallationPath); const skins = await getSkinsCount($osuInstallationPath);
if (skins_list) { if (skins !== null) {
skins.set(skins_list); skinsCount.set(skins);
skinsCount.set(skins_list.length);
} else { } else {
skinsCount.set(0); skinsCount.set(0);
} }
+5 -6
View File
@@ -14,7 +14,6 @@
osuBuild, osuBuild,
osuStream, osuStream,
presenceLoading, presenceLoading,
skins,
skinsCount, skinsCount,
} from '$lib/global'; } from '$lib/global';
import { import {
@@ -22,7 +21,7 @@
getBeatmapSetsCount, getBeatmapSetsCount,
getReleaseStream, getReleaseStream,
getSkin, getSkin,
getSkins, getSkinsCount,
getVersion, getVersion,
isValidOsuFolder, isValidOsuFolder,
} from '$lib/osuUtil'; } from '$lib/osuUtil';
@@ -103,10 +102,10 @@
beatmapSets.set(beatmapSetCount); beatmapSets.set(beatmapSetCount);
} }
const skins_list = await getSkins(osuInstallPath); const skins_count = await getSkinsCount(osuInstallPath);
if (skins_list) { if (skins_count) {
skins.set(skins_list); /* skins.set(skins_count); */
skinsCount.set(skins_list.length); skinsCount.set(skins_count);
} else { } else {
skinsCount.set(0); skinsCount.set(0);
} }