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",
"version": "3.2.6",
"version": "3.2.7",
"description": "",
"type": "module",
"scripts": {
+1 -1
View File
@@ -1239,7 +1239,7 @@ dependencies = [
[[package]]
name = "ezpplauncher"
version = "3.2.5"
version = "3.2.7"
dependencies = [
"aes-gcm",
"anyhow",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "ezpplauncher"
version = "3.2.5"
version = "3.2.7"
description = "EZPPLauncher redefined."
authors = ["HorizonCode"]
edition = "2024"
+10 -76
View File
@@ -186,75 +186,6 @@ pub async fn get_beatmapsets_count(folder: String) -> Option<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]
pub async fn get_skins_count(folder: String) -> Option<u64> {
let path = PathBuf::from(folder);
@@ -267,20 +198,23 @@ pub async fn get_skins_count(folder: String) -> Option<u64> {
let mut count = 0;
if let Ok(mut entries) = fs::read_dir(skins_folder).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 {
if ft.is_dir() {
let dir_path = entry.path();
if let Ok(mut files) = fs::read_dir(&dir_path).await {
while let Ok(Some(file)) = files.next_entry().await {
if file.path().extension().map_or(false, |ext| ext == "ini") {
let has_ini = tokio::fs::try_exists(dir_path.join("skin.ini"))
.await
.unwrap_or(false)
|| tokio::fs::try_exists(dir_path.join("Skin.ini"))
.await
.unwrap_or(false);
if has_ini {
count += 1;
break;
}
}
}
}
}
}
return Some(count);
Some(count)
}
#[tauri::command]
+7 -8
View File
@@ -18,13 +18,13 @@ use crate::{
download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme,
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_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl,
install_ezpp_launcher_update, is_open_tablet_driver_path_valid,
is_open_tablet_driver_running, is_osu_running, open_url_in_browser, opened_urls,
presence_connect, presence_disconnect, presence_is_connected, presence_update_button,
presence_update_status, presence_update_user, read_theme_info, replace_ui_files,
run_open_tablet_driver, run_osu, run_osu_updater, set_osu_config_values,
set_osu_user_config_values, stop_open_tablet_driver, valid_osu_folder,
get_skins_count, has_net8, has_osuwinello, has_wmctrl, install_ezpp_launcher_update,
is_open_tablet_driver_path_valid, is_open_tablet_driver_running, is_osu_running,
open_url_in_browser, opened_urls, presence_connect, presence_disconnect,
presence_is_connected, presence_update_button, presence_update_status,
presence_update_user, read_theme_info, replace_ui_files, run_open_tablet_driver, run_osu,
run_osu_updater, set_osu_config_values, set_osu_user_config_values,
stop_open_tablet_driver, valid_osu_folder,
},
state::AppState,
};
@@ -107,7 +107,6 @@ pub fn run() {
find_osu_installation,
valid_osu_folder,
get_beatmapsets_count,
get_skins,
get_skins_count,
get_osu_version,
get_osu_release_stream,
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "EZPPLauncher",
"version": "3.2.5",
"version": "3.2.7",
"identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher",
"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 getSkins = async (folder: string) =>
await invoke<{ name: string; author: string | undefined; modified: number }[] | undefined>(
'get_skins',
{ folder }
);
export const getSkinsCount = async (folder: string) =>
await invoke<number | undefined>('get_skins_count', { folder });
export const startOpenTabletDriver = async (otdDaemonPath: string) =>
await invoke('run_open_tablet_driver', { path: otdDaemonPath });
export const stopOpenTabletDriver = async () => await invoke('stop_open_tablet_driver');
+11 -13
View File
@@ -46,7 +46,6 @@
presenceLoading,
serverConnectionFails,
serverPing,
skins,
skinsCount,
trackingEnabled,
} from '$lib/global';
@@ -59,7 +58,7 @@
getEZPPLauncherUpdateFiles,
getReleaseStream,
getSkin,
getSkins,
getSkinsCount,
getVersion,
hasNet8,
hasOsuWinello,
@@ -70,7 +69,6 @@
isOsuCorrupted,
isOsuRunning,
isValidOsuFolder,
replaceUIFiles,
runOsu,
runUpdater,
setConfigValues,
@@ -230,10 +228,10 @@
const beatmapSetCount = await getBeatmapSetsCount(selectedPath);
if (beatmapSetCount) beatmapSets.set(beatmapSetCount);
const skins_list = await getSkins(selectedPath);
if (skins_list) {
skins.set(skins_list);
skinsCount.set(skins_list.length);
const skins_count = await getSkinsCount(selectedPath);
if (skins_count) {
/* skins.set(skins_list); */
skinsCount.set(skins_count);
}
const skin: string = await getSkin(selectedPath);
@@ -500,7 +498,7 @@
fadeGlobalVolume($custom_theme_volume, 0, 2000, pauseGlobalMedia);
await replaceUIFiles(osuPath, false);
/* await replaceUIFiles(osuPath, false); */
await new Promise((res) => setTimeout(res, 1000));
await getCurrentWindow().hide();
@@ -648,7 +646,7 @@
}
}
await new Promise((res) => setTimeout(res, 1000));
await replaceUIFiles(osuPath, true);
/* await replaceUIFiles(osuPath, true); */
const osuReleaseStream = await getReleaseStream(osuPath);
osuStream.set(osuReleaseStream);
@@ -658,10 +656,10 @@
const beatmapSetCount = await getBeatmapSetsCount(osuPath);
if (beatmapSetCount) beatmapSets.set(beatmapSetCount);
const skinsList = await getSkins(osuPath);
if (skinsList) {
skins.set(skinsList);
skinsCount.set(skinsList.length);
const skins_count = await getSkinsCount(osuPath);
if (skins_count) {
/* skins.set(skinsList); */
skinsCount.set(skins_count);
}
const skin = await getSkin(osuPath);
+4 -6
View File
@@ -17,7 +17,6 @@
newVersion,
osuBuild,
osuStream,
skins,
skinsCount,
} from '$lib/global';
import {
@@ -25,7 +24,7 @@
getEZPPLauncherStreams,
getReleaseStream,
getSkin,
getSkins,
getSkinsCount,
getVersion,
isValidOsuFolder,
} from '$lib/osuUtil';
@@ -156,10 +155,9 @@
if (beatmapSetCount !== null) beatmapSets.set(beatmapSetCount);
currentLoadingInfo.set('Counting skins...');
const skins_list = await getSkins($osuInstallationPath);
if (skins_list) {
skins.set(skins_list);
skinsCount.set(skins_list.length);
const skins = await getSkinsCount($osuInstallationPath);
if (skins !== null) {
skinsCount.set(skins);
} else {
skinsCount.set(0);
}
+5 -6
View File
@@ -14,7 +14,6 @@
osuBuild,
osuStream,
presenceLoading,
skins,
skinsCount,
} from '$lib/global';
import {
@@ -22,7 +21,7 @@
getBeatmapSetsCount,
getReleaseStream,
getSkin,
getSkins,
getSkinsCount,
getVersion,
isValidOsuFolder,
} from '$lib/osuUtil';
@@ -103,10 +102,10 @@
beatmapSets.set(beatmapSetCount);
}
const skins_list = await getSkins(osuInstallPath);
if (skins_list) {
skins.set(skins_list);
skinsCount.set(skins_list.length);
const skins_count = await getSkinsCount(osuInstallPath);
if (skins_count) {
/* skins.set(skins_count); */
skinsCount.set(skins_count);
} else {
skinsCount.set(0);
}