Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bde922ab9f | |||
| a1f96a7de3 | |||
| 3b2c902264 |
@@ -15,6 +15,7 @@
|
||||
"@tauri-apps/plugin-dialog": "^2.7.0",
|
||||
"@tauri-apps/plugin-fs": "^2.5.0",
|
||||
"@tauri-apps/plugin-shell": "^2.3.5",
|
||||
"@types/node": "^25.9.1",
|
||||
"animejs": "^4.1.3",
|
||||
"buffer": "^6.0.3",
|
||||
"crypto-js": "^4.2.0",
|
||||
@@ -302,7 +303,7 @@
|
||||
|
||||
"@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
|
||||
|
||||
"@types/node": ["@types/node@20.19.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-jJD50LtlD2dodAEO653i3YF04NWak6jN3ky+Ri3Em3mGR39/glWiboM/IePaRbgwSfqM1TpGXfAg8ohn/4dTgA=="],
|
||||
"@types/node": ["@types/node@25.9.1", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg=="],
|
||||
|
||||
"@types/react": ["@types/react@19.1.8", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="],
|
||||
|
||||
@@ -794,7 +795,7 @@
|
||||
|
||||
"typescript-eslint": ["typescript-eslint@8.42.0", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.42.0", "@typescript-eslint/parser": "8.42.0", "@typescript-eslint/typescript-estree": "8.42.0", "@typescript-eslint/utils": "8.42.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-ozR/rQn+aQXQxh1YgbCzQWDFrsi9mcg+1PM3l/z5o1+20P7suOIaNg515bpr/OYt6FObz/NHcBstydDLHWeEKg=="],
|
||||
|
||||
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||
"undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
|
||||
|
||||
"update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="],
|
||||
|
||||
@@ -854,6 +855,8 @@
|
||||
|
||||
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
|
||||
|
||||
"bun-types/@types/node": ["@types/node@20.19.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-jJD50LtlD2dodAEO653i3YF04NWak6jN3ky+Ri3Em3mGR39/glWiboM/IePaRbgwSfqM1TpGXfAg8ohn/4dTgA=="],
|
||||
|
||||
"chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
|
||||
"eslint/@eslint/core": ["@eslint/core@0.15.2", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg=="],
|
||||
@@ -906,6 +909,8 @@
|
||||
|
||||
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
|
||||
|
||||
"bun-types/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||
|
||||
"eslint-plugin-svelte/@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -5,9 +5,10 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"debug": "bun run tauri dev",
|
||||
"build": "bun ./scripts/sync-version.ts && bun run vite:build && bun run tauri:build",
|
||||
"debug:theme": "bun run tauri dev -- -- \"C:\\Users\\moebius\\Desktop\\dance.ezpplauncher-theme\"",
|
||||
"build": "bun ./scripts/build.ts",
|
||||
"vite:dev": "vite dev",
|
||||
"vite:build": "vite build",
|
||||
"vite:build": "vite build && exit 0",
|
||||
"tauri:build": "tauri build",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
@@ -28,6 +29,7 @@
|
||||
"@tauri-apps/plugin-dialog": "^2.7.0",
|
||||
"@tauri-apps/plugin-fs": "^2.5.0",
|
||||
"@tauri-apps/plugin-shell": "^2.3.5",
|
||||
"@types/node": "^25.9.1",
|
||||
"animejs": "^4.1.3",
|
||||
"buffer": "^6.0.3",
|
||||
"crypto-js": "^4.2.0",
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
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();
|
||||
await run('bunx', ['tauri', 'build']);
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"types": ["@types/bun", "@types/node"]
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
+29
-14
@@ -2,6 +2,7 @@
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Mutex;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_fs::FsExt;
|
||||
|
||||
pub mod commands;
|
||||
pub mod osudb;
|
||||
@@ -30,9 +31,32 @@ pub fn run() {
|
||||
let mut builder = tauri::Builder::default();
|
||||
#[cfg(desktop)]
|
||||
{
|
||||
builder = builder.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||
builder = builder.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
|
||||
let app_window = app.get_webview_window("main").expect("no main window");
|
||||
app_window.set_focus().expect("failed to focus");
|
||||
if args.len() > 1 {
|
||||
use tauri::Emitter;
|
||||
|
||||
let mut files = Vec::new();
|
||||
|
||||
for maybe_file in args.iter().skip(1) {
|
||||
if maybe_file.starts_with("-") {
|
||||
continue;
|
||||
}
|
||||
|
||||
let path = PathBuf::from(maybe_file);
|
||||
|
||||
if path.extension().and_then(|e| e.to_str()) == Some("ezpplauncher-theme") {
|
||||
app.fs_scope().allow_file(&path).ok();
|
||||
files.push(path);
|
||||
}
|
||||
}
|
||||
|
||||
app.state::<OpenedUrls>().0.lock().unwrap().extend(files.clone());
|
||||
|
||||
app.emit("opened", files.clone()).ok();
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -48,19 +72,10 @@ pub fn run() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Ok(url) = url::Url::parse(&maybe_file) {
|
||||
if let Ok(path) = url.to_file_path() {
|
||||
if path.extension().and_then(|str| str.to_str())
|
||||
== Some("ezpplauncher-theme")
|
||||
{
|
||||
files.push(path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let maybe_file_path = PathBuf::from(maybe_file);
|
||||
if maybe_file_path.extension().and_then(|str| str.to_str()) == Some("ezpplauncher-theme") {
|
||||
files.push(maybe_file_path);
|
||||
}
|
||||
let path = PathBuf::from(maybe_file);
|
||||
if path.extension().and_then(|e| e.to_str()) == Some("ezpplauncher-theme") {
|
||||
app.fs_scope().allow_file(&path).ok();
|
||||
files.push(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+38
-20
@@ -286,8 +286,13 @@ export const downloadTheme = async (
|
||||
const downloadableThemes = await getDownloadableThemes();
|
||||
custom_themes.update((themes) => {
|
||||
const reloadedThemes = [...themes];
|
||||
|
||||
for (const theme of downloadableThemes) {
|
||||
if (!reloadedThemes.find((t) => t.name === theme.name)) reloadedThemes.push(theme);
|
||||
if (theme.name === 'Default') continue; // never overwrite Default from remote
|
||||
|
||||
if (!reloadedThemes.find((t) => t.name === theme.name)) {
|
||||
reloadedThemes.push(theme);
|
||||
}
|
||||
|
||||
const installedTheme = reloadedThemes.find((t) => t.name === theme.name);
|
||||
if (installedTheme) {
|
||||
@@ -300,17 +305,21 @@ export const downloadTheme = async (
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const installedThemes of reloadedThemes) {
|
||||
if (installedThemes.name === theme.name) {
|
||||
installedThemes.name = themeInfoObj.name;
|
||||
installedThemes.author = themeInfoObj.author;
|
||||
installedThemes.version = themeInfoObj.version;
|
||||
installedThemes.scriptUrl = themeScriptUrl;
|
||||
installedThemes.assets = themeAssets;
|
||||
installedThemes.preview = themePreview;
|
||||
installedThemes.status = 'installed';
|
||||
|
||||
for (const installedTheme of reloadedThemes) {
|
||||
if (installedTheme.name === 'Default') continue; // never touch Default
|
||||
|
||||
if (installedTheme.name === theme.name) {
|
||||
installedTheme.name = themeInfoObj.name;
|
||||
installedTheme.author = themeInfoObj.author;
|
||||
installedTheme.version = themeInfoObj.version;
|
||||
installedTheme.scriptUrl = themeScriptUrl;
|
||||
installedTheme.assets = themeAssets;
|
||||
installedTheme.preview = themePreview;
|
||||
installedTheme.status = 'installed';
|
||||
}
|
||||
}
|
||||
|
||||
return reloadedThemes.sort((a, b) => {
|
||||
if (a.name === 'Default') return -1;
|
||||
if (b.name === 'Default') return 1;
|
||||
@@ -469,8 +478,13 @@ export const importThemeFromFile = async (themeName: string, filePath: string) =
|
||||
const downloadableThemes = await getDownloadableThemes();
|
||||
custom_themes.update((themes) => {
|
||||
const reloadedThemes = [...themes];
|
||||
|
||||
for (const theme of downloadableThemes) {
|
||||
if (!reloadedThemes.find((t) => t.name === theme.name)) reloadedThemes.push(theme);
|
||||
if (theme.name === 'Default') continue; // never overwrite Default from remote
|
||||
|
||||
if (!reloadedThemes.find((t) => t.name === theme.name)) {
|
||||
reloadedThemes.push(theme);
|
||||
}
|
||||
|
||||
const installedTheme = reloadedThemes.find((t) => t.name === theme.name);
|
||||
if (installedTheme) {
|
||||
@@ -483,17 +497,21 @@ export const importThemeFromFile = async (themeName: string, filePath: string) =
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const installedThemes of reloadedThemes) {
|
||||
if (installedThemes.name === themeName) {
|
||||
installedThemes.name = themeInfoObj.name;
|
||||
installedThemes.author = themeInfoObj.author;
|
||||
installedThemes.version = themeInfoObj.version;
|
||||
installedThemes.scriptUrl = themeScriptUrl;
|
||||
installedThemes.assets = themeAssets;
|
||||
installedThemes.preview = themePreview;
|
||||
installedThemes.status = 'installed';
|
||||
|
||||
for (const installedTheme of reloadedThemes) {
|
||||
if (installedTheme.name === 'Default') continue; // never touch Default
|
||||
|
||||
if (installedTheme.name === themeName) {
|
||||
installedTheme.name = themeInfoObj.name;
|
||||
installedTheme.author = themeInfoObj.author;
|
||||
installedTheme.version = themeInfoObj.version;
|
||||
installedTheme.scriptUrl = themeScriptUrl;
|
||||
installedTheme.assets = themeAssets;
|
||||
installedTheme.preview = themePreview;
|
||||
installedTheme.status = 'installed';
|
||||
}
|
||||
}
|
||||
|
||||
return reloadedThemes.sort((a, b) => {
|
||||
if (a.name === 'Default') return -1;
|
||||
if (b.name === 'Default') return 1;
|
||||
|
||||
@@ -808,7 +808,7 @@
|
||||
await listen<string[]>('opened', async (event) => {
|
||||
const files = event.payload;
|
||||
if (files.length > 0) {
|
||||
const firstFile = initialUrls[0];
|
||||
const firstFile = files[0];
|
||||
if (!firstFile.endsWith('.ezpplauncher-theme')) {
|
||||
sileo.error({
|
||||
title: 'Uhh...',
|
||||
|
||||
+2
-1
@@ -9,7 +9,8 @@
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "bundler"
|
||||
"moduleResolution": "bundler",
|
||||
"types": ["@types/node"]
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
|
||||
|
||||
Reference in New Issue
Block a user