Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
756638ecf1 | ||
|
|
34e93ee29b | ||
|
|
e1c04c4f5b | ||
|
|
cb117826c7 | ||
|
|
0e295c8425 | ||
|
|
746524d27e | ||
|
|
660fb557a6 | ||
|
|
575da8504a
|
||
|
|
8616253065 | ||
|
|
0105c5975a
|
||
|
|
c2fd265b49 | ||
|
|
687ab26752 | ||
|
|
9d312fb3bb | ||
|
|
ef214d424c | ||
|
|
d4be3f845d | ||
|
|
83b007818d | ||
|
|
cfb6ec8cce | ||
|
|
323a6f18af | ||
|
|
d56ed9d786 | ||
|
|
51f5fa3e46 | ||
|
|
07cbfa39a6 | ||
|
|
11aefee7ed | ||
|
|
5eea428802 | ||
|
|
760bd9a283 | ||
|
|
47c022642f | ||
|
|
5613c3be25 | ||
|
|
4d57184b73 | ||
|
|
d555ac366f | ||
|
|
918f8651dd | ||
|
|
4b039c9b79 | ||
|
|
809fca6f29 | ||
|
|
0025313c4d | ||
|
|
6b1ed5aa1a |
No files matched your search
@@ -183,6 +183,30 @@ src-tauri/target/release/bundle/deb/
|
|||||||
src-tauri/target/release/bundle/appimage/
|
src-tauri/target/release/bundle/appimage/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Cross-platform Releases
|
||||||
|
|
||||||
|
Use the release scripts to build a specific platform:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bun run release:macos
|
||||||
|
bun run release:windows
|
||||||
|
bun run release:linux
|
||||||
|
```
|
||||||
|
|
||||||
|
Windows installers can be cross-compiled from macOS with NSIS and `cargo-xwin`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install nsis llvm cmake nasm ninja
|
||||||
|
rustup target add x86_64-pc-windows-msvc
|
||||||
|
cargo install --locked cargo-xwin
|
||||||
|
bun run release:windows
|
||||||
|
```
|
||||||
|
|
||||||
|
The Windows installer is written to
|
||||||
|
`src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/`. Cross-compiled
|
||||||
|
Windows builds are unsigned. macOS releases must be built on macOS, and Linux
|
||||||
|
releases must be built on Linux.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📁 Project Structure (Overview)
|
## 📁 Project Structure (Overview)
|
||||||
|
|||||||
+5
-2
@@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "ezpplauncher",
|
"name": "ezpplauncher",
|
||||||
"version": "3.2.7",
|
"version": "3.3.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"debug": "bun run tauri dev",
|
"debug": "bun run tauri dev",
|
||||||
"build": "bun ./scripts/build.ts",
|
"release": "bun ./scripts/release.ts",
|
||||||
|
"release:macos": "bun ./scripts/release.ts macos",
|
||||||
|
"release:windows": "bun ./scripts/release.ts windows",
|
||||||
|
"release:linux": "bun ./scripts/release.ts linux",
|
||||||
"vite:dev": "vite dev",
|
"vite:dev": "vite dev",
|
||||||
"vite:build": "vite build && exit 0",
|
"vite:build": "vite build && exit 0",
|
||||||
"tauri:build": "tauri build",
|
"tauri:build": "tauri build",
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
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,4 +1,8 @@
|
|||||||
import { THEME_ICON_NAMES, type ThemeIconName, type ThemeIconSet } from '../src/lib/themeIcons';
|
import {
|
||||||
|
THEME_ICON_NAMES,
|
||||||
|
type ThemeIconName,
|
||||||
|
type ThemeIconSet,
|
||||||
|
} from '../src/lib/theme/themeIcons';
|
||||||
import { readFileSync, writeFileSync } from 'node:fs';
|
import { readFileSync, writeFileSync } from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
@@ -135,7 +139,7 @@ export const THEME_ICON_BODIES: Record<ThemeIconSet, Record<ThemeIconName, Theme
|
|||||||
)};
|
)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const outputPath = fileURLToPath(new URL('../src/lib/themeIconData.ts', import.meta.url));
|
const outputPath = fileURLToPath(new URL('../src/lib/theme/themeIconData.ts', import.meta.url));
|
||||||
writeFileSync(outputPath, output);
|
writeFileSync(outputPath, output);
|
||||||
console.log(
|
console.log(
|
||||||
`Generated ${THEME_ICON_NAMES.length} semantic icons for ${Object.keys(collectionPaths).length} sets.`
|
`Generated ${THEME_ICON_NAMES.length} semantic icons for ${Object.keys(collectionPaths).length} sets.`
|
||||||
|
|||||||
@@ -0,0 +1,301 @@
|
|||||||
|
import { spawn, execFileSync } from 'node:child_process';
|
||||||
|
import { accessSync, constants, existsSync } from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
|
const WINDOWS_TARGET = 'x86_64-pc-windows-msvc';
|
||||||
|
const TARGETS = ['macos', 'windows', 'linux'] as const;
|
||||||
|
|
||||||
|
type Target = (typeof TARGETS)[number];
|
||||||
|
|
||||||
|
function hostTarget(): Target {
|
||||||
|
if (process.platform === 'darwin') return 'macos';
|
||||||
|
if (process.platform === 'win32') return 'windows';
|
||||||
|
if (process.platform === 'linux') return 'linux';
|
||||||
|
throw new Error(`Unsupported build host: ${process.platform}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function findCommand(command: string, envPath: string): string | undefined {
|
||||||
|
const extensions =
|
||||||
|
process.platform === 'win32'
|
||||||
|
? ['', ...(process.env.PATHEXT ?? '.EXE;.CMD;.BAT').split(';')]
|
||||||
|
: [''];
|
||||||
|
|
||||||
|
for (const directory of envPath.split(path.delimiter)) {
|
||||||
|
if (!directory) continue;
|
||||||
|
for (const extension of extensions) {
|
||||||
|
const candidate = path.join(directory, `${command}${extension.toLowerCase()}`);
|
||||||
|
try {
|
||||||
|
accessSync(candidate, constants.X_OK);
|
||||||
|
return candidate;
|
||||||
|
} catch {
|
||||||
|
// Keep looking through PATH.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function prependExistingPath(env: NodeJS.ProcessEnv, directory: string) {
|
||||||
|
if (existsSync(directory)) env.PATH = `${directory}${path.delimiter}${env.PATH ?? ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureUtf8Locale(env: NodeJS.ProcessEnv) {
|
||||||
|
const current = env.LC_ALL || env.LC_CTYPE || env.LANG || '';
|
||||||
|
if (current && current !== 'C' && current !== 'POSIX') return;
|
||||||
|
|
||||||
|
// makeNSIS 3.13 crashes with std::bad_alloc on POSIX under the C locale.
|
||||||
|
const locale = process.platform === 'darwin' ? 'en_US.UTF-8' : 'C.UTF-8';
|
||||||
|
env.LC_ALL = locale;
|
||||||
|
env.LANG = locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectRustupToolchain(env: NodeJS.ProcessEnv) {
|
||||||
|
const rustup =
|
||||||
|
findCommand('rustup', env.PATH ?? '') ??
|
||||||
|
['/opt/homebrew/opt/rustup/bin/rustup', '/usr/local/opt/rustup/bin/rustup'].find((candidate) =>
|
||||||
|
existsSync(candidate)
|
||||||
|
);
|
||||||
|
if (!rustup) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const cargo = execFileSync(rustup, ['which', 'cargo'], {
|
||||||
|
encoding: 'utf8',
|
||||||
|
env,
|
||||||
|
stdio: ['ignore', 'pipe', 'ignore'],
|
||||||
|
}).trim();
|
||||||
|
env.PATH = `${path.dirname(cargo)}${path.delimiter}${env.PATH ?? ''}`;
|
||||||
|
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
const libDir = path.join(path.dirname(path.dirname(cargo)), 'lib');
|
||||||
|
env.DYLD_FALLBACK_LIBRARY_PATH = [libDir, env.DYLD_FALLBACK_LIBRARY_PATH]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(path.delimiter);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Fall back to the cargo already on PATH.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasRustTarget(target: string, env: NodeJS.ProcessEnv): boolean {
|
||||||
|
try {
|
||||||
|
const libdir = execFileSync('rustc', ['--print', 'target-libdir', '--target', target], {
|
||||||
|
encoding: 'utf8',
|
||||||
|
env,
|
||||||
|
stdio: ['ignore', 'pipe', 'ignore'],
|
||||||
|
}).trim();
|
||||||
|
return existsSync(libdir);
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function configureCrossWindowsLinker(env: NodeJS.ProcessEnv) {
|
||||||
|
// Microsoft's prebuilt CRT libraries reference PDBs that are not shipped
|
||||||
|
// with cargo-xwin, so lld-link emits LNK4099 for every library. The debug
|
||||||
|
// info is unavailable either way, so suppress only that specific warning.
|
||||||
|
const key = 'CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS';
|
||||||
|
env[key] = [env[key], '-C', 'link-arg=/ignore:4099'].filter(Boolean).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
function windowsPrerequisites(env: NodeJS.ProcessEnv): string[] {
|
||||||
|
const missing: string[] = [];
|
||||||
|
|
||||||
|
if (!findCommand('cargo-xwin', env.PATH ?? '')) {
|
||||||
|
missing.push('cargo-xwin (install with: cargo install --locked cargo-xwin)');
|
||||||
|
}
|
||||||
|
if (!findCommand('cmake', env.PATH ?? '')) {
|
||||||
|
missing.push(
|
||||||
|
process.platform === 'darwin'
|
||||||
|
? 'CMake (install with: brew install cmake)'
|
||||||
|
: 'CMake (install cmake and add it to PATH)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!findCommand('nasm', env.PATH ?? '')) {
|
||||||
|
missing.push(
|
||||||
|
process.platform === 'darwin'
|
||||||
|
? 'NASM (install with: brew install nasm)'
|
||||||
|
: 'NASM (install nasm and add it to PATH)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!findCommand('ninja', env.PATH ?? '')) {
|
||||||
|
missing.push(
|
||||||
|
process.platform === 'darwin'
|
||||||
|
? 'Ninja (install with: brew install ninja)'
|
||||||
|
: 'Ninja (install ninja and add it to PATH)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!hasRustTarget(WINDOWS_TARGET, env)) {
|
||||||
|
missing.push(
|
||||||
|
`${WINDOWS_TARGET} Rust target (install with: rustup target add ${WINDOWS_TARGET})`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (process.platform !== 'win32') {
|
||||||
|
if (!findCommand('llvm-rc', env.PATH ?? '')) {
|
||||||
|
missing.push(
|
||||||
|
process.platform === 'darwin'
|
||||||
|
? 'LLVM (install with: brew install llvm, then add its bin directory to PATH)'
|
||||||
|
: 'LLVM (install llvm and lld, then add llvm-rc to PATH)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!findCommand('makensis', env.PATH ?? '')) {
|
||||||
|
missing.push(
|
||||||
|
process.platform === 'darwin'
|
||||||
|
? 'NSIS (install with: brew install nsis)'
|
||||||
|
: 'NSIS (install makensis and add it to PATH)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return missing;
|
||||||
|
}
|
||||||
|
|
||||||
|
function artifactDirectory(target: Target): string {
|
||||||
|
if (target === 'windows') {
|
||||||
|
const suffix =
|
||||||
|
process.platform === 'win32'
|
||||||
|
? path.join('target', 'release')
|
||||||
|
: path.join('target', WINDOWS_TARGET, 'release');
|
||||||
|
return path.join('src-tauri', suffix, 'bundle', 'nsis');
|
||||||
|
}
|
||||||
|
if (target === 'macos') return path.join('src-tauri', 'target', 'release', 'bundle');
|
||||||
|
return path.join('src-tauri', 'target', 'release', 'bundle');
|
||||||
|
}
|
||||||
|
|
||||||
|
function run(command: string, args: string[], env: NodeJS.ProcessEnv): Promise<void> {
|
||||||
|
console.log(`\n$ ${[command, ...args].join(' ')}`);
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const child = spawn(command, args, { env, stdio: 'inherit' });
|
||||||
|
|
||||||
|
child.on('error', reject);
|
||||||
|
child.on('close', (code) => {
|
||||||
|
if (code === 0) resolve();
|
||||||
|
else reject(new Error(`${command} exited with code ${code ?? 'unknown'}`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vite's static-adapter build can leave the process alive after writing the
|
||||||
|
* output. Stop it once the adapter confirms the build is complete.
|
||||||
|
*/
|
||||||
|
function buildFrontend(command: string, env: NodeJS.ProcessEnv): Promise<void> {
|
||||||
|
console.log(`\n$ ${command} x --bun vite build`);
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const child = spawn(command, ['x', '--bun', 'vite', 'build'], {
|
||||||
|
env,
|
||||||
|
stdio: ['inherit', 'pipe', 'pipe'],
|
||||||
|
});
|
||||||
|
let completed = false;
|
||||||
|
|
||||||
|
const finish = (error?: Error) => {
|
||||||
|
if (completed) return;
|
||||||
|
completed = true;
|
||||||
|
if (error) reject(error);
|
||||||
|
else resolve();
|
||||||
|
};
|
||||||
|
|
||||||
|
child.stdout?.on('data', (data: Buffer) => {
|
||||||
|
process.stdout.write(data);
|
||||||
|
if (!completed && data.toString().includes('✔ done')) {
|
||||||
|
setTimeout(() => {
|
||||||
|
child.kill();
|
||||||
|
finish();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
child.stderr?.on('data', (data: Buffer) => process.stderr.write(data));
|
||||||
|
child.on('error', finish);
|
||||||
|
child.on('close', (code) => {
|
||||||
|
if (code === 0) finish();
|
||||||
|
else finish(new Error(`vite build exited with code ${code ?? 'unknown'}`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
console.log(`Build an EZPPLauncher release.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
bun run release Build for the current platform
|
||||||
|
bun run release:macos Build the macOS app and DMG
|
||||||
|
bun run release:windows Build the Windows NSIS installer
|
||||||
|
bun run release:linux Build the Linux package
|
||||||
|
|
||||||
|
On macOS, release:windows cross-compiles using cargo-xwin. On Linux, use
|
||||||
|
release:linux on a Linux host; Linux bundles cannot be built from macOS.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const requested = process.argv[2]?.toLowerCase();
|
||||||
|
if (requested === '--help' || requested === '-h') {
|
||||||
|
usage();
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
let target: Target;
|
||||||
|
try {
|
||||||
|
target = requested ? (requested as Target) : hostTarget();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error instanceof Error ? error.message : error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TARGETS.includes(target)) {
|
||||||
|
console.error(`Unknown release target: ${requested}`);
|
||||||
|
usage();
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const host = hostTarget();
|
||||||
|
if (target === 'macos' && host !== 'macos') {
|
||||||
|
console.error('macOS releases must be built on macOS.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
if (target === 'linux' && host !== 'linux') {
|
||||||
|
console.error('Linux releases must be built on Linux. Use a Linux host or CI runner.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const env = { ...process.env };
|
||||||
|
if (host === 'macos') {
|
||||||
|
prependExistingPath(env, '/opt/homebrew/opt/llvm/bin');
|
||||||
|
prependExistingPath(env, '/usr/local/opt/llvm/bin');
|
||||||
|
prependExistingPath(env, '/opt/homebrew/opt/nsis/bin');
|
||||||
|
prependExistingPath(env, '/usr/local/opt/nsis/bin');
|
||||||
|
}
|
||||||
|
if (host !== 'windows') ensureUtf8Locale(env);
|
||||||
|
if (target === 'windows') selectRustupToolchain(env);
|
||||||
|
|
||||||
|
if (target === 'windows' && host !== 'windows') {
|
||||||
|
const missing = windowsPrerequisites(env);
|
||||||
|
if (missing.length > 0) {
|
||||||
|
console.error('Windows cross-compilation is missing prerequisites:\n');
|
||||||
|
for (const requirement of missing) console.error(` - ${requirement}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
configureCrossWindowsLinker(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
const tauriArgs = ['x', 'tauri', 'build'];
|
||||||
|
if (target === 'windows') {
|
||||||
|
tauriArgs.push('--bundles', 'nsis');
|
||||||
|
if (host !== 'windows') tauriArgs.push('--runner', 'cargo-xwin', '--target', WINDOWS_TARGET);
|
||||||
|
}
|
||||||
|
|
||||||
|
const bun = findCommand('bun', env.PATH ?? '') ?? 'bun';
|
||||||
|
console.log(`Building the ${target} release from ${host}...`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await run(bun, ['./scripts/sync-version.ts'], env);
|
||||||
|
await buildFrontend(bun, env);
|
||||||
|
|
||||||
|
if (target === 'linux') env.NO_STRIP = '1';
|
||||||
|
await run(bun, tauriArgs, env);
|
||||||
|
|
||||||
|
console.log(`\n✅ ${target} release built.`);
|
||||||
|
console.log(`Artifacts: ${artifactDirectory(target)}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`\n❌ Release build failed: ${error instanceof Error ? error.message : error}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
Generated
+1
-1
@@ -1266,7 +1266,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ezpplauncher"
|
name = "ezpplauncher"
|
||||||
version = "3.2.7"
|
version = "3.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ezpplauncher"
|
name = "ezpplauncher"
|
||||||
version = "3.2.7"
|
version = "3.3.0"
|
||||||
description = "EZPPLauncher redefined."
|
description = "EZPPLauncher redefined."
|
||||||
authors = ["HorizonCode"]
|
authors = ["HorizonCode"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|||||||
@@ -195,6 +195,26 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"identifier": "fs:allow-stat",
|
||||||
|
"allow": [
|
||||||
|
{
|
||||||
|
"path": "$HOME/.ezpplauncher"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "$HOME/.ezpplauncher/*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "$HOME/.ezpplauncher/**/*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "$HOME/.ezpplauncher/**/.*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "$HOME/.ezpplauncher/**/.*/**"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"identifier": "fs:allow-mkdir",
|
"identifier": "fs:allow-mkdir",
|
||||||
"allow": [
|
"allow": [
|
||||||
|
|||||||
+189
-31
@@ -3,7 +3,7 @@ use hardware_id::get_id;
|
|||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::collections::HashSet;
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
@@ -112,6 +112,136 @@ pub async fn hash_file_sha256(path: String) -> Result<String, String> {
|
|||||||
.map_err(|e| format!("Thread error: {e}"))?
|
.map_err(|e| format!("Thread error: {e}"))?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Hash the files that make up a theme package. This ignores archive metadata
|
||||||
|
/// and the local workshop-sync sidecar, so it can be compared before and after
|
||||||
|
/// editing the theme folder.
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn hash_theme_content(theme_folder: String) -> Result<String, String> {
|
||||||
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
|
let folder = checked_theme_folder(&theme_folder)?;
|
||||||
|
tokio::task::spawn_blocking(move || {
|
||||||
|
let asset_filter = referenced_theme_assets(&folder.join("theme.json"));
|
||||||
|
let mut files = Vec::new();
|
||||||
|
collect_theme_content_files(&folder, &folder, asset_filter.as_ref(), &mut files)?;
|
||||||
|
files.sort_by_key(|path| path.to_string_lossy().to_lowercase());
|
||||||
|
|
||||||
|
let mut hasher = Sha256::new();
|
||||||
|
hasher.update(b"ezpplauncher-theme-content-v1\0");
|
||||||
|
|
||||||
|
for relative in files {
|
||||||
|
let path = folder.join(&relative);
|
||||||
|
let metadata = std::fs::metadata(&path)
|
||||||
|
.map_err(|e| format!("Failed to inspect theme file {}: {e}", path.display()))?;
|
||||||
|
if !metadata.is_file() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let name = relative.to_string_lossy().replace('\\', "/");
|
||||||
|
hasher.update((name.len() as u64).to_le_bytes());
|
||||||
|
hasher.update(name.as_bytes());
|
||||||
|
|
||||||
|
// Workshop metadata is not theme content. Ignore it so syncing
|
||||||
|
// tags or the server-assigned ID does not look like a local edit.
|
||||||
|
if name == "theme.json" {
|
||||||
|
let text = std::fs::read_to_string(&path).map_err(|e| {
|
||||||
|
format!("Failed to read theme manifest {}: {e}", path.display())
|
||||||
|
})?;
|
||||||
|
let mut config: Value = serde_json::from_str(&text)
|
||||||
|
.map_err(|e| format!("Failed to parse theme manifest: {e}"))?;
|
||||||
|
if let Some(object) = config.as_object_mut() {
|
||||||
|
object.remove("workshopId");
|
||||||
|
object.remove("tags");
|
||||||
|
}
|
||||||
|
let bytes = serde_json::to_vec(&config)
|
||||||
|
.map_err(|e| format!("Failed to serialize theme manifest: {e}"))?;
|
||||||
|
hasher.update((bytes.len() as u64).to_le_bytes());
|
||||||
|
hasher.update(&bytes);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasher.update(metadata.len().to_le_bytes());
|
||||||
|
let mut file = std::fs::File::open(&path)
|
||||||
|
.map_err(|e| format!("Failed to open theme file {}: {e}", path.display()))?;
|
||||||
|
let mut buffer = [0u8; 65536];
|
||||||
|
loop {
|
||||||
|
let bytes_read = file
|
||||||
|
.read(&mut buffer)
|
||||||
|
.map_err(|e| format!("Failed to read theme file {}: {e}", path.display()))?;
|
||||||
|
if bytes_read == 0 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hasher.update(&buffer[..bytes_read]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok::<_, String>(hex::encode(hasher.finalize()))
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Thread error: {e}"))?
|
||||||
|
}
|
||||||
|
|
||||||
|
fn collect_theme_content_files(
|
||||||
|
root: &Path,
|
||||||
|
directory: &Path,
|
||||||
|
asset_filter: Option<&HashSet<String>>,
|
||||||
|
files: &mut Vec<PathBuf>,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
let entries = std::fs::read_dir(directory)
|
||||||
|
.map_err(|e| format!("Failed to read {}: {e}", directory.display()))?;
|
||||||
|
let assets_root = root.join("assets");
|
||||||
|
|
||||||
|
for entry in entries {
|
||||||
|
let entry = entry.map_err(|e| format!("Failed to read theme entry: {e}"))?;
|
||||||
|
let file_name = entry.file_name();
|
||||||
|
if file_name.to_string_lossy().starts_with('.') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let file_type = entry
|
||||||
|
.file_type()
|
||||||
|
.map_err(|e| format!("Failed to inspect theme entry: {e}"))?;
|
||||||
|
if file_type.is_symlink() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let entry_path = entry.path();
|
||||||
|
let relative = entry_path
|
||||||
|
.strip_prefix(root)
|
||||||
|
.map_err(|e| format!("Failed to build theme path: {e}"))?
|
||||||
|
.to_string_lossy()
|
||||||
|
.replace('\\', "/");
|
||||||
|
|
||||||
|
if file_type.is_dir() {
|
||||||
|
if asset_filter.is_some() && directory == root && relative != "assets" {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
collect_theme_content_files(root, &entry_path, asset_filter, files)?;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if !file_type.is_file() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if asset_filter.is_some() && directory == root && relative != "theme.json" {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(filter) = asset_filter
|
||||||
|
&& let Ok(asset_path) = entry_path.strip_prefix(&assets_root)
|
||||||
|
{
|
||||||
|
let key = asset_path.to_string_lossy().replace('\\', "/");
|
||||||
|
if !filter.contains(&key) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
files.push(PathBuf::from(relative));
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Read a chunk of a file on disk starting at `offset` for `length` bytes.
|
/// Read a chunk of a file on disk starting at `offset` for `length` bytes.
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn read_file_chunk(path: String, offset: u64, length: u64) -> Result<Vec<u8>, String> {
|
pub async fn read_file_chunk(path: String, offset: u64, length: u64) -> Result<Vec<u8>, String> {
|
||||||
@@ -135,8 +265,7 @@ pub async fn read_file_chunk(path: String, offset: u64, length: u64) -> Result<V
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn get_hwid() -> String {
|
pub fn get_hwid() -> String {
|
||||||
get_id()
|
get_id().unwrap_or("recorderinsandybridge".to_string())
|
||||||
.unwrap_or("recorderinsandybridge".to_string())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Show the native macOS picker, which can select `osu!.app` bundles as files.
|
/// Show the native macOS picker, which can select `osu!.app` bundles as files.
|
||||||
@@ -268,6 +397,8 @@ pub async fn installation_diagnostics(app: AppHandle, folder: String) -> Install
|
|||||||
.map(patcher_file_stats)
|
.map(patcher_file_stats)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
// macOS fills in the Wine and FFmpeg fields below.
|
||||||
|
#[cfg_attr(not(target_os = "macos"), allow(unused_mut))]
|
||||||
let mut diagnostics = InstallationDiagnostics {
|
let mut diagnostics = InstallationDiagnostics {
|
||||||
platform: std::env::consts::OS.to_string(),
|
platform: std::env::consts::OS.to_string(),
|
||||||
os_version: System::long_os_version(),
|
os_version: System::long_os_version(),
|
||||||
@@ -421,7 +552,8 @@ pub async fn get_skins_count(folder: String) -> Option<u64> {
|
|||||||
if let Ok(mut entries) = fs::read_dir(skins_folder).await {
|
if let Ok(mut entries) = fs::read_dir(skins_folder).await {
|
||||||
while let Ok(Some(entry)) = entries.next_entry().await {
|
while let Ok(Some(entry)) = entries.next_entry().await {
|
||||||
if let Ok(ft) = entry.file_type().await
|
if let Ok(ft) = entry.file_type().await
|
||||||
&& ft.is_dir() {
|
&& ft.is_dir()
|
||||||
|
{
|
||||||
let dir_path = entry.path();
|
let dir_path = entry.path();
|
||||||
let has_ini = tokio::fs::try_exists(dir_path.join("skin.ini"))
|
let has_ini = tokio::fs::try_exists(dir_path.join("skin.ini"))
|
||||||
.await
|
.await
|
||||||
@@ -629,7 +761,7 @@ pub async fn run_osu(
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
if optimize {
|
if optimize {
|
||||||
#[link(name = "winmm")]
|
#[link(name = "winmm")]
|
||||||
extern "system" {
|
unsafe extern "system" {
|
||||||
fn timeBeginPeriod(uPeriod: u32) -> u32;
|
fn timeBeginPeriod(uPeriod: u32) -> u32;
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -776,7 +908,7 @@ pub async fn run_osu(
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
if optimize {
|
if optimize {
|
||||||
#[link(name = "winmm")]
|
#[link(name = "winmm")]
|
||||||
extern "system" {
|
unsafe extern "system" {
|
||||||
fn timeEndPeriod(uPeriod: u32) -> u32;
|
fn timeEndPeriod(uPeriod: u32) -> u32;
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -932,7 +1064,10 @@ pub async fn download_ezpp_launcher_update_files(
|
|||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
let patcher_exe = osu_path.join("EZPPLauncher").join("patcher").join("osu!.patcher.exe");
|
let patcher_exe = osu_path
|
||||||
|
.join("EZPPLauncher")
|
||||||
|
.join("patcher")
|
||||||
|
.join("osu!.patcher.exe");
|
||||||
if patcher_exe.is_file() {
|
if patcher_exe.is_file() {
|
||||||
let _ = crate::utils::ensure_patcher_compatibility(&patcher_exe);
|
let _ = crate::utils::ensure_patcher_compatibility(&patcher_exe);
|
||||||
}
|
}
|
||||||
@@ -1194,24 +1329,24 @@ pub struct PresenceButton {
|
|||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PresenceActivityPayload {
|
pub struct PresenceActivityPayload {
|
||||||
pub state: Option<String>,
|
pub state: String,
|
||||||
pub details: Option<String>,
|
pub details: String,
|
||||||
pub large_image_key: Option<String>,
|
pub large_image_key: String,
|
||||||
pub large_image_text: Option<String>,
|
pub large_image_text: String,
|
||||||
pub small_image_key: Option<Option<String>>,
|
pub small_image_key: Option<String>,
|
||||||
pub small_image_text: Option<Option<String>>,
|
pub small_image_text: Option<String>,
|
||||||
pub button1: Option<Option<presence::PresenceButton>>,
|
pub button1: Option<presence::PresenceButton>,
|
||||||
pub button2: Option<Option<presence::PresenceButton>>,
|
pub button2: Option<presence::PresenceButton>,
|
||||||
pub show_timestamp: Option<bool>,
|
pub show_timestamp: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn presence_update_activity(activity: PresenceActivityPayload) {
|
pub async fn presence_update_activity(activity: PresenceActivityPayload) {
|
||||||
presence::update_activity(
|
presence::update_activity(
|
||||||
activity.state.as_deref(),
|
&activity.state,
|
||||||
activity.details.as_deref(),
|
&activity.details,
|
||||||
activity.large_image_key.as_deref(),
|
&activity.large_image_key,
|
||||||
activity.large_image_text.as_deref(),
|
&activity.large_image_text,
|
||||||
activity.small_image_key,
|
activity.small_image_key,
|
||||||
activity.small_image_text,
|
activity.small_image_text,
|
||||||
activity.button1,
|
activity.button1,
|
||||||
@@ -1558,14 +1693,19 @@ pub async fn download_and_extract_community_theme(
|
|||||||
download_url: String,
|
download_url: String,
|
||||||
theme_folder: String,
|
theme_folder: String,
|
||||||
theme_name: String,
|
theme_name: String,
|
||||||
|
request_headers: Option<HashMap<String, String>>,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
let response = client
|
let mut request = client.get(&download_url).header(
|
||||||
.get(&download_url)
|
|
||||||
.header(
|
|
||||||
"User-Agent",
|
"User-Agent",
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
||||||
)
|
);
|
||||||
|
if let Some(headers) = request_headers {
|
||||||
|
for (name, value) in headers {
|
||||||
|
request = request.header(name.as_str(), value.as_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let response = request
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("Failed to download theme: {}", e))?;
|
.map_err(|e| format!("Failed to download theme: {}", e))?;
|
||||||
@@ -1803,7 +1943,8 @@ pub(crate) fn theme_root() -> Result<PathBuf, String> {
|
|||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
fn loopback_theme_asset_base() -> String {
|
fn loopback_theme_asset_base() -> String {
|
||||||
if crate::theme_server::base_url().is_none()
|
if crate::theme_server::base_url().is_none()
|
||||||
&& let Ok(root) = theme_root() {
|
&& let Ok(root) = theme_root()
|
||||||
|
{
|
||||||
match crate::theme_server::media_root() {
|
match crate::theme_server::media_root() {
|
||||||
Ok(media) => {
|
Ok(media) => {
|
||||||
if let Err(error) = crate::theme_server::start(root, media) {
|
if let Err(error) = crate::theme_server::start(root, media) {
|
||||||
@@ -1962,7 +2103,14 @@ pub async fn optimize_theme_media(app: AppHandle, source_url: String) -> Result<
|
|||||||
};
|
};
|
||||||
|
|
||||||
tokio::task::spawn_blocking(move || {
|
tokio::task::spawn_blocking(move || {
|
||||||
optimize_theme_media_blocking(&ffmpeg, &source, &original, &cache_name, &destination, on_progress)
|
optimize_theme_media_blocking(
|
||||||
|
&ffmpeg,
|
||||||
|
&source,
|
||||||
|
&original,
|
||||||
|
&cache_name,
|
||||||
|
&destination,
|
||||||
|
on_progress,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.map_err(|error| format!("Theme media optimizer thread failed: {error}"))?
|
.map_err(|error| format!("Theme media optimizer thread failed: {error}"))?
|
||||||
@@ -2123,8 +2271,11 @@ async fn download_ffmpeg(app: &AppHandle) -> Result<PathBuf, String> {
|
|||||||
.await
|
.await
|
||||||
.map_err(|error| format!("Could not write the FFmpeg archive: {error}"))?;
|
.map_err(|error| format!("Could not write the FFmpeg archive: {error}"))?;
|
||||||
|
|
||||||
if let Some(percent) = (received.min(total) * 100).checked_div(total).map(|v| v as u8)
|
if let Some(percent) = (received.min(total) * 100)
|
||||||
&& percent != last_percent {
|
.checked_div(total)
|
||||||
|
.map(|v| v as u8)
|
||||||
|
&& percent != last_percent
|
||||||
|
{
|
||||||
last_percent = percent;
|
last_percent = percent;
|
||||||
let _ = app.emit(
|
let _ = app.emit(
|
||||||
"theme-media-progress",
|
"theme-media-progress",
|
||||||
@@ -2580,8 +2731,11 @@ pub async fn open_presence_editor(app: AppHandle) -> Result<(), String> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let window =
|
let window = WebviewWindowBuilder::new(
|
||||||
WebviewWindowBuilder::new(&app, "presence-editor", WebviewUrl::App("index.html".into()))
|
&app,
|
||||||
|
"presence-editor",
|
||||||
|
WebviewUrl::App("index.html".into()),
|
||||||
|
)
|
||||||
.title("EZPPLauncher — Discord Rich Presence Editor")
|
.title("EZPPLauncher — Discord Rich Presence Editor")
|
||||||
.inner_size(1200.0, 800.0)
|
.inner_size(1200.0, 800.0)
|
||||||
.min_inner_size(980.0, 650.0)
|
.min_inner_size(980.0, 650.0)
|
||||||
@@ -2983,7 +3137,8 @@ fn collect_theme_asset_refs(value: &Value, assets: &mut HashSet<String>) {
|
|||||||
for (key, value) in object {
|
for (key, value) in object {
|
||||||
if (key == "src" || key == "preview")
|
if (key == "src" || key == "preview")
|
||||||
&& let Some(src) = value.as_str()
|
&& let Some(src) = value.as_str()
|
||||||
&& let Some(path) = theme_asset_reference(src) {
|
&& let Some(path) = theme_asset_reference(src)
|
||||||
|
{
|
||||||
assets.insert(path);
|
assets.insert(path);
|
||||||
}
|
}
|
||||||
collect_theme_asset_refs(value, assets);
|
collect_theme_asset_refs(value, assets);
|
||||||
@@ -3080,6 +3235,9 @@ fn add_theme_folder_to_zip(
|
|||||||
|
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
let entry = entry.map_err(|e| format!("Failed to read theme entry: {e}"))?;
|
let entry = entry.map_err(|e| format!("Failed to read theme entry: {e}"))?;
|
||||||
|
if entry.file_name().to_string_lossy().starts_with('.') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let file_type = entry
|
let file_type = entry
|
||||||
.file_type()
|
.file_type()
|
||||||
.map_err(|e| format!("Failed to inspect theme entry: {e}"))?;
|
.map_err(|e| format!("Failed to inspect theme entry: {e}"))?;
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ use crate::{
|
|||||||
download_ezpp_launcher_update, download_ezpp_launcher_update_files, encrypt_string, exit,
|
download_ezpp_launcher_update, download_ezpp_launcher_update_files, encrypt_string, exit,
|
||||||
export_theme, extract_theme, file_size, find_osu_installation, focus_presence_editor, focus_theme_editor, get_beatmapsets_count,
|
export_theme, extract_theme, file_size, find_osu_installation, focus_presence_editor, focus_theme_editor, get_beatmapsets_count,
|
||||||
get_ezpp_launcher_update_files, get_hwid, get_launcher_version, get_osu_release_stream,
|
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,
|
get_osu_skin, get_osu_version, get_platform, get_skins_count, has_net8,
|
||||||
has_wmctrl, hash_file_sha256, install_ezpp_launcher_update, installation_diagnostics,
|
has_osuwinello, has_wmctrl, hash_file_sha256, hash_theme_content,
|
||||||
|
install_ezpp_launcher_update, installation_diagnostics,
|
||||||
is_open_tablet_driver_path_valid, is_open_tablet_driver_running, is_osu_running,
|
is_open_tablet_driver_path_valid, is_open_tablet_driver_running, is_osu_running,
|
||||||
list_theme_backups, log_frontend, open_logs_folder, open_presence_editor, open_theme_editor, open_theme_folder,
|
list_theme_backups, log_frontend, open_logs_folder, open_presence_editor, open_theme_editor, open_theme_folder,
|
||||||
open_url_in_browser, opened_urls, optimize_theme_media, pick_osu_installation,
|
open_url_in_browser, opened_urls, optimize_theme_media, pick_osu_installation,
|
||||||
@@ -196,6 +197,7 @@ pub fn run() {
|
|||||||
save_theme_project,
|
save_theme_project,
|
||||||
export_theme,
|
export_theme,
|
||||||
hash_file_sha256,
|
hash_file_sha256,
|
||||||
|
hash_theme_content,
|
||||||
read_file_chunk,
|
read_file_chunk,
|
||||||
open_theme_folder,
|
open_theme_folder,
|
||||||
open_theme_editor,
|
open_theme_editor,
|
||||||
|
|||||||
+130
-23
@@ -393,7 +393,97 @@ pub struct LogBundleEntry {
|
|||||||
pub content: String,
|
pub content: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// List the rotating ZIP bundles, newest first, for the in-app log viewer.
|
const MAX_LOG_VIEW_BYTES: u64 = 2 * 1024 * 1024;
|
||||||
|
|
||||||
|
fn modified_millis(metadata: &fs::Metadata) -> u64 {
|
||||||
|
metadata
|
||||||
|
.modified()
|
||||||
|
.ok()
|
||||||
|
.and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok())
|
||||||
|
.map(|duration| duration.as_millis() as u64)
|
||||||
|
.unwrap_or(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Describe the active session. Unlike archived bundles, these files are still
|
||||||
|
/// being written and appear in the viewer without waiting for a rotation.
|
||||||
|
fn current_log_bundle(dir: &Path) -> Option<LogBundleInfo> {
|
||||||
|
let mut size = 0;
|
||||||
|
let mut modified = 0;
|
||||||
|
let mut has_logs = false;
|
||||||
|
|
||||||
|
for stream in Stream::ALL {
|
||||||
|
let Ok(metadata) = fs::metadata(dir.join(stream.file_name())) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
if metadata.len() == 0 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
has_logs = true;
|
||||||
|
size += metadata.len();
|
||||||
|
modified = modified.max(modified_millis(&metadata));
|
||||||
|
}
|
||||||
|
|
||||||
|
has_logs.then(|| LogBundleInfo {
|
||||||
|
path: dir.to_string_lossy().into_owned(),
|
||||||
|
name: "Current session".to_string(),
|
||||||
|
size,
|
||||||
|
modified,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_log_entry(
|
||||||
|
name: String,
|
||||||
|
reader: &mut impl Read,
|
||||||
|
size: u64,
|
||||||
|
) -> Result<LogBundleEntry, String> {
|
||||||
|
let mut bytes = Vec::new();
|
||||||
|
reader
|
||||||
|
.take(MAX_LOG_VIEW_BYTES)
|
||||||
|
.read_to_end(&mut bytes)
|
||||||
|
.map_err(|error| format!("Could not read a log entry: {error}"))?;
|
||||||
|
let mut content = String::from_utf8_lossy(&bytes).into_owned();
|
||||||
|
if size > bytes.len() as u64 {
|
||||||
|
content.push_str("\n… log truncated in the viewer …\n");
|
||||||
|
}
|
||||||
|
Ok(LogBundleEntry { name, content })
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_current_logs(root: &Path) -> Result<Vec<LogBundleEntry>, String> {
|
||||||
|
let mut entries = Vec::new();
|
||||||
|
|
||||||
|
for stream in Stream::ALL {
|
||||||
|
let path = root.join(stream.file_name());
|
||||||
|
let metadata = match fs::metadata(&path) {
|
||||||
|
Ok(metadata) => metadata,
|
||||||
|
Err(error) if error.kind() == io::ErrorKind::NotFound => continue,
|
||||||
|
Err(error) => {
|
||||||
|
return Err(format!(
|
||||||
|
"Could not read the current {}: {error}",
|
||||||
|
stream.file_name()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if metadata.len() == 0 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut file = File::open(&path).map_err(|error| {
|
||||||
|
format!("Could not read the current {}: {error}", stream.file_name())
|
||||||
|
})?;
|
||||||
|
entries.push(read_log_entry(
|
||||||
|
stream.file_name().to_string(),
|
||||||
|
&mut file,
|
||||||
|
metadata.len(),
|
||||||
|
)?);
|
||||||
|
}
|
||||||
|
|
||||||
|
entries.sort_by(|a, b| a.name.cmp(&b.name));
|
||||||
|
Ok(entries)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// List the active session followed by the rotating ZIP bundles, newest first,
|
||||||
|
/// for the in-app log viewer.
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn list_log_bundles() -> Result<Vec<LogBundleInfo>, String> {
|
pub fn list_log_bundles() -> Result<Vec<LogBundleInfo>, String> {
|
||||||
let dir = logs_directory();
|
let dir = logs_directory();
|
||||||
@@ -401,6 +491,7 @@ pub fn list_log_bundles() -> Result<Vec<LogBundleInfo>, String> {
|
|||||||
return Ok(Vec::new());
|
return Ok(Vec::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let current = current_log_bundle(&dir);
|
||||||
let mut bundles = fs::read_dir(&dir)
|
let mut bundles = fs::read_dir(&dir)
|
||||||
.map_err(|error| format!("Could not read the logs folder: {error}"))?
|
.map_err(|error| format!("Could not read the logs folder: {error}"))?
|
||||||
.filter_map(|entry| entry.ok())
|
.filter_map(|entry| entry.ok())
|
||||||
@@ -411,26 +502,23 @@ pub fn list_log_bundles() -> Result<Vec<LogBundleInfo>, String> {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let metadata = entry.metadata().ok()?;
|
let metadata = entry.metadata().ok()?;
|
||||||
let modified = metadata
|
|
||||||
.modified()
|
|
||||||
.ok()
|
|
||||||
.and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok())
|
|
||||||
.map(|duration| duration.as_millis() as u64)
|
|
||||||
.unwrap_or(0);
|
|
||||||
Some(LogBundleInfo {
|
Some(LogBundleInfo {
|
||||||
path: path.to_string_lossy().into_owned(),
|
path: path.to_string_lossy().into_owned(),
|
||||||
name,
|
name,
|
||||||
size: metadata.len(),
|
size: metadata.len(),
|
||||||
modified,
|
modified: modified_millis(&metadata),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
bundles.sort_by_key(|b| std::cmp::Reverse(b.modified));
|
bundles.sort_by_key(|b| std::cmp::Reverse(b.modified));
|
||||||
|
if let Some(current) = current {
|
||||||
|
bundles.insert(0, current);
|
||||||
|
}
|
||||||
Ok(bundles)
|
Ok(bundles)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read the launcher/osu/patcher logs out of one bundle.
|
/// Read the active logs or the launcher/osu/patcher logs out of an archive.
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn read_log_bundle(path: String) -> Result<Vec<LogBundleEntry>, String> {
|
pub fn read_log_bundle(path: String) -> Result<Vec<LogBundleEntry>, String> {
|
||||||
let dir = logs_directory();
|
let dir = logs_directory();
|
||||||
@@ -441,6 +529,9 @@ pub fn read_log_bundle(path: String) -> Result<Vec<LogBundleEntry>, String> {
|
|||||||
if !requested.starts_with(&root) {
|
if !requested.starts_with(&root) {
|
||||||
return Err("The log bundle is outside the logs folder".to_string());
|
return Err("The log bundle is outside the logs folder".to_string());
|
||||||
}
|
}
|
||||||
|
if requested == root {
|
||||||
|
return read_current_logs(&root);
|
||||||
|
}
|
||||||
|
|
||||||
let file = File::open(&requested)
|
let file = File::open(&requested)
|
||||||
.map_err(|error| format!("Could not read the log bundle: {error}"))?;
|
.map_err(|error| format!("Could not read the log bundle: {error}"))?;
|
||||||
@@ -456,20 +547,9 @@ pub fn read_log_bundle(path: String) -> Result<Vec<LogBundleEntry>, String> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut bytes = Vec::new();
|
let name = entry.name().to_string();
|
||||||
entry
|
let size = entry.size();
|
||||||
.by_ref()
|
entries.push(read_log_entry(name, &mut entry, size)?);
|
||||||
.take(2 * 1024 * 1024)
|
|
||||||
.read_to_end(&mut bytes)
|
|
||||||
.map_err(|error| format!("Could not read a log entry: {error}"))?;
|
|
||||||
let mut content = String::from_utf8_lossy(&bytes).into_owned();
|
|
||||||
if entry.size() > bytes.len() as u64 {
|
|
||||||
content.push_str("\n… log truncated in the viewer …\n");
|
|
||||||
}
|
|
||||||
entries.push(LogBundleEntry {
|
|
||||||
name: entry.name().to_string(),
|
|
||||||
content,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.sort_by(|a, b| a.name.cmp(&b.name));
|
entries.sort_by(|a, b| a.name.cmp(&b.name));
|
||||||
@@ -634,4 +714,31 @@ mod tests {
|
|||||||
drop(current);
|
drop(current);
|
||||||
fs::remove_dir_all(dir).unwrap();
|
fs::remove_dir_all(dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn current_session_includes_active_logs() {
|
||||||
|
let dir = temp_dir("current");
|
||||||
|
let logs = Arc::new(LogSet::new(dir.clone()));
|
||||||
|
write_line(&logs, Stream::Launcher, "launcher current\n");
|
||||||
|
write_line(&logs, Stream::Osu, "osu current\n");
|
||||||
|
|
||||||
|
let current = current_log_bundle(&dir).expect("active logs should have a session");
|
||||||
|
assert_eq!(current.name, "Current session");
|
||||||
|
assert_eq!(current.path, dir.to_string_lossy());
|
||||||
|
assert!(current.size > 0);
|
||||||
|
|
||||||
|
let entries = read_current_logs(&dir).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
entries
|
||||||
|
.iter()
|
||||||
|
.map(|entry| entry.name.as_str())
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
["launcher.log", "osu.log"]
|
||||||
|
);
|
||||||
|
assert_eq!(entries[0].content, "launcher current\n");
|
||||||
|
assert_eq!(entries[1].content, "osu current\n");
|
||||||
|
|
||||||
|
drop(logs);
|
||||||
|
fs::remove_dir_all(dir).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+47
-64
@@ -4,6 +4,7 @@ use std::sync::Mutex as StdMutex;
|
|||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
use tauri::{AppHandle, RunEvent};
|
use tauri::{AppHandle, RunEvent};
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
use tokio::task::JoinHandle;
|
||||||
use tokio::time::{Duration, interval};
|
use tokio::time::{Duration, interval};
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||||
@@ -57,19 +58,15 @@ enum PresenceCommand {
|
|||||||
IsConnected(oneshot::Sender<bool>),
|
IsConnected(oneshot::Sender<bool>),
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ReconnectResult {
|
|
||||||
Connected(Box<AsyncDiscordIpcClient>),
|
|
||||||
Failed,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct PresenceActor {
|
struct PresenceActor {
|
||||||
receiver: mpsc::Receiver<PresenceCommand>,
|
receiver: mpsc::Receiver<PresenceCommand>,
|
||||||
reconnect_rx: mpsc::Receiver<ReconnectResult>,
|
reconnect_rx: mpsc::Receiver<Box<AsyncDiscordIpcClient>>,
|
||||||
reconnect_tx: mpsc::Sender<ReconnectResult>,
|
reconnect_tx: mpsc::Sender<Box<AsyncDiscordIpcClient>>,
|
||||||
|
reconnect_task: Option<JoinHandle<()>>,
|
||||||
client: Option<AsyncDiscordIpcClient>,
|
client: Option<AsyncDiscordIpcClient>,
|
||||||
data: PresenceData,
|
data: PresenceData,
|
||||||
start_timestamp: i64,
|
start_timestamp: i64,
|
||||||
reconnecting: bool,
|
should_connect: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PresenceActor {
|
impl PresenceActor {
|
||||||
@@ -85,10 +82,11 @@ impl PresenceActor {
|
|||||||
receiver,
|
receiver,
|
||||||
reconnect_rx,
|
reconnect_rx,
|
||||||
reconnect_tx,
|
reconnect_tx,
|
||||||
|
reconnect_task: None,
|
||||||
client: None,
|
client: None,
|
||||||
data: PresenceData::default(),
|
data: PresenceData::default(),
|
||||||
start_timestamp: start,
|
start_timestamp: start,
|
||||||
reconnecting: false,
|
should_connect: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,18 +110,13 @@ impl PresenceActor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(result) = self.reconnect_rx.recv() => {
|
Some(client) = self.reconnect_rx.recv() => {
|
||||||
self.reconnecting = false;
|
self.reconnect_task = None;
|
||||||
match result {
|
if self.should_connect {
|
||||||
ReconnectResult::Connected(client) => {
|
|
||||||
log::info!(target: "launcher", "Presence: reconnect succeeded");
|
log::info!(target: "launcher", "Presence: reconnect succeeded");
|
||||||
self.client = Some(*client);
|
self.client = Some(*client);
|
||||||
self.push_presence().await;
|
self.push_presence().await;
|
||||||
}
|
}
|
||||||
ReconnectResult::Failed => {
|
|
||||||
log::warn!(target: "launcher", "Presence: all reconnect attempts exhausted");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = heartbeat.tick() => {
|
_ = heartbeat.tick() => {
|
||||||
@@ -134,15 +127,19 @@ impl PresenceActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn cmd_connect(&mut self, resp: oneshot::Sender<bool>) {
|
async fn cmd_connect(&mut self, resp: oneshot::Sender<bool>) {
|
||||||
|
self.should_connect = true;
|
||||||
if self.client.is_some() {
|
if self.client.is_some() {
|
||||||
let _ = resp.send(true);
|
let _ = resp.send(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if self.reconnect_task.is_some() {
|
||||||
|
let _ = resp.send(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
match try_connect_once().await {
|
match try_connect_once().await {
|
||||||
Some(client) => {
|
Some(client) => {
|
||||||
self.client = Some(client);
|
self.client = Some(client);
|
||||||
self.reconnecting = false;
|
|
||||||
self.push_presence().await;
|
self.push_presence().await;
|
||||||
let _ = resp.send(true);
|
let _ = resp.send(true);
|
||||||
}
|
}
|
||||||
@@ -158,6 +155,10 @@ impl PresenceActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn cmd_disconnect(&mut self, resp: oneshot::Sender<()>) {
|
async fn cmd_disconnect(&mut self, resp: oneshot::Sender<()>) {
|
||||||
|
self.should_connect = false;
|
||||||
|
if let Some(task) = self.reconnect_task.take() {
|
||||||
|
task.abort();
|
||||||
|
}
|
||||||
if let Some(mut client) = self.client.take() {
|
if let Some(mut client) = self.client.take() {
|
||||||
let _ = client.clear_activity().await;
|
let _ = client.clear_activity().await;
|
||||||
log::info!(target: "launcher", "Presence: disconnected");
|
log::info!(target: "launcher", "Presence: disconnected");
|
||||||
@@ -206,37 +207,37 @@ impl PresenceActor {
|
|||||||
e
|
e
|
||||||
);
|
);
|
||||||
self.client = None;
|
self.client = None;
|
||||||
|
self.should_connect = true;
|
||||||
self.spawn_reconnect_task();
|
self.spawn_reconnect_task();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_reconnect_task(&mut self) {
|
fn spawn_reconnect_task(&mut self) {
|
||||||
if self.reconnecting {
|
if self.reconnect_task.is_some() || !self.should_connect {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.reconnecting = true;
|
|
||||||
|
|
||||||
let tx = self.reconnect_tx.clone();
|
let tx = self.reconnect_tx.clone();
|
||||||
tokio::spawn(async move {
|
let task = tokio::spawn(async move {
|
||||||
const MAX_ATTEMPTS: u32 = 5;
|
let mut attempt: u32 = 0;
|
||||||
for attempt in 1..=MAX_ATTEMPTS {
|
loop {
|
||||||
let delay = Duration::from_secs(5 * attempt as u64);
|
attempt = attempt.saturating_add(1);
|
||||||
|
let delay = Duration::from_secs((5 * u64::from(attempt)).min(30));
|
||||||
log::info!(
|
log::info!(
|
||||||
target: "launcher",
|
target: "launcher",
|
||||||
"Presence: reconnect attempt {}/{} in {:?}…",
|
"Presence: reconnect attempt {} in {:?}…",
|
||||||
attempt,
|
attempt,
|
||||||
MAX_ATTEMPTS,
|
|
||||||
delay
|
delay
|
||||||
);
|
);
|
||||||
tokio::time::sleep(delay).await;
|
tokio::time::sleep(delay).await;
|
||||||
|
|
||||||
if let Some(client) = try_connect_once().await {
|
if let Some(client) = try_connect_once().await {
|
||||||
let _ = tx.send(ReconnectResult::Connected(Box::new(client))).await;
|
let _ = tx.send(Box::new(client)).await;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _ = tx.send(ReconnectResult::Failed).await;
|
|
||||||
});
|
});
|
||||||
|
self.reconnect_task = Some(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,45 +303,27 @@ pub async fn has_presence() -> bool {
|
|||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn update_activity(
|
pub fn update_activity(
|
||||||
state: Option<&str>,
|
state: &str,
|
||||||
details: Option<&str>,
|
details: &str,
|
||||||
large_image_key: Option<&str>,
|
large_image_key: &str,
|
||||||
large_image_text: Option<&str>,
|
large_image_text: &str,
|
||||||
small_image_key: Option<Option<String>>,
|
small_image_key: Option<String>,
|
||||||
small_image_text: Option<Option<String>>,
|
small_image_text: Option<String>,
|
||||||
button1: Option<Option<PresenceButton>>,
|
button1: Option<PresenceButton>,
|
||||||
button2: Option<Option<PresenceButton>>,
|
button2: Option<PresenceButton>,
|
||||||
show_timestamp: Option<bool>,
|
show_timestamp: bool,
|
||||||
) {
|
) {
|
||||||
let data = {
|
let data = {
|
||||||
let mut guard = PRESENCE_DATA.lock().unwrap();
|
let mut guard = PRESENCE_DATA.lock().unwrap();
|
||||||
if let Some(s) = state {
|
guard.state = state.to_string();
|
||||||
guard.state = s.to_string();
|
guard.details = details.to_string();
|
||||||
}
|
guard.large_image_key = large_image_key.to_string();
|
||||||
if let Some(d) = details {
|
guard.large_image_text = large_image_text.to_string();
|
||||||
guard.details = d.to_string();
|
guard.small_image_key = small_image_key;
|
||||||
}
|
guard.small_image_text = small_image_text;
|
||||||
if let Some(img) = large_image_key {
|
guard.dynamic_button = button1;
|
||||||
guard.large_image_key = img.to_string();
|
guard.secondary_button = button2;
|
||||||
}
|
guard.show_timestamp = show_timestamp;
|
||||||
if let Some(txt) = large_image_text {
|
|
||||||
guard.large_image_text = txt.to_string();
|
|
||||||
}
|
|
||||||
if let Some(key) = small_image_key {
|
|
||||||
guard.small_image_key = key;
|
|
||||||
}
|
|
||||||
if let Some(text) = small_image_text {
|
|
||||||
guard.small_image_text = text;
|
|
||||||
}
|
|
||||||
if let Some(b1) = button1 {
|
|
||||||
guard.dynamic_button = b1;
|
|
||||||
}
|
|
||||||
if let Some(b2) = button2 {
|
|
||||||
guard.secondary_button = b2;
|
|
||||||
}
|
|
||||||
if let Some(ts) = show_timestamp {
|
|
||||||
guard.show_timestamp = ts;
|
|
||||||
}
|
|
||||||
guard.clone()
|
guard.clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "EZPPLauncher",
|
"productName": "EZPPLauncher",
|
||||||
"version": "3.2.7",
|
"version": "3.3.0",
|
||||||
"identifier": "farm.EZPPFarm.Launcher",
|
"identifier": "farm.EZPPFarm.Launcher",
|
||||||
"mainBinaryName": "ezpplauncher",
|
"mainBinaryName": "ezpplauncher",
|
||||||
"build": {
|
"build": {
|
||||||
@@ -30,10 +30,13 @@
|
|||||||
"csp": {
|
"csp": {
|
||||||
"default-src": "'self' tauri: customprotocol: asset:",
|
"default-src": "'self' tauri: customprotocol: asset:",
|
||||||
"script-src": "'self' 'unsafe-inline' 'unsafe-eval' asset: http://asset.localhost https://asset.localhost http://127.0.0.1:* https://analytics.ez-pp.farm",
|
"script-src": "'self' 'unsafe-inline' 'unsafe-eval' asset: http://asset.localhost https://asset.localhost http://127.0.0.1:* https://analytics.ez-pp.farm",
|
||||||
"worker-src": ["'self'", "blob:"],
|
"worker-src": [
|
||||||
|
"'self'",
|
||||||
|
"blob:"
|
||||||
|
],
|
||||||
"style-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost http://127.0.0.1:*",
|
"style-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost http://127.0.0.1:*",
|
||||||
"img-src": "'self' asset: http://asset.localhost https://asset.localhost blob: data: http://127.0.0.1:* https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct",
|
"img-src": "'self' asset: http://asset.localhost https://asset.localhost blob: data: http://127.0.0.1:* https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct https://themes.ez-pp.farm",
|
||||||
"connect-src": "'self' ipc: http://ipc.localhost asset: http://asset.localhost https://asset.localhost http://127.0.0.1:* 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 https://api.fontsource.org https://cdn.jsdelivr.net",
|
"connect-src": "'self' ipc: http://ipc.localhost asset: http://asset.localhost https://asset.localhost http://127.0.0.1:* 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 https://api.fontsource.org https://cdn.jsdelivr.net https://themes.ez-pp.farm",
|
||||||
"media-src": "'self' asset: http://asset.localhost https://asset.localhost http://127.0.0.1:* blob:",
|
"media-src": "'self' asset: http://asset.localhost https://asset.localhost http://127.0.0.1:* blob:",
|
||||||
"font-src": [
|
"font-src": [
|
||||||
"'self'",
|
"'self'",
|
||||||
|
|||||||
+48
-1
@@ -162,7 +162,10 @@
|
|||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
html {
|
html,
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
overscroll-behavior: none;
|
overscroll-behavior: none;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
@@ -174,6 +177,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-scrollbar {
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-scrollbar::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pause continuous visual work while the launcher is hidden or in the background. */
|
||||||
|
main.app-inactive *,
|
||||||
|
main.app-inactive *::before,
|
||||||
|
main.app-inactive *::after {
|
||||||
|
animation-play-state: paused !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Suppress browser and WebKit native media controls and overlay play buttons on theme videos */
|
/* Suppress browser and WebKit native media controls and overlay play buttons on theme videos */
|
||||||
video::-webkit-media-controls,
|
video::-webkit-media-controls,
|
||||||
video::-webkit-media-controls-enclosure,
|
video::-webkit-media-controls-enclosure,
|
||||||
@@ -190,3 +209,31 @@ video::-webkit-media-controls-overlay-enclosure {
|
|||||||
width: 0 !important;
|
width: 0 !important;
|
||||||
height: 0 !important;
|
height: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Crossfade the rendered page when switching themes via the View Transitions API. */
|
||||||
|
::view-transition-old(root) {
|
||||||
|
animation: 320ms cubic-bezier(0.4, 0, 0.2, 1) both theme-crossfade-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
::view-transition-new(root) {
|
||||||
|
animation: 320ms cubic-bezier(0.4, 0, 0.2, 1) both theme-crossfade-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes theme-crossfade-out {
|
||||||
|
to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes theme-crossfade-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
::view-transition-old(root),
|
||||||
|
::view-transition-new(root) {
|
||||||
|
animation: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -154,9 +154,9 @@
|
|||||||
<Terminal class="size-4" />
|
<Terminal class="size-4" />
|
||||||
</div>
|
</div>
|
||||||
<div class="min-w-0">
|
<div class="min-w-0">
|
||||||
<h2 id="log-viewer-title" class="text-sm font-semibold">Log bundles</h2>
|
<h2 id="log-viewer-title" class="text-sm font-semibold">Logs</h2>
|
||||||
<p class="truncate text-[10px] text-muted-foreground">
|
<p class="truncate text-[10px] text-muted-foreground">
|
||||||
Launcher, osu! and patcher output, grouped by session
|
Current session plus archived launcher, osu! and patcher output
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -191,7 +191,7 @@
|
|||||||
<div
|
<div
|
||||||
class="flex shrink-0 items-center justify-between border-b border-theme-800 px-3 py-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
class="flex shrink-0 items-center justify-between border-b border-theme-800 px-3 py-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
||||||
>
|
>
|
||||||
<span>Bundles</span>
|
<span>Sessions</span>
|
||||||
<span>{bundles.length}</span>
|
<span>{bundles.length}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="min-h-0 flex-1 overflow-y-auto p-1.5">
|
<div class="min-h-0 flex-1 overflow-y-auto p-1.5">
|
||||||
@@ -202,8 +202,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else if bundles.length === 0}
|
{:else if bundles.length === 0}
|
||||||
<div class="p-3 text-[11px] leading-relaxed text-muted-foreground">
|
<div class="p-3 text-[11px] leading-relaxed text-muted-foreground">
|
||||||
No bundles yet. Logs are zipped on the next launcher restart or when a log reaches 5
|
No logs yet. The current session appears once the launcher writes its first line;
|
||||||
MiB.
|
archived bundles are created when logs rotate.
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
{#each bundles as bundle (bundle.path)}
|
{#each bundles as bundle (bundle.path)}
|
||||||
@@ -291,14 +291,14 @@
|
|||||||
class="flex h-full items-center justify-center gap-2 text-xs text-muted-foreground"
|
class="flex h-full items-center justify-center gap-2 text-xs text-muted-foreground"
|
||||||
>
|
>
|
||||||
<LoaderCircle class="size-4 animate-spin" />
|
<LoaderCircle class="size-4 animate-spin" />
|
||||||
Reading bundle…
|
Reading logs…
|
||||||
</div>
|
</div>
|
||||||
{:else if !selectedBundle}
|
{:else if !selectedBundle}
|
||||||
<div
|
<div
|
||||||
class="flex h-full flex-col items-center justify-center gap-2 text-center text-muted-foreground"
|
class="flex h-full flex-col items-center justify-center gap-2 text-center text-muted-foreground"
|
||||||
>
|
>
|
||||||
<Terminal class="size-8 opacity-40" />
|
<Terminal class="size-8 opacity-40" />
|
||||||
<p class="text-xs">Choose a log bundle to inspect it.</p>
|
<p class="text-xs">Choose a log session to inspect it.</p>
|
||||||
</div>
|
</div>
|
||||||
{:else if filteredLines.length === 0}
|
{:else if filteredLines.length === 0}
|
||||||
<div
|
<div
|
||||||
@@ -328,7 +328,7 @@
|
|||||||
<span>
|
<span>
|
||||||
{selectedBundle
|
{selectedBundle
|
||||||
? `${selectedBundle.name} · ${formatBytes(selectedBundle.size)}`
|
? `${selectedBundle.name} · ${formatBytes(selectedBundle.size)}`
|
||||||
: 'No bundle selected'}
|
: 'No session selected'}
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
const NOTIFICATION_TYPE_LABELS: Record<string, string> = {
|
const NOTIFICATION_TYPE_LABELS: Record<string, string> = {
|
||||||
theme_hidden: 'Theme hidden',
|
theme_hidden: 'Theme hidden',
|
||||||
theme_restored: 'Theme restored',
|
theme_restored: 'Theme restored',
|
||||||
|
theme_approved: 'Theme approved',
|
||||||
|
theme_rejected: 'Theme needs changes',
|
||||||
theme_taken_down: 'Theme taken down',
|
theme_taken_down: 'Theme taken down',
|
||||||
report_resolved: 'Report resolved',
|
report_resolved: 'Report resolved',
|
||||||
report_dismissed: 'Report dismissed',
|
report_dismissed: 'Report dismissed',
|
||||||
|
|||||||
@@ -12,13 +12,11 @@
|
|||||||
DISCORD_PRESENCE_PRESETS,
|
DISCORD_PRESENCE_PRESETS,
|
||||||
interpolatePresenceString,
|
interpolatePresenceString,
|
||||||
loadDiscordPresenceConfig,
|
loadDiscordPresenceConfig,
|
||||||
pushIdlePresenceFromConfig,
|
|
||||||
saveDiscordPresenceConfig,
|
saveDiscordPresenceConfig,
|
||||||
type DiscordPresenceConfig,
|
type DiscordPresenceConfig,
|
||||||
type PresenceVariableContext,
|
type PresenceVariableContext,
|
||||||
} from '$lib/discordPresenceConfig';
|
} from '$lib/discordPresenceConfig';
|
||||||
import { discordPresence, launcherVersion } from '$lib/global';
|
import { discordPresence, launcherVersion } from '$lib/global';
|
||||||
import * as presence from '$lib/presence';
|
|
||||||
import { currentUser } from '$lib/userAuthentication';
|
import { currentUser } from '$lib/userAuthentication';
|
||||||
import {
|
import {
|
||||||
Check,
|
Check,
|
||||||
@@ -206,10 +204,14 @@
|
|||||||
user?: Parameters<typeof currentUser.set>[0];
|
user?: Parameters<typeof currentUser.set>[0];
|
||||||
info?: Parameters<typeof currentUserInfo.set>[0];
|
info?: Parameters<typeof currentUserInfo.set>[0];
|
||||||
launcherVersion?: string;
|
launcherVersion?: string;
|
||||||
|
discordPresence?: boolean;
|
||||||
}>('sync-theme-editor-global-data', (event) => {
|
}>('sync-theme-editor-global-data', (event) => {
|
||||||
if (event.payload?.user) currentUser.set(event.payload.user);
|
if (event.payload?.user) currentUser.set(event.payload.user);
|
||||||
if (event.payload?.info) currentUserInfo.set(event.payload.info);
|
if (event.payload?.info) currentUserInfo.set(event.payload.info);
|
||||||
if (event.payload?.launcherVersion) launcherVersion.set(event.payload.launcherVersion);
|
if (event.payload?.launcherVersion) launcherVersion.set(event.payload.launcherVersion);
|
||||||
|
if (typeof event.payload?.discordPresence === 'boolean') {
|
||||||
|
discordPresence.set(event.payload.discordPresence);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
await emit('request-theme-editor-global-data');
|
await emit('request-theme-editor-global-data');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -469,18 +471,9 @@
|
|||||||
try {
|
try {
|
||||||
await saveDiscordPresenceConfig(workingConfig);
|
await saveDiscordPresenceConfig(workingConfig);
|
||||||
initialConfigJson = JSON.stringify(workingConfig);
|
initialConfigJson = JSON.stringify(workingConfig);
|
||||||
if ($discordPresence && (await presence.isConnected())) {
|
// The main window owns the live player stats and its presence config
|
||||||
await pushIdlePresenceFromConfig(
|
// store, so let it refresh and push the updated activity immediately.
|
||||||
{
|
await emit('discord-presence-config-saved');
|
||||||
user: $currentUser,
|
|
||||||
version: $launcherVersion || undefined,
|
|
||||||
rank: simRank,
|
|
||||||
pp: simPp,
|
|
||||||
accuracy: simAccuracy,
|
|
||||||
},
|
|
||||||
workingConfig
|
|
||||||
);
|
|
||||||
}
|
|
||||||
sileo.success({ title: 'Discord Rich Presence Saved', description: 'Activity updated' });
|
sileo.success({ title: 'Discord Rich Presence Saved', description: 'Activity updated' });
|
||||||
await handleClose();
|
await handleClose();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -6,18 +6,18 @@
|
|||||||
import Input from '$lib/components/ui/input/input.svelte';
|
import Input from '$lib/components/ui/input/input.svelte';
|
||||||
import Label from '$lib/components/ui/label/label.svelte';
|
import Label from '$lib/components/ui/label/label.svelte';
|
||||||
import * as Select from '$lib/components/ui/select';
|
import * as Select from '$lib/components/ui/select';
|
||||||
import { isThemeClockVariable, THEME_CLOCK_VARIABLE_NAMES } from '$lib/themeClock';
|
import { isThemeClockVariable, THEME_CLOCK_VARIABLE_NAMES } from '$lib/theme/themeClock';
|
||||||
import {
|
import {
|
||||||
themeBehaviorTargetLabel,
|
themeBehaviorTargetLabel,
|
||||||
themeElementLabel,
|
themeElementLabel,
|
||||||
themeGroupInteractiveCount,
|
themeGroupInteractiveCount,
|
||||||
themeGroupLabel,
|
themeGroupLabel,
|
||||||
} from '$lib/themeLogic';
|
} from '$lib/theme/themeLogic';
|
||||||
import {
|
import {
|
||||||
formatThemeScriptError,
|
formatThemeScriptError,
|
||||||
parseThemeScript,
|
parseThemeScript,
|
||||||
themeScriptProgramCanLeaveLauncher,
|
themeScriptProgramCanLeaveLauncher,
|
||||||
} from '$lib/themeScriptLang';
|
} from '$lib/theme/themeScriptLang';
|
||||||
import type {
|
import type {
|
||||||
ThemeV2Behavior,
|
ThemeV2Behavior,
|
||||||
ThemeV2BehaviorAction,
|
ThemeV2BehaviorAction,
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
ThemeV2Group,
|
ThemeV2Group,
|
||||||
ThemeV2ScriptScreen,
|
ThemeV2ScriptScreen,
|
||||||
ThemeV2ScriptValue,
|
ThemeV2ScriptValue,
|
||||||
} from '$lib/themeV2';
|
} from '$lib/theme/themeV2';
|
||||||
import { Link2, Plus, Trash2 } from '@lucide/svelte';
|
import { Link2, Plus, Trash2 } from '@lucide/svelte';
|
||||||
import { SvelteSet } from 'svelte/reactivity';
|
import { SvelteSet } from 'svelte/reactivity';
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
analyzeThemeSvelteSource,
|
analyzeThemeSvelteSource,
|
||||||
type ThemeSvelteAnalysis,
|
type ThemeSvelteAnalysis,
|
||||||
type ThemeSvelteDiagnostic,
|
type ThemeSvelteDiagnostic,
|
||||||
} from '$lib/themeSvelte';
|
} from '$lib/theme/themeSvelte';
|
||||||
import {
|
import {
|
||||||
THEME_SVELTE_COMPONENT_PLACEHOLDER,
|
THEME_SVELTE_COMPONENT_PLACEHOLDER,
|
||||||
THEME_SVELTE_COMPONENT_SKELETON,
|
THEME_SVELTE_COMPONENT_SKELETON,
|
||||||
} from '$lib/themeSvelteSnippets';
|
} from '$lib/theme/themeSvelteSnippets';
|
||||||
import { Component, CircleAlert, Maximize2, Minimize2, X } from '@lucide/svelte';
|
import { Component, CircleAlert, Maximize2, Minimize2, X } from '@lucide/svelte';
|
||||||
import type * as Monaco from 'monaco-editor';
|
import type * as Monaco from 'monaco-editor';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import Button from '$lib/components/ui/button/button.svelte';
|
import Button from '$lib/components/ui/button/button.svelte';
|
||||||
import Input from '$lib/components/ui/input/input.svelte';
|
import Input from '$lib/components/ui/input/input.svelte';
|
||||||
import Label from '$lib/components/ui/label/label.svelte';
|
import Label from '$lib/components/ui/label/label.svelte';
|
||||||
import { themeClassTokens } from '$lib/themeV2';
|
import { themeClassTokens } from '$lib/theme/themeV2';
|
||||||
import { Code2, RotateCcw } from '@lucide/svelte';
|
import { Code2, RotateCcw } from '@lucide/svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { compileThemeSvelte } from '$lib/themeSvelte';
|
import { compileThemeSvelte } from '$lib/theme/themeSvelte';
|
||||||
import { themeAssetUrl, type ThemeV2ScriptValue } from '$lib/themeV2';
|
import { themeAssetUrl, type ThemeV2ScriptValue } from '$lib/theme/themeV2';
|
||||||
import { TriangleAlert } from '@lucide/svelte';
|
import { TriangleAlert } from '@lucide/svelte';
|
||||||
import { mount, unmount } from 'svelte';
|
import { mount, unmount } from 'svelte';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Logo from '$assets/logo.png';
|
import Logo from '$assets/logo.png';
|
||||||
import { publishThemeToWorkshop } from '$lib/communityThemes';
|
import { fetchCommunityThemeDetails, publishThemeToWorkshop } from '$lib/theme/communityThemes';
|
||||||
import FontPreview from '$lib/components/theme/FontPreview.svelte';
|
import FontPreview from '$lib/components/theme/FontPreview.svelte';
|
||||||
import ThemeBehaviorInspector from '$lib/components/theme/ThemeBehaviorInspector.svelte';
|
import ThemeBehaviorInspector from '$lib/components/theme/ThemeBehaviorInspector.svelte';
|
||||||
import ThemeElementInspector from '$lib/components/theme/ThemeElementInspector.svelte';
|
import ThemeElementInspector from '$lib/components/theme/ThemeElementInspector.svelte';
|
||||||
@@ -44,30 +44,31 @@
|
|||||||
THEME_CLOCK_VARIABLE_NAMES,
|
THEME_CLOCK_VARIABLE_NAMES,
|
||||||
isThemeClockVariable,
|
isThemeClockVariable,
|
||||||
themeClockValues,
|
themeClockValues,
|
||||||
} from '$lib/themeClock';
|
} from '$lib/theme/themeClock';
|
||||||
import {
|
import {
|
||||||
BUNDLED_THEME_FONTS,
|
BUNDLED_THEME_FONTS,
|
||||||
bundledThemeFontFamily,
|
bundledThemeFontFamily,
|
||||||
fontStack,
|
fontStack,
|
||||||
type ThemeFontChoice,
|
type ThemeFontChoice,
|
||||||
} from '$lib/themeFonts';
|
} from '$lib/theme/themeFonts';
|
||||||
import { THEME_ICON_PREVIEW_NAMES, THEME_ICON_SETS } from '$lib/themeIcons';
|
import { THEME_ICON_PREVIEW_NAMES, THEME_ICON_SETS } from '$lib/theme/themeIcons';
|
||||||
import {
|
import {
|
||||||
themeBehaviorSummary,
|
themeBehaviorSummary,
|
||||||
themeBehaviorTargetLabel,
|
themeBehaviorTargetLabel,
|
||||||
themeElementLabel,
|
themeElementLabel,
|
||||||
themeGroupContainsElement,
|
themeGroupContainsElement,
|
||||||
themeGroupInteractiveCount,
|
themeGroupInteractiveCount,
|
||||||
} from '$lib/themeLogic';
|
} from '$lib/theme/themeLogic';
|
||||||
import { renderThemePreview } from '$lib/themePreview';
|
import { themeParallax } from '$lib/theme/themeParallax';
|
||||||
import { themeScriptInitialVariables, themeScriptVariableNames } from '$lib/themeScript';
|
import { renderThemePreview } from '$lib/theme/themePreview';
|
||||||
|
import { themeScriptInitialVariables, themeScriptVariableNames } from '$lib/theme/themeScript';
|
||||||
import {
|
import {
|
||||||
formatThemeScriptError,
|
formatThemeScriptError,
|
||||||
parseThemeScript,
|
parseThemeScript,
|
||||||
themeScriptProgramCanLeaveLauncher,
|
themeScriptProgramCanLeaveLauncher,
|
||||||
themeScriptProgramReferences,
|
themeScriptProgramReferences,
|
||||||
} from '$lib/themeScriptLang';
|
} from '$lib/theme/themeScriptLang';
|
||||||
import { analyzeThemeSvelteSource } from '$lib/themeSvelte';
|
import { analyzeThemeSvelteSource } from '$lib/theme/themeSvelte';
|
||||||
import {
|
import {
|
||||||
createDefaultThemeV2,
|
createDefaultThemeV2,
|
||||||
createThemeV2Behavior,
|
createThemeV2Behavior,
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
normalizeChrome,
|
normalizeChrome,
|
||||||
normalizeThemeTags,
|
normalizeThemeTags,
|
||||||
normalizeThemeV2,
|
normalizeThemeV2,
|
||||||
|
normalizeThemeVersion,
|
||||||
themeAssetName,
|
themeAssetName,
|
||||||
themeHasLaunchButton,
|
themeHasLaunchButton,
|
||||||
type ThemeV2Asset,
|
type ThemeV2Asset,
|
||||||
@@ -94,21 +96,24 @@
|
|||||||
type ThemeV2VideoElement,
|
type ThemeV2VideoElement,
|
||||||
type ThemeV2WidgetElement,
|
type ThemeV2WidgetElement,
|
||||||
type ThemeV2WidgetKind,
|
type ThemeV2WidgetKind,
|
||||||
} from '$lib/themeV2';
|
} from '$lib/theme/themeV2';
|
||||||
import {
|
import {
|
||||||
exportThemeFolder,
|
exportThemeFolder,
|
||||||
|
markThemeSynced,
|
||||||
saveThemeProject,
|
saveThemeProject,
|
||||||
themeAssetBase,
|
themeAssetBase,
|
||||||
themesDirectory,
|
themesDirectory,
|
||||||
toSafeName,
|
toSafeName,
|
||||||
updateInstalledThemeWorkshopId,
|
updateInstalledThemeWorkshopId,
|
||||||
} from '$lib/themes';
|
} from '$lib/theme/themes';
|
||||||
import type { EZPPUser, EZPPUserInfo } from '$lib/types';
|
import type { EZPPUser, EZPPUserInfo } from '$lib/types';
|
||||||
import { currentUser } from '$lib/userAuthentication';
|
import { currentUser } from '$lib/userAuthentication';
|
||||||
import { osuInstallationPath } from '$lib/userSettings';
|
import { osuInstallationPath } from '$lib/userSettings';
|
||||||
import { formatBytes, openURL } from '$lib/utils';
|
import { formatBytes, openURL } from '$lib/utils';
|
||||||
import {
|
import {
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
|
AlignCenter,
|
||||||
|
AlignHorizontalSpaceAround,
|
||||||
Boxes,
|
Boxes,
|
||||||
Check,
|
Check,
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
@@ -127,12 +132,14 @@
|
|||||||
Download,
|
Download,
|
||||||
Eye,
|
Eye,
|
||||||
EyeOff,
|
EyeOff,
|
||||||
|
FileText,
|
||||||
Film,
|
Film,
|
||||||
Gauge,
|
Gauge,
|
||||||
Globe,
|
Globe,
|
||||||
GripVertical,
|
GripVertical,
|
||||||
Hand,
|
Hand,
|
||||||
Image as ImageIcon,
|
Image as ImageIcon,
|
||||||
|
Info,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
Layers,
|
Layers,
|
||||||
LayoutGrid,
|
LayoutGrid,
|
||||||
@@ -173,6 +180,7 @@
|
|||||||
import { getCurrentWindow } from '@tauri-apps/api/window';
|
import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||||
import { open, save as saveDialog } from '@tauri-apps/plugin-dialog';
|
import { open, save as saveDialog } from '@tauri-apps/plugin-dialog';
|
||||||
import * as fs from '@tauri-apps/plugin-fs';
|
import * as fs from '@tauri-apps/plugin-fs';
|
||||||
|
import semver from 'semver';
|
||||||
import { sileo } from 'sileo';
|
import { sileo } from 'sileo';
|
||||||
import { onMount, tick } from 'svelte';
|
import { onMount, tick } from 'svelte';
|
||||||
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
||||||
@@ -287,6 +295,7 @@
|
|||||||
let panStart = { x: 0, y: 0, panX: 0, panY: 0 };
|
let panStart = { x: 0, y: 0, panX: 0, panY: 0 };
|
||||||
const canvasScale = $derived(canvasFitScale * canvasZoom);
|
const canvasScale = $derived(canvasFitScale * canvasZoom);
|
||||||
let statusMessage = $state('Ready');
|
let statusMessage = $state('Ready');
|
||||||
|
let lastPublishedVersion = $state<string | undefined>(undefined);
|
||||||
let renamingId = $state<string | undefined>(undefined);
|
let renamingId = $state<string | undefined>(undefined);
|
||||||
let draggingLayer = $state<LayerDragItem | undefined>(undefined);
|
let draggingLayer = $state<LayerDragItem | undefined>(undefined);
|
||||||
let dropTarget = $state<LayerDropTarget | undefined>(undefined);
|
let dropTarget = $state<LayerDropTarget | undefined>(undefined);
|
||||||
@@ -1803,6 +1812,7 @@
|
|||||||
|
|
||||||
async function loadContext() {
|
async function loadContext() {
|
||||||
loading = true;
|
loading = true;
|
||||||
|
lastPublishedVersion = undefined;
|
||||||
try {
|
try {
|
||||||
const context = await invoke<ThemeEditorContext>('theme_editor_context');
|
const context = await invoke<ThemeEditorContext>('theme_editor_context');
|
||||||
const parsed = context.themeJson
|
const parsed = context.themeJson
|
||||||
@@ -2920,6 +2930,12 @@
|
|||||||
notifyError('Add an author name so people know who made the theme.');
|
notifyError('Add an author name so people know who made the theme.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const version = normalizeThemeVersion(definition.version);
|
||||||
|
if (!version) {
|
||||||
|
notifyError('The version must use semantic versioning, for example 1.2.3 or 1.2.3-beta.1.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (definition.version !== version) definition.version = version;
|
||||||
const folderName = savedFolder ?? toSafeName(definition.name);
|
const folderName = savedFolder ?? toSafeName(definition.name);
|
||||||
if (!folderName.replace(/_/g, '')) {
|
if (!folderName.replace(/_/g, '')) {
|
||||||
notifyError('The theme name needs at least one letter or number.');
|
notifyError('The theme name needs at least one letter or number.');
|
||||||
@@ -3016,8 +3032,10 @@
|
|||||||
|
|
||||||
if (!definition.name.trim()) error('The theme needs a name.');
|
if (!definition.name.trim()) error('The theme needs a name.');
|
||||||
if (!definition.author.trim()) error('The theme needs an author.');
|
if (!definition.author.trim()) error('The theme needs an author.');
|
||||||
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(definition.version.trim())) {
|
if (!normalizeThemeVersion(definition.version)) {
|
||||||
warning('The version should use semantic versioning, for example 1.0.0.');
|
error(
|
||||||
|
'The version must use semantic versioning, for example 1.0.0 or 1.0.0-beta.1, with no "v" prefix.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!themeHasLaunchButton(definition)) {
|
if (!themeHasLaunchButton(definition)) {
|
||||||
error(
|
error(
|
||||||
@@ -3340,10 +3358,68 @@
|
|||||||
let publishStatusMessage = $state('');
|
let publishStatusMessage = $state('');
|
||||||
let publishProgress = $state(0);
|
let publishProgress = $state(0);
|
||||||
|
|
||||||
|
async function checkPublishVersion(): Promise<
|
||||||
|
{ ok: true; version: string } | { ok: false; error: string }
|
||||||
|
> {
|
||||||
|
const proposed = normalizeThemeVersion(definition.version);
|
||||||
|
if (!proposed) {
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
error: 'Use a semantic version such as 1.2.3 in the Theme tab before publishing.',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let publishedVersion = lastPublishedVersion;
|
||||||
|
const workshopId = definition.workshopId?.trim();
|
||||||
|
if (workshopId) {
|
||||||
|
let remoteVersion: string;
|
||||||
|
try {
|
||||||
|
remoteVersion = (await fetchCommunityThemeDetails(workshopId)).version?.trim() ?? '';
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('[Workshop] Could not verify the published theme version:', error);
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
error:
|
||||||
|
'Could not verify the current workshop version. Check your connection and try again.',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const validRemote = normalizeThemeVersion(remoteVersion);
|
||||||
|
if (!validRemote) {
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
error:
|
||||||
|
'The current workshop version could not be read. Contact a workshop administrator.',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!publishedVersion || semver.gt(validRemote, publishedVersion)) {
|
||||||
|
publishedVersion = validRemote;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (publishedVersion) {
|
||||||
|
if (semver.eq(proposed, publishedVersion)) {
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
error: `Version ${proposed} has already been published. Increase the version before publishing again.`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!semver.gt(proposed, publishedVersion)) {
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
error: `Version ${proposed} must be higher than the last published version ${publishedVersion}.`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ok: true, version: proposed };
|
||||||
|
}
|
||||||
|
|
||||||
async function openPublishDialog() {
|
async function openPublishDialog() {
|
||||||
if (exporting || saving || publishing) return;
|
if (exporting || saving || publishing) return;
|
||||||
|
|
||||||
if (!$currentUser) {
|
const user = $currentUser;
|
||||||
|
if (!user) {
|
||||||
sileo.error({
|
sileo.error({
|
||||||
title: 'Authentication Required',
|
title: 'Authentication Required',
|
||||||
description:
|
description:
|
||||||
@@ -3361,8 +3437,23 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirty) {
|
const versionCheck = await checkPublishVersion();
|
||||||
await saveTheme({ notify: false });
|
if (!versionCheck.ok) {
|
||||||
|
sileo.error({
|
||||||
|
title: 'Version not publishable',
|
||||||
|
description: versionCheck.error,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const versionChanged = definition.version !== versionCheck.version;
|
||||||
|
if (versionChanged) definition.version = versionCheck.version;
|
||||||
|
|
||||||
|
const authorIdChanged = definition.authorId !== user.id;
|
||||||
|
if (authorIdChanged) definition.authorId = user.id;
|
||||||
|
|
||||||
|
if (dirty || authorIdChanged || versionChanged) {
|
||||||
|
const saved = await saveTheme({ notify: false });
|
||||||
|
if (!saved) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
publishThemeId = definition.workshopId ?? '';
|
publishThemeId = definition.workshopId ?? '';
|
||||||
@@ -3399,16 +3490,34 @@
|
|||||||
|
|
||||||
async function handlePublishToWorkshop() {
|
async function handlePublishToWorkshop() {
|
||||||
if (publishing) return;
|
if (publishing) return;
|
||||||
if (!savedFolder) {
|
|
||||||
await saveTheme({ notify: false });
|
|
||||||
if (!savedFolder) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const firstPublish = !definition.workshopId;
|
||||||
publishing = true;
|
publishing = true;
|
||||||
publishProgress = 5;
|
publishProgress = 5;
|
||||||
publishStatusMessage = 'Packaging theme archive...';
|
publishStatusMessage = 'Checking version...';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const versionCheck = await checkPublishVersion();
|
||||||
|
if (!versionCheck.ok) {
|
||||||
|
sileo.error({
|
||||||
|
title: 'Version not publishable',
|
||||||
|
description: versionCheck.error,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (definition.version !== versionCheck.version) {
|
||||||
|
definition.version = versionCheck.version;
|
||||||
|
const saved = await saveTheme({ notify: false });
|
||||||
|
if (!saved) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!savedFolder) {
|
||||||
|
const saved = await saveTheme({ notify: false });
|
||||||
|
if (!saved || !savedFolder) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
publishStatusMessage = 'Packaging theme archive...';
|
||||||
const baseThemesDir = await themesDirectory();
|
const baseThemesDir = await themesDirectory();
|
||||||
const themeFolder = await path.join(baseThemesDir, savedFolder);
|
const themeFolder = await path.join(baseThemesDir, savedFolder);
|
||||||
const themeId = savedFolder || toSafeName(definition.name);
|
const themeId = savedFolder || toSafeName(definition.name);
|
||||||
@@ -3419,7 +3528,7 @@
|
|||||||
workshopId: definition.workshopId,
|
workshopId: definition.workshopId,
|
||||||
name: definition.name,
|
name: definition.name,
|
||||||
description: definition.description || '',
|
description: definition.description || '',
|
||||||
version: definition.version || '1.0.0',
|
version: versionCheck.version,
|
||||||
apiVersion: definition.apiVersion || '2.0.0',
|
apiVersion: definition.apiVersion || '2.0.0',
|
||||||
tags: definition.tags ?? [],
|
tags: definition.tags ?? [],
|
||||||
allowForking: definition.allowForking !== false,
|
allowForking: definition.allowForking !== false,
|
||||||
@@ -3429,6 +3538,8 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lastPublishedVersion = versionCheck.version;
|
||||||
|
|
||||||
if (result.themeId) {
|
if (result.themeId) {
|
||||||
// Persist the server-assigned ID so the next publish updates this
|
// Persist the server-assigned ID so the next publish updates this
|
||||||
// workshop record instead of creating another one.
|
// workshop record instead of creating another one.
|
||||||
@@ -3436,9 +3547,13 @@
|
|||||||
publishThemeId = result.themeId;
|
publishThemeId = result.themeId;
|
||||||
try {
|
try {
|
||||||
await updateInstalledThemeWorkshopId(savedFolder, result.themeId);
|
await updateInstalledThemeWorkshopId(savedFolder, result.themeId);
|
||||||
|
await markThemeSynced(savedFolder, {
|
||||||
|
workshopId: result.themeId,
|
||||||
|
version: versionCheck.version,
|
||||||
|
});
|
||||||
lastSavedKey = snapshotKey(captureSnapshot());
|
lastSavedKey = snapshotKey(captureSnapshot());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('[Workshop] Could not store the theme ID in theme.json:', err);
|
console.warn('[Workshop] Could not store the theme sync metadata:', err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The launcher window owns the installed-theme list. Tell it about the
|
// The launcher window owns the installed-theme list. Tell it about the
|
||||||
@@ -3452,8 +3567,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
sileo.success({
|
sileo.success({
|
||||||
title: 'Published to Workshop!',
|
title: firstPublish ? 'Submitted for review' : 'Workshop update submitted',
|
||||||
description: `"${definition.name}" is now live in the Community Themes Workshop.`,
|
description: firstPublish
|
||||||
|
? `"${definition.name}" will be listed once a moderator approves it.`
|
||||||
|
: `"${definition.name}" was updated in the Community Workshop.`,
|
||||||
});
|
});
|
||||||
|
|
||||||
publishModalOpen = false;
|
publishModalOpen = false;
|
||||||
@@ -4968,7 +5085,12 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="min-h-0 flex-1 space-y-3 overflow-y-auto p-3">
|
<div class="min-h-0 flex-1 space-y-3 overflow-y-auto p-3">
|
||||||
<ThemeSection title="Theme details" bordered={false} contentClass="space-y-3 pt-2">
|
<ThemeSection
|
||||||
|
title="Theme details"
|
||||||
|
icon={Info}
|
||||||
|
bordered={false}
|
||||||
|
contentClass="space-y-3 pt-2"
|
||||||
|
>
|
||||||
<div class="space-y-1.5">
|
<div class="space-y-1.5">
|
||||||
<Label for="theme-name" class={labelClass}>Name</Label>
|
<Label for="theme-name" class={labelClass}>Name</Label>
|
||||||
<Input
|
<Input
|
||||||
@@ -5127,7 +5249,11 @@
|
|||||||
onchange={setVariableDefault}
|
onchange={setVariableDefault}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ThemeSection title="Launcher Layout & Chrome" contentClass="space-y-3 pt-2.5">
|
<ThemeSection
|
||||||
|
title="Launcher Layout & Chrome"
|
||||||
|
icon={LayoutGrid}
|
||||||
|
contentClass="space-y-3 pt-2.5"
|
||||||
|
>
|
||||||
<div class="space-y-1.5">
|
<div class="space-y-1.5">
|
||||||
<Label class={labelClass}>Layout Preset</Label>
|
<Label class={labelClass}>Layout Preset</Label>
|
||||||
<div class="grid grid-cols-3 gap-1 rounded-md bg-black/30 p-1">
|
<div class="grid grid-cols-3 gap-1 rounded-md bg-black/30 p-1">
|
||||||
@@ -5312,7 +5438,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
|
|
||||||
<ThemeSection title="Background" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Background" icon={ImageIcon} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="grid grid-cols-4 gap-1 rounded-md bg-black/30 p-1">
|
<div class="grid grid-cols-4 gap-1 rounded-md bg-black/30 p-1">
|
||||||
{#each backgroundTypes as option (option.value)}
|
{#each backgroundTypes as option (option.value)}
|
||||||
<Button
|
<Button
|
||||||
@@ -6010,6 +6136,13 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="width:{CANVAS_WIDTH}px;height:{CANVAS_HEIGHT}px;transform:scale({canvasScale});transform-origin:top left;"
|
style="width:{CANVAS_WIDTH}px;height:{CANVAS_HEIGHT}px;transform:scale({canvasScale});transform-origin:top left;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="contents"
|
||||||
|
use:themeParallax={{
|
||||||
|
enabled: definition.parallax?.enabled === true,
|
||||||
|
intensity: definition.parallax?.intensity ?? 0.25,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<ThemeStage
|
<ThemeStage
|
||||||
{definition}
|
{definition}
|
||||||
@@ -6032,6 +6165,7 @@
|
|||||||
onbuttonaction={handleTestButtonAction}
|
onbuttonaction={handleTestButtonAction}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</ContextMenu.Trigger>
|
</ContextMenu.Trigger>
|
||||||
|
|
||||||
<ContextMenu.Content class="w-56 border-theme-700 bg-theme-950">
|
<ContextMenu.Content class="w-56 border-theme-700 bg-theme-950">
|
||||||
@@ -6123,6 +6257,7 @@
|
|||||||
<div class="min-h-0 flex-1 space-y-3 overflow-y-auto p-3">
|
<div class="min-h-0 flex-1 space-y-3 overflow-y-auto p-3">
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Align"
|
title="Align"
|
||||||
|
icon={AlignCenter}
|
||||||
bordered={false}
|
bordered={false}
|
||||||
headingClass="text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
headingClass="text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
||||||
contentClass="space-y-2 pt-2"
|
contentClass="space-y-2 pt-2"
|
||||||
@@ -6168,6 +6303,7 @@
|
|||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Distribute"
|
title="Distribute"
|
||||||
|
icon={AlignHorizontalSpaceAround}
|
||||||
headingClass="text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
headingClass="text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
||||||
contentClass="space-y-2 pt-2.5"
|
contentClass="space-y-2 pt-2.5"
|
||||||
>
|
>
|
||||||
@@ -6191,6 +6327,7 @@
|
|||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Layers"
|
title="Layers"
|
||||||
|
icon={Layers}
|
||||||
headingClass="text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
headingClass="text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"
|
||||||
contentClass="space-y-2 pt-2.5"
|
contentClass="space-y-2 pt-2.5"
|
||||||
>
|
>
|
||||||
@@ -6514,6 +6651,7 @@
|
|||||||
|
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Theme summary"
|
title="Theme summary"
|
||||||
|
icon={FileText}
|
||||||
class="mt-4"
|
class="mt-4"
|
||||||
bordered={false}
|
bordered={false}
|
||||||
contentClass="space-y-2 pt-2"
|
contentClass="space-y-2 pt-2"
|
||||||
@@ -6542,6 +6680,7 @@
|
|||||||
|
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Shortcuts"
|
title="Shortcuts"
|
||||||
|
icon={Keyboard}
|
||||||
class="mt-4"
|
class="mt-4"
|
||||||
bordered={false}
|
bordered={false}
|
||||||
open={false}
|
open={false}
|
||||||
@@ -6980,7 +7119,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-[10px] leading-relaxed text-muted-foreground/70">
|
<p class="text-[10px] leading-relaxed text-muted-foreground/70">
|
||||||
These details come from the Theme tab. Change them there before publishing.
|
These details come from the Theme tab. Published versions cannot be reused, so increase
|
||||||
|
the version before every update.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
import * as Select from '$lib/components/ui/select';
|
import * as Select from '$lib/components/ui/select';
|
||||||
import Slider from '$lib/components/ui/slider/slider.svelte';
|
import Slider from '$lib/components/ui/slider/slider.svelte';
|
||||||
import Textarea from '$lib/components/ui/textarea/textarea.svelte';
|
import Textarea from '$lib/components/ui/textarea/textarea.svelte';
|
||||||
import { getThemeDataSampleValue, resolveThemeDataValue, themeGlobalData } from '$lib/themeData';
|
import { getThemeDataSampleValue, resolveThemeDataValue, themeGlobalData } from '$lib/theme/themeData';
|
||||||
import type { ThemeFontChoice } from '$lib/themeFonts';
|
import type { ThemeFontChoice } from '$lib/theme/themeFonts';
|
||||||
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons';
|
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/theme/themeIcons';
|
||||||
import {
|
import {
|
||||||
THEME_DATA_FIELDS,
|
THEME_DATA_FIELDS,
|
||||||
THEME_PARTICLE_PRESETS,
|
THEME_PARTICLE_PRESETS,
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
type ThemeV2MaskShape,
|
type ThemeV2MaskShape,
|
||||||
type ThemeV2WidgetKind,
|
type ThemeV2WidgetKind,
|
||||||
type ThemeV2WidgetVariant,
|
type ThemeV2WidgetVariant,
|
||||||
} from '$lib/themeV2';
|
} from '$lib/theme/themeV2';
|
||||||
import { openURL } from '$lib/utils';
|
import { openURL } from '$lib/utils';
|
||||||
import {
|
import {
|
||||||
CircleUser,
|
CircleUser,
|
||||||
@@ -38,12 +38,15 @@
|
|||||||
Film,
|
Film,
|
||||||
Gauge,
|
Gauge,
|
||||||
Image as ImageIcon,
|
Image as ImageIcon,
|
||||||
|
Layers,
|
||||||
LayoutGrid,
|
LayoutGrid,
|
||||||
Megaphone,
|
Megaphone,
|
||||||
MousePointerClick,
|
MousePointerClick,
|
||||||
|
Move,
|
||||||
Play,
|
Play,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
Repeat,
|
Repeat,
|
||||||
|
Scan,
|
||||||
Shapes,
|
Shapes,
|
||||||
Sparkles,
|
Sparkles,
|
||||||
Spline,
|
Spline,
|
||||||
@@ -221,7 +224,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ThemeSection title="Position & size" bordered={false} contentClass="space-y-3 pt-2">
|
<ThemeSection title="Position & size" icon={Move} bordered={false} contentClass="space-y-3 pt-2">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-name" class={label}>Layer name</Label>
|
<Label for="element-name" class={label}>Layer name</Label>
|
||||||
<Input
|
<Input
|
||||||
@@ -290,6 +293,7 @@
|
|||||||
|
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Layer state"
|
title="Layer state"
|
||||||
|
icon={Layers}
|
||||||
contentClass="flex flex-wrap items-center gap-x-4 gap-y-2 pt-2.5"
|
contentClass="flex flex-wrap items-center gap-x-4 gap-y-2 pt-2.5"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-1.5">
|
<div class="flex items-center gap-1.5">
|
||||||
@@ -402,7 +406,11 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{#if element.type === 'text' || element.type === 'data'}
|
{#if element.type === 'text' || element.type === 'data'}
|
||||||
<ThemeSection title={element.type === 'data' ? 'Data' : 'Text'} contentClass="space-y-3 pt-2.5">
|
<ThemeSection
|
||||||
|
title={element.type === 'data' ? 'Data' : 'Text'}
|
||||||
|
icon={Type}
|
||||||
|
contentClass="space-y-3 pt-2.5"
|
||||||
|
>
|
||||||
{#if element.type === 'data'}
|
{#if element.type === 'data'}
|
||||||
<div class="space-y-1.5">
|
<div class="space-y-1.5">
|
||||||
<Label for="element-data-field" class={label}>Value</Label>
|
<Label for="element-data-field" class={label}>Value</Label>
|
||||||
@@ -695,7 +703,7 @@
|
|||||||
<ThemeTextStyleControls {element} onchange={(patch) => Object.assign(element, patch)} />
|
<ThemeTextStyleControls {element} onchange={(patch) => Object.assign(element, patch)} />
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'svelte'}
|
{:else if element.type === 'svelte'}
|
||||||
<ThemeSection title="Svelte component" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Svelte component" icon={Component} contentClass="space-y-3 pt-2.5">
|
||||||
<div
|
<div
|
||||||
class="rounded-md border border-amber-500/25 bg-amber-500/10 p-2 text-[9px] leading-relaxed text-amber-100"
|
class="rounded-md border border-amber-500/25 bg-amber-500/10 p-2 text-[9px] leading-relaxed text-amber-100"
|
||||||
>
|
>
|
||||||
@@ -721,7 +729,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'image' || element.type === 'video'}
|
{:else if element.type === 'image' || element.type === 'video'}
|
||||||
<ThemeSection title="Media" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Media" icon={ImageIcon} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="rounded-md border border-theme-800 bg-black/20 p-2">
|
<div class="rounded-md border border-theme-800 bg-black/20 p-2">
|
||||||
<p class="text-[10px] uppercase tracking-wide text-muted-foreground">Asset</p>
|
<p class="text-[10px] uppercase tracking-wide text-muted-foreground">Asset</p>
|
||||||
<p class="mt-1 truncate font-mono text-[10px] text-theme-100">{element.src}</p>
|
<p class="mt-1 truncate font-mono text-[10px] text-theme-100">{element.src}</p>
|
||||||
@@ -829,7 +837,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'lottie'}
|
{:else if element.type === 'lottie'}
|
||||||
<ThemeSection title="Lottie animation" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Lottie animation" icon={Film} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="rounded-md border border-theme-800 bg-black/20 p-2">
|
<div class="rounded-md border border-theme-800 bg-black/20 p-2">
|
||||||
<p class="text-[10px] uppercase tracking-wide text-muted-foreground">Animation</p>
|
<p class="text-[10px] uppercase tracking-wide text-muted-foreground">Animation</p>
|
||||||
<p class="mt-1 truncate font-mono text-[10px] text-theme-100">{element.src}</p>
|
<p class="mt-1 truncate font-mono text-[10px] text-theme-100">{element.src}</p>
|
||||||
@@ -885,7 +893,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'shape'}
|
{:else if element.type === 'shape'}
|
||||||
<ThemeSection title="Shape" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Shape" icon={Shapes} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-shape" class={label}>Shape</Label>
|
<Label for="element-shape" class={label}>Shape</Label>
|
||||||
<Select.Root
|
<Select.Root
|
||||||
@@ -1153,7 +1161,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'icon'}
|
{:else if element.type === 'icon'}
|
||||||
<ThemeSection title="Icon" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Icon" icon={Sparkles} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-icon" class={label}>Icon</Label>
|
<Label for="element-icon" class={label}>Icon</Label>
|
||||||
<ThemeIconPicker bind:value={element.icon} {iconSet} />
|
<ThemeIconPicker bind:value={element.icon} {iconSet} />
|
||||||
@@ -1185,7 +1193,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'repeater'}
|
{:else if element.type === 'repeater'}
|
||||||
<ThemeSection title="Repeater" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Repeater" icon={Repeat} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-repeater-source" class={label}>Tile</Label>
|
<Label for="element-repeater-source" class={label}>Tile</Label>
|
||||||
<Select.Root
|
<Select.Root
|
||||||
@@ -1307,7 +1315,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'gauge'}
|
{:else if element.type === 'gauge'}
|
||||||
<ThemeSection title="Gauge" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Gauge" icon={Gauge} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="grid grid-cols-2 gap-2">
|
<div class="grid grid-cols-2 gap-2">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-gauge-mode" class={label}>Style</Label>
|
<Label for="element-gauge-mode" class={label}>Style</Label>
|
||||||
@@ -1423,7 +1431,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'ticker'}
|
{:else if element.type === 'ticker'}
|
||||||
<ThemeSection title="Ticker" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Ticker" icon={Type} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-ticker-text" class={label}>Text</Label>
|
<Label for="element-ticker-text" class={label}>Text</Label>
|
||||||
<Textarea
|
<Textarea
|
||||||
@@ -1520,7 +1528,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'button'}
|
{:else if element.type === 'button'}
|
||||||
<ThemeSection title="Button" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Button" icon={MousePointerClick} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-button-label" class={label}>Label</Label>
|
<Label for="element-button-label" class={label}>Label</Label>
|
||||||
<Input id="element-button-label" class={field} bind:value={element.label} />
|
<Input id="element-button-label" class={field} bind:value={element.label} />
|
||||||
@@ -1704,7 +1712,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'path'}
|
{:else if element.type === 'path'}
|
||||||
<ThemeSection title="Vector path" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Vector path" icon={Spline} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-path-data" class={label}>SVG path data</Label>
|
<Label for="element-path-data" class={label}>SVG path data</Label>
|
||||||
<Textarea
|
<Textarea
|
||||||
@@ -1850,7 +1858,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'particles'}
|
{:else if element.type === 'particles'}
|
||||||
<ThemeSection title="Particles" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Particles" icon={Sparkles} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-particles-preset" class={label}>Preset</Label>
|
<Label for="element-particles-preset" class={label}>Preset</Label>
|
||||||
<Select.Root
|
<Select.Root
|
||||||
@@ -1954,7 +1962,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'clock'}
|
{:else if element.type === 'clock'}
|
||||||
<ThemeSection title="Clock" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Clock" icon={Clock} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-clock-mode" class={label}>Style</Label>
|
<Label for="element-clock-mode" class={label}>Style</Label>
|
||||||
<Select.Root
|
<Select.Root
|
||||||
@@ -2121,7 +2129,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'countdown'}
|
{:else if element.type === 'countdown'}
|
||||||
<ThemeSection title="Countdown" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Countdown" icon={Timer} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1.5">
|
<div class="space-y-1.5">
|
||||||
<Label for="element-countdown-target" class={label}>Target date & time</Label>
|
<Label for="element-countdown-target" class={label}>Target date & time</Label>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
@@ -2220,7 +2228,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{:else if element.type === 'widget'}
|
{:else if element.type === 'widget'}
|
||||||
<ThemeSection title="Widget" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Widget" icon={LayoutGrid} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1.5">
|
<div class="space-y-1.5">
|
||||||
<Label for="element-widget-type" class={label}>Widget Type</Label>
|
<Label for="element-widget-type" class={label}>Widget Type</Label>
|
||||||
<Select.Root
|
<Select.Root
|
||||||
@@ -2558,7 +2566,7 @@
|
|||||||
</ThemeSection>
|
</ThemeSection>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<ThemeSection title="Mask" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Mask" icon={Scan} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="element-mask-shape" class={label}>Clip shape</Label>
|
<Label for="element-mask-shape" class={label}>Clip shape</Label>
|
||||||
<Select.Root
|
<Select.Root
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
import ThemeSection from '$lib/components/theme/ThemeSection.svelte';
|
import ThemeSection from '$lib/components/theme/ThemeSection.svelte';
|
||||||
import Button from '$lib/components/ui/button/button.svelte';
|
import Button from '$lib/components/ui/button/button.svelte';
|
||||||
import Slider from '$lib/components/ui/slider/slider.svelte';
|
import Slider from '$lib/components/ui/slider/slider.svelte';
|
||||||
import type { ThemeV2Filters } from '$lib/themeV2';
|
import type { ThemeV2Filters } from '$lib/theme/themeV2';
|
||||||
|
import { SlidersHorizontal } from '@lucide/svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
filters,
|
filters,
|
||||||
@@ -67,6 +68,7 @@
|
|||||||
|
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Filters"
|
title="Filters"
|
||||||
|
icon={SlidersHorizontal}
|
||||||
open={false}
|
open={false}
|
||||||
actions={filterActions}
|
actions={filterActions}
|
||||||
contentClass="space-y-2.5 pt-2.5"
|
contentClass="space-y-2.5 pt-2.5"
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
type ThemeV2Element,
|
type ThemeV2Element,
|
||||||
type ThemeV2Group,
|
type ThemeV2Group,
|
||||||
type ThemeV2MaskShape,
|
type ThemeV2MaskShape,
|
||||||
} from '$lib/themeV2';
|
} from '$lib/theme/themeV2';
|
||||||
import { Boxes, RefreshCw, Ungroup } from '@lucide/svelte';
|
import { Boxes, Layers, RefreshCw, Scan, Ungroup } from '@lucide/svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
group = $bindable(),
|
group = $bindable(),
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ThemeSection title="Group" bordered={false} contentClass="space-y-3 pt-2">
|
<ThemeSection title="Group" icon={Boxes} bordered={false} contentClass="space-y-3 pt-2">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="group-name" class={label}>Group name</Label>
|
<Label for="group-name" class={label}>Group name</Label>
|
||||||
<Input
|
<Input
|
||||||
@@ -96,6 +96,7 @@
|
|||||||
|
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Group state"
|
title="Group state"
|
||||||
|
icon={Layers}
|
||||||
contentClass="flex flex-wrap items-center gap-x-4 gap-y-2 pt-2.5"
|
contentClass="flex flex-wrap items-center gap-x-4 gap-y-2 pt-2.5"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-1.5">
|
<div class="flex items-center gap-1.5">
|
||||||
@@ -167,7 +168,7 @@
|
|||||||
ondelete={ondeleterule}
|
ondelete={ondeleterule}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ThemeSection title="Mask" contentClass="space-y-3 pt-2.5">
|
<ThemeSection title="Mask" icon={Scan} contentClass="space-y-3 pt-2.5">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="group-mask-shape" class={label}>Clip shape</Label>
|
<Label for="group-mask-shape" class={label}>Clip shape</Label>
|
||||||
<Select.Root
|
<Select.Root
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getThemeIconBody } from '$lib/themeIconCatalog';
|
import { getThemeIconBody } from '$lib/theme/themeIconCatalog';
|
||||||
import { DEFAULT_THEME_ICON_SET, type ThemeIconName, type ThemeIconSet } from '$lib/themeIcons';
|
import {
|
||||||
|
DEFAULT_THEME_ICON_SET,
|
||||||
|
type ThemeIconName,
|
||||||
|
type ThemeIconSet,
|
||||||
|
} from '$lib/theme/themeIcons';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
name,
|
name,
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
getFullIconCatalog,
|
getFullIconCatalog,
|
||||||
type IconPackKey,
|
type IconPackKey,
|
||||||
type ThemeIconCatalogItem,
|
type ThemeIconCatalogItem,
|
||||||
} from '$lib/themeIconCatalog';
|
} from '$lib/theme/themeIconCatalog';
|
||||||
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons';
|
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/theme/themeIcons';
|
||||||
import ThemeIcon from './ThemeIcon.svelte';
|
import ThemeIcon from './ThemeIcon.svelte';
|
||||||
import { Check, ChevronsUpDown, LayoutGrid, List, Search, X } from '@lucide/svelte';
|
import { Check, ChevronsUpDown, LayoutGrid, List, Search, X } from '@lucide/svelte';
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ThemeBehaviorInspector from '$lib/components/theme/ThemeBehaviorInspector.svelte';
|
import ThemeBehaviorInspector from '$lib/components/theme/ThemeBehaviorInspector.svelte';
|
||||||
import Button from '$lib/components/ui/button/button.svelte';
|
import Button from '$lib/components/ui/button/button.svelte';
|
||||||
import { themeBehaviorSummary, themeGroupInteractiveCount } from '$lib/themeLogic';
|
import { themeEditorSectionOpen } from '$lib/theme/themeEditorUiState';
|
||||||
|
import { themeBehaviorSummary, themeGroupInteractiveCount } from '$lib/theme/themeLogic';
|
||||||
import type {
|
import type {
|
||||||
ThemeV2Behavior,
|
ThemeV2Behavior,
|
||||||
ThemeV2BehaviorTarget,
|
ThemeV2BehaviorTarget,
|
||||||
ThemeV2Element,
|
ThemeV2Element,
|
||||||
ThemeV2Group,
|
ThemeV2Group,
|
||||||
} from '$lib/themeV2';
|
} from '$lib/theme/themeV2';
|
||||||
import { AlertTriangle, ChevronDown, Plus, Zap } from '@lucide/svelte';
|
import { AlertTriangle, ChevronDown, Plus, Zap } from '@lucide/svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -30,8 +31,13 @@
|
|||||||
ondelete: (id: string) => void;
|
ondelete: (id: string) => void;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let open = $state(false);
|
const sectionKey = 'Logic';
|
||||||
|
let open = $state(themeEditorSectionOpen.get(sectionKey) ?? false);
|
||||||
let selectedId = $state<string | undefined>(undefined);
|
let selectedId = $state<string | undefined>(undefined);
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
themeEditorSectionOpen.set(sectionKey, open);
|
||||||
|
});
|
||||||
let section = $state<HTMLElement>();
|
let section = $state<HTMLElement>();
|
||||||
let lastFocusToken = 0;
|
let lastFocusToken = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,38 @@
|
|||||||
let container = $state<HTMLDivElement | undefined>(undefined);
|
let container = $state<HTMLDivElement | undefined>(undefined);
|
||||||
let animation: AnimationItem | undefined;
|
let animation: AnimationItem | undefined;
|
||||||
let reducedMotion = false;
|
let reducedMotion = false;
|
||||||
|
let windowActive = true;
|
||||||
|
|
||||||
|
function syncPlayback() {
|
||||||
|
if (!animation) return;
|
||||||
|
animation.loop = loop;
|
||||||
|
animation.setSpeed(speed);
|
||||||
|
if (autoplay && !reducedMotion && windowActive && document.visibilityState === 'visible') {
|
||||||
|
animation.play();
|
||||||
|
} else {
|
||||||
|
animation.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (!container || !src) return;
|
if (!container || !src) return;
|
||||||
reducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
reducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
|
|
||||||
|
const onBlur = () => {
|
||||||
|
windowActive = false;
|
||||||
|
syncPlayback();
|
||||||
|
};
|
||||||
|
const onFocus = () => {
|
||||||
|
windowActive = true;
|
||||||
|
syncPlayback();
|
||||||
|
};
|
||||||
|
const onVisibilityChange = () => syncPlayback();
|
||||||
|
|
||||||
|
window.addEventListener('blur', onBlur);
|
||||||
|
window.addEventListener('focus', onFocus);
|
||||||
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
|
||||||
const start = (animationData?: unknown) => {
|
const start = (animationData?: unknown) => {
|
||||||
if (cancelled || !container) return;
|
if (cancelled || !container) return;
|
||||||
try {
|
try {
|
||||||
@@ -30,7 +56,8 @@
|
|||||||
container,
|
container,
|
||||||
renderer: 'svg',
|
renderer: 'svg',
|
||||||
loop,
|
loop,
|
||||||
autoplay: autoplay && !reducedMotion,
|
autoplay:
|
||||||
|
autoplay && !reducedMotion && windowActive && document.visibilityState === 'visible',
|
||||||
...(animationData ? { animationData } : { path: src }),
|
...(animationData ? { animationData } : { path: src }),
|
||||||
rendererSettings: { preserveAspectRatio: 'xMidYMid meet' },
|
rendererSettings: { preserveAspectRatio: 'xMidYMid meet' },
|
||||||
});
|
});
|
||||||
@@ -52,15 +79,14 @@
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
|
window.removeEventListener('blur', onBlur);
|
||||||
|
window.removeEventListener('focus', onFocus);
|
||||||
|
document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (!animation) return;
|
syncPlayback();
|
||||||
animation.loop = loop;
|
|
||||||
animation.setSpeed(speed);
|
|
||||||
if (autoplay && !reducedMotion) animation.play();
|
|
||||||
else animation.pause();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {
|
|
||||||
reportCommunityTheme,
|
|
||||||
type CommunityTheme,
|
|
||||||
type ThemeReportCategory,
|
|
||||||
} from '$lib/communityThemes';
|
|
||||||
import { Button } from '$lib/components/ui/button';
|
import { Button } from '$lib/components/ui/button';
|
||||||
import * as Dialog from '$lib/components/ui/dialog';
|
import * as Dialog from '$lib/components/ui/dialog';
|
||||||
import { Label } from '$lib/components/ui/label';
|
import { Label } from '$lib/components/ui/label';
|
||||||
import * as Select from '$lib/components/ui/select';
|
import * as Select from '$lib/components/ui/select';
|
||||||
import Textarea from '$lib/components/ui/textarea/textarea.svelte';
|
import Textarea from '$lib/components/ui/textarea/textarea.svelte';
|
||||||
|
import {
|
||||||
|
reportCommunityTheme,
|
||||||
|
type CommunityTheme,
|
||||||
|
type ThemeReportCategory,
|
||||||
|
} from '$lib/theme/communityThemes';
|
||||||
import { Flag, LoaderCircle, X } from '@lucide/svelte';
|
import { Flag, LoaderCircle, X } from '@lucide/svelte';
|
||||||
import { sileo } from 'sileo';
|
import { sileo } from 'sileo';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { isThemeClockVariable, THEME_CLOCK_VARIABLE_NAMES } from '$lib/themeClock';
|
import { isThemeClockVariable, THEME_CLOCK_VARIABLE_NAMES } from '$lib/theme/themeClock';
|
||||||
import { parseThemeScript } from '$lib/themeScriptLang';
|
import { parseThemeScript } from '$lib/theme/themeScriptLang';
|
||||||
import type { ThemeV2Element, ThemeV2Group, ThemeV2ScriptScreen } from '$lib/themeV2';
|
import type { ThemeV2Element, ThemeV2Group, ThemeV2ScriptScreen } from '$lib/theme/themeV2';
|
||||||
import { Braces, CircleAlert, Maximize2, Minimize2, X } from '@lucide/svelte';
|
import { Braces, CircleAlert, Maximize2, Minimize2, X } from '@lucide/svelte';
|
||||||
import type * as Monaco from 'monaco-editor';
|
import type * as Monaco from 'monaco-editor';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { themeEditorSectionOpen } from '$lib/theme/themeEditorUiState';
|
||||||
import { ChevronDown } from '@lucide/svelte';
|
import { ChevronDown } from '@lucide/svelte';
|
||||||
|
import { untrack } from 'svelte';
|
||||||
import type { Component, Snippet } from 'svelte';
|
import type { Component, Snippet } from 'svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
title,
|
title,
|
||||||
open = $bindable(true),
|
open: initialOpen = true,
|
||||||
icon: Icon,
|
icon: Icon,
|
||||||
badge,
|
badge,
|
||||||
description,
|
description,
|
||||||
@@ -27,6 +29,12 @@
|
|||||||
headingClass?: string;
|
headingClass?: string;
|
||||||
bordered?: boolean;
|
bordered?: boolean;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
|
let isOpen = $state(untrack(() => themeEditorSectionOpen.get(title) ?? initialOpen));
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
themeEditorSectionOpen.set(title, isOpen);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="{bordered ? 'border-t border-theme-800 pt-3 ' : ''}{className}">
|
<section class="{bordered ? 'border-t border-theme-800 pt-3 ' : ''}{className}">
|
||||||
@@ -34,8 +42,8 @@
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="group flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-0.5 text-left transition-colors hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60"
|
class="group flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-0.5 text-left transition-colors hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60"
|
||||||
aria-expanded={open}
|
aria-expanded={isOpen}
|
||||||
onclick={() => (open = !open)}
|
onclick={() => (isOpen = !isOpen)}
|
||||||
>
|
>
|
||||||
{#if Icon}
|
{#if Icon}
|
||||||
<Icon class="size-3.5 shrink-0 text-primary" />
|
<Icon class="size-3.5 shrink-0 text-primary" />
|
||||||
@@ -49,7 +57,7 @@
|
|||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
<ChevronDown
|
<ChevronDown
|
||||||
class="ml-auto size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 {open
|
class="ml-auto size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 {isOpen
|
||||||
? 'rotate-180'
|
? 'rotate-180'
|
||||||
: ''}"
|
: ''}"
|
||||||
/>
|
/>
|
||||||
@@ -61,7 +69,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if open}
|
{#if isOpen}
|
||||||
<div class={contentClass}>
|
<div class={contentClass}>
|
||||||
{#if description}
|
{#if description}
|
||||||
<p class="text-[10px] leading-relaxed text-muted-foreground">{description}</p>
|
<p class="text-[10px] leading-relaxed text-muted-foreground">{description}</p>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
import ThemeV2Elements from '$lib/components/theme/ThemeV2Elements.svelte';
|
import ThemeV2Elements from '$lib/components/theme/ThemeV2Elements.svelte';
|
||||||
import * as Avatar from '$lib/components/ui/avatar';
|
import * as Avatar from '$lib/components/ui/avatar';
|
||||||
import { currentUserInfo } from '$lib/data';
|
import { currentUserInfo } from '$lib/data';
|
||||||
import { scopeThemeCss } from '$lib/themeCssScope';
|
import { scopeThemeCss } from '$lib/theme/themeCssScope';
|
||||||
import { fontStack, monoFontStack } from '$lib/themeFonts';
|
import { fontStack, monoFontStack } from '$lib/theme/themeFonts';
|
||||||
import { DEFAULT_THEME_ICON_SET } from '$lib/themeIcons';
|
import { DEFAULT_THEME_ICON_SET } from '$lib/theme/themeIcons';
|
||||||
import {
|
import {
|
||||||
normalizeChrome,
|
normalizeChrome,
|
||||||
readableTextColor,
|
readableTextColor,
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
type ThemeV2Group,
|
type ThemeV2Group,
|
||||||
type ThemeV2ScriptValue,
|
type ThemeV2ScriptValue,
|
||||||
type ThemeV2WidgetKind,
|
type ThemeV2WidgetKind,
|
||||||
} from '$lib/themeV2';
|
} from '$lib/theme/themeV2';
|
||||||
import { currentUser } from '$lib/userAuthentication';
|
import { currentUser } from '$lib/userAuthentication';
|
||||||
import { countryCodeToEmoji } from '$lib/utils';
|
import { countryCodeToEmoji } from '$lib/utils';
|
||||||
import { Clock, Trophy } from '@lucide/svelte';
|
import { Clock, Trophy } from '@lucide/svelte';
|
||||||
|
|||||||
@@ -4,8 +4,12 @@
|
|||||||
import Input from '$lib/components/ui/input/input.svelte';
|
import Input from '$lib/components/ui/input/input.svelte';
|
||||||
import Label from '$lib/components/ui/label/label.svelte';
|
import Label from '$lib/components/ui/label/label.svelte';
|
||||||
import * as Select from '$lib/components/ui/select';
|
import * as Select from '$lib/components/ui/select';
|
||||||
import type { ThemeV2TextDecoration, ThemeV2TextStyle, ThemeV2TextTransform } from '$lib/themeV2';
|
import type {
|
||||||
import { Bold, Italic, RotateCcw, Strikethrough, Underline } from '@lucide/svelte';
|
ThemeV2TextDecoration,
|
||||||
|
ThemeV2TextStyle,
|
||||||
|
ThemeV2TextTransform,
|
||||||
|
} from '$lib/theme/themeV2';
|
||||||
|
import { Bold, Italic, RotateCcw, Strikethrough, Type, Underline } from '@lucide/svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
element,
|
element,
|
||||||
@@ -89,6 +93,7 @@
|
|||||||
|
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Text style"
|
title="Text style"
|
||||||
|
icon={Type}
|
||||||
open={false}
|
open={false}
|
||||||
actions={textStyleActions}
|
actions={textStyleActions}
|
||||||
contentClass="space-y-2 pt-2.5"
|
contentClass="space-y-2 pt-2.5"
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
import Button from '$lib/components/ui/button/button.svelte';
|
import Button from '$lib/components/ui/button/button.svelte';
|
||||||
import Input from '$lib/components/ui/input/input.svelte';
|
import Input from '$lib/components/ui/input/input.svelte';
|
||||||
import Label from '$lib/components/ui/label/label.svelte';
|
import Label from '$lib/components/ui/label/label.svelte';
|
||||||
import type { ThemeV2Transform } from '$lib/themeV2';
|
import Slider from '$lib/components/ui/slider/slider.svelte';
|
||||||
|
import type { ThemeV2Transform } from '$lib/theme/themeV2';
|
||||||
import { FlipHorizontal2, FlipVertical2, RotateCcw, RotateCw } from '@lucide/svelte';
|
import { FlipHorizontal2, FlipVertical2, RotateCcw, RotateCw } from '@lucide/svelte';
|
||||||
|
|
||||||
type TransformTarget = ThemeV2Transform & { offsetX?: number; offsetY?: number };
|
type TransformTarget = ThemeV2Transform & { offsetX?: number; offsetY?: number };
|
||||||
@@ -112,6 +113,7 @@
|
|||||||
|
|
||||||
<ThemeSection
|
<ThemeSection
|
||||||
title="Transform"
|
title="Transform"
|
||||||
|
icon={RotateCw}
|
||||||
open={false}
|
open={false}
|
||||||
actions={transformActions}
|
actions={transformActions}
|
||||||
contentClass="space-y-2 pt-2.5"
|
contentClass="space-y-2 pt-2.5"
|
||||||
@@ -266,14 +268,13 @@
|
|||||||
<span class="text-[9px] text-muted-foreground">3D cursor perspective</span>
|
<span class="text-[9px] text-muted-foreground">3D cursor perspective</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<input
|
<Slider
|
||||||
type="range"
|
min={-1}
|
||||||
min="-1"
|
max={1}
|
||||||
max="1"
|
step={0.05}
|
||||||
step="0.05"
|
|
||||||
value={transform.parallax ?? 0}
|
value={transform.parallax ?? 0}
|
||||||
oninput={(e) => onchange({ parallax: Number((e.target as HTMLInputElement).value) })}
|
onValueChange={(value) => onchange({ parallax: value })}
|
||||||
class="h-1.5 w-24 cursor-pointer appearance-none rounded-lg bg-theme-800 accent-primary"
|
class="w-24"
|
||||||
/>
|
/>
|
||||||
<span class="w-8 font-mono text-[10px] text-right text-muted-foreground">
|
<span class="w-8 font-mono text-[10px] text-right text-muted-foreground">
|
||||||
{Math.round((transform.parallax ?? 0) * 100)}%
|
{Math.round((transform.parallax ?? 0) * 100)}%
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { custom_theme_volume } from '$lib/global';
|
import { custom_theme_volume } from '$lib/global';
|
||||||
import { playThemeMedia, themeMediaSource, themeVideoLifecycle } from '$lib/themeMedia';
|
import { playThemeMedia, themeMediaSource, themeVideoLifecycle } from '$lib/theme/themeMedia';
|
||||||
import type { ThemeV2Definition } from '$lib/themeV2';
|
import { themeParallax } from '$lib/theme/themeParallax';
|
||||||
import { themeAssetUrl } from '$lib/themeV2';
|
import type { ThemeV2Definition } from '$lib/theme/themeV2';
|
||||||
|
import { themeAssetUrl } from '$lib/theme/themeV2';
|
||||||
import { reduceAnimations } from '$lib/userSettings';
|
import { reduceAnimations } from '$lib/userSettings';
|
||||||
import { trackMediaContainer } from '$lib/utils';
|
import { trackMediaContainer } from '$lib/utils';
|
||||||
import { onDestroy } from 'svelte';
|
import { onDestroy } from 'svelte';
|
||||||
@@ -20,50 +21,8 @@
|
|||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let audioElement = $state<HTMLAudioElement | undefined>(undefined);
|
let audioElement = $state<HTMLAudioElement | undefined>(undefined);
|
||||||
let mousePx = $state(0);
|
|
||||||
let mousePy = $state(0);
|
|
||||||
let targetPx = 0;
|
|
||||||
let targetPy = 0;
|
|
||||||
let animFrame: number | undefined;
|
|
||||||
|
|
||||||
function onWindowMouseMove(e: MouseEvent) {
|
|
||||||
if ($reduceAnimations || !definition.parallax?.enabled) return;
|
|
||||||
const intensity = definition.parallax.intensity ?? 0.25;
|
|
||||||
const w = window.innerWidth || 1000;
|
|
||||||
const h = window.innerHeight || 650;
|
|
||||||
targetPx = (e.clientX / w - 0.5) * 2 * intensity;
|
|
||||||
targetPy = (e.clientY / h - 0.5) * 2 * intensity;
|
|
||||||
if (animFrame === undefined) {
|
|
||||||
animFrame = requestAnimationFrame(updateParallax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateParallax() {
|
|
||||||
animFrame = undefined;
|
|
||||||
mousePx += (targetPx - mousePx) * 0.12;
|
|
||||||
mousePy += (targetPy - mousePy) * 0.12;
|
|
||||||
if (Math.abs(targetPx - mousePx) > 0.001 || Math.abs(targetPy - mousePy) > 0.001) {
|
|
||||||
animFrame = requestAnimationFrame(updateParallax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$effect(() => {
|
|
||||||
if (!definition.parallax?.enabled) {
|
|
||||||
mousePx = 0;
|
|
||||||
mousePy = 0;
|
|
||||||
targetPx = 0;
|
|
||||||
targetPy = 0;
|
|
||||||
if (animFrame !== undefined) {
|
|
||||||
cancelAnimationFrame(animFrame);
|
|
||||||
animFrame = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
if (animFrame !== undefined) {
|
|
||||||
cancelAnimationFrame(animFrame);
|
|
||||||
}
|
|
||||||
if (audioElement) {
|
if (audioElement) {
|
||||||
try {
|
try {
|
||||||
audioElement.pause();
|
audioElement.pause();
|
||||||
@@ -140,13 +99,15 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window onmousemove={onWindowMouseMove} />
|
<div class="theme-v2 absolute inset-0 overflow-hidden" use:trackMedia>
|
||||||
|
<div
|
||||||
<div
|
class="absolute inset-0"
|
||||||
class="theme-v2 absolute inset-0 overflow-hidden"
|
use:themeParallax={{
|
||||||
use:trackMedia
|
enabled: definition.parallax?.enabled === true,
|
||||||
style="--mouse-px:{mousePx};--mouse-py:{mousePy};"
|
intensity: definition.parallax?.intensity ?? 0.25,
|
||||||
>
|
}}
|
||||||
|
style="transform:translate3d(calc(var(--mouse-px, 0) * -18px), calc(var(--mouse-py, 0) * -18px), 0);"
|
||||||
|
>
|
||||||
{#if background.type === 'color'}
|
{#if background.type === 'color'}
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0"
|
class="absolute inset-0"
|
||||||
@@ -156,7 +117,8 @@
|
|||||||
<div
|
<div
|
||||||
class="absolute inset-0"
|
class="absolute inset-0"
|
||||||
style="background-image:linear-gradient({background.angle ??
|
style="background-image:linear-gradient({background.angle ??
|
||||||
135}deg, {background.from}, {background.to});opacity:{background.opacity ?? 1}"
|
135}deg, {background.from}, {background.to});opacity:{background.opacity ??
|
||||||
|
1};transform:{definition.parallax?.enabled ? 'scale(1.06)' : 'none'}"
|
||||||
></div>
|
></div>
|
||||||
{:else if background.type === 'image'}
|
{:else if background.type === 'image'}
|
||||||
{#if background.src}
|
{#if background.src}
|
||||||
@@ -172,7 +134,7 @@
|
|||||||
? 'scale(1.08)'
|
? 'scale(1.08)'
|
||||||
: definition.parallax?.enabled
|
: definition.parallax?.enabled
|
||||||
? 'scale(1.06)'
|
? 'scale(1.06)'
|
||||||
: 'none'} translate3d({mousePx * -18}px, {mousePy * -18}px, 0);"
|
: 'none'};"
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if background.type === 'video'}
|
{:else if background.type === 'video'}
|
||||||
@@ -194,10 +156,11 @@
|
|||||||
? 'scale(1.08)'
|
? 'scale(1.08)'
|
||||||
: definition.parallax?.enabled
|
: definition.parallax?.enabled
|
||||||
? 'scale(1.06)'
|
? 'scale(1.06)'
|
||||||
: 'none'} translate3d({mousePx * -18}px, {mousePy * -18}px, 0);"
|
: 'none'};"
|
||||||
></video>
|
></video>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
{#if overlay && (overlay.opacity ?? 0) > 0}
|
{#if overlay && (overlay.opacity ?? 0) > 0}
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
import DownloadButton from '$lib/components/ui/download-button/DownloadButton.svelte';
|
import DownloadButton from '$lib/components/ui/download-button/DownloadButton.svelte';
|
||||||
import { currentUserInfo } from '$lib/data';
|
import { currentUserInfo } from '$lib/data';
|
||||||
import { launching as launchingStore } from '$lib/global';
|
import { launching as launchingStore } from '$lib/global';
|
||||||
import { getThemeDataSampleValue, resolveThemeDataValue, themeGlobalData } from '$lib/themeData';
|
import { getThemeDataSampleValue, resolveThemeDataValue, themeGlobalData } from '$lib/theme/themeData';
|
||||||
import { fontStack } from '$lib/themeFonts';
|
import { fontStack } from '$lib/theme/themeFonts';
|
||||||
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons';
|
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/theme/themeIcons';
|
||||||
import {
|
import {
|
||||||
themeArcGeometry,
|
themeArcGeometry,
|
||||||
themeClockDate,
|
themeClockDate,
|
||||||
@@ -16,9 +16,9 @@
|
|||||||
themeCountdownText,
|
themeCountdownText,
|
||||||
themeParticleSeeds,
|
themeParticleSeeds,
|
||||||
themeSvgGradientVector,
|
themeSvgGradientVector,
|
||||||
} from '$lib/themeLayers';
|
} from '$lib/theme/themeLayers';
|
||||||
import { themeMediaSource, themeVideoLifecycle } from '$lib/themeMedia';
|
import { themeMediaSource, themeVideoLifecycle } from '$lib/theme/themeMedia';
|
||||||
import { interpolateThemeText } from '$lib/themeTextVariables';
|
import { interpolateThemeText } from '$lib/theme/themeTextVariables';
|
||||||
import {
|
import {
|
||||||
themeAssetUrl,
|
themeAssetUrl,
|
||||||
themeClassNames,
|
themeClassNames,
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
type ThemeV2Group,
|
type ThemeV2Group,
|
||||||
type ThemeV2Point,
|
type ThemeV2Point,
|
||||||
type ThemeV2ScriptValue,
|
type ThemeV2ScriptValue,
|
||||||
} from '$lib/themeV2';
|
} from '$lib/theme/themeV2';
|
||||||
import { currentUser } from '$lib/userAuthentication';
|
import { currentUser } from '$lib/userAuthentication';
|
||||||
import { countryCodeToEmoji, formatRelativeTime, openURL } from '$lib/utils';
|
import { countryCodeToEmoji, formatRelativeTime, openURL } from '$lib/utils';
|
||||||
import { Boxes, ChevronRight, Clock, Move, RotateCw, Trophy } from '@lucide/svelte';
|
import { Boxes, ChevronRight, Clock, Move, RotateCw, Trophy } from '@lucide/svelte';
|
||||||
@@ -141,6 +141,15 @@
|
|||||||
);
|
);
|
||||||
const elementFilter = (element: ThemeV2Element) =>
|
const elementFilter = (element: ThemeV2Element) =>
|
||||||
themeFilterCss(element.filters, ...ancestorsOf(element).map((group) => group.filters));
|
themeFilterCss(element.filters, ...ancestorsOf(element).map((group) => group.filters));
|
||||||
|
/** Layer depth plus every ancestor group's depth; negative follows the background. */
|
||||||
|
const elementParallaxCss = (element: ThemeV2Element) => {
|
||||||
|
const depth =
|
||||||
|
(element.parallax ?? 0) +
|
||||||
|
ancestorsOf(element).reduce((total, group) => total + (group.parallax ?? 0), 0);
|
||||||
|
if (depth === 0) return '';
|
||||||
|
const offset = depth * 30;
|
||||||
|
return ` translate3d(calc(var(--mouse-px, 0) * ${offset}px), calc(var(--mouse-py, 0) * ${offset}px), 0)`;
|
||||||
|
};
|
||||||
const elementClassNames = (element: ThemeV2Element) =>
|
const elementClassNames = (element: ThemeV2Element) =>
|
||||||
themeClassNames(
|
themeClassNames(
|
||||||
[...ancestorsOf(element).map((group) => group.cssClasses), element.cssClasses]
|
[...ancestorsOf(element).map((group) => group.cssClasses), element.cssClasses]
|
||||||
@@ -1227,9 +1236,7 @@
|
|||||||
element,
|
element,
|
||||||
elements,
|
elements,
|
||||||
groups
|
groups
|
||||||
)}{element.parallax
|
)}{elementParallaxCss(element)};transform-origin:0 0;touch-action:none;outline:{selected
|
||||||
? ` translate3d(calc(var(--mouse-px, 0) * ${element.parallax * 30}px), calc(var(--mouse-py, 0) * ${element.parallax * 30}px), 0)`
|
|
||||||
: ''};transform-origin:0 0;touch-action:none;outline:{selected
|
|
||||||
? `${selectedIds.length > 1 ? 1 : 2}px solid #ff006e`
|
? `${selectedIds.length > 1 ? 1 : 2}px solid #ff006e`
|
||||||
: 'none'};outline-offset:2px;"
|
: 'none'};outline-offset:2px;"
|
||||||
role={interactive || element.interactive ? 'button' : undefined}
|
role={interactive || element.interactive ? 'button' : undefined}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import ThemeSection from '$lib/components/theme/ThemeSection.svelte';
|
import ThemeSection from '$lib/components/theme/ThemeSection.svelte';
|
||||||
import Button from '$lib/components/ui/button/button.svelte';
|
import Button from '$lib/components/ui/button/button.svelte';
|
||||||
import Input from '$lib/components/ui/input/input.svelte';
|
import Input from '$lib/components/ui/input/input.svelte';
|
||||||
import type { ThemeV2ScriptValue } from '$lib/themeV2';
|
import type { ThemeV2ScriptValue } from '$lib/theme/themeV2';
|
||||||
import { RotateCcw } from '@lucide/svelte';
|
import { Braces, RotateCcw } from '@lucide/svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
variables,
|
variables,
|
||||||
@@ -38,7 +38,12 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ThemeSection title="Variables" badge={variables.length} contentClass="space-y-2 pt-2">
|
<ThemeSection
|
||||||
|
title="Variables"
|
||||||
|
icon={Braces}
|
||||||
|
badge={variables.length}
|
||||||
|
contentClass="space-y-2 pt-2"
|
||||||
|
>
|
||||||
<p class="text-[10px] leading-relaxed text-muted-foreground">
|
<p class="text-[10px] leading-relaxed text-muted-foreground">
|
||||||
Starting values for
|
Starting values for
|
||||||
<code class="rounded bg-theme-900 px-1 py-0.5 text-theme-100">{'{name}'}</code>
|
<code class="rounded bg-theme-900 px-1 py-0.5 text-theme-100">{'{name}'}</code>
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
opacity:{$reduceAnimations ? 0 : s.opacity};
|
opacity:{$reduceAnimations ? 0 : s.opacity};
|
||||||
animation-duration:{s.duration}s;
|
animation-duration:{s.duration}s;
|
||||||
animation-delay:-{s.delay}s;
|
animation-delay:-{s.delay}s;
|
||||||
|
animation-play-state:{$reduceAnimations ? 'paused' : 'running'};
|
||||||
"
|
"
|
||||||
></div>
|
></div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ThemeIcon from '$lib/components/theme/ThemeIcon.svelte';
|
import ThemeIcon from '$lib/components/theme/ThemeIcon.svelte';
|
||||||
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons';
|
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/theme/themeIcons';
|
||||||
|
|
||||||
const prop: {
|
const prop: {
|
||||||
downloading: boolean;
|
downloading: boolean;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
let velocityAccumX = 0;
|
let velocityAccumX = 0;
|
||||||
let velocityAccumY = 0;
|
let velocityAccumY = 0;
|
||||||
let rotateSpringAnim: ReturnType<typeof animate> | null = null;
|
let rotateSpringAnim: ReturnType<typeof animate> | null = null;
|
||||||
|
let scheduleCursorFrame = () => {};
|
||||||
|
|
||||||
let cursor: HTMLElement;
|
let cursor: HTMLElement;
|
||||||
let cursorRotateWrapper: HTMLDivElement;
|
let cursorRotateWrapper: HTMLDivElement;
|
||||||
@@ -41,20 +42,15 @@
|
|||||||
let cursorAdditive: HTMLImageElement;
|
let cursorAdditive: HTMLImageElement;
|
||||||
|
|
||||||
function isInteractive(el: Element | null): boolean {
|
function isInteractive(el: Element | null): boolean {
|
||||||
while (el) {
|
if (!el) return false;
|
||||||
const tag = el.tagName.toLowerCase();
|
|
||||||
const role = el.getAttribute('role');
|
|
||||||
const computed = getComputedStyle(el);
|
|
||||||
if (
|
if (
|
||||||
['button', 'a', 'input', 'select', 'textarea', 'label', 'option'].includes(tag) ||
|
el.closest(
|
||||||
(role && ['button', 'link', 'checkbox', 'combobox', 'menuitem', 'option'].includes(role)) ||
|
'button, a, input, select, textarea, label, option, [role="button"], [role="link"], [role="checkbox"], [role="combobox"], [role="menuitem"], [role="option"]'
|
||||||
computed.cursor === 'pointer'
|
)
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
el = el.parentElement;
|
return getComputedStyle(el).cursor === 'pointer';
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dampContinuously(current: number, target: number, halfLife: number, dt: number): number {
|
function dampContinuously(current: number, target: number, halfLife: number, dt: number): number {
|
||||||
@@ -133,6 +129,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scheduleCursorFrame();
|
||||||
lastMouseX = targetX;
|
lastMouseX = targetX;
|
||||||
lastMouseY = targetY;
|
lastMouseY = targetY;
|
||||||
};
|
};
|
||||||
@@ -147,6 +144,7 @@
|
|||||||
lastVelocityTime = performance.now();
|
lastVelocityTime = performance.now();
|
||||||
|
|
||||||
isMouseDown = true;
|
isMouseDown = true;
|
||||||
|
scheduleCursorFrame();
|
||||||
|
|
||||||
if (rotateSpringAnim) {
|
if (rotateSpringAnim) {
|
||||||
rotateSpringAnim.pause();
|
rotateSpringAnim.pause();
|
||||||
@@ -213,12 +211,17 @@
|
|||||||
document.addEventListener('mouseleave', handleMouseLeave);
|
document.addEventListener('mouseleave', handleMouseLeave);
|
||||||
document.addEventListener('mouseenter', handleMouseEnter);
|
document.addEventListener('mouseenter', handleMouseEnter);
|
||||||
|
|
||||||
let animationFrameId: number;
|
let animationFrameId: number | undefined;
|
||||||
let lastFrameTime = performance.now();
|
let lastFrameTime = performance.now();
|
||||||
|
let paused = false;
|
||||||
|
|
||||||
const tick = (now: number) => {
|
const tick = (now: number) => {
|
||||||
|
animationFrameId = undefined;
|
||||||
|
if (paused) return;
|
||||||
|
|
||||||
const dt = Math.min(Math.max(now - lastFrameTime, 0), 64);
|
const dt = Math.min(Math.max(now - lastFrameTime, 0), 64);
|
||||||
lastFrameTime = now;
|
lastFrameTime = now;
|
||||||
|
let needsAnotherFrame = false;
|
||||||
|
|
||||||
if (hasMoved && cursor) {
|
if (hasMoved && cursor) {
|
||||||
if (!smoothCursor) {
|
if (!smoothCursor) {
|
||||||
@@ -229,6 +232,8 @@
|
|||||||
const halfLife = $cursorSmoothness > 50 ? 14 : Math.max(1, $cursorSmoothness || 14);
|
const halfLife = $cursorSmoothness > 50 ? 14 : Math.max(1, $cursorSmoothness || 14);
|
||||||
currentX = dampContinuously(currentX, targetX, halfLife, dt);
|
currentX = dampContinuously(currentX, targetX, halfLife, dt);
|
||||||
currentY = dampContinuously(currentY, targetY, halfLife, dt);
|
currentY = dampContinuously(currentY, targetY, halfLife, dt);
|
||||||
|
needsAnotherFrame =
|
||||||
|
Math.abs(targetX - currentX) >= 0.05 || Math.abs(targetY - currentY) >= 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs(targetX - currentX) < 0.05) currentX = targetX;
|
if (Math.abs(targetX - currentX) < 0.05) currentX = targetX;
|
||||||
@@ -244,19 +249,62 @@
|
|||||||
const rotFactor = 1 - Math.pow(0.5, dt / 25);
|
const rotFactor = 1 - Math.pow(0.5, dt / 25);
|
||||||
currentDegrees += (targetDegrees - currentDegrees) * rotFactor;
|
currentDegrees += (targetDegrees - currentDegrees) * rotFactor;
|
||||||
cursorRotateWrapper.style.transform = `rotate(${currentDegrees}deg)`;
|
cursorRotateWrapper.style.transform = `rotate(${currentDegrees}deg)`;
|
||||||
|
needsAnotherFrame = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needsAnotherFrame) {
|
||||||
|
animationFrameId = requestAnimationFrame(tick);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
scheduleCursorFrame = () => {
|
||||||
|
if (paused || animationFrameId !== undefined) return;
|
||||||
|
lastFrameTime = performance.now();
|
||||||
animationFrameId = requestAnimationFrame(tick);
|
animationFrameId = requestAnimationFrame(tick);
|
||||||
};
|
};
|
||||||
|
|
||||||
animationFrameId = requestAnimationFrame(tick);
|
const suspendCursor = () => {
|
||||||
|
paused = true;
|
||||||
|
if (animationFrameId !== undefined) {
|
||||||
|
cancelAnimationFrame(animationFrameId);
|
||||||
|
animationFrameId = undefined;
|
||||||
|
}
|
||||||
|
if (cursor) cursor.style.opacity = '0';
|
||||||
|
};
|
||||||
|
|
||||||
|
const resumeCursor = () => {
|
||||||
|
if (!paused) return;
|
||||||
|
paused = false;
|
||||||
|
lastFrameTime = performance.now();
|
||||||
|
if (!hasMoved) return;
|
||||||
|
if (cursor) cursor.style.opacity = '1';
|
||||||
|
scheduleCursorFrame();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onVisibilityChange = () => {
|
||||||
|
if (document.visibilityState === 'hidden') suspendCursor();
|
||||||
|
else if (document.hasFocus()) resumeCursor();
|
||||||
|
};
|
||||||
|
const onWindowBlur = () => suspendCursor();
|
||||||
|
const onWindowFocus = () => {
|
||||||
|
if (document.visibilityState !== 'hidden') resumeCursor();
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
window.addEventListener('blur', onWindowBlur);
|
||||||
|
window.addEventListener('focus', onWindowFocus);
|
||||||
|
onVisibilityChange();
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
document.documentElement.classList.remove('hiddenCursor');
|
document.documentElement.classList.remove('hiddenCursor');
|
||||||
document.removeEventListener('mouseleave', handleMouseLeave);
|
document.removeEventListener('mouseleave', handleMouseLeave);
|
||||||
document.removeEventListener('mouseenter', handleMouseEnter);
|
document.removeEventListener('mouseenter', handleMouseEnter);
|
||||||
cancelAnimationFrame(animationFrameId);
|
document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
window.removeEventListener('blur', onWindowBlur);
|
||||||
|
window.removeEventListener('focus', onWindowFocus);
|
||||||
|
scheduleCursorFrame = () => {};
|
||||||
|
suspendCursor();
|
||||||
if (rotateSpringAnim) {
|
if (rotateSpringAnim) {
|
||||||
rotateSpringAnim.pause();
|
rotateSpringAnim.pause();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
custom_theme_volume,
|
custom_theme_volume,
|
||||||
platform,
|
platform,
|
||||||
} from '$lib/global';
|
} from '$lib/global';
|
||||||
import { DEFAULT_THEME_ICON_SET } from '$lib/themeIcons';
|
import { DEFAULT_THEME_ICON_SET } from '$lib/theme/themeIcons';
|
||||||
import { reduceAnimations } from '$lib/userSettings';
|
import { reduceAnimations } from '$lib/userSettings';
|
||||||
import Minimize from '@lucide/svelte/icons/minus';
|
import Minimize from '@lucide/svelte/icons/minus';
|
||||||
import Close from '@lucide/svelte/icons/x';
|
import Close from '@lucide/svelte/icons/x';
|
||||||
@@ -16,6 +16,34 @@
|
|||||||
|
|
||||||
const iconSet = $derived($active_custom_theme?.definition?.iconSet ?? DEFAULT_THEME_ICON_SET);
|
const iconSet = $derived($active_custom_theme?.definition?.iconSet ?? DEFAULT_THEME_ICON_SET);
|
||||||
|
|
||||||
|
let volumeOpen = $state(false);
|
||||||
|
let volumeDragging = $state(false);
|
||||||
|
let volumeControl: HTMLDivElement | undefined = $state();
|
||||||
|
|
||||||
|
function openVolume() {
|
||||||
|
volumeOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeVolume() {
|
||||||
|
if (!volumeDragging) volumeOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function startVolumeDrag(event: PointerEvent) {
|
||||||
|
if (event.button !== 0) return;
|
||||||
|
volumeDragging = true;
|
||||||
|
volumeOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function endVolumeDrag(event: PointerEvent) {
|
||||||
|
if (!volumeDragging) return;
|
||||||
|
volumeDragging = false;
|
||||||
|
|
||||||
|
const element = document.elementFromPoint(event.clientX, event.clientY);
|
||||||
|
if (!element || !volumeControl?.contains(element)) {
|
||||||
|
volumeOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
|
|
||||||
@@ -26,9 +54,18 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window onpointerup={endVolumeDrag} onpointercancel={endVolumeDrag} />
|
||||||
|
|
||||||
<div data-tauri-drag-region class="titlebar z-[100]" class:macos-window={$platform === 'macos'}>
|
<div data-tauri-drag-region class="titlebar z-[100]" class:macos-window={$platform === 'macos'}>
|
||||||
{#if $custom_theme_audio_playing || ($active_custom_theme && $active_custom_theme.name !== 'Default')}
|
{#if $custom_theme_audio_playing || ($active_custom_theme && $active_custom_theme.name !== 'Default')}
|
||||||
<div class="relative flex items-center justify-center group">
|
<div
|
||||||
|
class="relative flex items-center justify-center group"
|
||||||
|
role="group"
|
||||||
|
aria-label="Theme volume"
|
||||||
|
bind:this={volumeControl}
|
||||||
|
onpointerenter={openVolume}
|
||||||
|
onpointerleave={closeVolume}
|
||||||
|
>
|
||||||
<div class="relative flex items-center justify-center p-1 cursor-pointer">
|
<div class="relative flex items-center justify-center p-1 cursor-pointer">
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0 bg-background rounded
|
class="absolute inset-0 bg-background rounded
|
||||||
@@ -51,8 +88,9 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
class="absolute top-full right-0 translate-x-[7px]
|
class="absolute top-full right-0 translate-x-[7px]
|
||||||
opacity-0 invisible pointer-events-none -translate-y-2
|
{volumeOpen
|
||||||
group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto group-hover:translate-y-0
|
? 'opacity-100 visible pointer-events-auto translate-y-0'
|
||||||
|
: 'opacity-0 invisible pointer-events-none -translate-y-2'}
|
||||||
{$reduceAnimations ? '' : 'transition-all duration-200 ease-out'}
|
{$reduceAnimations ? '' : 'transition-all duration-200 ease-out'}
|
||||||
z-50"
|
z-50"
|
||||||
>
|
>
|
||||||
@@ -68,6 +106,7 @@
|
|||||||
max="1"
|
max="1"
|
||||||
step="0.01"
|
step="0.01"
|
||||||
bind:value={$custom_theme_volume}
|
bind:value={$custom_theme_volume}
|
||||||
|
onpointerdown={startVolumeDrag}
|
||||||
oninput={() => {
|
oninput={() => {
|
||||||
config.value<number>('volume').set($custom_theme_volume);
|
config.value<number>('volume').set($custom_theme_volume);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ export const DISCORD_PRESENCE_PRESETS: DiscordPresencePreset[] = [
|
|||||||
},
|
},
|
||||||
button2: {
|
button2: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
label: 'View Profile',
|
label: 'Join EZPPFarm',
|
||||||
url: '{profileUrl}',
|
url: 'https://ez-pp.farm/discord',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -247,6 +247,8 @@ export type IdlePresenceParams = {
|
|||||||
rank?: number | string;
|
rank?: number | string;
|
||||||
pp?: number | string;
|
pp?: number | string;
|
||||||
accuracy?: number | string;
|
accuracy?: number | string;
|
||||||
|
mode?: string;
|
||||||
|
action?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PlayingPresenceParams = {
|
export type PlayingPresenceParams = {
|
||||||
@@ -282,6 +284,8 @@ export const pushIdlePresenceFromConfig = async (
|
|||||||
rank: params?.rank,
|
rank: params?.rank,
|
||||||
pp: params?.pp,
|
pp: params?.pp,
|
||||||
accuracy: params?.accuracy,
|
accuracy: params?.accuracy,
|
||||||
|
mode: params?.mode,
|
||||||
|
action: params?.action ?? 'In Launcher',
|
||||||
version: params?.version,
|
version: params?.version,
|
||||||
profileUrl: params?.user?.id ? `https://ez-pp.farm/u/${params.user.id}` : 'https://ez-pp.farm',
|
profileUrl: params?.user?.id ? `https://ez-pp.farm/u/${params.user.id}` : 'https://ez-pp.farm',
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { ezppfarm } from './api/ezpp';
|
import { ezppfarm } from './api/ezpp';
|
||||||
import type { Theme } from './themes';
|
import type { Theme } from './theme/themes';
|
||||||
import type { Release } from './types';
|
import type { Release } from './types';
|
||||||
import { setGlobalVolume } from './utils';
|
import { setGlobalVolume } from './utils';
|
||||||
import type { Component } from 'svelte';
|
import type { Component } from 'svelte';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getAuthHeaders, getThemesServiceUrl } from './communityThemes';
|
import { getAuthHeaders, getThemesServiceUrl } from './theme/communityThemes';
|
||||||
|
|
||||||
export type NotificationType =
|
export type NotificationType =
|
||||||
| 'theme_hidden'
|
| 'theme_hidden'
|
||||||
|
|||||||
+9
-9
@@ -6,15 +6,15 @@ export type PresenceButtonPayload = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type PresenceActivityPayload = {
|
export type PresenceActivityPayload = {
|
||||||
state?: string;
|
state: string;
|
||||||
details?: string;
|
details: string;
|
||||||
largeImageKey?: string;
|
largeImageKey: string;
|
||||||
largeImageText?: string;
|
largeImageText: string;
|
||||||
smallImageKey?: string | null;
|
smallImageKey: string | null;
|
||||||
smallImageText?: string | null;
|
smallImageText: string | null;
|
||||||
button1?: PresenceButtonPayload | null;
|
button1: PresenceButtonPayload | null;
|
||||||
button2?: PresenceButtonPayload | null;
|
button2: PresenceButtonPayload | null;
|
||||||
showTimestamp?: boolean;
|
showTimestamp: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const connect = async () => await invoke('presence_connect');
|
export const connect = async () => await invoke('presence_connect');
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install progress lives outside the workshop component because switching to
|
||||||
|
* the Installed tab unmounts it. Keeping the state here lets the workshop show
|
||||||
|
* the current progress again when it is remounted, while the in-flight
|
||||||
|
* download keeps running.
|
||||||
|
*/
|
||||||
|
export const activeThemeDownloads = new SvelteSet<string>();
|
||||||
|
export const themeDownloadProgress = new SvelteMap<string, number>();
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { config } from './config';
|
import { config } from '../config';
|
||||||
|
import { normalizeThemeVersion } from './themeV2';
|
||||||
import {
|
import {
|
||||||
|
markThemeSynced,
|
||||||
reloadThemes,
|
reloadThemes,
|
||||||
themesDirectory,
|
themesDirectory,
|
||||||
updateInstalledThemeTags,
|
updateInstalledThemeTags,
|
||||||
@@ -32,6 +34,8 @@ export interface ThemeSearchMatch {
|
|||||||
score: number;
|
score: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ThemeReviewStatus = 'pending' | 'approved' | 'rejected';
|
||||||
|
|
||||||
export interface CommunityTheme {
|
export interface CommunityTheme {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -45,6 +49,11 @@ export interface CommunityTheme {
|
|||||||
likeCount: number;
|
likeCount: number;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
allowForking: boolean;
|
allowForking: boolean;
|
||||||
|
reviewStatus: ThemeReviewStatus;
|
||||||
|
reviewNote: string | null;
|
||||||
|
reviewedAt: string | null;
|
||||||
|
reviewedBy: number | null;
|
||||||
|
reviewedByName: string | null;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
author: CommunityThemeAuthor;
|
author: CommunityThemeAuthor;
|
||||||
@@ -720,6 +729,13 @@ export async function publishThemeToWorkshop(options: {
|
|||||||
throw new Error('You must be logged in to EZPPFarm to publish themes.');
|
throw new Error('You must be logged in to EZPPFarm to publish themes.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const version = normalizeThemeVersion(options.version ?? '1.0.0');
|
||||||
|
if (!version) {
|
||||||
|
throw new Error(
|
||||||
|
'Theme version must use semantic versioning, for example 1.2.3 or 1.2.3-beta.1.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
onProgress('Packaging theme archive...', 5);
|
onProgress('Packaging theme archive...', 5);
|
||||||
|
|
||||||
const baseThemesDir = await themesDirectory();
|
const baseThemesDir = await themesDirectory();
|
||||||
@@ -764,7 +780,7 @@ export async function publishThemeToWorkshop(options: {
|
|||||||
themeId: options.workshopId || options.themeId,
|
themeId: options.workshopId || options.themeId,
|
||||||
name: options.name,
|
name: options.name,
|
||||||
description: options.description || '',
|
description: options.description || '',
|
||||||
version: options.version || '1.0.0',
|
version,
|
||||||
apiVersion: options.apiVersion || '2.0.0',
|
apiVersion: options.apiVersion || '2.0.0',
|
||||||
totalSize,
|
totalSize,
|
||||||
totalChunks,
|
totalChunks,
|
||||||
@@ -834,7 +850,7 @@ export async function publishThemeToWorkshop(options: {
|
|||||||
const completeData = (await completeRes.json()) as Record<string, unknown> & {
|
const completeData = (await completeRes.json()) as Record<string, unknown> & {
|
||||||
themeId?: unknown;
|
themeId?: unknown;
|
||||||
};
|
};
|
||||||
onProgress('Theme published successfully!', 100);
|
onProgress('Upload complete', 100);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
@@ -849,40 +865,147 @@ export async function publishThemeToWorkshop(options: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ThemeReviewQueueResponse {
|
||||||
|
items: CommunityTheme[];
|
||||||
|
total: number;
|
||||||
|
page: number;
|
||||||
|
totalPages: number;
|
||||||
|
canModerate: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the staff review queue. New themes stay out of public listings until approved.
|
||||||
|
*/
|
||||||
|
export async function fetchThemeReviewQueue(
|
||||||
|
status: ThemeReviewStatus = 'pending',
|
||||||
|
page = 1,
|
||||||
|
limit = 50
|
||||||
|
): Promise<ThemeReviewQueueResponse> {
|
||||||
|
const baseUrl = await getThemesServiceUrl();
|
||||||
|
const headers = await getAuthHeaders();
|
||||||
|
|
||||||
|
if (!headers['X-Username'] || !headers['X-Password']) {
|
||||||
|
throw new Error('Please log in to view the review queue.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = new URL(`${baseUrl}/v1/themes/moderation/review`);
|
||||||
|
url.searchParams.set('status', status);
|
||||||
|
url.searchParams.set('page', String(page));
|
||||||
|
url.searchParams.set('limit', String(limit));
|
||||||
|
|
||||||
|
const res = await fetch(url.toString(), { headers });
|
||||||
|
if (!res.ok) {
|
||||||
|
const errorJson = (await res.json().catch(() => ({}))) as { error?: string };
|
||||||
|
throw new Error(errorJson.error || `Failed to load the review queue (HTTP ${res.status})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = (await res.json()) as ThemeReviewQueueResponse;
|
||||||
|
for (const item of data.items) {
|
||||||
|
if (item.previewUrl && !item.previewUrl.startsWith('http')) {
|
||||||
|
item.previewUrl = `${baseUrl}${item.previewUrl}`;
|
||||||
|
}
|
||||||
|
if (item.downloadUrl && !item.downloadUrl.startsWith('http')) {
|
||||||
|
item.downloadUrl = `${baseUrl}${item.downloadUrl}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Approve a pending theme so it becomes publicly listed, or reject it with a note.
|
||||||
|
*/
|
||||||
|
export async function reviewCommunityTheme(
|
||||||
|
themeId: string,
|
||||||
|
status: 'approved' | 'rejected',
|
||||||
|
note?: string
|
||||||
|
): Promise<CommunityTheme> {
|
||||||
|
const baseUrl = await getThemesServiceUrl();
|
||||||
|
const headers = await getAuthHeaders();
|
||||||
|
|
||||||
|
if (!headers['X-Username'] || !headers['X-Password']) {
|
||||||
|
throw new Error('Please log in to review themes.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await fetch(`${baseUrl}/v1/themes/${encodeURIComponent(themeId)}/review`, {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { ...headers, 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ status, note }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
const errorJson = (await res.json().catch(() => ({}))) as { error?: string };
|
||||||
|
throw new Error(errorJson.error || `Failed to review theme (HTTP ${res.status})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const item = (await res.json()) as CommunityTheme;
|
||||||
|
if (item.previewUrl && !item.previewUrl.startsWith('http')) {
|
||||||
|
item.previewUrl = `${baseUrl}${item.previewUrl}`;
|
||||||
|
}
|
||||||
|
if (item.downloadUrl && !item.downloadUrl.startsWith('http')) {
|
||||||
|
item.downloadUrl = `${baseUrl}${item.downloadUrl}`;
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download, extract, and register a community theme into ~/.ezpplauncher/themes/.
|
* Download, extract, and register a community theme into ~/.ezpplauncher/themes/.
|
||||||
*/
|
*/
|
||||||
export async function downloadAndInstallCommunityTheme(
|
export async function downloadAndInstallCommunityTheme(
|
||||||
theme: CommunityTheme,
|
theme: CommunityTheme,
|
||||||
onProgress?: (status: string, percentage: number) => void
|
onProgress?: (status: string, percentage: number) => void,
|
||||||
|
options?: { folderName?: string; skipDownloadCount?: boolean }
|
||||||
): Promise<{ success: boolean; folderName: string }> {
|
): Promise<{ success: boolean; folderName: string }> {
|
||||||
const { onProgress: reportProgress = () => {} } = { onProgress };
|
const { onProgress: reportProgress = () => {} } = { onProgress };
|
||||||
const baseThemesDir = await themesDirectory();
|
const baseThemesDir = await themesDirectory();
|
||||||
const folderName = theme.id;
|
const folderName = options?.folderName?.trim() || theme.id;
|
||||||
const targetFolder = await path.join(baseThemesDir, folderName);
|
const targetFolder = await path.join(baseThemesDir, folderName);
|
||||||
|
const skipDownloadCount = options?.skipDownloadCount === true;
|
||||||
|
const downloadUrl = skipDownloadCount
|
||||||
|
? (() => {
|
||||||
|
const url = new URL(theme.downloadUrl);
|
||||||
|
url.searchParams.set('skipDownloadCount', '1');
|
||||||
|
return url.toString();
|
||||||
|
})()
|
||||||
|
: theme.downloadUrl;
|
||||||
|
let requestHeaders: Record<string, string> | undefined;
|
||||||
|
if (skipDownloadCount) {
|
||||||
|
requestHeaders = await getAuthHeaders();
|
||||||
|
if (!requestHeaders['X-Username'] || !requestHeaders['X-Password']) {
|
||||||
|
throw new Error('Please log in again before reverting this theme.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reportProgress('Downloading theme package...', 10);
|
reportProgress('Downloading theme package...', 10);
|
||||||
|
|
||||||
const unlistenDownload = await listen<{ received: number; total: number; progress: number }>(
|
// Progress events are global, so ignore those belonging to other themes that are
|
||||||
'download_progress',
|
// downloading at the same time.
|
||||||
(event) => {
|
const unlistenDownload = await listen<{
|
||||||
|
theme_name: string;
|
||||||
|
received: number;
|
||||||
|
total: number;
|
||||||
|
progress: number;
|
||||||
|
}>('download_progress', (event) => {
|
||||||
|
if (event.payload.theme_name !== theme.name) return;
|
||||||
reportProgress('Downloading theme package...', Math.round(10 + event.payload.progress * 50));
|
reportProgress('Downloading theme package...', Math.round(10 + event.payload.progress * 50));
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const unlistenExtract = await listen<{ extracted: number; total: number; progress: number }>(
|
const unlistenExtract = await listen<{
|
||||||
'extract_progress',
|
theme_name: string;
|
||||||
(event) => {
|
extracted: number;
|
||||||
|
total: number;
|
||||||
|
progress: number;
|
||||||
|
}>('extract_progress', (event) => {
|
||||||
|
if (event.payload.theme_name !== theme.name) return;
|
||||||
reportProgress('Extracting theme files...', Math.round(60 + event.payload.progress * 38));
|
reportProgress('Extracting theme files...', Math.round(60 + event.payload.progress * 38));
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
await invoke('download_and_extract_community_theme', {
|
await invoke('download_and_extract_community_theme', {
|
||||||
downloadUrl: theme.downloadUrl,
|
downloadUrl,
|
||||||
themeFolder: targetFolder,
|
themeFolder: targetFolder,
|
||||||
themeName: theme.name,
|
themeName: theme.name,
|
||||||
|
...(requestHeaders ? { requestHeaders } : {}),
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Fallback for legacy themes directly to git repo
|
// Fallback for legacy themes directly to git repo
|
||||||
@@ -902,6 +1025,7 @@ export async function downloadAndInstallCommunityTheme(
|
|||||||
// Keep the installed manifest aligned with the workshop record.
|
// Keep the installed manifest aligned with the workshop record.
|
||||||
await updateInstalledThemeTags(folderName, theme.tags);
|
await updateInstalledThemeTags(folderName, theme.tags);
|
||||||
await updateInstalledThemeWorkshopId(folderName, theme.id);
|
await updateInstalledThemeWorkshopId(folderName, theme.id);
|
||||||
|
await markThemeSynced(folderName, { workshopId: theme.id, version: theme.version });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('[Workshop] Could not write workshop metadata into the installed theme:', err);
|
console.warn('[Workshop] Could not write workshop metadata into the installed theme:', err);
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
@@ -1,8 +1,8 @@
|
|||||||
import { currentUserInfo } from './data';
|
import { currentUserInfo } from '../data';
|
||||||
import { launcherVersion, onlineFriends, osuBuild, osuStream, serverPing } from './global';
|
import { launcherVersion, onlineFriends, osuBuild, osuStream, serverPing } from '../global';
|
||||||
|
import { currentUser } from '../userAuthentication';
|
||||||
import { themeClockValues } from './themeClock';
|
import { themeClockValues } from './themeClock';
|
||||||
import type { ThemeV2DataField, ThemeV2DataMode } from './themeV2';
|
import type { ThemeV2DataField, ThemeV2DataMode } from './themeV2';
|
||||||
import { currentUser } from './userAuthentication';
|
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
|
|
||||||
export type ThemeDataStats = {
|
export type ThemeDataStats = {
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { SvelteMap } from 'svelte/reactivity';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open state for accordion sections in the current theme-editor WebView session.
|
||||||
|
* This module is re-evaluated when the editor window closes, so the state is not
|
||||||
|
* persisted across app launches.
|
||||||
|
*/
|
||||||
|
export const themeEditorSectionOpen = new SvelteMap<string, boolean>();
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -13,7 +13,7 @@
|
|||||||
* theme videos and videos picked in the editor (served as /preview/ URLs) are
|
* theme videos and videos picked in the editor (served as /preview/ URLs) are
|
||||||
* transcoded to a cached H.264 copy by the Rust backend before playback.
|
* transcoded to a cached H.264 copy by the Rust backend before playback.
|
||||||
*/
|
*/
|
||||||
import { custom_theme_volume } from './global';
|
import { custom_theme_volume } from '../global';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { listen } from '@tauri-apps/api/event';
|
import { listen } from '@tauri-apps/api/event';
|
||||||
import { get, writable } from 'svelte/store';
|
import { get, writable } from 'svelte/store';
|
||||||
@@ -532,12 +532,13 @@ export function themeMediaSuspension(node: HTMLElement) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage background video playback across document visibility changes.
|
* Manage background video playback across document visibility changes.
|
||||||
* Videos continue playing when the launcher window loses focus. Muted background
|
* Muted background videos pause when the document is hidden/minimized or the
|
||||||
* videos pause only when the document is hidden/minimized to save GPU decoding
|
* launcher loses focus, which saves GPU decoding cycles behind a running game
|
||||||
* cycles without interrupting theme music or audio.
|
* without interrupting unmuted theme music or audio.
|
||||||
*/
|
*/
|
||||||
export function themeVideoLifecycle(node: HTMLVideoElement) {
|
export function themeVideoLifecycle(node: HTMLVideoElement) {
|
||||||
let pausedByLifecycle = false;
|
let pausedByLifecycle = false;
|
||||||
|
let focused = true;
|
||||||
|
|
||||||
const pause = () => {
|
const pause = () => {
|
||||||
if (node.paused) return;
|
if (node.paused) return;
|
||||||
@@ -551,12 +552,22 @@ export function themeVideoLifecycle(node: HTMLVideoElement) {
|
|||||||
playThemeMedia(node);
|
playThemeMedia(node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onBlur = () => {
|
||||||
|
focused = false;
|
||||||
|
sync();
|
||||||
|
};
|
||||||
|
const onFocus = () => {
|
||||||
|
focused = true;
|
||||||
|
sync();
|
||||||
|
};
|
||||||
const sync = () => {
|
const sync = () => {
|
||||||
if (!node.isConnected) {
|
if (!node.isConnected) {
|
||||||
document.removeEventListener('visibilitychange', sync);
|
document.removeEventListener('visibilitychange', sync);
|
||||||
|
window.removeEventListener('blur', onBlur);
|
||||||
|
window.removeEventListener('focus', onFocus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (document.visibilityState === 'visible') {
|
if (document.visibilityState === 'visible' && focused) {
|
||||||
resume();
|
resume();
|
||||||
} else if (node.muted || node.volume === 0) {
|
} else if (node.muted || node.volume === 0) {
|
||||||
pause();
|
pause();
|
||||||
@@ -564,11 +575,15 @@ export function themeVideoLifecycle(node: HTMLVideoElement) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', sync);
|
document.addEventListener('visibilitychange', sync);
|
||||||
|
window.addEventListener('blur', onBlur);
|
||||||
|
window.addEventListener('focus', onFocus);
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
destroy() {
|
destroy() {
|
||||||
document.removeEventListener('visibilitychange', sync);
|
document.removeEventListener('visibilitychange', sync);
|
||||||
|
window.removeEventListener('blur', onBlur);
|
||||||
|
window.removeEventListener('focus', onFocus);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
import { reduceAnimations } from '$lib/userSettings';
|
||||||
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
|
export type ThemeParallaxOptions = {
|
||||||
|
enabled?: boolean;
|
||||||
|
intensity?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
const clampIntensity = (intensity: number | undefined) =>
|
||||||
|
Math.min(1, Math.max(0.05, typeof intensity === 'number' ? intensity : 0.25));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tracks the pointer for a theme host and exposes the smoothed offset as
|
||||||
|
* `--mouse-px` / `--mouse-py`. The host must contain both the background and
|
||||||
|
* the freeform layers so those variables are inherited by every layer.
|
||||||
|
*/
|
||||||
|
export function themeParallax(node: HTMLElement, options: ThemeParallaxOptions = {}) {
|
||||||
|
let enabled = options.enabled === true;
|
||||||
|
let intensity = clampIntensity(options.intensity);
|
||||||
|
let mousePx = 0;
|
||||||
|
let mousePy = 0;
|
||||||
|
let targetPx = 0;
|
||||||
|
let targetPy = 0;
|
||||||
|
let animFrame: number | undefined;
|
||||||
|
let reduced = get(reduceAnimations);
|
||||||
|
|
||||||
|
function apply() {
|
||||||
|
node.style.setProperty('--mouse-px', mousePx.toFixed(4));
|
||||||
|
node.style.setProperty('--mouse-py', mousePy.toFixed(4));
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop() {
|
||||||
|
if (animFrame !== undefined) {
|
||||||
|
cancelAnimationFrame(animFrame);
|
||||||
|
animFrame = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
stop();
|
||||||
|
mousePx = 0;
|
||||||
|
mousePy = 0;
|
||||||
|
targetPx = 0;
|
||||||
|
targetPy = 0;
|
||||||
|
apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateParallax() {
|
||||||
|
animFrame = undefined;
|
||||||
|
const dx = targetPx - mousePx;
|
||||||
|
const dy = targetPy - mousePy;
|
||||||
|
|
||||||
|
if (Math.abs(dx) < 0.0005 && Math.abs(dy) < 0.0005) {
|
||||||
|
mousePx = targetPx;
|
||||||
|
mousePy = targetPy;
|
||||||
|
apply();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mousePx += dx * 0.12;
|
||||||
|
mousePy += dy * 0.12;
|
||||||
|
apply();
|
||||||
|
animFrame = requestAnimationFrame(updateParallax);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onWindowMouseMove(event: MouseEvent) {
|
||||||
|
if (!enabled || reduced) return;
|
||||||
|
|
||||||
|
const width = window.innerWidth || 1000;
|
||||||
|
const height = window.innerHeight || 650;
|
||||||
|
targetPx = (event.clientX / width - 0.5) * 2 * intensity;
|
||||||
|
targetPy = (event.clientY / height - 0.5) * 2 * intensity;
|
||||||
|
|
||||||
|
if (animFrame === undefined) {
|
||||||
|
animFrame = requestAnimationFrame(updateParallax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsubscribe = reduceAnimations.subscribe((value) => {
|
||||||
|
reduced = value;
|
||||||
|
if (reduced) reset();
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('mousemove', onWindowMouseMove);
|
||||||
|
apply();
|
||||||
|
|
||||||
|
return {
|
||||||
|
update(next: ThemeParallaxOptions = {}) {
|
||||||
|
enabled = next.enabled === true;
|
||||||
|
intensity = clampIntensity(next.intensity);
|
||||||
|
if (!enabled || reduced) reset();
|
||||||
|
},
|
||||||
|
destroy() {
|
||||||
|
unsubscribe();
|
||||||
|
window.removeEventListener('mousemove', onWindowMouseMove);
|
||||||
|
stop();
|
||||||
|
node.style.removeProperty('--mouse-px');
|
||||||
|
node.style.removeProperty('--mouse-py');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
|
|||||||
import type { Theme } from '$lib/themes';
|
import type { Theme } from '$lib/theme/themes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 1.0 themes are executable bundles: loading one imports its entry script
|
* API 1.0 themes are executable bundles: loading one imports its entry script
|
||||||
@@ -646,6 +646,8 @@ export type ThemeV2Definition = {
|
|||||||
version: string;
|
version: string;
|
||||||
apiVersion: '2.0';
|
apiVersion: '2.0';
|
||||||
author: string;
|
author: string;
|
||||||
|
/** EZPPFarm user ID of the publisher, written when the theme is published. */
|
||||||
|
authorId?: number;
|
||||||
description?: string;
|
description?: string;
|
||||||
/** Workshop discovery tags for this theme. */
|
/** Workshop discovery tags for this theme. */
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
@@ -746,6 +748,16 @@ export const normalizeThemeTags = (raw: unknown): string[] => {
|
|||||||
return tags;
|
return tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const THEME_VERSION_PATTERN =
|
||||||
|
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
|
||||||
|
|
||||||
|
/** Accept only strict SemVer 2.0.0, preserving prerelease and build metadata. */
|
||||||
|
export const normalizeThemeVersion = (raw: unknown): string | undefined => {
|
||||||
|
if (typeof raw !== 'string') return undefined;
|
||||||
|
const version = raw.trim();
|
||||||
|
return version.length > 0 && THEME_VERSION_PATTERN.test(version) ? version : undefined;
|
||||||
|
};
|
||||||
|
|
||||||
const WORKSHOP_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
const WORKSHOP_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
||||||
|
|
||||||
/** Keep a server-assigned workshop ID while preserving legacy slug IDs. */
|
/** Keep a server-assigned workshop ID while preserving legacy slug IDs. */
|
||||||
@@ -755,6 +767,11 @@ const normalizeWorkshopId = (raw: unknown): string | undefined => {
|
|||||||
return WORKSHOP_ID_PATTERN.test(id) ? id : undefined;
|
return WORKSHOP_ID_PATTERN.test(id) ? id : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const normalizeAuthorId = (raw: unknown): number | undefined => {
|
||||||
|
if (typeof raw !== 'number' || !Number.isSafeInteger(raw) || raw <= 0) return undefined;
|
||||||
|
return raw;
|
||||||
|
};
|
||||||
|
|
||||||
const clampInteger = (value: unknown, fallback: number, min: number, max: number) =>
|
const clampInteger = (value: unknown, fallback: number, min: number, max: number) =>
|
||||||
Math.round(clamp(value, fallback, min, max));
|
Math.round(clamp(value, fallback, min, max));
|
||||||
|
|
||||||
@@ -1913,6 +1930,7 @@ export const normalizeThemeV2 = (raw: Partial<ThemeV2Definition>): ThemeV2Defini
|
|||||||
version: text(raw.version, '1.0.0'),
|
version: text(raw.version, '1.0.0'),
|
||||||
apiVersion: '2.0',
|
apiVersion: '2.0',
|
||||||
author: text(raw.author, 'Unknown'),
|
author: text(raw.author, 'Unknown'),
|
||||||
|
authorId: normalizeAuthorId(raw.authorId),
|
||||||
description: text(raw.description),
|
description: text(raw.description),
|
||||||
tags: normalizeThemeTags(raw.tags),
|
tags: normalizeThemeTags(raw.tags),
|
||||||
workshopId: normalizeWorkshopId(raw.workshopId),
|
workshopId: normalizeWorkshopId(raw.workshopId),
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
import { active_custom_theme, custom_theme_audio_playing, custom_themes } from './global';
|
import { active_custom_theme, custom_theme_audio_playing, custom_themes } from '../global';
|
||||||
|
import { disableMediaControls, setGlobalVolume } from '../utils';
|
||||||
import { clearThemeMediaCache, playThemeMedia } from './themeMedia';
|
import { clearThemeMediaCache, playThemeMedia } from './themeMedia';
|
||||||
import { isThemeV2, normalizeThemeV2, type ThemeV2Asset, type ThemeV2Definition } from './themeV2';
|
import { isThemeV2, normalizeThemeV2, type ThemeV2Asset, type ThemeV2Definition } from './themeV2';
|
||||||
import { disableMediaControls, setGlobalVolume } from './utils';
|
|
||||||
import { betterFetch } from '@better-fetch/fetch';
|
import { betterFetch } from '@better-fetch/fetch';
|
||||||
import { convertFileSrc, invoke } from '@tauri-apps/api/core';
|
import { convertFileSrc, invoke } from '@tauri-apps/api/core';
|
||||||
import { listen } from '@tauri-apps/api/event';
|
import { listen } from '@tauri-apps/api/event';
|
||||||
import * as path from '@tauri-apps/api/path';
|
import * as path from '@tauri-apps/api/path';
|
||||||
import * as fs from '@tauri-apps/plugin-fs';
|
import * as fs from '@tauri-apps/plugin-fs';
|
||||||
|
import { tick } from 'svelte';
|
||||||
|
|
||||||
export type Theme = {
|
export type Theme = {
|
||||||
folder_name: string;
|
folder_name: string;
|
||||||
@@ -16,6 +17,8 @@ export type Theme = {
|
|||||||
version: string;
|
version: string;
|
||||||
apiVersion: string;
|
apiVersion: string;
|
||||||
author: string;
|
author: string;
|
||||||
|
/** EZPPFarm user ID stored in the manifest when the theme is published. */
|
||||||
|
authorId?: number;
|
||||||
description: string;
|
description: string;
|
||||||
nsfw: boolean;
|
nsfw: boolean;
|
||||||
scriptUrl: string;
|
scriptUrl: string;
|
||||||
@@ -25,6 +28,18 @@ export type Theme = {
|
|||||||
status: 'installed' | 'downloading' | 'extracting' | 'deleting' | 'not-installed';
|
status: 'installed' | 'downloading' | 'extracting' | 'deleting' | 'not-installed';
|
||||||
progress: number;
|
progress: number;
|
||||||
updateAvailable: boolean;
|
updateAvailable: boolean;
|
||||||
|
/** The latest Workshop version, when the theme has been published. */
|
||||||
|
workshopVersion?: string;
|
||||||
|
/** Hash of the theme files when this copy was last known to match the Workshop. */
|
||||||
|
syncedContentHash?: string;
|
||||||
|
/** Local version current when the sync baseline was written. */
|
||||||
|
syncedVersion?: string;
|
||||||
|
/** True when the local theme differs from its published Workshop package. */
|
||||||
|
isNotSynced?: boolean;
|
||||||
|
/** Modification time of the generated preview, used to migrate existing installs. */
|
||||||
|
previewModifiedAt?: number;
|
||||||
|
/** Creation time of the theme folder, used to migrate existing installs. */
|
||||||
|
folderCreatedAt?: number;
|
||||||
/** The version available in the repository when an update is pending. */
|
/** The version available in the repository when an update is pending. */
|
||||||
availableVersion?: string;
|
availableVersion?: string;
|
||||||
definition?: ThemeV2Definition;
|
definition?: ThemeV2Definition;
|
||||||
@@ -44,6 +59,7 @@ export type ThemeInfo = {
|
|||||||
apiVersion?: string;
|
apiVersion?: string;
|
||||||
workshopId?: string;
|
workshopId?: string;
|
||||||
author?: string;
|
author?: string;
|
||||||
|
authorId?: number;
|
||||||
description?: string;
|
description?: string;
|
||||||
nsfw?: boolean;
|
nsfw?: boolean;
|
||||||
entry?: string;
|
entry?: string;
|
||||||
@@ -92,6 +108,75 @@ const encodeThemePath = (value: string) =>
|
|||||||
export const themesDirectory = async () =>
|
export const themesDirectory = async () =>
|
||||||
await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
|
await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
|
||||||
|
|
||||||
|
const THEME_SYNC_FILENAME = '.workshop-sync.json';
|
||||||
|
const CONTENT_HASH_PATTERN = /^[a-f0-9]{64}$/i;
|
||||||
|
|
||||||
|
export type ThemeWorkshopSync = {
|
||||||
|
contentHash: string;
|
||||||
|
version?: string;
|
||||||
|
workshopId?: string;
|
||||||
|
syncedAt?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
const readThemeWorkshopSyncFile = async (
|
||||||
|
folderPath: string
|
||||||
|
): Promise<ThemeWorkshopSync | undefined> => {
|
||||||
|
const syncPath = await path.join(folderPath, THEME_SYNC_FILENAME);
|
||||||
|
if (!(await fs.exists(syncPath))) return undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(await fs.readTextFile(syncPath)) as Partial<ThemeWorkshopSync>;
|
||||||
|
if (!parsed || typeof parsed !== 'object') return undefined;
|
||||||
|
const contentHash =
|
||||||
|
typeof parsed.contentHash === 'string' && CONTENT_HASH_PATTERN.test(parsed.contentHash)
|
||||||
|
? parsed.contentHash.toLowerCase()
|
||||||
|
: undefined;
|
||||||
|
if (!contentHash) return undefined;
|
||||||
|
|
||||||
|
return {
|
||||||
|
contentHash,
|
||||||
|
version: typeof parsed.version === 'string' ? parsed.version : undefined,
|
||||||
|
workshopId: typeof parsed.workshopId === 'string' ? parsed.workshopId : undefined,
|
||||||
|
syncedAt: typeof parsed.syncedAt === 'number' ? parsed.syncedAt : undefined,
|
||||||
|
};
|
||||||
|
} catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const readThemeWorkshopSync = async (folderName: string) =>
|
||||||
|
readThemeWorkshopSyncFile(await path.join(await themesDirectory(), folderName));
|
||||||
|
|
||||||
|
export const writeThemeWorkshopSync = async (
|
||||||
|
folderName: string,
|
||||||
|
sync: ThemeWorkshopSync
|
||||||
|
): Promise<void> => {
|
||||||
|
const folderPath = await path.join(await themesDirectory(), folderName);
|
||||||
|
const syncPath = await path.join(folderPath, THEME_SYNC_FILENAME);
|
||||||
|
await fs.writeFile(syncPath, new TextEncoder().encode(`${JSON.stringify(sync, null, 2)}\n`));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const hashThemeContent = async (folderName: string) => {
|
||||||
|
const themeFolder = await path.join(await themesDirectory(), folderName);
|
||||||
|
return await invoke<string>('hash_theme_content', { themeFolder });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Record the current local files as the published Workshop baseline. */
|
||||||
|
export const markThemeSynced = async (
|
||||||
|
folderName: string,
|
||||||
|
options: { version?: string; workshopId?: string } = {}
|
||||||
|
): Promise<ThemeWorkshopSync> => {
|
||||||
|
const contentHash = await hashThemeContent(folderName);
|
||||||
|
const sync: ThemeWorkshopSync = {
|
||||||
|
contentHash,
|
||||||
|
version: options.version,
|
||||||
|
workshopId: options.workshopId,
|
||||||
|
syncedAt: Date.now(),
|
||||||
|
};
|
||||||
|
await writeThemeWorkshopSync(folderName, sync);
|
||||||
|
return sync;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace a theme in the store instead of mutating it. The theme list is
|
* Replace a theme in the store instead of mutating it. The theme list is
|
||||||
* rendered from a filtered derived list, and Svelte treats each item as
|
* rendered from a filtered derived list, and Svelte treats each item as
|
||||||
@@ -129,6 +214,8 @@ const themeFromFolder = async (
|
|||||||
const definition = isV2
|
const definition = isV2
|
||||||
? normalizeThemeV2(parsed as unknown as Partial<ThemeV2Definition>)
|
? normalizeThemeV2(parsed as unknown as Partial<ThemeV2Definition>)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
const sync = await readThemeWorkshopSyncFile(folderPath);
|
||||||
|
const folderStat = await fs.stat(folderPath).catch(() => undefined);
|
||||||
|
|
||||||
const httpBase = await themeAssetBase();
|
const httpBase = await themeAssetBase();
|
||||||
const httpFolder = httpBase ? `${httpBase}/${encodeURIComponent(folderName)}` : '';
|
const httpFolder = httpBase ? `${httpBase}/${encodeURIComponent(folderName)}` : '';
|
||||||
@@ -155,9 +242,11 @@ const themeFromFolder = async (
|
|||||||
: convertFileSrc(await path.normalize(await path.join(folderPath, 'assets')));
|
: convertFileSrc(await path.normalize(await path.join(folderPath, 'assets')));
|
||||||
const previewName = parsed.preview || (isV2 ? 'preview.png' : '');
|
const previewName = parsed.preview || (isV2 ? 'preview.png' : '');
|
||||||
let preview = '';
|
let preview = '';
|
||||||
|
let previewModifiedAt: number | undefined;
|
||||||
if (previewName) {
|
if (previewName) {
|
||||||
const previewPath = await path.join(folderPath, 'assets', previewName);
|
const previewPath = await path.join(folderPath, 'assets', previewName);
|
||||||
if (await fs.exists(previewPath)) {
|
if (await fs.exists(previewPath)) {
|
||||||
|
previewModifiedAt = (await fs.stat(previewPath).catch(() => undefined))?.mtime?.getTime();
|
||||||
// The editor rewrites preview.png on every save. A cache-busting query
|
// The editor rewrites preview.png on every save. A cache-busting query
|
||||||
// makes the WebView pick up the new file instead of its cached asset.
|
// makes the WebView pick up the new file instead of its cached asset.
|
||||||
preview = httpFolder
|
preview = httpFolder
|
||||||
@@ -173,6 +262,12 @@ const themeFromFolder = async (
|
|||||||
version: parsed.version ?? '1.0.0',
|
version: parsed.version ?? '1.0.0',
|
||||||
apiVersion,
|
apiVersion,
|
||||||
author: parsed.author ?? 'Unknown',
|
author: parsed.author ?? 'Unknown',
|
||||||
|
authorId:
|
||||||
|
typeof parsed.authorId === 'number' &&
|
||||||
|
Number.isSafeInteger(parsed.authorId) &&
|
||||||
|
parsed.authorId > 0
|
||||||
|
? parsed.authorId
|
||||||
|
: undefined,
|
||||||
description: parsed.description ?? '',
|
description: parsed.description ?? '',
|
||||||
nsfw: parsed.nsfw === true,
|
nsfw: parsed.nsfw === true,
|
||||||
scriptUrl,
|
scriptUrl,
|
||||||
@@ -181,6 +276,10 @@ const themeFromFolder = async (
|
|||||||
status: 'installed',
|
status: 'installed',
|
||||||
progress: 0,
|
progress: 0,
|
||||||
updateAvailable: false,
|
updateAvailable: false,
|
||||||
|
syncedContentHash: sync?.contentHash,
|
||||||
|
syncedVersion: sync?.version,
|
||||||
|
previewModifiedAt,
|
||||||
|
folderCreatedAt: folderStat?.birthtime?.getTime(),
|
||||||
cssStyle,
|
cssStyle,
|
||||||
definition,
|
definition,
|
||||||
};
|
};
|
||||||
@@ -388,7 +487,18 @@ export const downloadTheme = async (
|
|||||||
return { success: true };
|
return { success: true };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volume = 0.15) => {
|
type LoadThemeOptions = {
|
||||||
|
/** Crossfade the rendered page when switching themes. */
|
||||||
|
animate?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const loadTheme = async (
|
||||||
|
theme: Theme,
|
||||||
|
themeContainer: HTMLElement,
|
||||||
|
volume = 0.15,
|
||||||
|
options: LoadThemeOptions = {}
|
||||||
|
) => {
|
||||||
|
const applyTheme = async () => {
|
||||||
// Theme media is buffered as blob URLs; the previous theme's URLs are no
|
// Theme media is buffered as blob URLs; the previous theme's URLs are no
|
||||||
// longer needed once it is replaced.
|
// longer needed once it is replaced.
|
||||||
clearThemeMediaCache();
|
clearThemeMediaCache();
|
||||||
@@ -416,6 +526,28 @@ export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volum
|
|||||||
});
|
});
|
||||||
|
|
||||||
void invoke('unlock_media_autoplay').catch(() => {});
|
void invoke('unlock_media_autoplay').catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
const canAnimate =
|
||||||
|
options.animate &&
|
||||||
|
typeof document !== 'undefined' &&
|
||||||
|
typeof document.startViewTransition === 'function';
|
||||||
|
|
||||||
|
if (!canAnimate) {
|
||||||
|
await applyTheme();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const transition = document.startViewTransition(async () => {
|
||||||
|
await applyTheme();
|
||||||
|
// Let Svelte paint the new theme before the transition takes its snapshot.
|
||||||
|
await tick();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Theme activation must not wait for, or fail because of, the visual
|
||||||
|
// transition. `finished` can reject when a transition is skipped.
|
||||||
|
void transition.finished.catch(() => {});
|
||||||
|
await transition.updateCallbackDone;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteTheme = async (themeToUninstall: Theme) => {
|
export const deleteTheme = async (themeToUninstall: Theme) => {
|
||||||
@@ -513,6 +645,7 @@ export const reloadThemes = async () => {
|
|||||||
if (ACTIVE_STATUSES.has(storeTheme.status)) return storeTheme;
|
if (ACTIVE_STATUSES.has(storeTheme.status)) return storeTheme;
|
||||||
const theme = installedMap.get(storeTheme.name);
|
const theme = installedMap.get(storeTheme.name);
|
||||||
if (!theme) return storeTheme;
|
if (!theme) return storeTheme;
|
||||||
|
const versionChanged = storeTheme.version !== theme.version;
|
||||||
|
|
||||||
// Replace the object rather than mutating it so the theme cards see the
|
// Replace the object rather than mutating it so the theme cards see the
|
||||||
// new values when the list is rendered from a filtered derived array.
|
// new values when the list is rendered from a filtered derived array.
|
||||||
@@ -523,13 +656,19 @@ export const reloadThemes = async () => {
|
|||||||
preview: theme.preview,
|
preview: theme.preview,
|
||||||
version: theme.version,
|
version: theme.version,
|
||||||
author: theme.author,
|
author: theme.author,
|
||||||
|
authorId: theme.authorId,
|
||||||
apiVersion: theme.apiVersion,
|
apiVersion: theme.apiVersion,
|
||||||
description: theme.description,
|
description: theme.description,
|
||||||
nsfw: theme.nsfw,
|
nsfw: theme.nsfw,
|
||||||
workshopId: theme.workshopId,
|
workshopId: theme.workshopId,
|
||||||
definition: theme.definition,
|
definition: theme.definition,
|
||||||
updateAvailable: theme.updateAvailable,
|
syncedContentHash: theme.syncedContentHash,
|
||||||
availableVersion: theme.availableVersion,
|
syncedVersion: theme.syncedVersion,
|
||||||
|
previewModifiedAt: theme.previewModifiedAt,
|
||||||
|
folderCreatedAt: theme.folderCreatedAt,
|
||||||
|
isNotSynced: versionChanged ? false : storeTheme.isNotSynced,
|
||||||
|
updateAvailable: versionChanged ? false : storeTheme.updateAvailable,
|
||||||
|
availableVersion: versionChanged ? undefined : storeTheme.availableVersion,
|
||||||
cssStyle: theme.cssStyle,
|
cssStyle: theme.cssStyle,
|
||||||
backups: theme.backups ?? storeTheme.backups,
|
backups: theme.backups ?? storeTheme.backups,
|
||||||
};
|
};
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { custom_theme_audio_playing } from './global';
|
import { custom_theme_audio_playing } from './global';
|
||||||
import { playThemeMedia } from './themeMedia';
|
import { playThemeMedia } from './theme/themeMedia';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { type ClassValue, clsx } from 'clsx';
|
import { type ClassValue, clsx } from 'clsx';
|
||||||
import * as crypto from 'crypto-js';
|
import * as crypto from 'crypto-js';
|
||||||
@@ -133,7 +133,7 @@ export const urlIsValidImage = async (url: string) => {
|
|||||||
const request = await fetch(url);
|
const request = await fetch(url);
|
||||||
if (!request.ok) return false;
|
if (!request.ok) return false;
|
||||||
const contentType = request.headers.get('content-type');
|
const contentType = request.headers.get('content-type');
|
||||||
return contentType?.startsWith('image/');
|
return contentType?.startsWith('image/') === true;
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import Logo from '$assets/logo.png';
|
import Logo from '$assets/logo.png';
|
||||||
import DiscordPresenceEditor from '$lib/components/presence/DiscordPresenceEditor.svelte';
|
|
||||||
import ThemeEditorWindow from '$lib/components/theme/ThemeEditorWindow.svelte';
|
|
||||||
import ThemeV2Background from '$lib/components/theme/ThemeV2Background.svelte';
|
import ThemeV2Background from '$lib/components/theme/ThemeV2Background.svelte';
|
||||||
import * as AlertDialog from '$lib/components/ui/alert-dialog';
|
import * as AlertDialog from '$lib/components/ui/alert-dialog';
|
||||||
import AnimatedBg from '$lib/components/ui/animated-bg/AnimatedBg.svelte';
|
import AnimatedBg from '$lib/components/ui/animated-bg/AnimatedBg.svelte';
|
||||||
@@ -44,10 +42,11 @@
|
|||||||
themeMediaStatus,
|
themeMediaStatus,
|
||||||
themeMediaSuspended,
|
themeMediaSuspended,
|
||||||
themeMediaSuspension,
|
themeMediaSuspension,
|
||||||
} from '$lib/themeMedia';
|
} from '$lib/theme/themeMedia';
|
||||||
import { isThemeTrusted } from '$lib/themeTrust';
|
import { themeParallax } from '$lib/theme/themeParallax';
|
||||||
import { themeV2Css } from '$lib/themeV2';
|
import { isThemeTrusted } from '$lib/theme/themeTrust';
|
||||||
import { getThemes, loadTheme } from '$lib/themes';
|
import { themeV2Css } from '$lib/theme/themeV2';
|
||||||
|
import { getThemes, loadTheme } from '$lib/theme/themes';
|
||||||
import { currentUser } from '$lib/userAuthentication';
|
import { currentUser } from '$lib/userAuthentication';
|
||||||
import {
|
import {
|
||||||
cursorSmoothening,
|
cursorSmoothening,
|
||||||
@@ -72,6 +71,37 @@
|
|||||||
|
|
||||||
let { children } = $props();
|
let { children } = $props();
|
||||||
|
|
||||||
|
function appActivity(node: HTMLElement) {
|
||||||
|
let focused = true;
|
||||||
|
|
||||||
|
const sync = () => {
|
||||||
|
node.classList.toggle('app-inactive', document.hidden || !focused);
|
||||||
|
};
|
||||||
|
const onBlur = () => {
|
||||||
|
focused = false;
|
||||||
|
sync();
|
||||||
|
};
|
||||||
|
const onFocus = () => {
|
||||||
|
focused = true;
|
||||||
|
sync();
|
||||||
|
};
|
||||||
|
const onVisibilityChange = () => sync();
|
||||||
|
|
||||||
|
window.addEventListener('blur', onBlur);
|
||||||
|
window.addEventListener('focus', onFocus);
|
||||||
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
sync();
|
||||||
|
|
||||||
|
return {
|
||||||
|
destroy() {
|
||||||
|
window.removeEventListener('blur', onBlur);
|
||||||
|
window.removeEventListener('focus', onFocus);
|
||||||
|
document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||||
|
node.classList.remove('app-inactive');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
let unlistenEditorState: (() => void) | undefined;
|
let unlistenEditorState: (() => void) | undefined;
|
||||||
let unlistenRequestEditorData: (() => void) | undefined;
|
let unlistenRequestEditorData: (() => void) | undefined;
|
||||||
let unlistenPresenceEditorState: (() => void) | undefined;
|
let unlistenPresenceEditorState: (() => void) | undefined;
|
||||||
@@ -218,6 +248,7 @@
|
|||||||
osuStream: get(osuStream),
|
osuStream: get(osuStream),
|
||||||
serverPing: get(serverPing),
|
serverPing: get(serverPing),
|
||||||
launcherVersion: get(launcherVersion),
|
launcherVersion: get(launcherVersion),
|
||||||
|
discordPresence: get(discordPresence),
|
||||||
});
|
});
|
||||||
} catch {}
|
} catch {}
|
||||||
};
|
};
|
||||||
@@ -449,9 +480,19 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{#if editorWindow}
|
{#if editorWindow}
|
||||||
|
{#await import('$lib/components/theme/ThemeEditorWindow.svelte')}
|
||||||
|
<div class="h-screen w-screen bg-theme-950"></div>
|
||||||
|
{:then editorModule}
|
||||||
|
{@const ThemeEditorWindow = editorModule.default}
|
||||||
<ThemeEditorWindow />
|
<ThemeEditorWindow />
|
||||||
|
{/await}
|
||||||
{:else if presenceEditorWindow}
|
{:else if presenceEditorWindow}
|
||||||
|
{#await import('$lib/components/presence/DiscordPresenceEditor.svelte')}
|
||||||
|
<div class="h-screen w-screen bg-theme-950"></div>
|
||||||
|
{:then presenceModule}
|
||||||
|
{@const DiscordPresenceEditor = presenceModule.default}
|
||||||
<DiscordPresenceEditor standalone />
|
<DiscordPresenceEditor standalone />
|
||||||
|
{/await}
|
||||||
{:else}
|
{:else}
|
||||||
{#if editorOpen}
|
{#if editorOpen}
|
||||||
<div
|
<div
|
||||||
@@ -542,7 +583,15 @@
|
|||||||
</AlertDialog.Content>
|
</AlertDialog.Content>
|
||||||
</AlertDialog.Root>
|
</AlertDialog.Root>
|
||||||
|
|
||||||
<main use:themeMediaSuspension>
|
<main
|
||||||
|
class="relative h-screen w-full overflow-hidden"
|
||||||
|
use:appActivity
|
||||||
|
use:themeMediaSuspension
|
||||||
|
use:themeParallax={{
|
||||||
|
enabled: $active_custom_theme?.definition?.parallax?.enabled === true,
|
||||||
|
intensity: $active_custom_theme?.definition?.parallax?.intensity ?? 0.25,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div class:hidden={!!$active_custom_theme?.definition}>
|
<div class:hidden={!!$active_custom_theme?.definition}>
|
||||||
<div class="opacity-30">
|
<div class="opacity-30">
|
||||||
<div transition:fade={{ duration: $reduceAnimations ? 0 : 500 }}>
|
<div transition:fade={{ duration: $reduceAnimations ? 0 : 500 }}>
|
||||||
|
|||||||
+874
-176
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user