3 Commits

9 changed files with 1138 additions and 913 deletions

View File

@@ -4,6 +4,7 @@
"": { "": {
"name": "ezpplauncher", "name": "ezpplauncher",
"dependencies": { "dependencies": {
"@better-fetch/fetch": "^1.1.18",
"@elron/svelte-audio-store": "1.0.0", "@elron/svelte-audio-store": "1.0.0",
"@number-flow/svelte": "^0.3.9", "@number-flow/svelte": "^0.3.9",
"@tailwindcss/typography": "0.5.16", "@tailwindcss/typography": "0.5.16",
@@ -16,7 +17,6 @@
"buffer": "^6.0.3", "buffer": "^6.0.3",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"ky": "1.8.1",
"lucide-svelte": "0.523.0", "lucide-svelte": "0.523.0",
"osu-classes": "3.1.0", "osu-classes": "3.1.0",
"osu-parsers": "4.1.7", "osu-parsers": "4.1.7",
@@ -56,6 +56,8 @@
"@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="],
"@better-fetch/fetch": ["@better-fetch/fetch@1.1.18", "", {}, "sha512-rEFOE1MYIsBmoMJtQbl32PGHHXuG2hDxvEd7rUHE0vCBoFQVSDqaVs9hkZEtHCxRoY+CljXKFCOuJ8uxqw1LcA=="],
"@bufbuild/protobuf": ["@bufbuild/protobuf@2.5.2", "", {}, "sha512-foZ7qr0IsUBjzWIq+SuBLfdQCpJ1j8cTuNNT4owngTHoN5KsJb8L9t65fzz7SCeSWzescoOil/0ldqiL041ABg=="], "@bufbuild/protobuf": ["@bufbuild/protobuf@2.5.2", "", {}, "sha512-foZ7qr0IsUBjzWIq+SuBLfdQCpJ1j8cTuNNT4owngTHoN5KsJb8L9t65fzz7SCeSWzescoOil/0ldqiL041ABg=="],
"@elron/svelte-audio-store": ["@elron/svelte-audio-store@1.0.0", "", { "peerDependencies": { "svelte": "^4.0.0" } }, "sha512-ksBF88rG4cbIt+ZLrxMKDdr1CxWxxEiyyZfHfNHCF/G9O2eDflSnCytSpid0Y43R4DwK+AukUlFfc0j5evqqEw=="], "@elron/svelte-audio-store": ["@elron/svelte-audio-store@1.0.0", "", { "peerDependencies": { "svelte": "^4.0.0" } }, "sha512-ksBF88rG4cbIt+ZLrxMKDdr1CxWxxEiyyZfHfNHCF/G9O2eDflSnCytSpid0Y43R4DwK+AukUlFfc0j5evqqEw=="],
@@ -382,8 +384,6 @@
"kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], "kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],
"ky": ["ky@1.8.1", "", {}, "sha512-7Bp3TpsE+L+TARSnnDpk3xg8Idi8RwSLdj6CMbNWoOARIrGrbuLGusV0dYwbZOm4bB3jHNxSw8Wk/ByDqJEnDw=="],
"lilconfig": ["lilconfig@3.1.3", "", {}, "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw=="], "lilconfig": ["lilconfig@3.1.3", "", {}, "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw=="],
"lines-and-columns": ["lines-and-columns@1.2.4", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="], "lines-and-columns": ["lines-and-columns@1.2.4", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="],

View File

@@ -16,6 +16,7 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@better-fetch/fetch": "^1.1.18",
"@elron/svelte-audio-store": "1.0.0", "@elron/svelte-audio-store": "1.0.0",
"@number-flow/svelte": "^0.3.9", "@number-flow/svelte": "^0.3.9",
"@tailwindcss/typography": "0.5.16", "@tailwindcss/typography": "0.5.16",
@@ -28,7 +29,6 @@
"buffer": "^6.0.3", "buffer": "^6.0.3",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"ky": "1.8.1",
"lucide-svelte": "0.523.0", "lucide-svelte": "0.523.0",
"osu-classes": "3.1.0", "osu-classes": "3.1.0",
"osu-parsers": "4.1.7", "osu-parsers": "4.1.7",

1972
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ name = "ezpplauncher"
version = "0.1.0" version = "0.1.0"
description = "A Tauri App" description = "A Tauri App"
authors = ["you"] authors = ["you"]
edition = "2021" edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -15,10 +15,10 @@ name = "ezpplauncher_lib"
crate-type = ["staticlib", "cdylib", "rlib"] crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies] [build-dependencies]
tauri-build = { version = "2", features = [] } tauri-build = { version = "2.3.0", features = [] }
[dependencies] [dependencies]
tauri = { version = "2", features = [] } tauri = { version = "2.6.2", features = [] }
tauri-plugin-shell = "2.3.0" tauri-plugin-shell = "2.3.0"
serde = { version = "1.0.219", features = ["derive"] } serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140" serde_json = "1.0.140"
@@ -28,6 +28,7 @@ tauri-plugin-dialog = "2.3.0"
tauri-plugin-fs = "2.4.0" tauri-plugin-fs = "2.4.0"
hardware-id = "0.3.0" hardware-id = "0.3.0"
winreg = "0.55.0" winreg = "0.55.0"
tauri-plugin-cors-fetch = "4.1.0"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-single-instance = "2.3.0" tauri-plugin-single-instance = "2.3.0"

View File

@@ -2,9 +2,7 @@
"$schema": "../gen/schemas/desktop-schema.json", "$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default", "identifier": "default",
"description": "Capability for the main window", "description": "Capability for the main window",
"windows": [ "windows": ["main"],
"main"
],
"permissions": [ "permissions": [
"core:default", "core:default",
"shell:allow-open", "shell:allow-open",
@@ -14,6 +12,7 @@
"core:window:allow-start-dragging", "core:window:allow-start-dragging",
"core:window:allow-minimize", "core:window:allow-minimize",
"core:window:allow-close", "core:window:allow-close",
"cors-fetch:default",
"fs:default", "fs:default",
{ {
"identifier": "fs:allow-write", "identifier": "fs:allow-write",

View File

@@ -137,7 +137,7 @@ fn find_osu_installation() -> Option<String> {
#[cfg_attr(mobile, tauri::mobile_entry_point)] #[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() { pub fn run() {
let mut builder = tauri::Builder::default().plugin(tauri_plugin_fs::init()); let mut builder = tauri::Builder::default();
#[cfg(desktop)] #[cfg(desktop)]
{ {
builder = builder.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { builder = builder.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
@@ -155,8 +155,10 @@ pub fn run() {
find_osu_installation, find_osu_installation,
valid_osu_folder valid_osu_folder
]) ])
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_cors_fetch::init())
.plugin(tauri_plugin_sql::Builder::default().build()) .plugin(tauri_plugin_sql::Builder::default().build())
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");

View File

@@ -20,6 +20,7 @@
"maximizable": false "maximizable": false
} }
], ],
"withGlobalTauri": true,
"security": { "security": {
"csp": null "csp": null
} }

View File

@@ -1,4 +1,5 @@
import ky from 'ky'; import type { EZPPUser } from '@/types';
import { betterFetch } from '@better-fetch/fetch';
const BANCHO_ENDPOINT = 'https://c.ez-pp.farm/'; const BANCHO_ENDPOINT = 'https://c.ez-pp.farm/';
const ENDPOINT = 'https://ez-pp.farm/'; const ENDPOINT = 'https://ez-pp.farm/';
@@ -7,8 +8,8 @@ export const ezppfarm = {
ping: async (): Promise<number | undefined> => { ping: async (): Promise<number | undefined> => {
try { try {
const start = Date.now(); const start = Date.now();
const request = await ky(BANCHO_ENDPOINT); const request = await betterFetch(BANCHO_ENDPOINT);
if (!request.ok) return undefined; if (request.error) return undefined;
const ping = Date.now() - start; const ping = Date.now() - start;
return ping; return ping;
} catch { } catch {
@@ -31,28 +32,23 @@ export const ezppfarm = {
} }
| undefined | undefined
> => { > => {
try { const request = await betterFetch<{
const request = await ky(`${ENDPOINT}login/check`, {
method: 'POST',
body: JSON.stringify({ username, password }),
headers: {
'Content-Type': 'application/json',
'User-Agent': 'EZPPLauncher',
},
});
if (!request.ok) return undefined;
return await request.json<{
code: number; code: number;
message: string; message: string;
user?: { user?: EZPPUser;
id: number; }>('https://ez-pp.farm/login/check', {
donor: boolean; method: 'POST',
name: string; body: JSON.stringify({
email: string; username: username,
}; password: password,
}>(); }),
} catch { headers: {
return undefined; 'Content-Type': 'application/json',
} 'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0',
},
});
if (request.error) return undefined;
return request.data;
}, },
}; };

View File

@@ -1,11 +1,9 @@
import ky from "ky";
const API_ENDPOINT = "https://osu.direct/api/"; const API_ENDPOINT = "https://osu.direct/api/";
export const osudirect = { export const osudirect = {
osu: async (mapId: number): Promise<string | undefined> => { osu: async (mapId: number): Promise<string | undefined> => {
try { try {
return await ky(API_ENDPOINT + `osu/${mapId}?raw`).text(); return await (await fetch(API_ENDPOINT + `osu/${mapId}?raw`)).text();
} catch { } catch {
return undefined; return undefined;
} }