Compare commits
139 Commits
3.1.2
...
eaffc35288
| Author | SHA1 | Date | |
|---|---|---|---|
| eaffc35288 | |||
| 78c7fdb756 | |||
| ec7ce53016 | |||
| 0610d4beef | |||
|
416067f2ea
|
|||
|
e58be09bdb
|
|||
| ccb0c467f2 | |||
|
67bc968497
|
|||
|
dc06b53089
|
|||
|
d5e5fd4c43
|
|||
|
29359c9242
|
|||
|
71bd64a2cf
|
|||
|
7fa83d6d0a
|
|||
|
f2e795e2c9
|
|||
|
cece28dd46
|
|||
| 474f1f0c33 | |||
| 871c40922e | |||
| 20e8389409 | |||
|
051a86943e
|
|||
|
7d0147edb9
|
|||
|
7e2404753b
|
|||
|
9952e164c5
|
|||
|
df8ee34e73
|
|||
|
3a27646da8
|
|||
|
ace3320632
|
|||
| 2ba094f07e | |||
| fcf9e46a8f | |||
| 3768ab1064 | |||
| e5e09505a0 | |||
| 94f78f281d | |||
| d2ecc5210f | |||
| 6f8036e9d4 | |||
| 73256f32c4 | |||
| cfb4c8a611 | |||
| f2d8056cfd | |||
| 2eb95cd802 | |||
| a28d56e283 | |||
| f88a33c2aa | |||
| 8a964d0a6a | |||
| cc4697efbc | |||
|
5b1e32d4eb
|
|||
|
d0b0011910
|
|||
|
1467d3e296
|
|||
|
2ded0d4b94
|
|||
|
9d80811e83
|
|||
| 730a27b397 | |||
| e84feb292b | |||
| 485cb3acf7 | |||
|
44ad025d3d
|
|||
|
ec80b13de3
|
|||
|
6a279de728
|
|||
|
4e33ec3451
|
|||
|
6fdb2376a1
|
|||
|
afdd74175a
|
|||
|
6f8043d2d0
|
|||
| f7fff7748a | |||
| d5286263b9 | |||
| 1cc1a4a0c3 | |||
| d2ae9e939f | |||
| bde922ab9f | |||
| a1f96a7de3 | |||
| 3b2c902264 | |||
| 40a32d7a60 | |||
| 52c60acf37 | |||
| 2788cd6e8b | |||
| 2d1941db33 | |||
| 00958d5238 | |||
| b8a0b448c7 | |||
| 09487e945e | |||
| 2532ab0059 | |||
| 16fe91b3a5 | |||
| eca08f16c5 | |||
| e76d67f3a8 | |||
| 9811b36e58 | |||
|
0f10beb3b4
|
|||
|
4326199a56
|
|||
|
7f65384b1c
|
|||
|
aacd0d1d91
|
|||
|
079a076f99
|
|||
| 6d88c39ce2 | |||
| 56608a64fc | |||
| eaf6f5976d | |||
| 93f1f380ec | |||
| c47ea1f976 | |||
| 09af78f1aa | |||
| 3900b5c6cf | |||
| adf607e24c | |||
| 1128b51778 | |||
| d435f0c09a | |||
| b188e2dee8 | |||
| 8fd56ae749 | |||
| b2e7d22d28 | |||
| d871e06172 | |||
| 6a1c5441c3 | |||
| ef36f49a6f | |||
| 7e40536ec8 | |||
| 694d403aeb | |||
| 9515892b2f | |||
| 0a58f0f63b | |||
| 60e3ef4131 | |||
| 7375cccc05 | |||
| 251bf8177c | |||
| bf4ce18671 | |||
| 4dc83c882d | |||
| e20f11be64 | |||
| 407996269e | |||
| 95c6db6a1d | |||
| a87a4bcc54 | |||
| 97f072f4ce | |||
| 1aa3070ea1 | |||
| d3c3e4e771 | |||
| 921dbd716c | |||
| 34e82f89e8 | |||
| 901fbefd1b | |||
| a795978827 | |||
| a9152cc376 | |||
| 8d790c7da3 | |||
| f5a2c4365b | |||
| a925548ae9 | |||
| a6495ea353 | |||
| 24802b5132 | |||
| f09405ed58 | |||
| eeda85f48f | |||
| 9770e81d6f | |||
| 31b7d17b09 | |||
| 1fc0391113 | |||
| 62f03cf7c0 | |||
| 94f6e850cf | |||
| d6fdb2a152 | |||
| 9cd990cf96 | |||
| 2e0ef81bcb | |||
| 96680ff8b5 | |||
| 0b9d6373bf | |||
| 295c1424c9 | |||
| 0e12a801d2 | |||
| cf86dba5c4 | |||
| 540c653399 | |||
| c9b8d9f599 | |||
| 49665d94bc |
@@ -9,7 +9,7 @@
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"bracketSpacing": true,
|
||||
"plugins": ["prettier-plugin-svelte"],
|
||||
"plugins": ["prettier-plugin-svelte", "@trivago/prettier-plugin-sort-imports"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.svelte",
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
{
|
||||
"svelte.enable-ts-plugin": true,
|
||||
"git.enableCommitSigning": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "file",
|
||||
"[rust]": {
|
||||
"editor.defaultFormatter": "rust-lang.rust-analyzer"
|
||||
},
|
||||
"json.schemaDownload.trustedDomains": {
|
||||
"https://schemastore.azurewebsites.net/": true,
|
||||
"https://raw.githubusercontent.com/": true,
|
||||
"https://www.schemastore.org/": true,
|
||||
"https://json.schemastore.org/": true,
|
||||
"https://json-schema.org/": true,
|
||||
"https://schema.tauri.app/": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ It enhances the osu! experience with quality-of-life features and integration sp
|
||||
## 🚀 Features
|
||||
|
||||
- [x] Automatically updates osu! before launching
|
||||
- [x] Automatically start/stop the OpenTabletDriver Daemon
|
||||
- [x] Automatic ingame login
|
||||
- [x] Patches the osu! client to show misses in Relax and Autopilot
|
||||
- [x] Displays your EZPPFarm stats in the launcher
|
||||
@@ -22,6 +23,7 @@ It enhances the osu! experience with quality-of-life features and integration sp
|
||||
- [x] Displays ping to the EZPPFarm server
|
||||
- [x] Discord Rich Presence
|
||||
- [x] Performance Display Overlay (currently in experimental patcher release stream)
|
||||
- [x] Launcher Theming
|
||||
|
||||
---
|
||||
|
||||
@@ -73,3 +75,9 @@ src-tauri/target/release/ezpplauncher.exe
|
||||
├── package.json # Bun project config
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Launcher Themes
|
||||
|
||||
By default, the launcher includes several downloadable themes. If you want to create your own custom theme, please use the [create-ezpplauncher-theme](https://git.ez-pp.farm/EZPPFarm/create-ezpplauncher-theme) repository for a template and instructions.
|
||||
|
||||
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 157 KiB |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://next.shadcn-svelte.com/schema.json",
|
||||
"$schema": "https://shadcn-svelte.com/schema.json",
|
||||
"tailwind": {
|
||||
"css": "src\\app.css",
|
||||
"baseColor": "gray"
|
||||
@@ -12,5 +12,5 @@
|
||||
"lib": "$lib"
|
||||
},
|
||||
"typescript": true,
|
||||
"registry": "https://tw3.shadcn-svelte.com/registry/default"
|
||||
"registry": "https://shadcn-svelte.com/registry"
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import svelteConfig from './svelte.config.js';
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import js from '@eslint/js';
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import svelte from 'eslint-plugin-svelte';
|
||||
import globals from 'globals';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import ts from 'typescript-eslint';
|
||||
import svelteConfig from './svelte.config.js';
|
||||
|
||||
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
|
||||
|
||||
@@ -36,5 +36,14 @@ export default ts.config(
|
||||
svelteConfig,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'no-empty': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^\\$\\$(Props|Events|Slots|Generic)$' },
|
||||
],
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "ezpplauncher",
|
||||
"version": "3.1.2",
|
||||
"version": "3.2.3",
|
||||
"description": "",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"debug": "bun run tauri dev",
|
||||
"build": "bun ./scripts/sync-version.ts && bun run vite:build && bun run tauri:build",
|
||||
"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",
|
||||
@@ -18,64 +18,65 @@
|
||||
},
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@better-fetch/fetch": "^1.1.18",
|
||||
"@fontsource/sora": "^5.2.6",
|
||||
"@fontsource/space-mono": "^5.2.8",
|
||||
"@number-flow/svelte": "^0.3.9",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@tailwindcss/vite": "^4.1.11",
|
||||
"@tauri-apps/api": "^2.9.1",
|
||||
"@tauri-apps/plugin-dialog": "^2.4.2",
|
||||
"@tauri-apps/plugin-fs": "^2.4.4",
|
||||
"@tauri-apps/plugin-shell": "^2.3.3",
|
||||
"@types/umami": "^2.10.1",
|
||||
"animejs": "^4.1.3",
|
||||
"@better-fetch/fetch": "^1.1.21",
|
||||
"@fontsource-variable/sora": "^5.2.8",
|
||||
"@fontsource/space-mono": "^5.2.9",
|
||||
"@number-flow/svelte": "^0.4.0",
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@tailwindcss/vite": "^4.3.0",
|
||||
"@tauri-apps/api": "^2.11.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.7.1",
|
||||
"@tauri-apps/plugin-fs": "^2.5.1",
|
||||
"@tauri-apps/plugin-shell": "^2.3.5",
|
||||
"@types/node": "^25.9.1",
|
||||
"animejs": "^4.4.1",
|
||||
"buffer": "^6.0.3",
|
||||
"crypto-js": "^4.2.0",
|
||||
"lucide-svelte": "^0.575.0",
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"jszip": "^3.10.1",
|
||||
"react": "^19.2.6",
|
||||
"react-dom": "^19.2.6",
|
||||
"react-to-webcomponent": "^2.0.1",
|
||||
"semver": "^7.7.2",
|
||||
"sileo": "^0.1.3",
|
||||
"semver": "^7.8.1",
|
||||
"sileo": "^0.1.5",
|
||||
"svelte-confetti": "^2.3.2",
|
||||
"tw-animate-css": "^1.3.8"
|
||||
"tw-animate-css": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^2.0.0",
|
||||
"@eslint/js": "^9.35.0",
|
||||
"@eslint/compat": "^2.1.0",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@iarna/toml": "2.2.5",
|
||||
"@lucide/svelte": "^0.575.0",
|
||||
"@sveltejs/adapter-static": "^3.0.9",
|
||||
"@sveltejs/kit": "^2.37.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^6.1.4",
|
||||
"@tauri-apps/cli": "^2.9.6",
|
||||
"@types/bun": "^1.2.21",
|
||||
"@lucide/svelte": "^1.16.0",
|
||||
"@sveltejs/adapter-static": "^3.0.10",
|
||||
"@sveltejs/kit": "^2.61.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
||||
"@tauri-apps/cli": "^2.11.2",
|
||||
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
||||
"@types/bun": "^1.3.14",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/semver": "^7.7.1",
|
||||
"autoprefixer": "10.4.21",
|
||||
"bits-ui": "^1.4.7",
|
||||
"autoprefixer": "10.5.0",
|
||||
"bits-ui": "^2.18.1",
|
||||
"clsx": "^2.1.1",
|
||||
"eslint": "^9.35.0",
|
||||
"eslint": "^10.4.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-svelte": "^3.12.2",
|
||||
"globals": "^17.0.0",
|
||||
"eslint-plugin-svelte": "^3.17.1",
|
||||
"globals": "^17.6.0",
|
||||
"mode-watcher": "^1.1.0",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier-plugin-svelte": "^3.4.0",
|
||||
"sass-embedded": "^1.92.1",
|
||||
"svelte": "^5.38.7",
|
||||
"svelte-check": "^4.3.1",
|
||||
"svelte-sonner": "^1.0.5",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tailwind-variants": "^3.1.0",
|
||||
"tailwindcss": "^4.1.7",
|
||||
"prettier": "^3.8.3",
|
||||
"prettier-plugin-svelte": "^4.0.1",
|
||||
"sass-embedded": "^1.100.0",
|
||||
"svelte": "^5.55.9",
|
||||
"svelte-check": "^4.4.8",
|
||||
"svelte-sonner": "^1.1.1",
|
||||
"tailwind-merge": "^3.6.0",
|
||||
"tailwind-variants": "^3.2.2",
|
||||
"tailwindcss": "^4.3.0",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.42.0",
|
||||
"vite": "^7.1.5",
|
||||
"typescript": "^6.0.3",
|
||||
"typescript-eslint": "^8.60.0",
|
||||
"vite": "^8.0.14",
|
||||
"vite-plugin-devtools-json": "^1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
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']);
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as toml from '@iarna/toml';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import * as toml from '@iarna/toml';
|
||||
import { cwd } from 'process';
|
||||
|
||||
const packageJsonPath = path.join(cwd(), 'package.json');
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"types": ["@types/bun", "@types/node"]
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -1,12 +1,22 @@
|
||||
[package]
|
||||
name = "ezpplauncher"
|
||||
version = "3.1.2"
|
||||
version = "3.2.3"
|
||||
description = "EZPPLauncher redefined."
|
||||
authors = ["HorizonCode"]
|
||||
edition = "2024"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[profile.dev]
|
||||
incremental = true # Compile your binary in smaller steps.
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1 # Allows LLVM to perform better optimization.
|
||||
lto = true # Enables link-time-optimizations.
|
||||
opt-level = "s" # Prioritizes small binary size. Use `3` if you prefer speed.
|
||||
panic = "abort" # Higher performance by disabling panic handlers.
|
||||
strip = true # Ensures debug symbols are removed.
|
||||
|
||||
[lib]
|
||||
# The `_lib` suffix may seem redundant but it is necessary
|
||||
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||
@@ -15,33 +25,44 @@ name = "ezpplauncher_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.5.3", features = [] }
|
||||
tauri-build = { version = "2.6.2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2.9.5", features = [] }
|
||||
tauri-plugin-shell = "2.3.3"
|
||||
tauri = { version = "2.11.2", features = ["protocol-asset"] }
|
||||
tauri-plugin-shell = "2.3.5"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
serde_json = "1.0.148"
|
||||
serde_json = "1.0.150"
|
||||
serde_repr = "0.1.20"
|
||||
tauri-plugin-dialog = "2.4.2"
|
||||
tauri-plugin-fs = "2.4.4"
|
||||
tauri-plugin-dialog = "2.7.1"
|
||||
tauri-plugin-fs = "2.5.1"
|
||||
hardware-id = "0.3.0"
|
||||
tauri-plugin-cors-fetch = "4.1.0"
|
||||
sysinfo = "0.37.2"
|
||||
reqwest = { version = "0.13.1", features = ["json", "stream", "query"] }
|
||||
tauri-plugin-cors-fetch = "5.0.0"
|
||||
sysinfo = "0.39.2"
|
||||
reqwest = { version = "0.13.4", features = ["json", "stream", "query"] }
|
||||
md5 = "0.8.0"
|
||||
tokio = { version = "1.48.0", features = ["full"] }
|
||||
open = "5.3.3"
|
||||
windows-sys = "0.61.2"
|
||||
discord-rich-presence = "1.0.0"
|
||||
once_cell = "1.21.3"
|
||||
tokio = { version = "1.52.3", features = ["full"] }
|
||||
open = "5.3.5"
|
||||
presenceforge = { version = "0.2.1", features = ["tokio-runtime"] }
|
||||
once_cell = "1.21.4"
|
||||
futures-util = "0.3.32"
|
||||
byteorder = "1.5.0"
|
||||
anyhow = "1.0.102"
|
||||
url = "2.5.8"
|
||||
zip = "8.6.0"
|
||||
sha1 = "0.11.0"
|
||||
hex = "0.4.3"
|
||||
rusqlite = { version = "0.40.0", features = ["bundled"] }
|
||||
aes-gcm = "0.10.3"
|
||||
base64 = "0.22.1"
|
||||
sha2 = "0.11.0"
|
||||
thiserror = "2.0.18"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = "0.55.0"
|
||||
winapi = { version = "0.3", features = ["winuser", "wincrypt", "memoryapi", "winbase", "dpapi"] }
|
||||
base64 = "0.22.1"
|
||||
winreg = "0.56.0"
|
||||
winapi = { version = "0.3.9", features = ["winuser", "wincrypt", "memoryapi", "winbase", "dpapi"] }
|
||||
widestring = "1.2.1"
|
||||
windows-sys = "0.61.2"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-single-instance = "2.3.6"
|
||||
tauri-plugin-single-instance = "2.4.2"
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"shell:allow-open",
|
||||
@@ -19,58 +21,128 @@
|
||||
{
|
||||
"identifier": "fs:allow-read",
|
||||
"allow": [
|
||||
{ "path": "$HOME/.ezpplauncher" },
|
||||
{ "path": "$HOME/.ezpplauncher/*" },
|
||||
{ "path": "$HOME/.ezpplauncher/**/*" }
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-write",
|
||||
"allow": [
|
||||
{ "path": "$HOME/.ezpplauncher" },
|
||||
{ "path": "$HOME/.ezpplauncher/*" },
|
||||
{ "path": "$HOME/.ezpplauncher/**/*" }
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-exists",
|
||||
"allow": [
|
||||
{ "path": "$HOME/.ezpplauncher" },
|
||||
{ "path": "$HOME/.ezpplauncher/*" },
|
||||
{ "path": "$HOME/.ezpplauncher/**/*" }
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-read-file",
|
||||
"allow": [
|
||||
{ "path": "$HOME/.ezpplauncher" },
|
||||
{ "path": "$HOME/.ezpplauncher/*" },
|
||||
{ "path": "$HOME/.ezpplauncher/**/*" }
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-write-file",
|
||||
"allow": [
|
||||
{ "path": "$HOME/.ezpplauncher" },
|
||||
{ "path": "$HOME/.ezpplauncher/*" },
|
||||
{ "path": "$HOME/.ezpplauncher/**/*" }
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-read-text-file",
|
||||
"allow": [
|
||||
{ "path": "$HOME/.ezpplauncher" },
|
||||
{ "path": "$HOME/.ezpplauncher/*" },
|
||||
{ "path": "$HOME/.ezpplauncher/**/*" }
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-mkdir",
|
||||
"allow": [
|
||||
{ "path": "$HOME/.ezpplauncher" },
|
||||
{ "path": "$HOME/.ezpplauncher/*" },
|
||||
{ "path": "$HOME/.ezpplauncher/**/*" }
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-read-dir",
|
||||
"allow": [
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-remove",
|
||||
"allow": [
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/*"
|
||||
},
|
||||
{
|
||||
"path": "$HOME/.ezpplauncher/**/*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.6 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#fff</color>
|
||||
</resources>
|
||||
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 357 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -3,4 +3,19 @@
|
||||
${OrIf} ${Silent}
|
||||
Exec '"$INSTDIR\${MAINBINARYNAME}.exe"'
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
!macro NSIS_HOOK_PREUNINSTALL
|
||||
${If} $DeleteAppDataCheckboxState = 1
|
||||
MessageBox MB_YESNO "Do you want to remove all EZPPLauncher data and themes?" IDYES do_delete IDNO skip_delete
|
||||
do_delete:
|
||||
StrCpy $R9 1
|
||||
skip_delete:
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
!macro NSIS_HOOK_POSTUNINSTALL
|
||||
${If} $R9 = 1
|
||||
RMDir /r "$PROFILE\.ezpplauncher"
|
||||
${EndIf}
|
||||
!macroend
|
||||
@@ -0,0 +1,219 @@
|
||||
use aes_gcm::aead::rand_core::RngCore;
|
||||
use aes_gcm::{
|
||||
Aes256Gcm, Key, Nonce,
|
||||
aead::{Aead, KeyInit, OsRng},
|
||||
};
|
||||
use base64::{Engine, engine::general_purpose::STANDARD as BASE64};
|
||||
use rusqlite::{Connection, OptionalExtension, params};
|
||||
use serde_json::Value;
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::path::PathBuf;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ConfigError {
|
||||
#[error("SQLite error: {0}")]
|
||||
Sqlite(#[from] rusqlite::Error),
|
||||
#[error("Encryption error: {0}")]
|
||||
Encryption(String),
|
||||
#[error("JSON error: {0}")]
|
||||
Json(#[from] serde_json::Error),
|
||||
#[error("Base64 error: {0}")]
|
||||
Base64(#[from] base64::DecodeError),
|
||||
#[error("Config not initialized")]
|
||||
NotInitialized,
|
||||
#[error("IO error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
}
|
||||
|
||||
impl serde::Serialize for ConfigError {
|
||||
fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
|
||||
s.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Config {
|
||||
db_path: PathBuf,
|
||||
conn: Option<Connection>,
|
||||
hwid_key: Option<[u8; 32]>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn new(db_path: impl Into<PathBuf>) -> Self {
|
||||
Self {
|
||||
db_path: db_path.into(),
|
||||
conn: None,
|
||||
hwid_key: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init(&mut self, hwid: &str) -> Result<bool, ConfigError> {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(hwid.as_bytes());
|
||||
let key_bytes: [u8; 32] = hasher.finalize().into();
|
||||
self.hwid_key = Some(key_bytes);
|
||||
|
||||
let is_new = !self.db_path.exists();
|
||||
|
||||
if let Some(parent) = self.db_path.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
|
||||
let conn = Connection::open(&self.db_path)?;
|
||||
|
||||
conn.execute_batch(
|
||||
"
|
||||
PRAGMA journal_mode=WAL;
|
||||
CREATE TABLE IF NOT EXISTS config (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT NOT NULL,
|
||||
encrypted INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
",
|
||||
)?;
|
||||
|
||||
self.conn = Some(conn);
|
||||
Ok(is_new)
|
||||
}
|
||||
|
||||
pub fn get(&self, key: &str) -> Result<Option<Value>, ConfigError> {
|
||||
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
|
||||
|
||||
let mut stmt = conn.prepare("SELECT value, encrypted FROM config WHERE key = ?1")?;
|
||||
|
||||
let row: Option<(String, bool)> = stmt
|
||||
.query_row(params![key], |r| Ok((r.get(0)?, r.get(1)?)))
|
||||
.optional()?;
|
||||
|
||||
match row {
|
||||
None => Ok(None),
|
||||
Some((raw, false)) => Ok(Some(serde_json::from_str::<Value>(&raw)?)),
|
||||
Some((raw, true)) => {
|
||||
let plaintext = self
|
||||
.decrypt_value(&raw)
|
||||
.map_err(|_| ConfigError::Encryption(format!("failed to decrypt '{}'", key)))?;
|
||||
|
||||
serde_json::from_str::<Value>(&plaintext)
|
||||
.map(Some)
|
||||
.map_err(|_| {
|
||||
ConfigError::Encryption(format!("decrypted '{}' is not valid JSON", key))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn exists(&self, key: &str) -> Result<bool, ConfigError> {
|
||||
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
|
||||
let count: i64 = conn.query_row(
|
||||
"SELECT COUNT(*) FROM config WHERE key = ?1",
|
||||
params![key],
|
||||
|r| r.get(0),
|
||||
)?;
|
||||
Ok(count > 0)
|
||||
}
|
||||
|
||||
/// Return all key/value pairs (decrypting encrypted ones).
|
||||
pub fn all(&self) -> Result<Vec<(String, Value)>, ConfigError> {
|
||||
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
|
||||
let mut stmt = conn.prepare("SELECT key, value, encrypted FROM config")?;
|
||||
|
||||
let rows = stmt.query_map([], |r| {
|
||||
Ok((
|
||||
r.get::<_, String>(0)?,
|
||||
r.get::<_, String>(1)?,
|
||||
r.get::<_, bool>(2)?,
|
||||
))
|
||||
})?;
|
||||
|
||||
let mut out = Vec::new();
|
||||
for row in rows {
|
||||
let (k, raw, enc) = row?;
|
||||
let v: Value = if enc {
|
||||
let pt = self.decrypt_value(&raw)?;
|
||||
serde_json::from_str(&pt)?
|
||||
} else {
|
||||
serde_json::from_str(&raw)?
|
||||
};
|
||||
out.push((k, v));
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
pub fn set<T: serde::Serialize>(
|
||||
&self,
|
||||
key: &str,
|
||||
value: T,
|
||||
encrypt: bool,
|
||||
) -> Result<(), ConfigError> {
|
||||
let json = serde_json::to_string(&value)?;
|
||||
if encrypt {
|
||||
let blob = self.encrypt_value(&json)?;
|
||||
self.upsert(key, &blob, true)
|
||||
} else {
|
||||
self.upsert(key, &json, false)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn delete(&self, key: &str) -> Result<(), ConfigError> {
|
||||
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
|
||||
conn.execute("DELETE FROM config WHERE key = ?1", params![key])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn clear(&self) -> Result<(), ConfigError> {
|
||||
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
|
||||
conn.execute("DELETE FROM config", [])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn upsert(&self, key: &str, raw: &str, encrypted: bool) -> Result<(), ConfigError> {
|
||||
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
|
||||
conn.execute(
|
||||
"INSERT INTO config (key, value, encrypted)
|
||||
VALUES (?1, ?2, ?3)
|
||||
ON CONFLICT(key) DO UPDATE SET value = excluded.value,
|
||||
encrypted = excluded.encrypted",
|
||||
params![key, raw, encrypted as i32],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn cipher(&self) -> Result<Aes256Gcm, ConfigError> {
|
||||
let key_bytes = self.hwid_key.ok_or(ConfigError::NotInitialized)?;
|
||||
let key = Key::<Aes256Gcm>::from_slice(&key_bytes);
|
||||
Ok(Aes256Gcm::new(key))
|
||||
}
|
||||
|
||||
fn encrypt_value(&self, plaintext: &str) -> Result<String, ConfigError> {
|
||||
let cipher = self.cipher()?;
|
||||
let mut nonce_bytes = [0u8; 12];
|
||||
OsRng.fill_bytes(&mut nonce_bytes);
|
||||
let nonce = Nonce::from_slice(&nonce_bytes);
|
||||
|
||||
let ciphertext = cipher
|
||||
.encrypt(nonce, plaintext.as_bytes())
|
||||
.map_err(|e| ConfigError::Encryption(e.to_string()))?;
|
||||
|
||||
let mut combined = nonce_bytes.to_vec();
|
||||
combined.extend_from_slice(&ciphertext);
|
||||
Ok(BASE64.encode(&combined))
|
||||
}
|
||||
|
||||
fn decrypt_value(&self, blob: &str) -> Result<String, ConfigError> {
|
||||
let cipher = self.cipher()?;
|
||||
let combined = BASE64.decode(blob)?;
|
||||
|
||||
if combined.len() < 12 {
|
||||
return Err(ConfigError::Encryption("blob too short".into()));
|
||||
}
|
||||
|
||||
let (nonce_bytes, ciphertext) = combined.split_at(12);
|
||||
let nonce = Nonce::from_slice(nonce_bytes);
|
||||
|
||||
let plaintext = cipher
|
||||
.decrypt(nonce, ciphertext)
|
||||
.map_err(|e| ConfigError::Encryption(e.to_string()))?;
|
||||
|
||||
String::from_utf8(plaintext).map_err(|e| ConfigError::Encryption(e.to_string()))
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,113 @@
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
use hardware_id::get_id;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Mutex;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_fs::FsExt;
|
||||
|
||||
pub mod commands;
|
||||
pub mod config;
|
||||
pub mod osudb;
|
||||
pub mod presence;
|
||||
pub mod state;
|
||||
pub mod utils;
|
||||
use crate::commands::{
|
||||
check_for_corruption, download_ezpp_launcher_update, download_ezpp_launcher_update_files,
|
||||
encrypt_string, exit, 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_count, has_net8, has_osuwinello,
|
||||
has_wmctrl, install_ezpp_launcher_update, is_osu_running, open_url_in_browser,
|
||||
presence_connect, presence_disconnect, presence_is_connected, presence_update_status,
|
||||
presence_update_user, replace_ui_files, run_osu, run_osu_updater, set_osu_config_values,
|
||||
set_osu_user_config_values, valid_osu_folder,
|
||||
use crate::{
|
||||
commands::{
|
||||
check_for_corruption, config_all, config_clear, config_delete, config_exists, config_get,
|
||||
config_set, download_and_extract_theme, download_ezpp_launcher_update,
|
||||
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,
|
||||
},
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
#[cfg(target_os = "linux")]
|
||||
unsafe {
|
||||
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
// std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
}
|
||||
|
||||
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.emit("opened", files.clone()).ok();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
let app = builder
|
||||
.setup(|app| {
|
||||
// ── Config ────────────────────────────────────────────────────────
|
||||
let home = std::env::var("HOME")
|
||||
.or_else(|_| std::env::var("USERPROFILE"))
|
||||
.unwrap_or_else(|_| ".".into());
|
||||
let db_path = PathBuf::from(home).join(".ezpplauncher").join("config.db");
|
||||
|
||||
let hwid = get_id().unwrap_or_else(|_| "recorderinsandybridge".into());
|
||||
|
||||
let mut cfg = config::Config::new(db_path);
|
||||
cfg.init(&hwid)?;
|
||||
|
||||
// ── Opened files ──────────────────────────────────────────────────
|
||||
let mut opened_files = Vec::new();
|
||||
let args = std::env::args().collect::<Vec<_>>();
|
||||
if args.len() > 1 {
|
||||
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();
|
||||
opened_files.push(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.manage(AppState {
|
||||
config: Mutex::new(cfg),
|
||||
opened_files: Mutex::new(opened_files),
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
opened_urls,
|
||||
get_hwid,
|
||||
find_osu_installation,
|
||||
valid_osu_folder,
|
||||
get_beatmapsets_count,
|
||||
get_skins,
|
||||
get_skins_count,
|
||||
get_osu_version,
|
||||
get_osu_release_stream,
|
||||
@@ -58,13 +129,27 @@ pub fn run() {
|
||||
presence_disconnect,
|
||||
presence_update_status,
|
||||
presence_update_user,
|
||||
presence_update_button,
|
||||
presence_is_connected,
|
||||
has_osuwinello,
|
||||
has_wmctrl,
|
||||
has_net8,
|
||||
encrypt_string,
|
||||
download_ezpp_launcher_update,
|
||||
install_ezpp_launcher_update
|
||||
install_ezpp_launcher_update,
|
||||
read_theme_info,
|
||||
extract_theme,
|
||||
download_and_extract_theme,
|
||||
config_get,
|
||||
config_set,
|
||||
config_exists,
|
||||
config_delete,
|
||||
config_clear,
|
||||
config_all,
|
||||
run_open_tablet_driver,
|
||||
stop_open_tablet_driver,
|
||||
is_open_tablet_driver_running,
|
||||
is_open_tablet_driver_path_valid
|
||||
])
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
@@ -73,12 +158,7 @@ pub fn run() {
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while building tauri application");
|
||||
|
||||
app.run(|_app_handle, event| {
|
||||
if let tauri::RunEvent::ExitRequested { api, .. } = event {
|
||||
api.prevent_exit();
|
||||
|
||||
tauri::async_runtime::block_on(presence::disconnect());
|
||||
std::process::exit(0);
|
||||
}
|
||||
app.run(|app, event| {
|
||||
presence::handle_run_event(app, &event);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,370 @@
|
||||
use std::io::{Cursor, Read};
|
||||
|
||||
use anyhow::{Result, anyhow};
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct OsuReader {
|
||||
cursor: Cursor<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl OsuReader {
|
||||
pub fn new(data: Vec<u8>) -> Self {
|
||||
Self {
|
||||
cursor: Cursor::new(data),
|
||||
}
|
||||
}
|
||||
|
||||
fn read_i16(&mut self) -> Result<i16> {
|
||||
Ok(self.cursor.read_i16::<LittleEndian>()?)
|
||||
}
|
||||
|
||||
fn read_i32(&mut self) -> Result<i32> {
|
||||
Ok(self.cursor.read_i32::<LittleEndian>()?)
|
||||
}
|
||||
|
||||
fn read_i64(&mut self) -> Result<i64> {
|
||||
Ok(self.cursor.read_i64::<LittleEndian>()?)
|
||||
}
|
||||
|
||||
fn read_u8(&mut self) -> Result<u8> {
|
||||
Ok(self.cursor.read_u8()?)
|
||||
}
|
||||
|
||||
fn read_f32(&mut self) -> Result<f32> {
|
||||
Ok(self.cursor.read_f32::<LittleEndian>()?)
|
||||
}
|
||||
|
||||
fn read_f64(&mut self) -> Result<f64> {
|
||||
Ok(self.cursor.read_f64::<LittleEndian>()?)
|
||||
}
|
||||
|
||||
fn read_bool(&mut self) -> Result<bool> {
|
||||
Ok(self.read_u8()? != 0)
|
||||
}
|
||||
|
||||
fn read_string(&mut self) -> Result<Option<String>> {
|
||||
let indicator = self.read_u8()?;
|
||||
|
||||
if indicator == 0 {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
if indicator != 0x0B {
|
||||
return Err(anyhow!("Invalid osu string indicator"));
|
||||
}
|
||||
|
||||
let len = self.read_uleb128()? as usize;
|
||||
let mut buf = vec![0; len];
|
||||
self.cursor.read_exact(&mut buf)?;
|
||||
|
||||
Ok(Some(String::from_utf8(buf)?))
|
||||
}
|
||||
|
||||
fn read_uleb128(&mut self) -> Result<u64> {
|
||||
let mut result = 0;
|
||||
let mut shift = 0;
|
||||
|
||||
loop {
|
||||
let byte = self.read_u8()?;
|
||||
result |= ((byte & 0x7F) as u64) << shift;
|
||||
|
||||
if (byte & 0x80) == 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
shift += 7;
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TimingPoint {
|
||||
pub bpm: f64,
|
||||
pub offset: f64,
|
||||
pub inherited: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Beatmap {
|
||||
pub artist_name: Option<String>,
|
||||
pub artist_unicode: Option<String>,
|
||||
pub song_title: Option<String>,
|
||||
pub song_title_unicode: Option<String>,
|
||||
pub creator: Option<String>,
|
||||
pub difficulty: Option<String>,
|
||||
pub audio: Option<String>,
|
||||
pub md5: Option<String>,
|
||||
pub osu_file_name: Option<String>,
|
||||
|
||||
pub ranked_status: u8,
|
||||
pub hitcircles: i16,
|
||||
pub slider_count: i16,
|
||||
pub spinner_count: i16,
|
||||
pub last_modification: i64,
|
||||
|
||||
pub approach_rate: f32,
|
||||
pub circle_size: f32,
|
||||
pub hp_drain: f32,
|
||||
pub overall_difficulty: f32,
|
||||
pub slider_velocity: f64,
|
||||
|
||||
pub difficulties: HashMap<i32, f64>,
|
||||
|
||||
pub drain_time: i32,
|
||||
pub total_time: i32,
|
||||
pub preview_offset: i32,
|
||||
|
||||
pub beatmap_id: i32,
|
||||
pub beatmapset_id: i32,
|
||||
pub thread_id: i32,
|
||||
|
||||
pub grade_standard: u8,
|
||||
pub grade_taiko: u8,
|
||||
pub grade_catch: u8,
|
||||
pub grade_mania: u8,
|
||||
|
||||
pub local_beatmap_offset: i16,
|
||||
pub stack_leniency: f32,
|
||||
|
||||
pub mode: u8,
|
||||
pub song_source: Option<String>,
|
||||
pub song_tags: Option<String>,
|
||||
|
||||
pub online_beatmap_offset: i16,
|
||||
pub title_font: Option<String>,
|
||||
|
||||
pub unplayed: bool,
|
||||
pub last_played: i64,
|
||||
pub osz2: bool,
|
||||
pub folder_name: Option<String>,
|
||||
pub last_checked_against_repository: i64,
|
||||
|
||||
pub ignore_sound: bool,
|
||||
pub ignore_skin: bool,
|
||||
pub disable_storyboard: bool,
|
||||
pub disable_video: bool,
|
||||
pub visual_override: bool,
|
||||
|
||||
pub last_modification_time: i32,
|
||||
pub mania_scroll_speed: u8,
|
||||
|
||||
pub timing_points: Vec<TimingPoint>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct OsuDbData {
|
||||
pub osuver: i32,
|
||||
pub folder_count: i32,
|
||||
pub is_unlocked: bool,
|
||||
pub date_unlock_ticks: i64,
|
||||
pub username: Option<String>,
|
||||
pub beatmaps: Vec<Beatmap>,
|
||||
pub userperms: i32,
|
||||
}
|
||||
|
||||
//
|
||||
// =========================
|
||||
// PARSER
|
||||
// =========================
|
||||
//
|
||||
|
||||
pub fn parse_osudb(bytes: Vec<u8>) -> Result<OsuDbData> {
|
||||
let mut reader = OsuReader::new(bytes);
|
||||
|
||||
let osuver = reader.read_i32()?;
|
||||
let folder_count = reader.read_i32()?;
|
||||
let is_unlocked = reader.read_bool()?;
|
||||
let date_unlock_ticks = reader.read_i64()?;
|
||||
let username = reader.read_string()?;
|
||||
let beatmaps_count = reader.read_i32()?;
|
||||
|
||||
let mut beatmaps = Vec::new();
|
||||
|
||||
for _ in 0..beatmaps_count {
|
||||
if osuver < 20191107 {
|
||||
reader.read_i32()?; // entry size
|
||||
}
|
||||
|
||||
let artist_name = reader.read_string()?;
|
||||
let artist_unicode = reader.read_string()?;
|
||||
let song_title = reader.read_string()?;
|
||||
let song_title_unicode = reader.read_string()?;
|
||||
let creator = reader.read_string()?;
|
||||
let difficulty = reader.read_string()?;
|
||||
let audio = reader.read_string()?;
|
||||
let md5 = reader.read_string()?;
|
||||
let osu_file_name = reader.read_string()?;
|
||||
|
||||
let ranked_status = reader.read_u8()?;
|
||||
let hitcircles = reader.read_i16()?;
|
||||
let slider_count = reader.read_i16()?;
|
||||
let spinner_count = reader.read_i16()?;
|
||||
let last_modification = reader.read_i64()?;
|
||||
|
||||
let approach_rate = if osuver < 20140609 {
|
||||
reader.read_u8()? as f32
|
||||
} else {
|
||||
reader.read_f32()?
|
||||
};
|
||||
|
||||
let circle_size = if osuver < 20140609 {
|
||||
reader.read_u8()? as f32
|
||||
} else {
|
||||
reader.read_f32()?
|
||||
};
|
||||
|
||||
let hp_drain = if osuver < 20140609 {
|
||||
reader.read_u8()? as f32
|
||||
} else {
|
||||
reader.read_f32()?
|
||||
};
|
||||
|
||||
let overall_difficulty = if osuver < 20140609 {
|
||||
reader.read_u8()? as f32
|
||||
} else {
|
||||
reader.read_f32()?
|
||||
};
|
||||
|
||||
let slider_velocity = reader.read_f64()?;
|
||||
|
||||
let mut difficulties: HashMap<i32, f64> = HashMap::new();
|
||||
|
||||
if osuver >= 20140609 {
|
||||
for _ in 0..4 {
|
||||
let len = reader.read_i32()?;
|
||||
for _ in 0..len {
|
||||
reader.read_u8()?;
|
||||
let mode = reader.read_i32()?;
|
||||
reader.read_u8()?;
|
||||
let diff = if osuver > 20250107 {
|
||||
reader.read_f32()? as f64
|
||||
} else {
|
||||
reader.read_f64()?
|
||||
};
|
||||
|
||||
difficulties.insert(mode, diff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let drain_time = reader.read_i32()?;
|
||||
let total_time = reader.read_i32()?;
|
||||
let preview_offset = reader.read_i32()?;
|
||||
|
||||
let timing_len = reader.read_i32()?;
|
||||
let mut timing_points = Vec::new();
|
||||
for _ in 0..timing_len {
|
||||
timing_points.push(TimingPoint {
|
||||
bpm: reader.read_f64()?,
|
||||
offset: reader.read_f64()?,
|
||||
inherited: reader.read_bool()?,
|
||||
});
|
||||
}
|
||||
|
||||
let beatmap_id = reader.read_i32()?;
|
||||
let beatmapset_id = reader.read_i32()?;
|
||||
let thread_id = reader.read_i32()?;
|
||||
|
||||
let grade_standard = reader.read_u8()?;
|
||||
let grade_taiko = reader.read_u8()?;
|
||||
let grade_catch = reader.read_u8()?;
|
||||
let grade_mania = reader.read_u8()?;
|
||||
|
||||
let local_beatmap_offset = reader.read_i16()?;
|
||||
let stack_leniency = reader.read_f32()?;
|
||||
|
||||
let mode = reader.read_u8()?;
|
||||
let song_source = reader.read_string()?;
|
||||
let song_tags = reader.read_string()?;
|
||||
|
||||
let online_beatmap_offset = reader.read_i16()?;
|
||||
let title_font = reader.read_string()?;
|
||||
|
||||
let unplayed = reader.read_bool()?;
|
||||
let last_played = reader.read_i64()?;
|
||||
let osz2 = reader.read_bool()?;
|
||||
let folder_name = reader.read_string()?;
|
||||
let last_checked_against_repository = reader.read_i64()?;
|
||||
|
||||
let ignore_sound = reader.read_bool()?;
|
||||
let ignore_skin = reader.read_bool()?;
|
||||
let disable_storyboard = reader.read_bool()?;
|
||||
let disable_video = reader.read_bool()?;
|
||||
let visual_override = reader.read_bool()?;
|
||||
|
||||
if osuver < 20140609 {
|
||||
reader.read_i16()?;
|
||||
}
|
||||
|
||||
let last_modification_time = reader.read_i32()?;
|
||||
let mania_scroll_speed = reader.read_u8()?;
|
||||
|
||||
beatmaps.push(Beatmap {
|
||||
artist_name,
|
||||
artist_unicode,
|
||||
song_title,
|
||||
song_title_unicode,
|
||||
creator,
|
||||
difficulty,
|
||||
audio,
|
||||
md5,
|
||||
osu_file_name,
|
||||
ranked_status,
|
||||
hitcircles,
|
||||
slider_count,
|
||||
spinner_count,
|
||||
last_modification,
|
||||
approach_rate,
|
||||
circle_size,
|
||||
hp_drain,
|
||||
overall_difficulty,
|
||||
slider_velocity,
|
||||
difficulties,
|
||||
drain_time,
|
||||
total_time,
|
||||
preview_offset,
|
||||
beatmap_id,
|
||||
beatmapset_id,
|
||||
thread_id,
|
||||
grade_standard,
|
||||
grade_taiko,
|
||||
grade_catch,
|
||||
grade_mania,
|
||||
local_beatmap_offset,
|
||||
stack_leniency,
|
||||
mode,
|
||||
song_source,
|
||||
song_tags,
|
||||
online_beatmap_offset,
|
||||
title_font,
|
||||
unplayed,
|
||||
last_played,
|
||||
osz2,
|
||||
folder_name,
|
||||
last_checked_against_repository,
|
||||
ignore_sound,
|
||||
ignore_skin,
|
||||
disable_storyboard,
|
||||
disable_video,
|
||||
visual_override,
|
||||
last_modification_time,
|
||||
mania_scroll_speed,
|
||||
timing_points,
|
||||
});
|
||||
}
|
||||
|
||||
let userperms = reader.read_i32()?;
|
||||
|
||||
Ok(OsuDbData {
|
||||
osuver,
|
||||
folder_count,
|
||||
is_unlocked,
|
||||
date_unlock_ticks,
|
||||
username,
|
||||
beatmaps,
|
||||
userperms,
|
||||
})
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
use discord_rich_presence::{
|
||||
DiscordIpc, DiscordIpcClient,
|
||||
activity::{Activity, Assets, Button, Timestamps},
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
use presenceforge::{ActivityBuilder, AsyncDiscordIpcClient};
|
||||
use std::sync::Mutex as StdMutex;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use tauri::{AppHandle, RunEvent};
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use tokio::time::{Duration, interval};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PresenceButton {
|
||||
pub label: String,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PresenceData {
|
||||
pub state: String,
|
||||
@@ -16,6 +20,21 @@ pub struct PresenceData {
|
||||
pub large_image_text: String,
|
||||
pub small_image_key: Option<String>,
|
||||
pub small_image_text: Option<String>,
|
||||
pub dynamic_button: Option<PresenceButton>,
|
||||
}
|
||||
|
||||
impl Default for PresenceData {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
state: "Idle in Launcher...".to_string(),
|
||||
details: " ".to_string(),
|
||||
large_image_key: "ezppfarm".to_string(),
|
||||
large_image_text: "EZPPFarm".to_string(),
|
||||
small_image_key: None,
|
||||
small_image_text: None,
|
||||
dynamic_button: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -26,11 +45,19 @@ enum PresenceCommand {
|
||||
IsConnected(oneshot::Sender<bool>),
|
||||
}
|
||||
|
||||
enum ReconnectResult {
|
||||
Connected(AsyncDiscordIpcClient),
|
||||
Failed,
|
||||
}
|
||||
|
||||
struct PresenceActor {
|
||||
receiver: mpsc::Receiver<PresenceCommand>,
|
||||
client: Option<DiscordIpcClient>,
|
||||
reconnect_rx: mpsc::Receiver<ReconnectResult>,
|
||||
reconnect_tx: mpsc::Sender<ReconnectResult>,
|
||||
client: Option<AsyncDiscordIpcClient>,
|
||||
data: PresenceData,
|
||||
start_timestamp: i64,
|
||||
reconnecting: bool,
|
||||
}
|
||||
|
||||
impl PresenceActor {
|
||||
@@ -40,137 +67,184 @@ impl PresenceActor {
|
||||
.unwrap()
|
||||
.as_secs() as i64;
|
||||
|
||||
let data = PresenceData {
|
||||
state: "Idle in Launcher...".to_string(),
|
||||
details: " ".to_string(),
|
||||
large_image_key: "ezppfarm".to_string(),
|
||||
large_image_text: "EZPPFarm".to_string(),
|
||||
small_image_key: None,
|
||||
small_image_text: None,
|
||||
};
|
||||
let (reconnect_tx, reconnect_rx) = mpsc::channel(1);
|
||||
|
||||
PresenceActor {
|
||||
Self {
|
||||
receiver,
|
||||
reconnect_rx,
|
||||
reconnect_tx,
|
||||
client: None,
|
||||
data,
|
||||
data: PresenceData::default(),
|
||||
start_timestamp: start,
|
||||
reconnecting: false,
|
||||
}
|
||||
}
|
||||
|
||||
async fn run(&mut self) {
|
||||
let mut update_interval = interval(Duration::from_millis(2500));
|
||||
let mut heartbeat = interval(Duration::from_secs(5));
|
||||
heartbeat.tick().await;
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
Some(cmd) = self.receiver.recv() => {
|
||||
match cmd {
|
||||
PresenceCommand::Connect(responder) => self.handle_connect(responder).await,
|
||||
PresenceCommand::Disconnect(responder) => {
|
||||
self.handle_disconnect(responder).await;
|
||||
},
|
||||
PresenceCommand::UpdateData(new_data) => {
|
||||
self.data = new_data;
|
||||
},
|
||||
PresenceCommand::IsConnected(responder) => {
|
||||
let _ = responder.send(self.client.is_some());
|
||||
PresenceCommand::Connect(resp) => self.cmd_connect(resp).await,
|
||||
PresenceCommand::Disconnect(resp) => self.cmd_disconnect(resp).await,
|
||||
PresenceCommand::UpdateData(data) => {
|
||||
self.data = data;
|
||||
self.push_presence().await;
|
||||
}
|
||||
PresenceCommand::IsConnected(resp) => {
|
||||
let _ = resp.send(self.client.is_some());
|
||||
}
|
||||
}
|
||||
}
|
||||
_ = update_interval.tick() => {
|
||||
if self.client.is_some() {
|
||||
self.handle_update().await;
|
||||
|
||||
Some(result) = self.reconnect_rx.recv() => {
|
||||
self.reconnecting = false;
|
||||
match result {
|
||||
ReconnectResult::Connected(client) => {
|
||||
println!("Presence: reconnect succeeded.");
|
||||
self.client = Some(client);
|
||||
self.push_presence().await;
|
||||
}
|
||||
ReconnectResult::Failed => {
|
||||
eprintln!("Presence: all reconnect attempts exhausted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ = heartbeat.tick() => {
|
||||
self.push_presence().await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_connect(&mut self, responder: oneshot::Sender<bool>) {
|
||||
async fn cmd_connect(&mut self, resp: oneshot::Sender<bool>) {
|
||||
if self.client.is_some() {
|
||||
let _ = responder.send(true);
|
||||
let _ = resp.send(true);
|
||||
return;
|
||||
}
|
||||
|
||||
println!("Actor: Connecting to Discord...");
|
||||
let mut dc_client = DiscordIpcClient::new("1032772293220384808");
|
||||
match dc_client.connect() {
|
||||
Ok(()) => {
|
||||
self.client = Some(dc_client);
|
||||
println!("Actor: Connected successfully.");
|
||||
self.handle_update().await;
|
||||
let _ = responder.send(true);
|
||||
match try_connect_once().await {
|
||||
Some(client) => {
|
||||
self.client = Some(client);
|
||||
self.reconnecting = false;
|
||||
self.push_presence().await;
|
||||
let _ = resp.send(true);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to create Discord client: {:?}", e);
|
||||
let _ = responder.send(false);
|
||||
None => {
|
||||
eprintln!("Presence: initial connect failed; spawning reconnect task.");
|
||||
let _ = resp.send(false);
|
||||
self.spawn_reconnect_task();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_disconnect(&mut self, responder: oneshot::Sender<()>) {
|
||||
async fn cmd_disconnect(&mut self, resp: oneshot::Sender<()>) {
|
||||
if let Some(mut client) = self.client.take() {
|
||||
println!("Actor: Disconnecting...");
|
||||
let _ = client.clear_activity().map_err(|e| e.to_string());
|
||||
let _ = client.close().map_err(|e| e.to_string());
|
||||
println!("Actor: Disconnected successfully.");
|
||||
let _ = client.clear_activity().await;
|
||||
println!("Presence: disconnected.");
|
||||
}
|
||||
let _ = responder.send(());
|
||||
let _ = resp.send(());
|
||||
}
|
||||
|
||||
async fn handle_update(&mut self) {
|
||||
if let Some(client) = self.client.as_mut() {
|
||||
let mut assets = Assets::new()
|
||||
.large_image(&self.data.large_image_key)
|
||||
.large_text(&self.data.large_image_text);
|
||||
async fn push_presence(&mut self) {
|
||||
let client = match self.client.as_mut() {
|
||||
Some(c) => c,
|
||||
None => return,
|
||||
};
|
||||
|
||||
if let Some(key) = &self.data.small_image_key {
|
||||
assets = assets.small_image(key);
|
||||
}
|
||||
if let Some(text) = &self.data.small_image_text {
|
||||
assets = assets.small_text(text);
|
||||
}
|
||||
let mut builder = ActivityBuilder::new()
|
||||
.state(&self.data.state)
|
||||
.details(&self.data.details)
|
||||
.start_timestamp(self.start_timestamp as u64)
|
||||
.large_image(&self.data.large_image_key)
|
||||
.large_text(&self.data.large_image_text);
|
||||
|
||||
let activity = Activity::new()
|
||||
.state(&self.data.state)
|
||||
.details(&self.data.details)
|
||||
.timestamps(Timestamps::new().start(self.start_timestamp))
|
||||
.assets(assets)
|
||||
.buttons(vec![
|
||||
Button::new(
|
||||
"Download the Launcher",
|
||||
"https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/releases/latest",
|
||||
),
|
||||
Button::new("Join EZPPFarm", "https://ez-pp.farm/discord"),
|
||||
]);
|
||||
if let Some(key) = &self.data.small_image_key {
|
||||
builder = builder.small_image(key);
|
||||
}
|
||||
if let Some(text) = &self.data.small_image_text {
|
||||
builder = builder.small_text(text);
|
||||
}
|
||||
|
||||
if let Err(e) = client.set_activity(activity).map_err(|e| e.to_string()) {
|
||||
eprintln!("Failed to set activity, disconnecting: {:?}", e);
|
||||
if let Some(mut client) = self.client.take() {
|
||||
let _ = client.clear_activity();
|
||||
let _ = client.close();
|
||||
if let Some(btn) = &self.data.dynamic_button {
|
||||
builder = builder.button(&btn.label, &btn.url);
|
||||
} else {
|
||||
builder = builder.button(
|
||||
"Download the Launcher",
|
||||
"https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/releases/latest",
|
||||
);
|
||||
}
|
||||
builder = builder.button("Join EZPPFarm", "https://ez-pp.farm/discord");
|
||||
|
||||
let activity = builder.build();
|
||||
|
||||
/* println!("Presence: updating activity: {:?}", activity); */
|
||||
if let Err(e) = client.set_activity(&activity).await {
|
||||
eprintln!("Presence: set_activity failed ({:?}); will reconnect.", e);
|
||||
self.client = None;
|
||||
self.spawn_reconnect_task();
|
||||
}
|
||||
}
|
||||
|
||||
fn spawn_reconnect_task(&mut self) {
|
||||
if self.reconnecting {
|
||||
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);
|
||||
println!(
|
||||
"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(client)).await;
|
||||
return;
|
||||
}
|
||||
}
|
||||
let _ = tx.send(ReconnectResult::Failed).await;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async fn try_connect_once() -> Option<AsyncDiscordIpcClient> {
|
||||
match AsyncDiscordIpcClient::new("1032772293220384808").await {
|
||||
Ok(mut client) => match client.connect().await {
|
||||
Ok(_) => {
|
||||
println!("Presence: IPC connected.");
|
||||
Some(client)
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Presence: IPC connect error: {:?}", e);
|
||||
None
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
eprintln!("Presence: failed to create client: {:?}", e);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PRESENCE_TX: Lazy<mpsc::Sender<PresenceCommand>> = Lazy::new(|| {
|
||||
let (tx, rx) = mpsc::channel(10);
|
||||
let (tx, rx) = mpsc::channel(32);
|
||||
let mut actor = PresenceActor::new(rx);
|
||||
tokio::spawn(async move { actor.run().await });
|
||||
tx
|
||||
});
|
||||
|
||||
pub static PRESENCE_DATA: Lazy<StdMutex<PresenceData>> = Lazy::new(|| {
|
||||
StdMutex::new(PresenceData {
|
||||
state: "Idle in Launcher...".to_string(),
|
||||
details: " ".to_string(),
|
||||
large_image_key: "ezppfarm".to_string(),
|
||||
large_image_text: "EZPPFarm".to_string(),
|
||||
small_image_key: None,
|
||||
small_image_text: None,
|
||||
})
|
||||
});
|
||||
pub static PRESENCE_DATA: Lazy<StdMutex<PresenceData>> =
|
||||
Lazy::new(|| StdMutex::new(PresenceData::default()));
|
||||
|
||||
pub async fn connect() -> bool {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
@@ -182,14 +256,8 @@ pub async fn connect() -> bool {
|
||||
|
||||
pub async fn disconnect() {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
if PRESENCE_TX
|
||||
.send(PresenceCommand::Disconnect(tx))
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
let _ = rx.await;
|
||||
} else {
|
||||
println!("Could not send disconnect command; actor may not be running.");
|
||||
if PRESENCE_TX.send(PresenceCommand::Disconnect(tx)).await.is_ok() {
|
||||
let _ = tokio::time::timeout(Duration::from_secs(2), rx).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,30 +274,73 @@ pub async fn has_presence() -> bool {
|
||||
}
|
||||
|
||||
pub fn update_status(state: Option<&str>, details: Option<&str>, large_image_key: Option<&str>) {
|
||||
let mut data = PRESENCE_DATA.lock().unwrap();
|
||||
if let Some(s) = state {
|
||||
data.state = s.to_string();
|
||||
}
|
||||
if let Some(d) = details {
|
||||
data.details = d.to_string();
|
||||
}
|
||||
if let Some(img) = large_image_key {
|
||||
data.large_image_key = img.to_string();
|
||||
}
|
||||
let data_clone = data.clone();
|
||||
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();
|
||||
}
|
||||
guard.clone()
|
||||
};
|
||||
|
||||
let tx = PRESENCE_TX.clone();
|
||||
tokio::spawn(async move {
|
||||
let _ = tx.send(PresenceCommand::UpdateData(data_clone)).await;
|
||||
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
|
||||
});
|
||||
}
|
||||
|
||||
pub fn update_user(username: Option<&str>, id: Option<&str>) {
|
||||
let mut data = PRESENCE_DATA.lock().unwrap();
|
||||
data.small_image_key = id.map(|id_str| format!("https://a.ez-pp.farm/{}", id_str));
|
||||
data.small_image_text = username.map(|s| s.to_string());
|
||||
let data_clone = data.clone();
|
||||
let data = {
|
||||
let mut guard = PRESENCE_DATA.lock().unwrap();
|
||||
guard.small_image_key = id.map(|s| format!("https://a.ez-pp.farm/{}", s));
|
||||
guard.small_image_text = username.map(str::to_string);
|
||||
guard.clone()
|
||||
};
|
||||
|
||||
let tx = PRESENCE_TX.clone();
|
||||
tokio::spawn(async move {
|
||||
let _ = tx.send(PresenceCommand::UpdateData(data_clone)).await;
|
||||
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
|
||||
});
|
||||
}
|
||||
|
||||
pub fn set_button(label: &str, url: &str) {
|
||||
let data = {
|
||||
let mut guard = PRESENCE_DATA.lock().unwrap();
|
||||
guard.dynamic_button = Some(PresenceButton {
|
||||
label: label.to_string(),
|
||||
url: url.to_string(),
|
||||
});
|
||||
guard.clone()
|
||||
};
|
||||
|
||||
let tx = PRESENCE_TX.clone();
|
||||
tokio::spawn(async move {
|
||||
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
|
||||
});
|
||||
}
|
||||
|
||||
pub fn clear_button() {
|
||||
let data = {
|
||||
let mut guard = PRESENCE_DATA.lock().unwrap();
|
||||
guard.dynamic_button = None;
|
||||
guard.clone()
|
||||
};
|
||||
|
||||
let tx = PRESENCE_TX.clone();
|
||||
tokio::spawn(async move {
|
||||
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
|
||||
});
|
||||
}
|
||||
|
||||
pub fn handle_run_event(_app: &AppHandle, event: &RunEvent) {
|
||||
if let RunEvent::ExitRequested { .. } | RunEvent::Exit = event {
|
||||
tauri::async_runtime::block_on(async {
|
||||
disconnect().await;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// state.rs
|
||||
use crate::config::Config;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub struct AppState {
|
||||
pub config: Mutex<Config>,
|
||||
pub opened_files: Mutex<Vec<PathBuf>>,
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "EZPPLauncher",
|
||||
"version": "3.1.2",
|
||||
"version": "3.2.3",
|
||||
"identifier": "farm.EZPPFarm.Launcher",
|
||||
"mainBinaryName": "ezpplauncher",
|
||||
"build": {
|
||||
@@ -16,19 +16,45 @@
|
||||
"title": "EZPPLauncher",
|
||||
"width": 1000,
|
||||
"height": 650,
|
||||
"minWidth": 1000,
|
||||
"minHeight": 650,
|
||||
"decorations": false,
|
||||
"resizable": false,
|
||||
"maximizable": false
|
||||
"maximizable": false,
|
||||
"shadow": true
|
||||
}
|
||||
],
|
||||
"withGlobalTauri": true,
|
||||
"security": {
|
||||
"csp": null
|
||||
"csp": {
|
||||
"default-src": "'self' tauri: customprotocol: asset:",
|
||||
"script-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost https://analytics.ez-pp.farm",
|
||||
"style-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost",
|
||||
"img-src": "'self' asset: http://asset.localhost https://asset.localhost blob: data: https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct",
|
||||
"connect-src": "'self' ipc: http://ipc.localhost https://ez-pp.farm https://api.ez-pp.farm https://c.ez-pp.farm https://analytics.ez-pp.farm https://git.ez-pp.farm https://osu.direct https://osu.ppy.sh",
|
||||
"media-src": "'self' asset: http://asset.localhost https://asset.localhost blob:",
|
||||
"font-src": [
|
||||
"'self'",
|
||||
"asset:",
|
||||
"blob:",
|
||||
"data:",
|
||||
"http://asset.localhost",
|
||||
"https://asset.localhost"
|
||||
]
|
||||
},
|
||||
"assetProtocol": {
|
||||
"enable": true,
|
||||
"scope": [
|
||||
"$HOME/.ezpplauncher/themes/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"publisher": "EZPPFarm",
|
||||
"copyright": "EZPPFarm",
|
||||
"shortDescription": "osu! launcher for EZPPFarm",
|
||||
"longDescription": "EZPPLauncher is a custom osu! launcher for the EZPPFarm server, featuring automatic updates, ingame login, stat tracking and launcher theming.",
|
||||
"homepage": "https://ez-pp.farm",
|
||||
"license": "GPL-3.0",
|
||||
"active": true,
|
||||
@@ -36,6 +62,17 @@
|
||||
"nsis",
|
||||
"appimage"
|
||||
],
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": [
|
||||
"ezpplauncher-theme"
|
||||
],
|
||||
"name": "EZPPLauncher Theme",
|
||||
"description": "EZPPLauncher Theme File",
|
||||
"role": "Viewer",
|
||||
"mimeType": "application/x-ezpplauncher-theme"
|
||||
}
|
||||
],
|
||||
"windows": {
|
||||
"webviewInstallMode": {
|
||||
"silent": true,
|
||||
@@ -44,6 +81,7 @@
|
||||
"nsis": {
|
||||
"installMode": "currentUser",
|
||||
"compression": "lzma",
|
||||
"installerIcon": "icons/icon.ico",
|
||||
"installerHooks": "./nsis/nsis-hooks.nsh"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
@custom-variant dark (&:where(.dark, .dark *));
|
||||
|
||||
@import "@fontsource-variable/sora";
|
||||
@import "@fontsource/space-mono";
|
||||
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(95.36% 0.017 256.57);
|
||||
@@ -41,7 +44,7 @@
|
||||
--sidebar-ring: oklch(60.7% 0.226 299.68);
|
||||
|
||||
--font-sans:
|
||||
"Sora", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
||||
"Sora Variable", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
||||
"Segoe UI Symbol", "Noto Color Emoji";
|
||||
--font-mono:
|
||||
"Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
||||
|
||||
|
After Width: | Height: | Size: 173 KiB |
@@ -3,7 +3,7 @@ import type {
|
||||
EZPPUserInfoResponse,
|
||||
EZPPUserResponse,
|
||||
EZPPUSerStatusResponse,
|
||||
} from '@/types';
|
||||
} from '$lib/types';
|
||||
import { betterFetch } from '@better-fetch/fetch';
|
||||
|
||||
const BANCHO_ENDPOINT = 'https://c.ez-pp.farm/';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Release } from '@/types';
|
||||
import type { Release } from '$lib/types';
|
||||
import { betterFetch } from '@better-fetch/fetch';
|
||||
import semver from 'semver';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { StreamsResult } from '@/types';
|
||||
import type { StreamsResult } from '$lib/types';
|
||||
import { betterFetch } from '@better-fetch/fetch';
|
||||
|
||||
const API_ENDPOINT = 'https://osu.ppy.sh/api/';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
import { buttonVariants } from '$lib/components/ui/button/index.js';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
import { buttonVariants } from '$lib/components/ui/button/index.js';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { AlertDialog as AlertDialogPrimitive, type WithoutChild } from 'bits-ui';
|
||||
import AlertDialogOverlay from './alert-dialog-overlay.svelte';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import AlertDialogOverlay from './alert-dialog-overlay.svelte';
|
||||
import { AlertDialog as AlertDialogPrimitive, type WithoutChild } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { cn } from '$lib/utils.js';
|
||||
import type { WithElementRef } from 'bits-ui';
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
import { cn } from '$lib/utils.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { cn } from '$lib/utils.js';
|
||||
import type { WithElementRef } from 'bits-ui';
|
||||
import type { HTMLAttributes } from 'svelte/elements';
|
||||
import { cn } from '$lib/utils.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
import Title from './alert-dialog-title.svelte';
|
||||
import Action from './alert-dialog-action.svelte';
|
||||
import Cancel from './alert-dialog-cancel.svelte';
|
||||
import Content from './alert-dialog-content.svelte';
|
||||
import Description from './alert-dialog-description.svelte';
|
||||
import Footer from './alert-dialog-footer.svelte';
|
||||
import Header from './alert-dialog-header.svelte';
|
||||
import Overlay from './alert-dialog-overlay.svelte';
|
||||
import Content from './alert-dialog-content.svelte';
|
||||
import Description from './alert-dialog-description.svelte';
|
||||
import Title from './alert-dialog-title.svelte';
|
||||
import { AlertDialog as AlertDialogPrimitive } from 'bits-ui';
|
||||
|
||||
const Root = AlertDialogPrimitive.Root;
|
||||
const Trigger = AlertDialogPrimitive.Trigger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Logo from '$assets/logo.png';
|
||||
import { reduceAnimations } from '$lib/userSettings';
|
||||
|
||||
//TODO: maybe dynamic background images fetched from ezpp?
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
<div
|
||||
class="relative h-full w-full from-0% to-90% bg-gradient-to-b from-transparent to-black z-50"
|
||||
></div>
|
||||
{#each streaks as s}
|
||||
{#each streaks as s, index (index)}
|
||||
<div
|
||||
class="streak drop-shadow-lg"
|
||||
class="streak drop-shadow-lg transition-opacity duration-1000"
|
||||
style="
|
||||
width:{s.width}px;
|
||||
height:{s.height}px;
|
||||
left:{s.x}%;
|
||||
top:{s.y}%;
|
||||
opacity:{s.opacity};
|
||||
opacity:{$reduceAnimations ? 0 : s.opacity};
|
||||
animation-duration:{s.duration}s;
|
||||
animation-delay:-{s.delay}s;
|
||||
"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Root from './avatar.svelte';
|
||||
import Image from './avatar-image.svelte';
|
||||
import Fallback from './avatar-fallback.svelte';
|
||||
import Image from './avatar-image.svelte';
|
||||
import Root from './avatar.svelte';
|
||||
|
||||
export {
|
||||
Root,
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { cn } from '$lib/utils.js';
|
||||
import type { WithElementRef } from 'bits-ui';
|
||||
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
||||
import { cn } from '$lib/utils.js';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
@@ -42,7 +42,7 @@
|
||||
this={href ? 'a' : 'span'}
|
||||
bind:this={ref}
|
||||
{href}
|
||||
class={cn(badgeVariants({ variant, className }))}
|
||||
class={cn(badgeVariants({ variant }), className)}
|
||||
{...restProps}
|
||||
>
|
||||
{@render children?.()}
|
||||
|
||||
@@ -53,13 +53,13 @@
|
||||
</script>
|
||||
|
||||
{#if href}
|
||||
<a bind:this={ref} class={cn(buttonVariants({ variant, size, className }))} {href} {...restProps}>
|
||||
<a bind:this={ref} class={cn(buttonVariants({ variant, size }), className)} {href} {...restProps}>
|
||||
{@render children?.()}
|
||||
</a>
|
||||
{:else}
|
||||
<button
|
||||
bind:this={ref}
|
||||
class={cn(buttonVariants({ variant, size, className }))}
|
||||
class={cn(buttonVariants({ variant, size }), className)}
|
||||
{type}
|
||||
{...restProps}
|
||||
>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Checkbox as CheckboxPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import Check from '@lucide/svelte/icons/check';
|
||||
import Minus from '@lucide/svelte/icons/minus';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { Checkbox as CheckboxPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Root from './checkbox.svelte';
|
||||
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Ellipsis from 'lucide-svelte/icons/ellipsis';
|
||||
import Play from 'lucide-svelte/icons/play';
|
||||
import Ellipsis from '@lucide/svelte/icons/ellipsis';
|
||||
import Play from '@lucide/svelte/icons/play';
|
||||
|
||||
const prop: {
|
||||
downloading: boolean;
|
||||
@@ -17,7 +17,7 @@
|
||||
</script>
|
||||
|
||||
<button
|
||||
class="group flex items-center h-12 rounded-full bg-primary-300 disabled:bg-primary-300/70 shadow-lg shadow-primary/25 transition-all not-disabled:hover:shadow-primary/40 not-disabled:hover:brightness-110 not-disabled:active:scale-[0.98] cursor-pointer w-fit"
|
||||
class="group flex items-center h-12 rounded-full bg-primary disabled:bg-primary/70 shadow-lg shadow-primary/25 transition-all not-disabled:hover:shadow-primary/40 not-disabled:hover:brightness-110 not-disabled:active:scale-[0.98] cursor-pointer w-fit"
|
||||
disabled={prop.disabled}
|
||||
onclick={prop.onClick}
|
||||
>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { DropdownMenu as DropdownMenuPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import Check from '@lucide/svelte/icons/check';
|
||||
import Minus from '@lucide/svelte/icons/minus';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { DropdownMenu as DropdownMenuPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
|
||||
import { cn } from '$lib/utils.js';
|
||||
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
|
||||