Add directify desktop app source

osu!lazer-style beatmap search (mode, mania key count, genre, language,
star-rating range) against catboy.best-compatible mirrors with automatic
fallback, library management with offline-cached cover art, a collection.db
editor, portable beatpack backup/restore, i18n (en/es/ja), light/dark theme,
keyboard shortcuts, proxy support, and an in-app GitHub Releases update check.
This commit is contained in:
pvrzz
2026-09-17 19:31:30 -04:00
parent 90a52a7697
commit ca53ea4956
95 changed files with 9338 additions and 6 deletions
+20
View File
@@ -0,0 +1,20 @@
node_modules/
dist/
dist-electron/
out/
release/
.next/
*.log
.env
.env.local
.DS_Store
# Local editor/agent tooling config and design-process notes, not part of the project
.claude/
.tastemaker/
# The website is closed-source and hosted separately from this repo
apps/web/
# Staging copies of fetched icons, already mirrored into the app itself
design/
+6 -6
View File
@@ -65,21 +65,21 @@ manage collections, all from one desktop app. The actual beatmap search and down
## Project layout ## Project layout
This is a pnpm monorepo: This repo is a pnpm monorepo holding the app itself and the libraries it depends on. The landing
page at [directify.pvrz.lol](https://directify.pvrz.lol) is closed-source and lives in a separate,
private repo; it isn't part of this codebase.
| Path | What it is | | Path | What it is |
| --- | --- | | --- | --- |
| `apps/desktop` | The actual product: an Electron + React app. Beatmap source adapters live in `apps/desktop/src/main/sources` (a generic `MirrorSource` class works against any catboy.best-compatible API); `apps/desktop/src/main/source-registry.ts` handles the fallback chain and per-source rate limiting. | | `apps/desktop` | The app: an Electron + React client. Beatmap source adapters live in `apps/desktop/src/main/sources` (a generic `MirrorSource` class works against any catboy.best-compatible API); `apps/desktop/src/main/source-registry.ts` handles the fallback chain and per-source rate limiting. |
| `apps/web` | The landing page (Next.js) at [directify.pvrz.lol](https://directify.pvrz.lol): hero, feature overview, and a download link to this repo's Releases. It doesn't do any beatmap searching itself. | | `packages/shared` | Types shared across the app, plus the `collection.db` binary reader/writer. |
| `packages/shared` | Types shared across apps, plus the `collection.db` binary reader/writer. | | `packages/ui` | The app's design system: theme tokens, `Button`, `Card`, `Icon`, `DualRangeSlider`, and more. |
| `packages/ui` | The shared design system (theme tokens, `Button`, `Card`, `Icon`, `DualRangeSlider`, and more) used by both the desktop renderer and the website. |
## Development ## Development
```bash ```bash
pnpm install pnpm install
pnpm dev:desktop # Electron app pnpm dev:desktop # Electron app
pnpm dev:web # Landing page at http://localhost:3000
``` ```
Build a real portable `.exe`, the same thing the Releases page ships: Build a real portable `.exe`, the same thing the Releases page ships:
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+16
View File
@@ -0,0 +1,16 @@
appId: com.directify.app
productName: directify
directories:
output: release
buildResources: build
files:
- out/**/*
- package.json
extraResources:
- from: resources
to: .
win:
target: portable
icon: build/icon.ico
artifactName: ${productName}-${version}-portable.${ext}
asar: true
+22
View File
@@ -0,0 +1,22 @@
import { resolve } from "node:path";
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
import react from "@vitejs/plugin-react";
const workspacePackages = ["@directify/shared", "@directify/ui"];
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin({ exclude: workspacePackages })],
},
preload: {
plugins: [externalizeDepsPlugin({ exclude: workspacePackages })],
},
renderer: {
resolve: {
alias: {
"@renderer": resolve("src/renderer/src"),
},
},
plugins: [react()],
},
});
+42
View File
@@ -0,0 +1,42 @@
{
"name": "@directify/desktop",
"version": "0.1.0",
"description": "A feature-rich, unofficial client for catboy.best. Seamlessly search, download, and manage your osu! beatmaps and beatpacks.",
"author": "directify",
"homepage": "https://github.com/pvrzz/directify",
"repository": "github:pvrzz/directify",
"private": true,
"main": "./out/main/index.js",
"scripts": {
"dev": "electron-vite dev",
"dev:preview": "vite --config vite.preview.config.ts",
"build": "electron-vite build",
"start": "electron-vite preview",
"lint": "tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.web.json",
"package": "electron-vite build && electron-builder --win portable"
},
"dependencies": {
"@directify/shared": "workspace:*",
"@directify/ui": "workspace:*",
"@fontsource/roboto": "^5.1.0",
"archiver": "^7.0.1",
"extract-zip": "^2.0.1",
"framer-motion": "^11.11.0",
"i18next": "^23.16.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"react-i18next": "^15.1.0",
"react-router-dom": "^6.27.0"
},
"devDependencies": {
"@types/archiver": "^6.0.2",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.0",
"electron": "^32.1.0",
"electron-builder": "^25.1.8",
"electron-vite": "^2.3.0",
"typescript": "^5.6.0",
"vite": "^5.4.0"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+49
View File
@@ -0,0 +1,49 @@
// Typed contract between the main process (implementation) and the preload
// bridge/renderer (consumers) — see src/main/index.ts for handlers and
// src/preload/index.ts for the exposed window.directify implementation.
import type { BackupManifest } from "./main/library.js";
import type { UpdateCheckResult } from "./main/updates.js";
import type {
BeatmapSearchQuery,
BeatmapSearchResult,
BeatmapSet,
BeatmapSourceConfig,
CollectionDatabase,
ProxyConfig,
ThemeMode,
} from "@directify/shared";
export interface AppSettings {
osuInstallDir: string | null;
theme: ThemeMode;
reduceMotion: boolean;
language: string;
proxy: ProxyConfig;
/** Ordered fallback chain: tried top to bottom, skipping disabled entries. */
searchSources: BeatmapSourceConfig[];
}
export interface DirectifyIpcApi {
getSettings(): Promise<AppSettings>;
saveSettings(settings: AppSettings): Promise<void>;
detectOsuInstall(): Promise<string | null>;
pickOsuInstallDir(): Promise<string | null>;
listInstalledBeatmapFolders(): Promise<string[]>;
scanLibrary(): Promise<BeatmapSet[]>;
deleteBeatmapSet(folderName: string): Promise<void>;
pickBackupDestination(): Promise<string | null>;
backupLibrary(destZipPath: string, folderNames?: string[]): Promise<BackupManifest>;
pickBackupToRestore(): Promise<string | null>;
restoreBackup(zipPath: string): Promise<void>;
searchBeatmaps(query: BeatmapSearchQuery): Promise<BeatmapSearchResult>;
installBeatmapSet(set: BeatmapSet): Promise<void>;
readCollections(): Promise<CollectionDatabase>;
writeCollections(db: CollectionDatabase): Promise<void>;
checkForUpdate(): Promise<UpdateCheckResult>;
openExternal(url: string): Promise<void>;
}
+168
View File
@@ -0,0 +1,168 @@
// Electron main process entry point: window creation, IPC handler
// registration, and startup tasks (osu! install auto-detect, proxy config).
import {
readCollectionDb,
writeCollectionDb,
type BeatmapSearchQuery,
type BeatmapSet,
type CollectionDatabase,
} from "@directify/shared";
import { app, BrowserWindow, dialog, ipcMain, shell } from "electron";
import { existsSync } from "node:fs";
import { readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import {
backupLibrary,
deleteBeatmapSet,
installBeatmapSet,
listInstalledBeatmapFolders,
restoreBackup,
scanInstalledBeatmapSets,
} from "./library.js";
import { applyProxySettings } from "./network.js";
import { collectionDbPath, detectOsuInstallDir, isValidOsuInstallDir } from "./osu-install.js";
import { loadSettings, saveSettings, type AppSettings } from "./settings.js";
import { resolveDownloadUrlForResult, searchWithFallback } from "./source-registry.js";
import { checkForUpdate } from "./updates.js";
const ALLOWED_EXTERNAL_HOSTS = ["github.com", "www.github.com"];
function requireInstallDir(): string {
const { osuInstallDir } = loadSettings();
if (!osuInstallDir) throw new Error("osu! install directory is not configured yet.");
return osuInstallDir;
}
function registerIpcHandlers(): void {
ipcMain.handle("settings:get", () => loadSettings());
ipcMain.handle("settings:save", async (_e, settings: AppSettings) => {
saveSettings(settings);
await applyProxySettings(settings.proxy);
});
ipcMain.handle("osu:detectInstall", () => detectOsuInstallDir());
ipcMain.handle("osu:pickInstallDir", async () => {
const result = await dialog.showOpenDialog({ properties: ["openDirectory"] });
if (result.canceled || result.filePaths.length === 0) return null;
const dir = result.filePaths[0];
return isValidOsuInstallDir(dir) ? dir : null;
});
ipcMain.handle("library:listFolders", () => listInstalledBeatmapFolders(requireInstallDir()));
ipcMain.handle("library:scan", () => scanInstalledBeatmapSets(requireInstallDir()));
ipcMain.handle("library:delete", (_e, folderName: string) =>
deleteBeatmapSet(requireInstallDir(), folderName)
);
ipcMain.handle("backup:pickDestination", async () => {
const result = await dialog.showSaveDialog({
defaultPath: `directify-backup-${Date.now()}.zip`,
filters: [{ name: "Directify backup", extensions: ["zip"] }],
});
return result.canceled ? null : (result.filePath ?? null);
});
ipcMain.handle(
"backup:create",
(_e, destZipPath: string, folderNames?: string[]) =>
backupLibrary(requireInstallDir(), destZipPath, folderNames)
);
ipcMain.handle("backup:pickToRestore", async () => {
const result = await dialog.showOpenDialog({
properties: ["openFile"],
filters: [{ name: "Directify backup", extensions: ["zip"] }],
});
return result.canceled || result.filePaths.length === 0 ? null : result.filePaths[0];
});
ipcMain.handle("backup:restore", (_e, zipPath: string) =>
restoreBackup(zipPath, requireInstallDir())
);
ipcMain.handle("beatmaps:search", (_e, query: BeatmapSearchQuery) =>
searchWithFallback(loadSettings().searchSources, query)
);
ipcMain.handle("beatmaps:install", async (_e, set: BeatmapSet) => {
const downloadUrl = await resolveDownloadUrlForResult(
loadSettings().searchSources,
set.source,
set.id
);
if (!downloadUrl) {
throw new Error(`No download available for "${set.artist} - ${set.title}" yet.`);
}
await installBeatmapSet(
requireInstallDir(),
downloadUrl,
`${set.id} ${set.artist} - ${set.title}`,
set.coverUrl
);
});
ipcMain.handle("collections:read", async () => {
const path = collectionDbPath(requireInstallDir());
if (!existsSync(path)) {
return { version: 20240101, collections: [] } satisfies CollectionDatabase;
}
return readCollectionDb(await readFile(path));
});
ipcMain.handle("collections:write", async (_e, db: CollectionDatabase) => {
const path = collectionDbPath(requireInstallDir());
await writeFile(path, writeCollectionDb(db));
});
ipcMain.handle("app:checkForUpdate", () => checkForUpdate(app.getVersion()));
ipcMain.handle("app:openExternal", (_e, url: string) => {
const host = new URL(url).hostname;
if (!ALLOWED_EXTERNAL_HOSTS.includes(host)) {
throw new Error(`Refusing to open untrusted external URL host: ${host}`);
}
return shell.openExternal(url);
});
}
function resolveIconPath(): string {
return app.isPackaged
? join(process.resourcesPath, "icon.png")
: join(__dirname, "../../resources/icon.png");
}
function createWindow(): void {
const win = new BrowserWindow({
width: 1280,
height: 800,
backgroundColor: "#171a1c",
icon: resolveIconPath(),
webPreferences: {
preload: join(__dirname, "../preload/index.js"),
contextIsolation: true,
nodeIntegration: false,
sandbox: true,
},
});
if (process.env.ELECTRON_RENDERER_URL) {
win.loadURL(process.env.ELECTRON_RENDERER_URL);
} else {
win.loadFile(join(__dirname, "../renderer/index.html"));
}
}
app.whenReady().then(async () => {
const settings = loadSettings();
await applyProxySettings(settings.proxy);
if (!settings.osuInstallDir) {
const detected = await detectOsuInstallDir();
if (detected) saveSettings({ ...settings, osuInstallDir: detected });
}
registerIpcHandlers();
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit();
});
+247
View File
@@ -0,0 +1,247 @@
// Songs-folder operations: scanning installed beatmapsets (parsing .osu files
// rather than the binary osu!.db, since that format shifts between osu!
// versions and text parsing is immune to it), zip backup/restore, and
// installing a beatmapset (downloading its .osz plus caching its cover image
// locally so the Library still shows artwork offline).
import type { Beatmap, BeatmapSet } from "@directify/shared";
import archiver from "archiver";
import { net } from "electron";
import extractZip from "extract-zip";
import { createWriteStream, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { basename, extname, join } from "node:path";
import { parseOsuFile } from "./osu-file.js";
import { songsDir } from "./osu-install.js";
export interface BackupManifest {
createdAt: string;
osuInstallDir: string;
beatmapFolders: string[];
}
const CACHED_COVER_BASENAME = "directify-cover";
function findCachedCover(folderPath: string): string | null {
for (const ext of [".jpg", ".jpeg", ".png"]) {
const path = join(folderPath, `${CACHED_COVER_BASENAME}${ext}`);
if (existsSync(path)) return path;
}
return null;
}
async function coverToDataUrl(coverPath: string): Promise<string> {
const buffer = await readFile(coverPath);
const ext = extname(coverPath).slice(1);
const mime = ext === "png" ? "image/png" : "image/jpeg";
return `data:${mime};base64,${buffer.toString("base64")}`;
}
function remoteCoverUrl(beatmapSetId: number): string {
return `https://assets.ppy.sh/beatmaps/${beatmapSetId}/covers/cover.jpg`;
}
async function cacheCoverInBackground(folderPath: string, beatmapSetId: number): Promise<void> {
try {
const res = await net.fetch(remoteCoverUrl(beatmapSetId));
if (!res.ok) return;
const buffer = Buffer.from(await res.arrayBuffer());
if (!findCachedCover(folderPath)) {
await writeFile(join(folderPath, `${CACHED_COVER_BASENAME}.jpg`), buffer);
}
} catch {
/* empty */
}
}
export function listInstalledBeatmapFolders(installDir: string): string[] {
const dir = songsDir(installDir);
if (!existsSync(dir)) return [];
return readdirSync(dir).filter((entry) => statSync(join(dir, entry)).isDirectory());
}
export async function scanInstalledBeatmapSets(installDir: string): Promise<BeatmapSet[]> {
const dir = songsDir(installDir);
if (!existsSync(dir)) return [];
const sets: BeatmapSet[] = [];
for (const folderName of listInstalledBeatmapFolders(installDir)) {
const folderPath = join(dir, folderName);
const osuFiles = readdirSync(folderPath).filter((f) => f.toLowerCase().endsWith(".osu"));
if (osuFiles.length === 0) continue;
const beatmaps: Beatmap[] = [];
let beatmapSetId = 0;
for (const osuFile of osuFiles) {
const parsed = parseOsuFile(join(folderPath, osuFile));
if (!parsed) continue;
if (parsed.beatmapSetId > 0) beatmapSetId = parsed.beatmapSetId;
beatmaps.push({
id: parsed.beatmapId,
beatmapsetId: parsed.beatmapSetId,
version: parsed.version,
mode: parsed.mode,
difficultyRating: 0,
bpm: 0,
totalLength: 0,
cs: parsed.cs,
ar: parsed.ar,
od: parsed.od,
hp: parsed.hp,
checksum: parsed.checksum,
});
}
if (beatmaps.length === 0) continue;
const first = parseOsuFile(join(folderPath, osuFiles[0]));
if (!first) continue;
const cachedCover = findCachedCover(folderPath);
let coverUrl: string | undefined;
if (cachedCover) {
coverUrl = await coverToDataUrl(cachedCover);
} else if (beatmapSetId > 0) {
coverUrl = remoteCoverUrl(beatmapSetId);
void cacheCoverInBackground(folderPath, beatmapSetId);
}
sets.push({
id: beatmapSetId || hashFolderNameToId(folderName),
title: first.title,
artist: first.artist,
creator: first.creator,
status: "unknown",
coverUrl,
tags: first.tags,
submittedAt: "",
updatedAt: "",
beatmaps,
source: "local",
folderName,
});
}
return sets;
}
function hashFolderNameToId(folderName: string): number {
let hash = 0;
for (let i = 0; i < folderName.length; i++) {
hash = (hash * 31 + folderName.charCodeAt(i)) | 0;
}
return -Math.abs(hash) - 1;
}
export async function deleteBeatmapSet(installDir: string, folderName: string): Promise<void> {
const target = join(songsDir(installDir), folderName);
if (!existsSync(target)) return;
await rm(target, { recursive: true, force: true });
}
export async function backupLibrary(
installDir: string,
destZipPath: string,
folderNames?: string[]
): Promise<BackupManifest> {
const songs = songsDir(installDir);
const foldersToBackup = folderNames ?? listInstalledBeatmapFolders(installDir);
const manifest: BackupManifest = {
createdAt: new Date().toISOString(),
osuInstallDir: installDir,
beatmapFolders: foldersToBackup,
};
await new Promise<void>((resolve, reject) => {
const output = createWriteStream(destZipPath);
const archive = archiver("zip", { zlib: { level: 9 } });
output.on("close", resolve);
archive.on("error", reject);
archive.pipe(output);
for (const folder of foldersToBackup) {
const folderPath = join(songs, folder);
if (existsSync(folderPath)) {
archive.directory(folderPath, `Songs/${folder}`);
}
}
archive.append(JSON.stringify(manifest, null, 2), { name: "directify-manifest.json" });
archive.finalize();
});
return manifest;
}
export async function restoreBackup(zipPath: string, installDir: string): Promise<void> {
const tempDir = await mkdtemp(join(tmpdir(), "directify-restore-"));
try {
await extractZip(zipPath, { dir: tempDir });
const extractedSongs = join(tempDir, "Songs");
if (!existsSync(extractedSongs)) return;
const destSongs = songsDir(installDir);
mkdirSync(destSongs, { recursive: true });
for (const folder of readdirSync(extractedSongs)) {
const src = join(extractedSongs, folder);
const dest = join(destSongs, folder);
if (!existsSync(dest)) {
await copyDir(src, dest);
}
}
} finally {
await rm(tempDir, { recursive: true, force: true });
}
}
async function copyDir(src: string, dest: string): Promise<void> {
mkdirSync(dest, { recursive: true });
for (const entry of readdirSync(src)) {
const srcPath = join(src, entry);
const destPath = join(dest, entry);
if (statSync(srcPath).isDirectory()) {
await copyDir(srcPath, destPath);
} else {
await writeFile(destPath, await readFile(srcPath));
}
}
}
export async function installBeatmapSet(
installDir: string,
downloadUrl: string,
folderName: string,
coverUrl?: string
): Promise<void> {
const res = await net.fetch(downloadUrl);
if (!res.ok) throw new Error(`Download failed: ${res.status} ${res.statusText}`);
const tempDir = await mkdtemp(join(tmpdir(), "directify-install-"));
const oszPath = join(tempDir, `${basename(folderName)}.osz`);
try {
const buffer = Buffer.from(await res.arrayBuffer());
await writeFile(oszPath, buffer);
const destDir = join(songsDir(installDir), folderName);
mkdirSync(destDir, { recursive: true });
await extractZip(oszPath, { dir: destDir });
if (coverUrl) {
try {
const coverRes = await net.fetch(coverUrl);
if (coverRes.ok) {
const coverBuffer = Buffer.from(await coverRes.arrayBuffer());
await writeFile(join(destDir, `${CACHED_COVER_BASENAME}.jpg`), coverBuffer);
}
} catch {
/* empty */
}
}
} finally {
await rm(tempDir, { recursive: true, force: true });
}
}
+17
View File
@@ -0,0 +1,17 @@
// Applies the user's proxy choice to the app's network session (covers every net.fetch call: search, metadata, .osz and cover downloads).
import type { ProxyConfig } from "@directify/shared";
import { session } from "electron";
export function applyProxySettings(proxy: ProxyConfig): Promise<void> {
if (proxy.type === "none" || !proxy.host) {
return session.defaultSession.setProxy({ mode: "direct" });
}
const hostPort = proxy.port ? `${proxy.host}:${proxy.port}` : proxy.host;
const proxyRules =
proxy.type === "socks4" || proxy.type === "socks5"
? `${proxy.type}://${hostPort}`
: `${proxy.type}=${hostPort}`;
return session.defaultSession.setProxy({ proxyRules });
}
+78
View File
@@ -0,0 +1,78 @@
// Minimal reader for the [General]/[Metadata]/[Difficulty] sections of a
// .osu beatmap file (plain-text key: value format, not the binary osu!.db).
// Ignores hitobjects/timing points — only enough to display/organize a map,
// not play it. checksum is the MD5 of the raw file bytes, the same value
// osu!stable stores in collection.db.
import type { OsuMode } from "@directify/shared";
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
export interface ParsedOsuFile {
title: string;
artist: string;
creator: string;
version: string;
source: string;
tags: string[];
beatmapId: number;
beatmapSetId: number;
mode: OsuMode;
cs: number;
ar: number;
od: number;
hp: number;
checksum: string;
}
const MODE_BY_NUMBER: Record<string, OsuMode> = {
"0": "osu",
"1": "taiko",
"2": "fruits",
"3": "mania",
};
export function parseOsuFile(filePath: string): ParsedOsuFile | null {
const buffer = readFileSync(filePath);
const text = buffer.toString("utf8");
const fields: Record<string, string> = {};
let section = "";
for (const rawLine of text.split(/\r?\n/)) {
const line = rawLine.trim();
if (!line || line.startsWith("//")) continue;
const sectionMatch = line.match(/^\[(\w+)\]$/);
if (sectionMatch) {
section = sectionMatch[1];
if (section === "Events" || section === "TimingPoints" || section === "HitObjects") break;
continue;
}
if (section !== "General" && section !== "Metadata" && section !== "Difficulty") continue;
const separatorIndex = line.indexOf(":");
if (separatorIndex === -1) continue;
const key = line.slice(0, separatorIndex).trim();
const value = line.slice(separatorIndex + 1).trim();
fields[key] = value;
}
if (!fields.Title && !fields.Artist) return null;
return {
title: fields.TitleUnicode || fields.Title || "Unknown title",
artist: fields.ArtistUnicode || fields.Artist || "Unknown artist",
creator: fields.Creator || "Unknown creator",
version: fields.Version || "Normal",
source: fields.Source || "",
tags: fields.Tags ? fields.Tags.split(/\s+/).filter(Boolean) : [],
beatmapId: Number(fields.BeatmapID) || 0,
beatmapSetId: Number(fields.BeatmapSetID) || 0,
mode: MODE_BY_NUMBER[fields.Mode ?? "0"] ?? "osu",
cs: Number(fields.CircleSize) || 0,
ar: Number(fields.ApproachRate ?? fields.OverallDifficulty) || 0,
od: Number(fields.OverallDifficulty) || 0,
hp: Number(fields.HPDrainRate) || 0,
checksum: createHash("md5").update(buffer).digest("hex"),
};
}
+54
View File
@@ -0,0 +1,54 @@
// osu!stable install-folder detection: checks the default per-user install
// path first, then falls back to the Windows uninstall registry for a
// portable/custom location.
import { exec } from "node:child_process";
import { existsSync } from "node:fs";
import { join } from "node:path";
import { promisify } from "node:util";
const execAsync = promisify(exec);
export async function detectOsuInstallDir(): Promise<string | null> {
const localAppData = process.env.LOCALAPPDATA;
if (localAppData) {
const defaultPath = join(localAppData, "osu!");
if (existsSync(join(defaultPath, "osu!.exe"))) {
return defaultPath;
}
}
return findViaUninstallRegistry();
}
async function findViaUninstallRegistry(): Promise<string | null> {
if (process.platform !== "win32") return null;
const uninstallRoot = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
try {
const { stdout } = await execAsync(`reg query "${uninstallRoot}" /s /f "osu!" /d`, {
windowsHide: true,
});
const installLocationMatch = stdout.match(/InstallLocation\s+REG_SZ\s+(.+)/i);
if (installLocationMatch) {
const path = installLocationMatch[1].trim();
if (existsSync(join(path, "osu!.exe"))) return path;
}
} catch {
/* empty */
}
return null;
}
export function isValidOsuInstallDir(dir: string): boolean {
return existsSync(join(dir, "osu!.exe")) && existsSync(join(dir, "Songs"));
}
export function songsDir(installDir: string): string {
return join(installDir, "Songs");
}
export function collectionDbPath(installDir: string): string {
return join(installDir, "collection.db");
}
+52
View File
@@ -0,0 +1,52 @@
// Reads/writes the persisted AppSettings JSON file in Electron's userData dir.
import { app } from "electron";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import type { AppSettings } from "../ipc-types.js";
export type { AppSettings };
const DEFAULT_SETTINGS: AppSettings = {
osuInstallDir: null,
theme: "dark",
reduceMotion: false,
language: "en",
proxy: { type: "none", host: "", port: "" },
searchSources: [
{
id: "catboy-best",
name: "catboy.best",
baseUrl: "https://catboy.best",
builtIn: true,
enabled: true,
},
{
id: "osu-direct",
name: "osu.direct",
baseUrl: "https://osu.direct",
builtIn: true,
enabled: true,
},
],
};
function settingsPath(): string {
return join(app.getPath("userData"), "settings.json");
}
export function loadSettings(): AppSettings {
const path = settingsPath();
if (!existsSync(path)) return structuredClone(DEFAULT_SETTINGS);
try {
const raw = JSON.parse(readFileSync(path, "utf8"));
return { ...structuredClone(DEFAULT_SETTINGS), ...raw };
} catch {
return structuredClone(DEFAULT_SETTINGS);
}
}
export function saveSettings(settings: AppSettings): void {
const path = settingsPath();
mkdirSync(dirname(path), { recursive: true });
writeFileSync(path, JSON.stringify(settings, null, 2), "utf8");
}
+56
View File
@@ -0,0 +1,56 @@
// Tries enabled beatmap sources in the user's configured order, falling
// through to the next one on failure, and throttles per-source requests so
// rapid filter changes (typing, dragging the star slider) can't hammer a
// mirror faster than a search reasonably should. Install/download always
// goes back to the specific mirror a result came from — each mirror has its
// own independent id space, so a numeric id from one can't be assumed to
// exist, let alone mean the same thing, on another.
import type { BeatmapSearchQuery, BeatmapSearchResult, BeatmapSourceConfig } from "@directify/shared";
import { MirrorSource } from "./sources/mirror-source.js";
const MIN_REQUEST_INTERVAL_MS = 350;
const lastRequestAt = new Map<string, number>();
async function throttle(sourceId: string): Promise<void> {
const last = lastRequestAt.get(sourceId) ?? 0;
const wait = last + MIN_REQUEST_INTERVAL_MS - Date.now();
if (wait > 0) await new Promise((resolve) => setTimeout(resolve, wait));
lastRequestAt.set(sourceId, Date.now());
}
function enabledInOrder(sources: BeatmapSourceConfig[]): BeatmapSourceConfig[] {
return sources.filter((s) => s.enabled);
}
export async function searchWithFallback(
sources: BeatmapSourceConfig[],
query: BeatmapSearchQuery
): Promise<BeatmapSearchResult> {
const candidates = enabledInOrder(sources);
if (candidates.length === 0) {
throw new Error("No beatmap search sources are enabled.");
}
let lastError: unknown;
for (const config of candidates) {
try {
await throttle(config.id);
return await new MirrorSource(config).search(query);
} catch (err) {
lastError = err;
}
}
throw lastError instanceof Error ? lastError : new Error("All beatmap sources failed.");
}
export async function resolveDownloadUrlForResult(
sources: BeatmapSourceConfig[],
sourceName: string,
beatmapSetId: number
): Promise<string | null> {
const config =
sources.find((s) => s.name === sourceName && s.enabled) ?? enabledInOrder(sources)[0];
if (!config) return null;
await throttle(config.id);
return new MirrorSource(config).resolveDownloadUrl(beatmapSetId);
}
@@ -0,0 +1,219 @@
// BeatmapSource for any catboy.best-compatible mirror API (the open-source
// server software several community osu! mirrors run) — search, metadata,
// and .osz download, parametrized by base URL so users can add their own
// compatible mirror alongside the built-in catboy.best entry. Verified live
// against the real catboy.best API on 2026-09-17: GET /api/search,
// GET /api/v2/s/:id, GET /d/:id. Requests go through electron.net.fetch
// (Chromium's network stack) rather than Node's fetch, which some hosts
// behind Cloudflare-style bot protection 403 outright.
import type {
Beatmap,
BeatmapSearchQuery,
BeatmapSearchResult,
BeatmapSet,
OsuMode,
RankedStatus,
} from "@directify/shared";
import { net } from "electron";
import type { BeatmapSource } from "./types.js";
const STATUS_BY_CODE: Record<number, RankedStatus> = {
[-2]: "graveyard",
[-1]: "wip",
0: "pending",
1: "ranked",
2: "approved",
3: "qualified",
4: "loved",
};
const STATUS_TO_CODE: Record<RankedStatus, number> = {
graveyard: -2,
wip: -1,
pending: 0,
ranked: 1,
approved: 2,
qualified: 3,
loved: 4,
unknown: 0,
};
const MODE_BY_NUMBER: Record<number, OsuMode> = {
0: "osu",
1: "taiko",
2: "fruits",
3: "mania",
};
interface MirrorSearchBeatmap {
BeatmapID: number;
ParentSetID: number;
DiffName: string;
Mode: number;
DifficultyRating: number;
BPM: number;
TotalLength: number;
CS: number;
AR: number;
OD: number;
HP: number;
FileMD5: string;
}
interface MirrorSearchResult {
SetID: number;
RankedStatus: number;
Artist: string;
Title: string;
Creator: string;
Tags: string;
LastUpdate: string;
Genre?: { ID: number; Name: string };
Language?: { ID: number; Name: string };
ChildrenBeatmaps: MirrorSearchBeatmap[];
}
function coverUrl(setId: number): string {
return `https://assets.ppy.sh/beatmaps/${setId}/covers/cover.jpg`;
}
function previewUrl(setId: number): string {
return `https://b.ppy.sh/preview/${setId}.mp3`;
}
export class MirrorSource implements BeatmapSource {
readonly id: string;
readonly name: string;
private readonly baseUrl: string;
constructor(config: { id: string; name: string; baseUrl: string }) {
this.id = config.id;
this.name = config.name;
this.baseUrl = config.baseUrl.replace(/\/$/, "");
}
private toBeatmapSet(raw: MirrorSearchResult): BeatmapSet {
const beatmaps: Beatmap[] = raw.ChildrenBeatmaps.map((b) => ({
id: b.BeatmapID,
beatmapsetId: b.ParentSetID,
version: b.DiffName,
mode: MODE_BY_NUMBER[b.Mode] ?? "osu",
difficultyRating: b.DifficultyRating,
bpm: b.BPM,
totalLength: b.TotalLength,
cs: b.CS,
ar: b.AR,
od: b.OD,
hp: b.HP,
checksum: b.FileMD5,
}));
return {
id: raw.SetID,
title: raw.Title,
artist: raw.Artist,
creator: raw.Creator,
status: STATUS_BY_CODE[raw.RankedStatus] ?? "unknown",
coverUrl: coverUrl(raw.SetID),
previewUrl: previewUrl(raw.SetID),
tags: raw.Tags ? raw.Tags.split(/\s+/).filter(Boolean) : [],
genre: raw.Genre?.Name,
language: raw.Language?.Name,
submittedAt: raw.LastUpdate,
updatedAt: raw.LastUpdate,
beatmaps,
source: this.name,
};
}
async search(query: BeatmapSearchQuery): Promise<BeatmapSearchResult> {
const page = query.page ?? 1;
const pageSize = query.pageSize ?? 30;
const params = new URLSearchParams();
if (query.query) params.set("query", query.query);
params.set("limit", String(pageSize));
params.set("offset", String((page - 1) * pageSize));
if (query.mode) {
const modeNumber = Object.entries(MODE_BY_NUMBER).find(([, m]) => m === query.mode)?.[0];
if (modeNumber) params.set("mode", modeNumber);
}
if (query.status) params.set("status", String(STATUS_TO_CODE[query.status]));
const res = await net.fetch(`${this.baseUrl}/api/search?${params}`);
if (!res.ok) throw new Error(`${this.name} search failed: ${res.status} ${res.statusText}`);
// Everything below is applied client-side rather than as extra query
// params: mode/status are the only fields verified across mirrors, and a
// custom user-added endpoint's exact param support is unknown — filtering
// the (documented, required) response shape after the fact works
// identically on every compatible mirror without risking a query it
// doesn't understand.
const raw = (await res.json()) as MirrorSearchResult[];
const filteredRaw = raw.filter((r) => {
if (query.genre !== undefined && r.Genre?.ID !== query.genre) return false;
if (query.language !== undefined && r.Language?.ID !== query.language) return false;
if (
query.mode === "mania" &&
query.keys !== undefined &&
!r.ChildrenBeatmaps.some((b) => b.Mode === 3 && Math.round(b.CS) === query.keys)
) {
return false;
}
return true;
});
const results = filteredRaw.map((r) => this.toBeatmapSet(r)).filter((set) => {
if (query.minStars !== undefined && !set.beatmaps.some((b) => b.difficultyRating >= query.minStars!)) {
return false;
}
if (query.maxStars !== undefined && !set.beatmaps.some((b) => b.difficultyRating <= query.maxStars!)) {
return false;
}
return true;
});
return { results, page, pageSize, total: results.length };
}
async getBeatmapSet(id: number): Promise<BeatmapSet | null> {
const res = await net.fetch(`${this.baseUrl}/api/v2/s/${id}`);
if (res.status === 404) return null;
if (!res.ok) throw new Error(`${this.name} lookup failed: ${res.status} ${res.statusText}`);
const raw = (await res.json()) as any;
const beatmaps: Beatmap[] = (raw.beatmaps ?? []).map((b: any) => ({
id: b.id,
beatmapsetId: id,
version: b.version,
mode: (b.mode as OsuMode) ?? "osu",
difficultyRating: b.difficulty_rating ?? 0,
bpm: b.bpm ?? 0,
totalLength: b.total_length ?? 0,
cs: b.cs ?? 0,
ar: b.ar ?? 0,
od: b.accuracy ?? 0,
hp: b.drain ?? 0,
checksum: b.checksum ?? "",
}));
return {
id,
title: raw.title,
artist: raw.artist,
creator: raw.creator,
status: (raw.status as RankedStatus) ?? "unknown",
coverUrl: raw.covers?.cover ?? coverUrl(id),
previewUrl: previewUrl(id),
tags: raw.tags ? String(raw.tags).split(/\s+/).filter(Boolean) : [],
submittedAt: raw.ranked_date ?? "",
updatedAt: raw.last_updated ?? "",
beatmaps,
source: this.name,
};
}
async resolveDownloadUrl(beatmapSetId: number): Promise<string | null> {
return `${this.baseUrl}/d/${beatmapSetId}`;
}
}
+15
View File
@@ -0,0 +1,15 @@
import type { BeatmapSearchQuery, BeatmapSearchResult, BeatmapSet } from "@directify/shared";
/**
* A source adapter resolves beatmap metadata and download links from one
* upstream provider (an existing public osu! mirror), called directly from
* the Electron main process. directify never stores or serves .osz files
* itself — `resolveDownloadUrl` returns the upstream's own URL, which the
* main process downloads straight into the user's Songs folder.
*/
export interface BeatmapSource {
readonly name: string;
search(query: BeatmapSearchQuery): Promise<BeatmapSearchResult>;
getBeatmapSet(id: number): Promise<BeatmapSet | null>;
resolveDownloadUrl(beatmapSetId: number): Promise<string | null>;
}
+46
View File
@@ -0,0 +1,46 @@
// Checks GitHub Releases for a newer portable build than the one currently
// running. directify ships as a single portable .exe with no installer or
// auto-updater — settings/library cache live in %APPDATA%, so "updating" is
// just swapping the .exe for a newer one — this only tells the user one exists.
import { net } from "electron";
const REPO = "pvrzz/directify";
export interface UpdateCheckResult {
hasUpdate: boolean;
currentVersion: string;
latestVersion?: string;
releaseUrl?: string;
}
function compareVersions(a: string, b: string): number {
const pa = a.split(".").map((n) => Number(n) || 0);
const pb = b.split(".").map((n) => Number(n) || 0);
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
if (diff !== 0) return diff;
}
return 0;
}
export async function checkForUpdate(currentVersion: string): Promise<UpdateCheckResult> {
try {
const res = await net.fetch(`https://api.github.com/repos/${REPO}/releases/latest`, {
headers: { Accept: "application/vnd.github+json" },
});
if (!res.ok) return { hasUpdate: false, currentVersion };
const data = (await res.json()) as { tag_name?: string; html_url?: string };
const latestVersion = (data.tag_name ?? "").replace(/^v/, "");
if (!latestVersion) return { hasUpdate: false, currentVersion };
return {
hasUpdate: compareVersions(latestVersion, currentVersion) > 0,
currentVersion,
latestVersion,
releaseUrl: data.html_url ?? `https://github.com/${REPO}/releases`,
};
} catch {
return { hasUpdate: false, currentVersion };
}
}
+31
View File
@@ -0,0 +1,31 @@
import { contextBridge, ipcRenderer } from "electron";
import type { DirectifyIpcApi } from "../ipc-types.js";
const api: DirectifyIpcApi = {
getSettings: () => ipcRenderer.invoke("settings:get"),
saveSettings: (settings) => ipcRenderer.invoke("settings:save", settings),
detectOsuInstall: () => ipcRenderer.invoke("osu:detectInstall"),
pickOsuInstallDir: () => ipcRenderer.invoke("osu:pickInstallDir"),
listInstalledBeatmapFolders: () => ipcRenderer.invoke("library:listFolders"),
scanLibrary: () => ipcRenderer.invoke("library:scan"),
deleteBeatmapSet: (folderName) => ipcRenderer.invoke("library:delete", folderName),
pickBackupDestination: () => ipcRenderer.invoke("backup:pickDestination"),
backupLibrary: (destZipPath, folderNames) =>
ipcRenderer.invoke("backup:create", destZipPath, folderNames),
pickBackupToRestore: () => ipcRenderer.invoke("backup:pickToRestore"),
restoreBackup: (zipPath) => ipcRenderer.invoke("backup:restore", zipPath),
searchBeatmaps: (query) => ipcRenderer.invoke("beatmaps:search", query),
installBeatmapSet: (set) => ipcRenderer.invoke("beatmaps:install", set),
readCollections: () => ipcRenderer.invoke("collections:read"),
writeCollections: (db) => ipcRenderer.invoke("collections:write", db),
checkForUpdate: () => ipcRenderer.invoke("app:checkForUpdate"),
openExternal: (url) => ipcRenderer.invoke("app:openExternal", url),
};
contextBridge.exposeInMainWorld("directify", api);
+15
View File
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' https: data:; connect-src 'self' https:;"
/>
<title>directify</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="./src/main.tsx"></script>
</body>
</html>
+206
View File
@@ -0,0 +1,206 @@
// App shell: sidebar nav + routed pages. Applies the current theme, reduced-motion, and language settings to the document root.
import { Icon } from "@directify/ui";
import { motion, MotionConfig } from "framer-motion";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { NavLink, Route, Routes, useLocation, useNavigate } from "react-router-dom";
import wordmark from "./assets/brand/wordmark.png";
import { BackupPage } from "./pages/BackupPage";
import { CollectionsPage } from "./pages/CollectionsPage";
import { LibraryPage } from "./pages/LibraryPage";
import { SearchPage } from "./pages/SearchPage";
import { SettingsPage } from "./pages/SettingsPage";
import { useSettings } from "./settings-context";
import { ShortcutsHelp } from "./ShortcutsHelp";
import { UpdateBanner } from "./UpdateBanner";
import type { UpdateCheckResult } from "../../main/updates";
const SHORTCUT_ROUTES = ["/", "/search", "/collections", "/backup", "/settings"];
export function App() {
const { settings } = useSettings();
const { t, i18n } = useTranslation();
const location = useLocation();
const navigate = useNavigate();
const [showShortcuts, setShowShortcuts] = useState(false);
const [updateInfo, setUpdateInfo] = useState<UpdateCheckResult | null>(null);
useEffect(() => {
window.directify.checkForUpdate().then(setUpdateInfo);
}, []);
useEffect(() => {
function onKeyDown(e: KeyboardEvent) {
const target = e.target as HTMLElement;
const typing = ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName);
if (e.key === "Escape") {
setShowShortcuts(false);
return;
}
if (typing) return;
if (e.key === "?") {
e.preventDefault();
setShowShortcuts((v) => !v);
} else if (e.altKey && /^[1-5]$/.test(e.key)) {
e.preventDefault();
navigate(SHORTCUT_ROUTES[Number(e.key) - 1]);
} else if (e.key === "/") {
e.preventDefault();
document.getElementById("primary-search-input")?.focus();
}
}
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, [navigate]);
useEffect(() => {
if (!settings) return;
const root = document.documentElement;
if (settings.theme === "system") {
const media = window.matchMedia("(prefers-color-scheme: dark)");
const apply = () => (root.dataset.theme = media.matches ? "dark" : "light");
apply();
media.addEventListener("change", apply);
return () => media.removeEventListener("change", apply);
}
root.dataset.theme = settings.theme;
}, [settings?.theme]);
useEffect(() => {
if (!settings) return;
document.documentElement.dataset.reduceMotion = String(settings.reduceMotion);
}, [settings?.reduceMotion]);
useEffect(() => {
if (settings?.language) i18n.changeLanguage(settings.language);
}, [settings?.language, i18n]);
const navItems = [
{ to: "/", label: t("nav.library"), icon: "disc-3", end: true },
{ to: "/search", label: t("nav.findMaps"), icon: "search" },
{ to: "/collections", label: t("nav.collections"), icon: "star" },
{ to: "/backup", label: t("nav.backup"), icon: "archive" },
{ to: "/settings", label: t("nav.settings"), icon: "settings" },
];
return (
<MotionConfig reducedMotion={settings?.reduceMotion ? "always" : "user"}>
<div style={{ display: "flex", flexDirection: "column", height: "100vh", overflow: "hidden" }}>
{updateInfo?.hasUpdate && updateInfo.latestVersion && updateInfo.releaseUrl && (
<UpdateBanner
latestVersion={updateInfo.latestVersion}
releaseUrl={updateInfo.releaseUrl}
onDismiss={() => setUpdateInfo(null)}
/>
)}
<div style={{ display: "flex", flex: 1, overflow: "hidden" }}>
<nav
aria-label="Primary"
style={{
width: 220,
padding: "24px 12px",
borderRight: "1px solid var(--df-border)",
background: "var(--df-glass-bg)",
backdropFilter: "var(--df-glass-blur)",
boxShadow: "var(--df-shadow-lg)",
position: "relative",
zIndex: 1,
display: "flex",
flexDirection: "column",
gap: 2,
}}
>
<motion.img
src={wordmark}
alt="directify"
initial={{ opacity: 0, y: -8 }}
animate={{ opacity: 1, y: 0 }}
style={{
height: 22,
width: "auto",
alignSelf: "flex-start",
objectFit: "contain",
margin: "0 0 24px",
padding: "0 12px",
display: "block",
}}
/>
{navItems.map((item) => (
<NavLink
key={item.to}
to={item.to}
end={item.end}
style={({ isActive }) => ({
display: "flex",
alignItems: "center",
gap: 10,
padding: "9px 12px",
borderRadius: "var(--df-radius-sm)",
textDecoration: "none",
color: isActive ? "var(--df-text)" : "var(--df-text-muted)",
background: isActive ? "var(--df-surface-2)" : "transparent",
boxShadow: isActive ? "var(--df-shadow-sm)" : "none",
borderLeft: `2px solid ${isActive ? "var(--df-pink)" : "transparent"}`,
fontWeight: 600,
fontSize: 14,
transition:
"background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease",
})}
>
{({ isActive }) => (
<>
<Icon name={item.icon} tone={isActive ? "pink" : "muted"} size={16} />
{item.label}
</>
)}
</NavLink>
))}
<button
onClick={() => setShowShortcuts(true)}
style={{
marginTop: "auto",
background: "none",
border: "none",
color: "var(--df-text-muted)",
fontSize: 12,
cursor: "pointer",
textAlign: "left",
padding: "9px 12px",
}}
>
{t("shortcuts.title")} <kbd style={{ fontFamily: "inherit" }}>?</kbd>
</button>
</nav>
<main style={{ flex: 1, overflow: "auto", padding: 32 }}>
{/* Remount-on-key-change enter transition rather than
AnimatePresence — AnimatePresence's exit-then-enter sequencing
can permanently stall (confirmed: navigation got stuck showing
the previous page) when combined with React 18 StrictMode's
double-invoked effects. A plain remount always completes. */}
<motion.div
key={location.pathname}
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.18, ease: "easeOut" }}
>
<Routes location={location}>
<Route path="/" element={<LibraryPage />} />
<Route path="/search" element={<SearchPage />} />
<Route path="/backup" element={<BackupPage />} />
<Route path="/collections" element={<CollectionsPage />} />
<Route path="/settings" element={<SettingsPage />} />
</Routes>
</motion.div>
</main>
</div>
</div>
{showShortcuts && <ShortcutsHelp onClose={() => setShowShortcuts(false)} />}
</MotionConfig>
);
}
@@ -0,0 +1,72 @@
// Keyboard-shortcuts cheat sheet, opened with "?".
import { motion } from "framer-motion";
import { useTranslation } from "react-i18next";
export function ShortcutsHelp({ onClose }: { onClose: () => void }) {
const { t } = useTranslation();
const rows: [string, string][] = [
["Alt+1 … Alt+5", t("shortcuts.jumpToTab")],
["/", t("shortcuts.focusSearch")],
["Enter", t("shortcuts.activateSelection")],
["Esc", t("shortcuts.closeOrDeselect")],
["?", t("shortcuts.toggleHelp")],
];
return (
<div
role="dialog"
aria-modal="true"
aria-label={t("shortcuts.title")}
onClick={onClose}
style={{
position: "fixed",
inset: 0,
background: "rgba(0,0,0,0.5)",
display: "flex",
alignItems: "center",
justifyContent: "center",
zIndex: 100,
}}
>
<motion.div
initial={{ opacity: 0, scale: 0.96 }}
animate={{ opacity: 1, scale: 1 }}
onClick={(e) => e.stopPropagation()}
style={{
background: "var(--df-surface-1)",
border: "1px solid var(--df-border)",
borderRadius: "var(--df-radius-lg)",
boxShadow: "var(--df-shadow-lg)",
padding: 28,
width: 360,
}}
>
<h2 style={{ margin: "0 0 16px", fontSize: 18 }}>{t("shortcuts.title")}</h2>
<div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
{rows.map(([keys, desc]) => (
<div
key={keys}
style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}
>
<span style={{ fontSize: 13, color: "var(--df-text-muted)" }}>{desc}</span>
<kbd
style={{
fontFamily: "inherit",
fontSize: 12,
fontWeight: 600,
padding: "4px 8px",
borderRadius: "var(--df-radius-sm)",
background: "var(--df-surface-2)",
border: "1px solid var(--df-border)",
}}
>
{keys}
</kbd>
</div>
))}
</div>
</motion.div>
</div>
);
}
@@ -0,0 +1,59 @@
// Dismissible banner shown when a newer GitHub release exists than the running build.
import { Button } from "@directify/ui";
import { motion } from "framer-motion";
import { useTranslation } from "react-i18next";
export function UpdateBanner({
latestVersion,
releaseUrl,
onDismiss,
}: {
latestVersion: string;
releaseUrl: string;
onDismiss: () => void;
}) {
const { t } = useTranslation();
return (
<motion.div
initial={{ opacity: 0, y: -12 }}
animate={{ opacity: 1, y: 0 }}
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
gap: 12,
padding: "10px 20px",
background: "var(--df-blue)",
color: "var(--df-on-fill)",
fontSize: 13,
fontWeight: 600,
}}
>
<span>{t("update.available", { version: latestVersion })}</span>
<div style={{ display: "flex", gap: 8, alignItems: "center" }}>
<Button
variant="secondary"
style={{ padding: "6px 14px", fontSize: 12 }}
onClick={() => window.directify.openExternal(releaseUrl)}
>
{t("update.download")}
</Button>
<button
onClick={onDismiss}
aria-label={t("update.dismiss")}
style={{
background: "none",
border: "none",
color: "var(--df-on-fill)",
fontSize: 16,
cursor: "pointer",
lineHeight: 1,
}}
>
×
</button>
</div>
</motion.div>
);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#171A1C" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="20" height="5" x="2" y="3" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8m-10 4h4"/></g></svg>

After

Width:  |  Height:  |  Size: 297 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#171A1C" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M6 12c0-1.7.7-3.2 1.8-4.2"/><circle cx="12" cy="12" r="2"/><path d="M18 12c0 1.7-.7 3.2-1.8 4.2"/></g></svg>

After

Width:  |  Height:  |  Size: 328 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#171A1C" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10l5 5l5-5"/></g></svg>

After

Width:  |  Height:  |  Size: 274 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#171A1C" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m21 21l-4.34-4.34"/><circle cx="11" cy="11" r="8"/></g></svg>

After

Width:  |  Height:  |  Size: 249 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#171A1C" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></g></svg>

After

Width:  |  Height:  |  Size: 559 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#171A1C" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 5H3m9 14H3M14 3v4m2 10v4m5-9h-9m9 7h-5m5-14h-7m-6 5v4m0-2H3"/></svg>

After

Width:  |  Height:  |  Size: 257 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#171A1C" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z"/></svg>

After

Width:  |  Height:  |  Size: 548 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#F4F2F7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="20" height="5" x="2" y="3" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8m-10 4h4"/></g></svg>

After

Width:  |  Height:  |  Size: 297 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#F4F2F7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M6 12c0-1.7.7-3.2 1.8-4.2"/><circle cx="12" cy="12" r="2"/><path d="M18 12c0 1.7-.7 3.2-1.8 4.2"/></g></svg>

After

Width:  |  Height:  |  Size: 328 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#F4F2F7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10l5 5l5-5"/></g></svg>

After

Width:  |  Height:  |  Size: 274 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#F4F2F7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m21 21l-4.34-4.34"/><circle cx="11" cy="11" r="8"/></g></svg>

After

Width:  |  Height:  |  Size: 249 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#F4F2F7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></g></svg>

After

Width:  |  Height:  |  Size: 559 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#F4F2F7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z"/></svg>

After

Width:  |  Height:  |  Size: 548 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="20" height="5" x="2" y="3" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8m-10 4h4"/></g></svg>

After

Width:  |  Height:  |  Size: 297 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M6 12c0-1.7.7-3.2 1.8-4.2"/><circle cx="12" cy="12" r="2"/><path d="M18 12c0 1.7-.7 3.2-1.8 4.2"/></g></svg>

After

Width:  |  Height:  |  Size: 328 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10l5 5l5-5"/></g></svg>

After

Width:  |  Height:  |  Size: 274 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m6 14l1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/></svg>

After

Width:  |  Height:  |  Size: 371 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M3 12a9 9 0 0 1 9-9a9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5m5 4a9 9 0 0 1-9 9a9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></g></svg>

After

Width:  |  Height:  |  Size: 343 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m21 21l-4.34-4.34"/><circle cx="11" cy="11" r="8"/></g></svg>

After

Width:  |  Height:  |  Size: 249 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></g></svg>

After

Width:  |  Height:  |  Size: 559 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 5H3m9 14H3M14 3v4m2 10v4m5-9h-9m9 7h-5m5-14h-7m-6 5v4m0-2H3"/></svg>

After

Width:  |  Height:  |  Size: 257 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z"/></svg>

After

Width:  |  Height:  |  Size: 548 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#9CA3A8" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>

After

Width:  |  Height:  |  Size: 293 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#FF66AB" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="20" height="5" x="2" y="3" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8m-10 4h4"/></g></svg>

After

Width:  |  Height:  |  Size: 297 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#FF66AB" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M6 12c0-1.7.7-3.2 1.8-4.2"/><circle cx="12" cy="12" r="2"/><path d="M18 12c0 1.7-.7 3.2-1.8 4.2"/></g></svg>

After

Width:  |  Height:  |  Size: 328 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#FF66AB" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10l5 5l5-5"/></g></svg>

After

Width:  |  Height:  |  Size: 274 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#FF66AB" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m21 21l-4.34-4.34"/><circle cx="11" cy="11" r="8"/></g></svg>

After

Width:  |  Height:  |  Size: 249 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#FF66AB" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></g></svg>

After

Width:  |  Height:  |  Size: 559 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="#FF66AB" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z"/></svg>

After

Width:  |  Height:  |  Size: 548 B

+9
View File
@@ -0,0 +1,9 @@
import type { DirectifyIpcApi } from "../../ipc-types";
declare global {
interface Window {
directify: DirectifyIpcApi;
}
}
export {};
+27
View File
@@ -0,0 +1,27 @@
// i18next setup. Only en/es/ja ship with real translations today; every
// other language falls back to English — the framework (and this file) is
// what lets community contributors add more without touching app code.
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import en from "./locales/en.json";
import es from "./locales/es.json";
import ja from "./locales/ja.json";
export const SUPPORTED_LANGUAGES = [
{ code: "en", label: "English" },
{ code: "es", label: "Español" },
{ code: "ja", label: "日本語" },
];
i18n.use(initReactI18next).init({
resources: {
en: { translation: en },
es: { translation: es },
ja: { translation: ja },
},
lng: "en",
fallbackLng: "en",
interpolation: { escapeValue: false },
});
export default i18n;
+28
View File
@@ -0,0 +1,28 @@
import type { IconTone } from "@directify/ui";
// Eagerly imported as real module assets (not `public/`) so Vite emits each
// SVG as a hashed file and rewrites every reference to a path relative to
// the built index.html. That's what makes icons work under Electron's
// `file://` window — a hardcoded root-absolute string like "/icons/x.svg"
// resolves against the filesystem drive root there, not the app folder.
const modules = import.meta.glob("./assets/icons/*/*.svg", {
eager: true,
query: "?url",
import: "default",
}) as Record<string, string>;
const iconUrls = new Map<string, string>();
for (const [path, url] of Object.entries(modules)) {
const match = path.match(/assets\/icons\/([^/]+)\/([^/]+)\.svg$/);
if (match) iconUrls.set(`${match[1]}/${match[2]}`, url);
}
export function resolveDesktopIcon(name: string, tone: IconTone): string {
const key = `${tone}/${name}`;
const url = iconUrls.get(key);
if (!url) {
console.warn(`[directify] No bundled icon for "${key}" — check the name/tone are fetched.`);
return "";
}
return url;
}
@@ -0,0 +1,102 @@
{
"nav": {
"library": "Library",
"findMaps": "Find maps",
"collections": "Collections",
"backup": "Backup",
"settings": "Settings"
},
"common": {
"search": "Search",
"install": "Install",
"installing": "Installing...",
"rescan": "Rescan",
"add": "Add",
"remove": "Remove",
"delete": "Delete",
"loading": "Loading..."
},
"library": {
"title": "Library",
"filterPlaceholder": "Filter your library...",
"scanning": "Scanning your Songs folder...",
"foundCount": "{{count}} beatmapsets found.",
"emptyNoMaps": "No beatmaps found in your Songs folder yet — install some from Find maps.",
"emptyNoMatch": "No maps match that filter.",
"selectedCount": "{{count}} selected",
"collectionNamePlaceholder": "Collection name...",
"addToCollection": "Add to collection",
"difficulty_one": "{{count}} difficulty",
"difficulty_other": "{{count}} difficulties"
},
"search": {
"placeholder": "Search beatmaps...",
"emptyPrompt": "Search for a title, artist, or mapper to get started.",
"resultCount": "{{count}} results",
"genre": "Genre",
"language": "Language",
"any": "Any",
"starRating": "Star rating"
},
"collections": {
"title": "Collections",
"description": "Reads and writes your osu!stable collection.db directly — changes here show up in-game the next time you restart osu!.",
"newNamePlaceholder": "New collection name",
"emptyState": "No collections yet — add one above, or select maps in your Library and add them there.",
"maps_one": "{{count}} map",
"maps_other": "{{count}} maps"
},
"backup": {
"title": "Backup & Restore",
"restoreFromZip": "Restore from zip...",
"backupEverything": "Backup everything",
"backupSelected": "Backup {{count}} selected",
"description": "{{count}} beatmapsets found. Click cards to select a subset, or leave nothing selected to back up everything."
},
"settings": {
"title": "Settings",
"osuFolder": "osu!stable install folder",
"notConfigured": "Not configured",
"autoDetect": "Auto-detect",
"chooseFolder": "Choose folder...",
"appearance": "Appearance",
"appearanceDesc": "Theme, motion, and language for the whole app.",
"networkDesc": "Route directify's traffic through a proxy if you need one.",
"theme": "Theme",
"themeDark": "Dark",
"themeLight": "Light",
"themeSystem": "System",
"reduceMotion": "Reduce motion",
"reduceMotionHint": "Turns off hover lifts, tab-switch fades, and other animation.",
"language": "Language",
"network": "Network",
"proxy": "Proxy",
"proxyType": "Proxy type",
"proxyTypeNone": "None",
"proxyHost": "Host",
"proxyPort": "Port",
"sources": "Beatmap search sources",
"sourcesHint": "Tried top to bottom — if one fails, the next enabled source is used automatically. Drag the order to your preference, or disable one instead of removing it.",
"sourceFormatHint": "A source must be a catboy.best-compatible mirror exposing: GET {{baseUrl}}/api/search, GET {{baseUrl}}/api/v2/s/:id, and GET {{baseUrl}}/d/:id",
"addSource": "Add source",
"sourceNamePlaceholder": "Name",
"sourceUrlPlaceholder": "https://your-mirror.example",
"builtIn": "Built-in",
"enabled": "Enabled",
"moveUp": "Move up",
"moveDown": "Move down"
},
"update": {
"available": "directify {{version}} is available.",
"download": "Download",
"dismiss": "Dismiss"
},
"shortcuts": {
"title": "Keyboard shortcuts",
"jumpToTab": "Jump to a tab",
"focusSearch": "Focus search / filter",
"activateSelection": "Activate the focused item",
"closeOrDeselect": "Close dialog / clear selection",
"toggleHelp": "Toggle this help"
}
}
@@ -0,0 +1,102 @@
{
"nav": {
"library": "Biblioteca",
"findMaps": "Buscar mapas",
"collections": "Colecciones",
"backup": "Copia de seguridad",
"settings": "Configuración"
},
"common": {
"search": "Buscar",
"install": "Instalar",
"installing": "Instalando...",
"rescan": "Volver a escanear",
"add": "Añadir",
"remove": "Quitar",
"delete": "Eliminar",
"loading": "Cargando..."
},
"library": {
"title": "Biblioteca",
"filterPlaceholder": "Filtrar tu biblioteca...",
"scanning": "Escaneando tu carpeta Songs...",
"foundCount": "{{count}} beatmapsets encontrados.",
"emptyNoMaps": "Aún no hay mapas en tu carpeta Songs — instala algunos desde Buscar mapas.",
"emptyNoMatch": "Ningún mapa coincide con ese filtro.",
"selectedCount": "{{count}} seleccionados",
"collectionNamePlaceholder": "Nombre de la colección...",
"addToCollection": "Añadir a colección",
"difficulty_one": "{{count}} dificultad",
"difficulty_other": "{{count}} dificultades"
},
"search": {
"placeholder": "Buscar beatmaps...",
"emptyPrompt": "Busca un título, artista o mapper para empezar.",
"resultCount": "{{count}} resultados",
"genre": "Género",
"language": "Idioma",
"any": "Cualquiera",
"starRating": "Dificultad (estrellas)"
},
"collections": {
"title": "Colecciones",
"description": "Lee y escribe directamente tu collection.db de osu!stable — los cambios aquí aparecen en el juego la próxima vez que reinicies osu!.",
"newNamePlaceholder": "Nombre de nueva colección",
"emptyState": "Todavía no hay colecciones — añade una arriba, o selecciona mapas en tu Biblioteca y añádelos ahí.",
"maps_one": "{{count}} mapa",
"maps_other": "{{count}} mapas"
},
"backup": {
"title": "Copia de seguridad y restauración",
"restoreFromZip": "Restaurar desde zip...",
"backupEverything": "Respaldar todo",
"backupSelected": "Respaldar {{count}} seleccionados",
"description": "{{count}} beatmapsets encontrados. Haz clic en las tarjetas para elegir un subconjunto, o no selecciones nada para respaldarlo todo."
},
"settings": {
"title": "Configuración",
"osuFolder": "Carpeta de instalación de osu!stable",
"notConfigured": "Sin configurar",
"autoDetect": "Detectar automáticamente",
"chooseFolder": "Elegir carpeta...",
"appearance": "Apariencia",
"appearanceDesc": "Tema, movimiento e idioma para toda la aplicación.",
"networkDesc": "Enruta el tráfico de directify a través de un proxy si lo necesitas.",
"theme": "Tema",
"themeDark": "Oscuro",
"themeLight": "Claro",
"themeSystem": "Sistema",
"reduceMotion": "Reducir movimiento",
"reduceMotionHint": "Desactiva los efectos de hover, transiciones de pestañas y otras animaciones.",
"language": "Idioma",
"network": "Red",
"proxy": "Proxy",
"proxyType": "Tipo de proxy",
"proxyTypeNone": "Ninguno",
"proxyHost": "Host",
"proxyPort": "Puerto",
"sources": "Fuentes de búsqueda de beatmaps",
"sourcesHint": "Se prueban de arriba a abajo — si una falla, se usa automáticamente la siguiente habilitada. Ordénalas a tu gusto, o desactiva una en vez de eliminarla.",
"sourceFormatHint": "Debe ser un mirror compatible con catboy.best que exponga: GET {{baseUrl}}/api/search, GET {{baseUrl}}/api/v2/s/:id y GET {{baseUrl}}/d/:id",
"addSource": "Añadir fuente",
"sourceNamePlaceholder": "Nombre",
"sourceUrlPlaceholder": "https://tu-mirror.example",
"builtIn": "Integrado",
"enabled": "Habilitado",
"moveUp": "Subir",
"moveDown": "Bajar"
},
"update": {
"available": "directify {{version}} está disponible.",
"download": "Descargar",
"dismiss": "Descartar"
},
"shortcuts": {
"title": "Atajos de teclado",
"jumpToTab": "Saltar a una pestaña",
"focusSearch": "Enfocar búsqueda / filtro",
"activateSelection": "Activar el elemento enfocado",
"closeOrDeselect": "Cerrar diálogo / deseleccionar",
"toggleHelp": "Mostrar/ocultar esta ayuda"
}
}
@@ -0,0 +1,100 @@
{
"nav": {
"library": "ライブラリ",
"findMaps": "譜面を探す",
"collections": "コレクション",
"backup": "バックアップ",
"settings": "設定"
},
"common": {
"search": "検索",
"install": "インストール",
"installing": "インストール中...",
"rescan": "再スキャン",
"add": "追加",
"remove": "削除",
"delete": "削除",
"loading": "読み込み中..."
},
"library": {
"title": "ライブラリ",
"filterPlaceholder": "ライブラリを絞り込む...",
"scanning": "Songsフォルダをスキャンしています...",
"foundCount": "{{count}} 件の譜面セットが見つかりました。",
"emptyNoMaps": "Songsフォルダにまだ譜面がありません — 「譜面を探す」からインストールしてください。",
"emptyNoMatch": "条件に一致する譜面がありません。",
"selectedCount": "{{count}} 件選択中",
"collectionNamePlaceholder": "コレクション名...",
"addToCollection": "コレクションに追加",
"difficulty_other": "難易度 {{count}} 個"
},
"search": {
"placeholder": "譜面を検索...",
"emptyPrompt": "タイトル、アーティスト、譜面制作者で検索してください。",
"resultCount": "{{count}} 件の結果",
"genre": "ジャンル",
"language": "言語",
"any": "指定なし",
"starRating": "スター難易度"
},
"collections": {
"title": "コレクション",
"description": "osu!stableのcollection.dbを直接読み書きします — ここでの変更はosu!を再起動すると反映されます。",
"newNamePlaceholder": "新しいコレクション名",
"emptyState": "まだコレクションがありません — 上で追加するか、ライブラリで譜面を選んで追加してください。",
"maps_other": "譜面 {{count}} 件"
},
"backup": {
"title": "バックアップと復元",
"restoreFromZip": "zipから復元...",
"backupEverything": "すべてバックアップ",
"backupSelected": "{{count}} 件をバックアップ",
"description": "{{count}} 件の譜面セットが見つかりました。カードをクリックして一部を選択するか、何も選択せずにすべてをバックアップしてください。"
},
"settings": {
"title": "設定",
"osuFolder": "osu!stable インストールフォルダ",
"notConfigured": "未設定",
"autoDetect": "自動検出",
"chooseFolder": "フォルダを選択...",
"appearance": "外観",
"appearanceDesc": "アプリ全体のテーマ、アニメーション、言語。",
"networkDesc": "必要に応じてdirectifyの通信をプロキシ経由にします。",
"theme": "テーマ",
"themeDark": "ダーク",
"themeLight": "ライト",
"themeSystem": "システム",
"reduceMotion": "アニメーションを減らす",
"reduceMotionHint": "ホバー効果やタブ切り替えのアニメーションなどをオフにします。",
"language": "言語",
"network": "ネットワーク",
"proxy": "プロキシ",
"proxyType": "プロキシの種類",
"proxyTypeNone": "なし",
"proxyHost": "ホスト",
"proxyPort": "ポート",
"sources": "譜面検索ソース",
"sourcesHint": "上から順に試され、失敗すると次の有効なソースが自動的に使われます。順序は好みに並べ替えられ、削除する代わりに無効化もできます。",
"sourceFormatHint": "catboy.best互換ミラーである必要があります: GET {{baseUrl}}/api/search, GET {{baseUrl}}/api/v2/s/:id, GET {{baseUrl}}/d/:id",
"addSource": "ソースを追加",
"sourceNamePlaceholder": "名前",
"sourceUrlPlaceholder": "https://your-mirror.example",
"builtIn": "組み込み",
"enabled": "有効",
"moveUp": "上へ",
"moveDown": "下へ"
},
"update": {
"available": "directify {{version}} が利用可能です。",
"download": "ダウンロード",
"dismiss": "閉じる"
},
"shortcuts": {
"title": "キーボードショートカット",
"jumpToTab": "タブに移動",
"focusSearch": "検索・フィルターにフォーカス",
"activateSelection": "フォーカス中の項目を実行",
"closeOrDeselect": "ダイアログを閉じる/選択解除",
"toggleHelp": "このヘルプの表示切替"
}
}
+29
View File
@@ -0,0 +1,29 @@
// Renderer entry point: fonts, i18n, providers, and the router root.
import "@fontsource/roboto/400.css";
import "@fontsource/roboto/500.css";
import "@fontsource/roboto/700.css";
import "@fontsource/roboto/900.css";
import { IconProvider } from "@directify/ui";
import "@directify/ui";
import React from "react";
import ReactDOM from "react-dom/client";
import { HashRouter } from "react-router-dom";
import { App } from "./App";
import "./i18n";
import { resolveDesktopIcon } from "./icon-map";
import { installMockDirectifyIfNeeded } from "./mock-directify";
import { SettingsProvider } from "./settings-context";
installMockDirectifyIfNeeded();
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<IconProvider resolve={resolveDesktopIcon}>
<SettingsProvider>
<HashRouter>
<App />
</HashRouter>
</SettingsProvider>
</IconProvider>
</React.StrictMode>
);
@@ -0,0 +1,202 @@
// Stand-in for the real window.directify IPC bridge, used only when the
// renderer is opened directly in a browser (outside Electron) for a quick
// visual preview. The real preload script always installs the genuine API
// before app code runs, so this never activates inside the actual app.
import type { BeatmapSet, CollectionDatabase } from "@directify/shared";
import type { AppSettings, DirectifyIpcApi } from "../../ipc-types";
export function installMockDirectifyIfNeeded(): void {
if (typeof window === "undefined" || window.directify) return;
let settings: AppSettings = {
osuInstallDir: "C:\\Users\\preview\\AppData\\Local\\osu!",
theme: "dark",
reduceMotion: false,
language: "en",
proxy: { type: "none", host: "", port: "" },
searchSources: [
{
id: "catboy-best",
name: "catboy.best",
baseUrl: "https://catboy.best",
builtIn: true,
enabled: true,
},
{
id: "osu-direct",
name: "osu.direct",
baseUrl: "https://osu.direct",
builtIn: true,
enabled: true,
},
],
};
let collections: CollectionDatabase = {
version: 20240101,
collections: [
{ name: "Favorites", beatmapChecksums: ["a".repeat(32), "b".repeat(32)] },
{ name: "Farm maps", beatmapChecksums: ["c".repeat(32)] },
],
};
let installedSets: BeatmapSet[] = [
{
id: 1,
title: "sample beatmapset",
artist: "Sample Artist",
creator: "sample_mapper",
status: "unknown",
tags: ["sample"],
submittedAt: "",
updatedAt: "",
source: "local",
folderName: "1 Sample Artist - sample beatmapset",
beatmaps: [
{
id: 1,
beatmapsetId: 1,
version: "Normal",
mode: "osu",
difficultyRating: 0,
bpm: 0,
totalLength: 0,
cs: 3,
ar: 7,
od: 6,
hp: 5,
checksum: "a".repeat(32),
},
],
},
{
id: 2,
title: "another set",
artist: "Another Artist",
creator: "another_mapper",
status: "unknown",
tags: [],
submittedAt: "",
updatedAt: "",
source: "local",
folderName: "2 Another Artist - another set",
beatmaps: [
{
id: 2,
beatmapsetId: 2,
version: "Hard",
mode: "osu",
difficultyRating: 0,
bpm: 0,
totalLength: 0,
cs: 4,
ar: 8,
od: 7,
hp: 5,
checksum: "b".repeat(32),
},
],
},
{
id: 3,
title: "PANDORA PALLADIUM",
artist: "Camellia",
creator: "preview_mapper",
status: "unknown",
tags: ["speedcore"],
submittedAt: "",
updatedAt: "",
source: "local",
folderName: "3 Camellia - PANDORA PALLADIUM",
beatmaps: [
{
id: 3,
beatmapsetId: 3,
version: "Wildberry Everything",
mode: "osu",
difficultyRating: 0,
bpm: 0,
totalLength: 0,
cs: 4,
ar: 9.8,
od: 9,
hp: 6,
checksum: "c".repeat(32),
},
],
},
];
const mock: DirectifyIpcApi = {
getSettings: async () => settings,
saveSettings: async (next) => {
settings = next;
},
detectOsuInstall: async () => "C:\\Users\\preview\\AppData\\Local\\osu!",
pickOsuInstallDir: async () => "C:\\Users\\preview\\AppData\\Local\\osu!",
listInstalledBeatmapFolders: async () => installedSets.map((s) => s.folderName!),
scanLibrary: async () => installedSets,
deleteBeatmapSet: async (folderName) => {
installedSets = installedSets.filter((s) => s.folderName !== folderName);
},
pickBackupDestination: async () => "C:\\Users\\preview\\Desktop\\directify-backup.zip",
backupLibrary: async (_dest, folderNames) => ({
createdAt: new Date().toISOString(),
osuInstallDir: "C:\\Users\\preview\\AppData\\Local\\osu!",
beatmapFolders: folderNames ?? ["1 Sample Artist - sample beatmapset"],
}),
pickBackupToRestore: async () => "C:\\Users\\preview\\Desktop\\directify-backup.zip",
restoreBackup: async () => {},
searchBeatmaps: async (query) => ({
results: [
{
id: 2234472,
title: "White Peak",
artist: "xi",
creator: "Shurelia",
status: "ranked" as const,
coverUrl: "https://assets.ppy.sh/beatmaps/2234472/covers/cover.jpg",
tags: ["instrumental", "electronic"],
submittedAt: "2026-09-10T19:05:42Z",
updatedAt: "2026-09-10T19:05:42Z",
source: "catboy.best",
beatmaps: [],
},
{
id: 30872,
title: "scarlet heaven of Delays",
artist: "camellia",
creator: "Shino",
status: "graveyard" as const,
coverUrl: "https://assets.ppy.sh/beatmaps/30872/covers/cover.jpg",
tags: ["touhou", "dubstep"],
submittedAt: "2012-09-07T22:44:00Z",
updatedAt: "2012-09-07T22:44:00Z",
source: "catboy.best",
beatmaps: [],
},
].filter((set) =>
query.query ? `${set.title} ${set.artist}`.toLowerCase().includes(query.query.toLowerCase()) : true
),
page: 1,
pageSize: 30,
total: 2,
}),
installBeatmapSet: async () => {},
readCollections: async () => collections,
writeCollections: async (db) => {
collections = db;
},
checkForUpdate: async () => ({ hasUpdate: false, currentVersion: "0.1.0" }),
openExternal: async (url) => {
window.open(url, "_blank");
},
};
window.directify = mock;
}
@@ -0,0 +1,105 @@
// Backup page: zips the whole Songs folder (or a selected subset) into a portable archive, and restores one back.
import { Button, Card, Icon } from "@directify/ui";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
export function BackupPage() {
const { t } = useTranslation();
const [folders, setFolders] = useState<string[]>([]);
const [selected, setSelected] = useState<Set<string>>(new Set());
const [status, setStatus] = useState("");
useEffect(() => {
window.directify.listInstalledBeatmapFolders().then(setFolders);
}, []);
function toggle(folder: string) {
setSelected((prev) => {
const next = new Set(prev);
if (next.has(folder)) next.delete(folder);
else next.add(folder);
return next;
});
}
async function runBackup() {
const dest = await window.directify.pickBackupDestination();
if (!dest) return;
setStatus(t("common.loading"));
const folderNames = selected.size > 0 ? Array.from(selected) : undefined;
const manifest = await window.directify.backupLibrary(dest, folderNames);
setStatus(`${manifest.beatmapFolders.length} → ${dest}`);
}
async function runRestore() {
const zip = await window.directify.pickBackupToRestore();
if (!zip) return;
setStatus(t("common.loading"));
await window.directify.restoreBackup(zip);
window.directify.listInstalledBeatmapFolders().then(setFolders);
}
return (
<div style={{ display: "flex", flexDirection: "column", gap: 20 }}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
<h2 style={{ margin: 0 }}>{t("backup.title")}</h2>
<div style={{ display: "flex", gap: 8 }}>
<Button variant="secondary" onClick={runRestore}>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="folder-open" size={14} />
{t("backup.restoreFromZip")}
</span>
</Button>
<Button onClick={runBackup}>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="archive" tone="dark" size={14} />
{selected.size > 0
? t("backup.backupSelected", { count: selected.size })
: t("backup.backupEverything")}
</span>
</Button>
</div>
</div>
{status && (
<p role="status" style={{ color: "var(--df-text-muted)", fontSize: 13 }}>
{status}
</p>
)}
<p style={{ color: "var(--df-text-muted)", fontSize: 13 }}>
{t("backup.description", { count: folders.length })}
</p>
<div
style={{
display: "grid",
gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))",
gap: 12,
}}
>
{folders.map((folder) => (
<Card
key={folder}
selected={selected.has(folder)}
label={folder}
onClick={() => toggle(folder)}
>
<div
style={{
fontSize: 13,
fontWeight: selected.has(folder) ? 700 : 500,
color: selected.has(folder) ? "var(--df-pink)" : "var(--df-text)",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
{folder}
</div>
</Card>
))}
</div>
</div>
);
}
@@ -0,0 +1,104 @@
// Collections page: reads/writes osu!stable's collection.db directly.
import type { CollectionDatabase } from "@directify/shared";
import { Button, Icon, TextInput } from "@directify/ui";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
export function CollectionsPage() {
const { t } = useTranslation();
const [db, setDb] = useState<CollectionDatabase | null>(null);
const [newName, setNewName] = useState("");
useEffect(() => {
window.directify.readCollections().then(setDb);
}, []);
async function persist(next: CollectionDatabase) {
setDb(next);
await window.directify.writeCollections(next);
}
function addCollection() {
if (!db || !newName.trim()) return;
persist({ ...db, collections: [...db.collections, { name: newName.trim(), beatmapChecksums: [] }] });
setNewName("");
}
function removeCollection(name: string) {
if (!db) return;
persist({ ...db, collections: db.collections.filter((c) => c.name !== name) });
}
if (!db) return null;
return (
<div style={{ maxWidth: 640, display: "flex", flexDirection: "column", gap: 20 }}>
<h2 style={{ margin: 0 }}>{t("collections.title")}</h2>
<p style={{ color: "var(--df-text-muted)", fontSize: 13, margin: 0 }}>
{t("collections.description")}
</p>
<div style={{ display: "flex", gap: 8 }}>
<TextInput
value={newName}
onChange={(e) => setNewName(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && addCollection()}
placeholder={t("collections.newNamePlaceholder")}
aria-label={t("collections.newNamePlaceholder")}
style={{ flex: 1 }}
/>
<Button onClick={addCollection}>{t("common.add")}</Button>
</div>
{db.collections.length === 0 ? (
<div
style={{
padding: 40,
textAlign: "center",
color: "var(--df-text-muted)",
border: "1px dashed var(--df-border)",
borderRadius: "var(--df-radius-lg)",
}}
>
{t("collections.emptyState")}
</div>
) : (
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
{db.collections.map((collection) => (
<div
key={collection.name}
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
padding: "12px 16px",
borderRadius: "var(--df-radius-sm)",
background: "var(--df-surface-1)",
border: "1px solid var(--df-border)",
boxShadow: "var(--df-shadow-sm)",
}}
>
<span style={{ display: "flex", alignItems: "center", gap: 10 }}>
<Icon name="star" tone="pink" size={16} />
{collection.name}{" "}
<span style={{ color: "var(--df-text-muted)", fontSize: 12 }}>
({t("collections.maps", { count: collection.beatmapChecksums.length })})
</span>
</span>
<Button
variant="ghost"
onClick={() => removeCollection(collection.name)}
aria-label={`${t("common.remove")} ${collection.name}`}
>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="trash-2" size={14} />
{t("common.remove")}
</span>
</Button>
</div>
))}
</div>
)}
</div>
);
}
@@ -0,0 +1,224 @@
// Library page: shows installed beatmapsets (scanned from Songs), lets the user filter, select, add to a collection, or delete.
import type { BeatmapSet, CollectionDatabase } from "@directify/shared";
import { Button, Card, Icon, TextInput } from "@directify/ui";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
export function LibraryPage() {
const { t } = useTranslation();
const [sets, setSets] = useState<BeatmapSet[] | null>(null);
const [collections, setCollections] = useState<CollectionDatabase | null>(null);
const [query, setQuery] = useState("");
const [selected, setSelected] = useState<Set<string>>(new Set());
const [collectionName, setCollectionName] = useState("");
const [status, setStatus] = useState("");
async function rescan() {
setStatus(t("library.scanning"));
try {
const [scanned, db] = await Promise.all([
window.directify.scanLibrary(),
window.directify.readCollections(),
]);
setSets(scanned);
setCollections(db);
setSelected(new Set());
setStatus(t("library.foundCount", { count: scanned.length }));
} catch (err) {
setStatus((err as Error).message);
}
}
useEffect(() => {
rescan();
}, []);
const filtered = useMemo(() => {
if (!sets) return [];
const q = query.trim().toLowerCase();
if (!q) return sets;
return sets.filter((s) =>
`${s.title} ${s.artist} ${s.creator} ${s.tags.join(" ")}`.toLowerCase().includes(q)
);
}, [sets, query]);
function toggle(folderName: string) {
setSelected((prev) => {
const next = new Set(prev);
if (next.has(folderName)) next.delete(folderName);
else next.add(folderName);
return next;
});
}
function selectedSets(): BeatmapSet[] {
return (sets ?? []).filter((s) => s.folderName && selected.has(s.folderName));
}
async function addSelectedToCollection() {
if (!collections || !collectionName.trim() || selected.size === 0) return;
const name = collectionName.trim();
const checksums = selectedSets().flatMap((s) => s.beatmaps.map((b) => b.checksum));
const existing = collections.collections.find(
(c) => c.name.toLowerCase() === name.toLowerCase()
);
const nextCollections = existing
? collections.collections.map((c) =>
c === existing
? { ...c, beatmapChecksums: Array.from(new Set([...c.beatmapChecksums, ...checksums])) }
: c
)
: [...collections.collections, { name, beatmapChecksums: checksums }];
const next = { ...collections, collections: nextCollections };
setCollections(next);
await window.directify.writeCollections(next);
setCollectionName("");
setSelected(new Set());
}
async function deleteSelected() {
if (selected.size === 0) return;
const confirmed = window.confirm(
`Permanently delete ${selected.size} beatmapset(s) from your Songs folder? This cannot be undone.`
);
if (!confirmed) return;
for (const folderName of selected) {
await window.directify.deleteBeatmapSet(folderName);
}
await rescan();
}
return (
<div style={{ display: "flex", flexDirection: "column", gap: 20 }}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", gap: 12 }}>
<h2 style={{ margin: 0 }}>{t("library.title")}</h2>
<Button variant="secondary" onClick={rescan}>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="refresh-cw" size={14} />
{t("common.rescan")}
</span>
</Button>
</div>
<div style={{ position: "relative" }}>
<div style={{ position: "absolute", left: 12, top: "50%", transform: "translateY(-50%)" }}>
<Icon name="search" size={16} />
</div>
<TextInput
id="primary-search-input"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("library.filterPlaceholder")}
aria-label={t("library.filterPlaceholder")}
style={{ width: "100%", paddingLeft: 38 }}
/>
</div>
{status && (
<p role="status" style={{ color: "var(--df-text-muted)", fontSize: 13 }}>
{status}
</p>
)}
{selected.size > 0 && (
<div
style={{
display: "flex",
gap: 8,
alignItems: "center",
padding: 12,
borderRadius: "var(--df-radius-sm)",
background: "var(--df-glass-bg)",
backdropFilter: "var(--df-glass-blur)",
border: "1px solid var(--df-border)",
boxShadow: "var(--df-shadow-md)",
flexWrap: "wrap",
}}
>
<span style={{ fontSize: 13, color: "var(--df-text-muted)" }}>
{t("library.selectedCount", { count: selected.size })}
</span>
<TextInput
value={collectionName}
onChange={(e) => setCollectionName(e.target.value)}
placeholder={t("library.collectionNamePlaceholder")}
aria-label={t("library.collectionNamePlaceholder")}
list="collection-names"
style={{ flex: 1, minWidth: 160 }}
/>
<datalist id="collection-names">
{collections?.collections.map((c) => <option key={c.name} value={c.name} />)}
</datalist>
<Button variant="secondary" onClick={addSelectedToCollection}>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="star" size={14} />
{t("library.addToCollection")}
</span>
</Button>
<Button variant="ghost" onClick={deleteSelected} style={{ color: "var(--df-pink)" }}>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="trash-2" tone="pink" size={14} />
{t("common.delete")}
</span>
</Button>
</div>
)}
{sets === null ? (
<p style={{ color: "var(--df-text-muted)" }}>{t("common.loading")}</p>
) : filtered.length === 0 ? (
<div
style={{
padding: 40,
textAlign: "center",
color: "var(--df-text-muted)",
border: "1px dashed var(--df-border)",
borderRadius: "var(--df-radius-lg)",
}}
>
{sets.length === 0 ? t("library.emptyNoMaps") : t("library.emptyNoMatch")}
</div>
) : (
<div
style={{
display: "grid",
gridTemplateColumns: "repeat(auto-fill, minmax(240px, 1fr))",
gap: 16,
}}
>
{filtered.map((set) => {
const isSelected = !!set.folderName && selected.has(set.folderName);
return (
<Card
key={set.folderName ?? set.id}
selected={isSelected}
label={`${set.title} — ${set.artist}`}
coverUrl={set.coverUrl}
onClick={() => set.folderName && toggle(set.folderName)}
>
<div
style={{
fontWeight: 700,
fontSize: 15,
color: isSelected ? "var(--df-pink)" : "var(--df-text)",
}}
>
{set.title}
</div>
<div style={{ fontSize: 13, color: "var(--df-text-muted)", marginBottom: 6 }}>
{set.artist} · {set.creator}
</div>
<div style={{ fontSize: 12, color: "var(--df-text-muted)" }}>
{t("library.difficulty", { count: set.beatmaps.length })}
</div>
</Card>
);
})}
</div>
)}
</div>
);
}
@@ -0,0 +1,247 @@
// Find-maps page: osu!lazer-style search — free text plus mode, key count, genre, language, and star-rating filters — against the active (fallback-chain) beatmap source.
import { GENRES, LANGUAGES, type BeatmapSet, type OsuMode } from "@directify/shared";
import { Button, Card, DualRangeSlider, Icon, StatusBadge, TextInput } from "@directify/ui";
import { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
const MODES: { value: OsuMode | ""; label: string }[] = [
{ value: "", label: "All" },
{ value: "osu", label: "Standard" },
{ value: "taiko", label: "Taiko" },
{ value: "fruits", label: "Catch" },
{ value: "mania", label: "Mania" },
];
const MANIA_KEY_COUNTS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
function chipStyle(active: boolean): React.CSSProperties {
return {
padding: "6px 12px",
borderRadius: 999,
fontSize: 13,
fontWeight: 600,
cursor: "pointer",
border: `1px solid ${active ? "var(--df-pink)" : "var(--df-border)"}`,
background: active ? "var(--df-pink)" : "var(--df-surface-2)",
color: active ? "var(--df-on-fill)" : "var(--df-text)",
};
}
function selectStyle(): React.CSSProperties {
return {
padding: "8px 10px",
borderRadius: "var(--df-radius-sm)",
border: "1px solid var(--df-border)",
background: "var(--df-surface-2)",
color: "var(--df-text)",
fontSize: 13,
fontFamily: "inherit",
};
}
export function SearchPage() {
const { t } = useTranslation();
const [query, setQuery] = useState("");
const [mode, setMode] = useState<OsuMode | "">("");
const [keys, setKeys] = useState<number | null>(null);
const [genre, setGenre] = useState<number | "">("");
const [language, setLanguage] = useState<number | "">("");
const [starRange, setStarRange] = useState<[number, number]>([0, 10]);
const [results, setResults] = useState<BeatmapSet[]>([]);
const [status, setStatus] = useState("");
const [installing, setInstalling] = useState<number | null>(null);
const debounceRef = useRef<ReturnType<typeof setTimeout>>();
async function search() {
setStatus(t("common.loading"));
try {
const res = await window.directify.searchBeatmaps({
query,
mode: mode || undefined,
keys: mode === "mania" && keys ? keys : undefined,
genre: genre === "" ? undefined : genre,
language: language === "" ? undefined : language,
minStars: starRange[0] > 0 ? starRange[0] : undefined,
maxStars: starRange[1] < 10 ? starRange[1] : undefined,
page: 1,
pageSize: 30,
});
setResults(res.results);
setStatus(t("search.resultCount", { count: res.total }));
} catch (err) {
setStatus((err as Error).message);
}
}
// Debounced auto-search: every filter change re-searches after a short
// pause instead of on every keystroke/slider tick, so dragging the star
// slider or flipping through modes can't hammer the active mirror.
useEffect(() => {
clearTimeout(debounceRef.current);
debounceRef.current = setTimeout(search, 450);
return () => clearTimeout(debounceRef.current);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [query, mode, keys, genre, language, starRange[0], starRange[1]]);
async function install(set: BeatmapSet) {
setInstalling(set.id);
setStatus(`${t("common.installing")} ${set.artist} - ${set.title}`);
try {
await window.directify.installBeatmapSet(set);
setStatus(`${set.artist} - ${set.title}`);
} catch (err) {
setStatus((err as Error).message);
} finally {
setInstalling(null);
}
}
return (
<div style={{ display: "flex", flexDirection: "column", gap: 20 }}>
<div style={{ position: "relative" }}>
<div style={{ position: "absolute", left: 12, top: "50%", transform: "translateY(-50%)" }}>
<Icon name="search" size={16} />
</div>
<TextInput
id="primary-search-input"
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && search()}
placeholder={t("search.placeholder")}
aria-label={t("search.placeholder")}
style={{ width: "100%", paddingLeft: 38 }}
/>
</div>
<div
style={{
display: "flex",
flexDirection: "column",
gap: 16,
padding: 16,
borderRadius: "var(--df-radius-lg)",
background: "var(--df-surface-1)",
border: "1px solid var(--df-border)",
}}
>
<div style={{ display: "flex", gap: 8, flexWrap: "wrap" }}>
{MODES.map((m) => (
<button key={m.value} style={chipStyle(mode === m.value)} onClick={() => setMode(m.value)}>
{m.label}
</button>
))}
</div>
{mode === "mania" && (
<div style={{ display: "flex", gap: 8, flexWrap: "wrap" }}>
{MANIA_KEY_COUNTS.map((k) => (
<button
key={k}
style={chipStyle(keys === k)}
onClick={() => setKeys(keys === k ? null : k)}
>
{k}K
</button>
))}
</div>
)}
<div style={{ display: "flex", gap: 12, flexWrap: "wrap" }}>
<label style={{ display: "flex", flexDirection: "column", gap: 4 }}>
<span style={{ fontSize: 12, color: "var(--df-text-muted)" }}>{t("search.genre")}</span>
<select
value={genre}
onChange={(e) => setGenre(e.target.value === "" ? "" : Number(e.target.value))}
style={selectStyle()}
>
<option value="">{t("search.any")}</option>
{Object.entries(GENRES).map(([id, name]) => (
<option key={id} value={id}>
{name}
</option>
))}
</select>
</label>
<label style={{ display: "flex", flexDirection: "column", gap: 4 }}>
<span style={{ fontSize: 12, color: "var(--df-text-muted)" }}>{t("search.language")}</span>
<select
value={language}
onChange={(e) => setLanguage(e.target.value === "" ? "" : Number(e.target.value))}
style={selectStyle()}
>
<option value="">{t("search.any")}</option>
{Object.entries(LANGUAGES).map(([id, name]) => (
<option key={id} value={id}>
{name}
</option>
))}
</select>
</label>
</div>
<DualRangeSlider
label={t("search.starRating")}
min={0}
max={10}
step={0.1}
valueMin={starRange[0]}
valueMax={starRange[1]}
onChange={(lo, hi) => setStarRange([lo, hi])}
/>
</div>
{status && (
<p role="status" style={{ color: "var(--df-text-muted)", fontSize: 13 }}>
{status}
</p>
)}
{results.length === 0 ? (
<div
style={{
padding: 40,
textAlign: "center",
color: "var(--df-text-muted)",
border: "1px dashed var(--df-border)",
borderRadius: "var(--df-radius-lg)",
}}
>
{t("search.emptyPrompt")}
</div>
) : (
<div
style={{
display: "grid",
gridTemplateColumns: "repeat(auto-fill, minmax(240px, 1fr))",
gap: 16,
}}
>
{results.map((set) => (
<Card key={set.id} coverUrl={set.coverUrl} label={`${set.title} — ${set.artist}`}>
<div style={{ display: "flex", justifyContent: "space-between", gap: 8 }}>
<div style={{ fontWeight: 700, fontSize: 15 }}>{set.title}</div>
<StatusBadge status={set.status} />
</div>
<div style={{ fontSize: 13, color: "var(--df-text-muted)", margin: "4px 0 10px" }}>
{set.artist} · {set.creator}
</div>
<Button
variant="secondary"
onClick={() => install(set)}
disabled={installing === set.id}
aria-label={`${t("common.install")} ${set.title}`}
>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="download" size={14} />
{installing === set.id ? t("common.installing") : t("common.install")}
</span>
</Button>
</Card>
))}
</div>
)}
</div>
);
}
@@ -0,0 +1,347 @@
// Settings page: distinct, centered-header sections for the osu! folder, appearance, network, and beatmap search source management.
import type { BeatmapSourceConfig } from "@directify/shared";
import { Button, Icon, TextInput } from "@directify/ui";
import type { ReactNode } from "react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { SUPPORTED_LANGUAGES } from "../i18n";
import { useSettings } from "../settings-context";
function selectStyle(): React.CSSProperties {
return {
padding: "8px 10px",
borderRadius: "var(--df-radius-sm)",
border: "1px solid var(--df-border)",
background: "var(--df-surface-2)",
color: "var(--df-text)",
fontSize: 14,
fontFamily: "inherit",
};
}
function SettingsSection({
title,
description,
children,
}: {
title: string;
description?: string;
children: ReactNode;
}) {
return (
<section
style={{
background: "var(--df-surface-1)",
border: "1px solid var(--df-border)",
borderRadius: "var(--df-radius-lg)",
boxShadow: "var(--df-shadow-sm)",
padding: "28px 32px",
}}
>
<div style={{ textAlign: "center", marginBottom: 24 }}>
<h3 style={{ margin: "0 0 6px", fontSize: 16 }}>{title}</h3>
{description && (
<p
style={{
margin: "0 auto",
maxWidth: 460,
fontSize: 13,
color: "var(--df-text-muted)",
lineHeight: 1.5,
}}
>
{description}
</p>
)}
</div>
{children}
</section>
);
}
export function SettingsPage() {
const { settings, update } = useSettings();
const { t } = useTranslation();
const [status, setStatus] = useState("");
const [newSourceName, setNewSourceName] = useState("");
const [newSourceUrl, setNewSourceUrl] = useState("");
async function detect() {
setStatus(t("common.loading"));
const dir = await window.directify.detectOsuInstall();
if (dir) {
await update({ osuInstallDir: dir });
setStatus(`${dir}`);
} else {
setStatus(t("settings.notConfigured"));
}
}
async function pick() {
const dir = await window.directify.pickOsuInstallDir();
if (dir) await update({ osuInstallDir: dir });
}
function addSource() {
if (!settings || !newSourceName.trim() || !newSourceUrl.trim()) return;
const source: BeatmapSourceConfig = {
id: crypto.randomUUID(),
name: newSourceName.trim(),
baseUrl: newSourceUrl.trim().replace(/\/$/, ""),
enabled: true,
};
update({ searchSources: [...settings.searchSources, source] });
setNewSourceName("");
setNewSourceUrl("");
}
function removeSource(id: string) {
if (!settings) return;
update({ searchSources: settings.searchSources.filter((s) => s.id !== id) });
}
function toggleSource(id: string, enabled: boolean) {
if (!settings) return;
update({
searchSources: settings.searchSources.map((s) => (s.id === id ? { ...s, enabled } : s)),
});
}
function moveSource(index: number, direction: -1 | 1) {
if (!settings) return;
const next = [...settings.searchSources];
const target = index + direction;
if (target < 0 || target >= next.length) return;
[next[index], next[target]] = [next[target], next[index]];
update({ searchSources: next });
}
if (!settings) return null;
return (
<div style={{ maxWidth: 680, margin: "0 auto", display: "flex", flexDirection: "column", gap: 20 }}>
<h2 style={{ textAlign: "center", margin: "0 0 4px" }}>{t("settings.title")}</h2>
<SettingsSection title={t("settings.osuFolder")}>
<div
style={{
display: "flex",
alignItems: "center",
gap: 10,
padding: 12,
borderRadius: "var(--df-radius-sm)",
background: "var(--df-surface-2)",
border: "1px solid var(--df-border)",
fontSize: 13,
marginBottom: 12,
wordBreak: "break-all",
}}
>
<Icon name="folder-open" size={16} />
{settings.osuInstallDir ?? t("settings.notConfigured")}
</div>
<div style={{ display: "flex", gap: 8, justifyContent: "center" }}>
<Button variant="secondary" onClick={detect}>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name="refresh-cw" size={14} />
{t("settings.autoDetect")}
</span>
</Button>
<Button variant="ghost" onClick={pick}>
{t("settings.chooseFolder")}
</Button>
</div>
{status && (
<p style={{ color: "var(--df-text-muted)", fontSize: 13, textAlign: "center" }}>{status}</p>
)}
</SettingsSection>
<SettingsSection title={t("settings.appearance")} description={t("settings.appearanceDesc")}>
<div style={{ display: "flex", flexDirection: "column", gap: 14 }}>
<label style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
<span style={{ fontSize: 14 }}>{t("settings.theme")}</span>
<select
value={settings.theme}
onChange={(e) => update({ theme: e.target.value as typeof settings.theme })}
style={selectStyle()}
>
<option value="dark">{t("settings.themeDark")}</option>
<option value="light">{t("settings.themeLight")}</option>
<option value="system">{t("settings.themeSystem")}</option>
</select>
</label>
<label style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
<span style={{ fontSize: 14 }}>
{t("settings.reduceMotion")}
<div style={{ fontSize: 12, color: "var(--df-text-muted)" }}>
{t("settings.reduceMotionHint")}
</div>
</span>
<input
type="checkbox"
checked={settings.reduceMotion}
onChange={(e) => update({ reduceMotion: e.target.checked })}
aria-label={t("settings.reduceMotion")}
style={{ width: 18, height: 18 }}
/>
</label>
<label style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
<span style={{ fontSize: 14 }}>{t("settings.language")}</span>
<select
value={settings.language}
onChange={(e) => update({ language: e.target.value })}
style={selectStyle()}
>
{SUPPORTED_LANGUAGES.map((lang) => (
<option key={lang.code} value={lang.code}>
{lang.label}
</option>
))}
</select>
</label>
</div>
</SettingsSection>
<SettingsSection title={t("settings.network")} description={t("settings.networkDesc")}>
<div style={{ display: "flex", gap: 8, justifyContent: "center" }}>
<label style={{ display: "flex", flexDirection: "column", gap: 6, width: 140 }}>
<span style={{ fontSize: 14 }}>{t("settings.proxyType")}</span>
<select
value={settings.proxy.type}
onChange={(e) =>
update({ proxy: { ...settings.proxy, type: e.target.value as typeof settings.proxy.type } })
}
style={selectStyle()}
>
<option value="none">{t("settings.proxyTypeNone")}</option>
<option value="http">HTTP</option>
<option value="https">HTTPS</option>
<option value="socks4">SOCKS4</option>
<option value="socks5">SOCKS5</option>
</select>
</label>
{settings.proxy.type !== "none" && (
<>
<label style={{ display: "flex", flexDirection: "column", gap: 6, flex: 1 }}>
<span style={{ fontSize: 14 }}>{t("settings.proxyHost")}</span>
<TextInput
value={settings.proxy.host}
onChange={(e) => update({ proxy: { ...settings.proxy, host: e.target.value } })}
placeholder="127.0.0.1"
/>
</label>
<label style={{ display: "flex", flexDirection: "column", gap: 6, width: 100 }}>
<span style={{ fontSize: 14 }}>{t("settings.proxyPort")}</span>
<TextInput
value={settings.proxy.port}
onChange={(e) => update({ proxy: { ...settings.proxy, port: e.target.value } })}
placeholder="8080"
/>
</label>
</>
)}
</div>
</SettingsSection>
<SettingsSection title={t("settings.sources")} description={t("settings.sourcesHint")}>
<div style={{ display: "flex", flexDirection: "column", gap: 8, marginBottom: 16 }}>
{settings.searchSources.map((source, index) => (
<div
key={source.id}
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
padding: "10px 14px",
borderRadius: "var(--df-radius-sm)",
background: "var(--df-surface-2)",
border: `1px solid ${source.enabled ? "var(--df-border)" : "var(--df-surface-3)"}`,
opacity: source.enabled ? 1 : 0.55,
}}
>
<div style={{ display: "flex", flexDirection: "column" }}>
<div style={{ display: "flex", gap: 4, marginBottom: 2 }}>
<Button
variant="ghost"
aria-label={t("settings.moveUp")}
disabled={index === 0}
onClick={() => moveSource(index, -1)}
style={{ padding: "2px 6px" }}
>
↑
</Button>
<Button
variant="ghost"
aria-label={t("settings.moveDown")}
disabled={index === settings.searchSources.length - 1}
onClick={() => moveSource(index, 1)}
style={{ padding: "2px 6px" }}
>
↓
</Button>
</div>
<div style={{ fontWeight: 600, fontSize: 14 }}>
{source.name}{" "}
{source.builtIn && (
<span style={{ fontSize: 11, color: "var(--df-text-muted)" }}>
({t("settings.builtIn")})
</span>
)}
</div>
<div style={{ fontSize: 12, color: "var(--df-text-muted)", wordBreak: "break-all" }}>
{source.baseUrl}
</div>
</div>
<div style={{ display: "flex", gap: 8, alignItems: "center" }}>
<label
style={{ display: "flex", alignItems: "center", gap: 6, fontSize: 12 }}
title={t("settings.enabled")}
>
{t("settings.enabled")}
<input
type="checkbox"
checked={source.enabled}
onChange={(e) => toggleSource(source.id, e.target.checked)}
aria-label={`${t("settings.enabled")}: ${source.name}`}
/>
</label>
{!source.builtIn && (
<Button
variant="ghost"
aria-label={`${t("common.remove")} ${source.name}`}
onClick={() => removeSource(source.id)}
>
<Icon name="trash-2" size={14} />
</Button>
)}
</div>
</div>
))}
</div>
<div style={{ display: "flex", gap: 8, marginBottom: 8 }}>
<TextInput
value={newSourceName}
onChange={(e) => setNewSourceName(e.target.value)}
placeholder={t("settings.sourceNamePlaceholder")}
style={{ width: 140 }}
/>
<TextInput
value={newSourceUrl}
onChange={(e) => setNewSourceUrl(e.target.value)}
placeholder={t("settings.sourceUrlPlaceholder")}
style={{ flex: 1 }}
/>
<Button variant="secondary" onClick={addSource}>
{t("settings.addSource")}
</Button>
</div>
<p style={{ fontSize: 11, color: "var(--df-text-muted)", margin: 0, textAlign: "center" }}>
{t("settings.sourceFormatHint", { baseUrl: newSourceUrl.trim() || t("settings.sourceUrlPlaceholder") })}
</p>
</SettingsSection>
</div>
);
}
@@ -0,0 +1,37 @@
// Shared app settings loaded once and kept in sync across every page/component that reads or writes them.
import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
import type { AppSettings } from "../../ipc-types";
interface SettingsContextValue {
settings: AppSettings | null;
update: (patch: Partial<AppSettings>) => Promise<void>;
}
const SettingsContext = createContext<SettingsContextValue | null>(null);
export function SettingsProvider({ children }: { children: ReactNode }) {
const [settings, setSettings] = useState<AppSettings | null>(null);
useEffect(() => {
window.directify.getSettings().then(setSettings);
}, []);
async function update(patch: Partial<AppSettings>) {
setSettings((prev) => {
if (!prev) return prev;
const next = { ...prev, ...patch };
window.directify.saveSettings(next);
return next;
});
}
return (
<SettingsContext.Provider value={{ settings, update }}>{children}</SettingsContext.Provider>
);
}
export function useSettings(): SettingsContextValue {
const ctx = useContext(SettingsContext);
if (!ctx) throw new Error("useSettings must be used within SettingsProvider");
return ctx;
}
+4
View File
@@ -0,0 +1,4 @@
{
"files": [],
"references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.web.json" }]
}
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["electron-vite/node"],
"lib": ["ES2022"],
"noEmit": true
},
"include": ["src/main/**/*", "src/preload/**/*", "electron.vite.config.ts"]
}
+16
View File
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"jsx": "react-jsx",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": ["vite/client"],
"noEmit": true,
"baseUrl": ".",
"paths": {
"@renderer/*": ["src/renderer/src/*"]
}
},
"include": ["src/renderer/src/**/*"]
}
+21
View File
@@ -0,0 +1,21 @@
import { resolve } from "node:path";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
/**
* Browser-only preview of the renderer UI (no Electron, no real IPC — see
* `src/renderer/src/mock-directify.ts`). Not used by the real app build,
* which goes through `electron.vite.config.ts` instead.
*/
export default defineConfig({
root: "src/renderer",
resolve: {
alias: {
"@renderer": resolve("src/renderer/src"),
},
},
plugins: [react()],
server: {
port: 5174,
},
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

+16
View File
@@ -0,0 +1,16 @@
{
"name": "directify",
"private": true,
"version": "0.1.0",
"description": "A feature-rich, unofficial client for catboy.best.",
"scripts": {
"dev:desktop": "pnpm --filter @directify/desktop dev",
"build": "pnpm -r build",
"test": "pnpm -r test",
"lint": "pnpm -r lint"
},
"engines": {
"node": ">=20"
},
"packageManager": "pnpm@12.4.2"
}
+17
View File
@@ -0,0 +1,17 @@
{
"name": "@directify/shared",
"version": "0.1.0",
"private": true,
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"scripts": {
"test": "vitest run",
"lint": "tsc --noEmit"
},
"devDependencies": {
"@types/node": "^20.14.0",
"typescript": "^5.6.0",
"vitest": "^2.1.0"
}
}
+45
View File
@@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import { readCollectionDb, writeCollectionDb } from "./collection-db";
import type { CollectionDatabase } from "./types";
describe("collection.db round-trip", () => {
it("writes then reads back an identical structure", () => {
const db: CollectionDatabase = {
version: 20240101,
collections: [
{
name: "Favorites",
beatmapChecksums: [
"a".repeat(32),
"b".repeat(32),
],
},
{
name: "Empty collection",
beatmapChecksums: [],
},
{
name: "unicode ☆ collection 譜面",
beatmapChecksums: ["c".repeat(32)],
},
],
};
const buf = writeCollectionDb(db);
const roundTripped = readCollectionDb(buf);
expect(roundTripped).toEqual(db);
});
it("produces byte-identical output when re-serialized", () => {
const db: CollectionDatabase = {
version: 20240101,
collections: [{ name: "Test", beatmapChecksums: ["d".repeat(32)] }],
};
const first = writeCollectionDb(db);
const second = writeCollectionDb(readCollectionDb(first));
expect(second.equals(first)).toBe(true);
});
});
+145
View File
@@ -0,0 +1,145 @@
import type { Collection, CollectionDatabase } from "./types";
/**
* Reader/writer for osu!stable's `collection.db`.
*
* Format (little-endian):
* int32 version
* int32 collection count
* for each collection:
* string name
* int32 beatmap count
* for each beatmap:
* string beatmap (.osu) MD5 checksum
*
* osu!-strings are a single marker byte (0x00 = null, 0x0b = present)
* followed, when present, by a ULEB128-encoded byte length and the UTF-8 bytes.
*/
const STRING_NULL = 0x00;
const STRING_PRESENT = 0x0b;
class ByteReader {
private offset = 0;
constructor(private readonly buf: Buffer) {}
get bytesRemaining(): number {
return this.buf.length - this.offset;
}
readInt32(): number {
const value = this.buf.readInt32LE(this.offset);
this.offset += 4;
return value;
}
readByte(): number {
const value = this.buf.readUInt8(this.offset);
this.offset += 1;
return value;
}
private readUleb128(): number {
let result = 0;
let shift = 0;
for (;;) {
const byte = this.readByte();
result |= (byte & 0x7f) << shift;
if ((byte & 0x80) === 0) break;
shift += 7;
}
return result;
}
readString(): string | null {
const marker = this.readByte();
if (marker === STRING_NULL) return null;
if (marker !== STRING_PRESENT) {
throw new Error(`Unexpected osu!-string marker byte 0x${marker.toString(16)}`);
}
const length = this.readUleb128();
const value = this.buf.toString("utf8", this.offset, this.offset + length);
this.offset += length;
return value;
}
}
class ByteWriter {
private chunks: Buffer[] = [];
writeInt32(value: number): this {
const b = Buffer.alloc(4);
b.writeInt32LE(value, 0);
this.chunks.push(b);
return this;
}
writeByte(value: number): this {
this.chunks.push(Buffer.from([value]));
return this;
}
private writeUleb128(value: number): this {
const bytes: number[] = [];
let v = value;
do {
let byte = v & 0x7f;
v >>>= 7;
if (v !== 0) byte |= 0x80;
bytes.push(byte);
} while (v !== 0);
this.chunks.push(Buffer.from(bytes));
return this;
}
writeString(value: string | null | undefined): this {
if (value === null || value === undefined) {
return this.writeByte(STRING_NULL);
}
this.writeByte(STRING_PRESENT);
const utf8 = Buffer.from(value, "utf8");
this.writeUleb128(utf8.length);
this.chunks.push(utf8);
return this;
}
toBuffer(): Buffer {
return Buffer.concat(this.chunks);
}
}
export function readCollectionDb(buf: Buffer): CollectionDatabase {
const reader = new ByteReader(buf);
const version = reader.readInt32();
const collectionCount = reader.readInt32();
const collections: Collection[] = [];
for (let i = 0; i < collectionCount; i++) {
const name = reader.readString() ?? "";
const beatmapCount = reader.readInt32();
const beatmapChecksums: string[] = [];
for (let j = 0; j < beatmapCount; j++) {
const checksum = reader.readString();
if (checksum) beatmapChecksums.push(checksum);
}
collections.push({ name, beatmapChecksums });
}
return { version, collections };
}
export function writeCollectionDb(db: CollectionDatabase): Buffer {
const writer = new ByteWriter();
writer.writeInt32(db.version);
writer.writeInt32(db.collections.length);
for (const collection of db.collections) {
writer.writeString(collection.name);
writer.writeInt32(collection.beatmapChecksums.length);
for (const checksum of collection.beatmapChecksums) {
writer.writeString(checksum);
}
}
return writer.toBuffer();
}
+2
View File
@@ -0,0 +1,2 @@
export * from "./types";
export * from "./collection-db";
+139
View File
@@ -0,0 +1,139 @@
export type OsuMode = "osu" | "taiko" | "fruits" | "mania";
export type RankedStatus =
| "graveyard"
| "wip"
| "pending"
| "ranked"
| "approved"
| "qualified"
| "loved"
/** Status can't be determined from a local scan alone (no online lookup performed). */
| "unknown";
/** A single difficulty within a beatmapset. */
export interface Beatmap {
id: number;
beatmapsetId: number;
version: string;
mode: OsuMode;
difficultyRating: number;
bpm: number;
totalLength: number;
/** Circle size — also doubles as the key count for mania difficulties. */
cs: number;
ar: number;
od: number;
hp: number;
/** MD5 of the .osu file, used as the key in osu!stable's collection.db. */
checksum: string;
}
/** A beatmapset as indexed from a source mirror. */
export interface BeatmapSet {
id: number;
title: string;
artist: string;
creator: string;
status: RankedStatus;
coverUrl?: string;
previewUrl?: string;
tags: string[];
genre?: string;
language?: string;
submittedAt: string;
updatedAt: string;
beatmaps: Beatmap[];
/** Which source mirror this record was resolved from, or "local" for an installed scan. */
source: string;
/** Present for beatmapsets found on disk; the Songs subfolder name, used for file operations. */
folderName?: string;
}
/** osu!'s own genre enum (matches the IDs osu!/mirrors report; "any" omitted since it means "no filter"). */
export const GENRES: Record<number, string> = {
1: "Unspecified",
2: "Video Game",
3: "Anime",
4: "Rock",
5: "Pop",
6: "Other",
7: "Novelty",
9: "Hip Hop",
10: "Electronic",
11: "Metal",
12: "Classical",
13: "Folk",
14: "Jazz",
};
/** osu!'s own language enum. */
export const LANGUAGES: Record<number, string> = {
1: "Unspecified",
2: "English",
3: "Japanese",
4: "Chinese",
5: "Instrumental",
6: "Korean",
7: "French",
8: "German",
9: "Swedish",
10: "Spanish",
11: "Italian",
12: "Russian",
13: "Polish",
14: "Other",
};
export interface BeatmapSearchQuery {
query?: string;
mode?: OsuMode;
status?: RankedStatus;
minStars?: number;
maxStars?: number;
/** Numeric genre id — see GENRES. */
genre?: number;
/** Numeric language id — see LANGUAGES. */
language?: number;
/** Mania key count (4, 7, ...) — matched against difficulty CS. Ignored unless mode is "mania". */
keys?: number;
page?: number;
pageSize?: number;
}
export interface BeatmapSearchResult {
results: BeatmapSet[];
page: number;
pageSize: number;
total: number;
}
/** In-memory representation of an osu!stable collection. */
export interface Collection {
name: string;
/** Beatmap (.osu) MD5 checksums belonging to this collection. */
beatmapChecksums: string[];
}
export interface CollectionDatabase {
version: number;
collections: Collection[];
}
export interface BeatmapSourceConfig {
id: string;
name: string;
baseUrl: string;
builtIn?: boolean;
enabled: boolean;
}
export type ThemeMode = "dark" | "light" | "system";
export type ProxyType = "none" | "http" | "https" | "socks4" | "socks5";
export interface ProxyConfig {
type: ProxyType;
host: string;
port: string;
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
},
"include": ["src"]
}
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@directify/ui",
"version": "0.1.0",
"private": true,
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"scripts": {
"lint": "tsc --noEmit"
},
"peerDependencies": {
"react": "^18.3.0",
"react-dom": "^18.3.0"
},
"dependencies": {
"@directify/shared": "workspace:*",
"framer-motion": "^11.11.0"
},
"devDependencies": {
"@types/node": "^20.14.0",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"typescript": "^5.6.0"
}
}
+60
View File
@@ -0,0 +1,60 @@
// Button: pink (primary) is the app's own branded action, blue (accent) is reserved for download/get-the-app actions — matches osu!'s own site split between "Support" (pink) and "Download" (blue) rather than one hue for everything.
import { motion } from "framer-motion";
import type { ButtonHTMLAttributes, ReactNode } from "react";
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: "primary" | "accent" | "secondary" | "ghost";
children: ReactNode;
}
const variantStyles: Record<NonNullable<ButtonProps["variant"]>, React.CSSProperties> = {
primary: {
background: "var(--df-pink)",
color: "var(--df-on-fill)",
border: "none",
boxShadow: "var(--df-shadow-sm)",
},
accent: {
background: "var(--df-blue)",
color: "var(--df-on-fill)",
border: "none",
boxShadow: "var(--df-shadow-sm)",
},
secondary: {
background: "var(--df-surface-2)",
color: "var(--df-text)",
border: "1px solid var(--df-border)",
},
ghost: {
background: "transparent",
color: "var(--df-text-muted)",
border: "1px solid transparent",
},
};
const hoverGlow: Partial<Record<NonNullable<ButtonProps["variant"]>, string>> = {
primary: "var(--df-glow-pink)",
accent: "var(--df-glow-blue)",
};
export function Button({ variant = "primary", style, children, ...rest }: ButtonProps) {
return (
<motion.button
whileHover={{ y: -2, filter: "brightness(1.08)", boxShadow: hoverGlow[variant] }}
whileTap={{ y: 0, scale: 0.98 }}
transition={{ type: "spring", stiffness: 500, damping: 30 }}
style={{
padding: "10px 20px",
borderRadius: "var(--df-radius-sm)",
fontWeight: 600,
fontSize: 14,
cursor: "pointer",
...variantStyles[variant],
...style,
}}
{...(rest as any)}
>
{children}
</motion.button>
);
}
+83
View File
@@ -0,0 +1,83 @@
// Beatmapset-style card: soft resting shadow, lifts on hover/selection; the cover is a real <img> (not a CSS background string) so a failed/missing cover degrades to the plain surface color instead of rendering nothing; keyboard-operable when clickable.
import { motion } from "framer-motion";
import { useState, type KeyboardEvent, type ReactNode } from "react";
export interface CardProps {
children: ReactNode;
onClick?: () => void;
coverUrl?: string;
selected?: boolean;
label?: string;
}
export function Card({ children, onClick, coverUrl, selected, label }: CardProps) {
const [coverFailed, setCoverFailed] = useState(false);
const showCover = !!coverUrl && !coverFailed;
function handleKeyDown(e: KeyboardEvent<HTMLDivElement>) {
if (!onClick) return;
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
onClick();
}
}
return (
<motion.div
onClick={onClick}
onKeyDown={handleKeyDown}
role={onClick ? "button" : undefined}
tabIndex={onClick ? 0 : undefined}
aria-pressed={onClick ? selected : undefined}
aria-label={label}
initial={false}
animate={{
boxShadow: selected ? "var(--df-glow-pink)" : "var(--df-shadow-sm)",
}}
whileHover={onClick ? { y: -3, boxShadow: "var(--df-shadow-md)" } : undefined}
transition={{ type: "spring", stiffness: 400, damping: 32 }}
style={{
position: "relative",
borderRadius: "var(--df-radius-md)",
overflow: "hidden",
background: "var(--df-surface-1)",
border: `1px solid ${selected ? "var(--df-pink)" : "var(--df-border)"}`,
cursor: onClick ? "pointer" : "default",
minHeight: 140,
display: "flex",
flexDirection: "column",
justifyContent: "flex-end",
padding: 24,
}}
>
{showCover && (
<>
<img
src={coverUrl}
alt=""
aria-hidden
onError={() => setCoverFailed(true)}
style={{
position: "absolute",
inset: 0,
width: "100%",
height: "100%",
objectFit: "cover",
zIndex: 0,
}}
/>
<div
style={{
position: "absolute",
inset: 0,
background:
"linear-gradient(180deg, rgba(23,26,28,0.15) 0%, rgba(23,26,28,0.95) 85%)",
zIndex: 0,
}}
/>
</>
)}
<div style={{ position: "relative", zIndex: 1 }}>{children}</div>
</motion.div>
);
}
+93
View File
@@ -0,0 +1,93 @@
// Two-thumb range slider (e.g. min/max star rating) built from two overlapping native <input type="range"> elements sharing one visual track — no drag-and-drop implementation needed, fully keyboard-operable for free.
import { useId } from "react";
export interface DualRangeSliderProps {
min: number;
max: number;
step?: number;
valueMin: number;
valueMax: number;
onChange: (min: number, max: number) => void;
formatValue?: (v: number) => string;
label: string;
}
export function DualRangeSlider({
min,
max,
step = 0.1,
valueMin,
valueMax,
onChange,
formatValue = (v) => v.toFixed(1),
label,
}: DualRangeSliderProps) {
const id = useId();
const pct = (v: number) => ((v - min) / (max - min)) * 100;
return (
<div>
<div
style={{
display: "flex",
justifyContent: "space-between",
fontSize: 13,
marginBottom: 8,
color: "var(--df-text-muted)",
}}
>
<span>{label}</span>
<span style={{ color: "var(--df-text)", fontWeight: 600 }}>
{formatValue(valueMin)} – {formatValue(valueMax)}
</span>
</div>
<div style={{ position: "relative", height: 24 }}>
<div
style={{
position: "absolute",
top: 10,
left: 0,
right: 0,
height: 4,
borderRadius: 2,
background: "var(--df-surface-3)",
}}
/>
<div
style={{
position: "absolute",
top: 10,
height: 4,
borderRadius: 2,
background: "var(--df-pink)",
left: `${pct(valueMin)}%`,
right: `${100 - pct(valueMax)}%`,
}}
/>
<input
id={`${id}-min`}
type="range"
min={min}
max={max}
step={step}
value={valueMin}
aria-label={`${label} minimum`}
onChange={(e) => onChange(Math.min(Number(e.target.value), valueMax), valueMax)}
className="df-range-thumb"
style={{ zIndex: valueMin > max - (max - min) / 2 ? 2 : 1 }}
/>
<input
id={`${id}-max`}
type="range"
min={min}
max={max}
step={step}
value={valueMax}
aria-label={`${label} maximum`}
onChange={(e) => onChange(valueMin, Math.max(Number(e.target.value), valueMin))}
className="df-range-thumb"
/>
</div>
</div>
);
}
+51
View File
@@ -0,0 +1,51 @@
// Icon: resolves a name+tone to a URL via a swappable resolver. Default is a
// root-relative `/icons/<tone>/<name>.svg` path, correct for anything served
// over http(s) with its own public/ folder at the origin root (e.g. the
// Next.js site) — but wrong for a file:// window, where a root slash
// resolves against the filesystem drive root, not the app's own folder.
// Apps loaded via file:// (Electron's packaged build) override this with
// IconProvider and real bundled asset URLs; see
// apps/desktop/src/renderer/src/icon-map.ts for that resolver.
import { createContext, useContext, type ReactNode } from "react";
export type IconTone = "muted" | "pink" | "light" | "dark";
export interface IconProps {
name: string;
tone?: IconTone;
size?: number;
className?: string;
}
type IconResolver = (name: string, tone: IconTone) => string;
const defaultResolver: IconResolver = (name, tone) => `/icons/${tone}/${name}.svg`;
const IconResolverContext = createContext<IconResolver>(defaultResolver);
export function IconProvider({
resolve,
children,
}: {
resolve: IconResolver;
children: ReactNode;
}) {
return (
<IconResolverContext.Provider value={resolve}>{children}</IconResolverContext.Provider>
);
}
export function Icon({ name, tone = "muted", size = 18, className }: IconProps) {
const resolve = useContext(IconResolverContext);
return (
<img
src={resolve(name, tone)}
alt=""
aria-hidden
width={size}
height={size}
className={className}
style={{ display: "block" }}
/>
);
}
+37
View File
@@ -0,0 +1,37 @@
import type { RankedStatus } from "@directify/shared";
// Mirrors osu!'s own status colors (extracted live from osu.ppy.sh — see
// /.tastemaker/style-lock.md) rather than inventing a new status palette.
const STATUS_COLOR: Record<RankedStatus, string> = {
ranked: "var(--df-lime)",
approved: "var(--df-lime)",
qualified: "var(--df-blue)",
pending: "var(--df-blue)",
loved: "var(--df-pink)",
wip: "var(--df-text-muted)",
graveyard: "var(--df-text-muted)",
unknown: "var(--df-text-muted)",
};
export function StatusBadge({ status }: { status: RankedStatus }) {
const color = STATUS_COLOR[status];
return (
<span
style={{
display: "inline-flex",
alignItems: "center",
gap: 6,
padding: "3px 8px",
borderRadius: 999,
fontSize: 11,
fontWeight: 700,
letterSpacing: 0.3,
textTransform: "uppercase",
color: "var(--df-on-fill)",
background: color,
}}
>
{status}
</span>
);
}
+20
View File
@@ -0,0 +1,20 @@
import type { InputHTMLAttributes } from "react";
export function TextInput({ style, ...rest }: InputHTMLAttributes<HTMLInputElement>) {
return (
<input
style={{
padding: "10px 12px",
borderRadius: "var(--df-radius-sm)",
border: "1px solid var(--df-border)",
background: "var(--df-surface-2)",
color: "var(--df-text)",
fontSize: 14,
fontFamily: "inherit",
outline: "none",
...style,
}}
{...rest}
/>
);
}
+7
View File
@@ -0,0 +1,7 @@
export * from "./Button";
export * from "./Card";
export * from "./DualRangeSlider";
export * from "./Icon";
export * from "./StatusBadge";
export * from "./TextInput";
import "./theme.css";
+155
View File
@@ -0,0 +1,155 @@
/*
* Design tokens for both apps. Dark palette grounded in osu.ppy.sh's own
* rendered styles (getComputedStyle, 2026-09-17); light palette is a
* from-scratch WCAG-checked counterpart (osu! itself has no light mode to
* ground against). Font is Roboto — "Google Sans" (used on the logo) is
* Google-internal and not redistributable, Roboto is the real open-source
* font it derives its character from. Full extraction, contrast matrix, and
* rationale in /.tastemaker/style-lock.md.
*/
:root,
:root[data-theme="dark"] {
--df-bg: #171a1c;
--df-surface-1: #22282a;
--df-surface-2: #2e3538;
--df-surface-3: #394246;
--df-surface-4: #454f54;
--df-border: #394246;
--df-bg-elevated: var(--df-surface-1);
--df-bg-elevated-2: var(--df-surface-2);
--df-text: #f4f2f7;
--df-text-muted: #9ca3a8;
--df-pink: #ff66ab;
--df-blue: #66ccff;
--df-lime: #b3ff66;
--df-on-fill: #171a1c;
--df-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.3);
--df-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
--df-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.35);
--df-glow-pink: 0 0 0 1px rgba(255, 102, 171, 0.3), 0 8px 24px rgba(255, 102, 171, 0.18);
--df-glow-blue: 0 0 0 1px rgba(102, 204, 255, 0.3), 0 8px 24px rgba(102, 204, 255, 0.18);
--df-glass-bg: rgba(34, 40, 42, 0.72);
--df-glass-blur: blur(14px) saturate(140%);
}
:root[data-theme="light"] {
--df-bg: #f4f5f6;
--df-surface-1: #ffffff;
--df-surface-2: #eceeef;
--df-surface-3: #dde0e2;
--df-surface-4: #c7cbce;
--df-border: #dde0e2;
--df-bg-elevated: var(--df-surface-1);
--df-bg-elevated-2: var(--df-surface-2);
--df-text: #171a1c;
--df-text-muted: #5b6367;
--df-pink: #c41f6b;
--df-blue: #0972a8;
--df-lime: #4f7a1a;
--df-on-fill: #ffffff;
--df-shadow-sm: 0 1px 2px rgba(23, 26, 28, 0.08), 0 1px 1px rgba(23, 26, 28, 0.06);
--df-shadow-md: 0 4px 12px rgba(23, 26, 28, 0.1), 0 2px 4px rgba(23, 26, 28, 0.06);
--df-shadow-lg: 0 16px 40px rgba(23, 26, 28, 0.14), 0 4px 10px rgba(23, 26, 28, 0.08);
--df-glow-pink: 0 0 0 1px rgba(196, 31, 107, 0.25), 0 8px 24px rgba(196, 31, 107, 0.12);
--df-glow-blue: 0 0 0 1px rgba(9, 114, 168, 0.25), 0 8px 24px rgba(9, 114, 168, 0.12);
--df-glass-bg: rgba(255, 255, 255, 0.72);
--df-glass-blur: blur(14px) saturate(140%);
}
:root {
--df-radius-sm: 8px;
--df-radius-md: 10px;
--df-radius-lg: 16px;
--df-font: "Roboto", "Segoe UI", system-ui, sans-serif;
}
:root[data-reduce-motion="true"] *,
:root[data-reduce-motion="true"] *::before,
:root[data-reduce-motion="true"] *::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: radial-gradient(circle at 20% -10%, color-mix(in srgb, var(--df-pink) 8%, transparent), transparent 45%),
radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--df-blue) 8%, transparent), transparent 40%),
var(--df-bg);
color: var(--df-text);
font-family: var(--df-font);
transition: background-color 0.2s ease, color 0.2s ease;
}
:focus-visible {
outline: 2px solid var(--df-blue);
outline-offset: 2px;
border-radius: var(--df-radius-sm);
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}
.df-range-thumb {
position: absolute;
top: 0;
left: 0;
width: 100%;
margin: 0;
background: none;
pointer-events: none;
appearance: none;
-webkit-appearance: none;
}
.df-range-thumb::-webkit-slider-thumb {
appearance: none;
-webkit-appearance: none;
pointer-events: auto;
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--df-pink);
border: 2px solid var(--df-on-fill);
box-shadow: var(--df-shadow-sm);
cursor: pointer;
}
.df-range-thumb::-moz-range-thumb {
pointer-events: auto;
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--df-pink);
border: 2px solid var(--df-on-fill);
box-shadow: var(--df-shadow-sm);
cursor: pointer;
}
.df-range-thumb::-webkit-slider-runnable-track,
.df-range-thumb::-moz-range-track {
background: transparent;
}
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"jsx": "react-jsx",
"lib": ["ES2022", "DOM"]
},
"include": ["src"]
}
+5114
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
packages:
- "apps/*"
- "packages/*"
allowBuilds:
electron: true
esbuild: true
+56
View File
@@ -0,0 +1,56 @@
"""One-off script: generate every sized asset the app needs from the two
source logo PNGs in the project root. Not part of any build step, re-run
manually if the source logos change.
"""
from PIL import Image
import os
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LETTER = os.path.join(ROOT, "directify_letter_logo.png")
WORD = os.path.join(ROOT, "directify_fullword_logo.png")
def trim(im: Image.Image) -> Image.Image:
"""Crop to the opaque bounding box so the mark isn't sitting in a huge padded canvas."""
alpha = im.getchannel("A")
bbox = alpha.getbbox()
return im.crop(bbox) if bbox else im
def square(im: Image.Image, padding_pct: float = 0.12) -> Image.Image:
"""Center the mark on a transparent square canvas (correct for icon use —
a direct non-uniform resize to NxN would squash a non-square mark)."""
w, h = im.size
side = round(max(w, h) * (1 + padding_pct))
canvas = Image.new("RGBA", (side, side), (0, 0, 0, 0))
canvas.paste(im, ((side - w) // 2, (side - h) // 2), im)
return canvas
letter = square(trim(Image.open(LETTER).convert("RGBA")))
word = trim(Image.open(WORD).convert("RGBA"))
# --- Windows .ico for electron-builder (win.icon) ---
ico_sizes = [16, 24, 32, 48, 64, 128, 256]
os.makedirs(os.path.join(ROOT, "apps/desktop/build"), exist_ok=True)
letter.save(
os.path.join(ROOT, "apps/desktop/build/icon.ico"),
sizes=[(s, s) for s in ico_sizes],
)
# --- Runtime BrowserWindow icon (dev + packaged, via resources/) ---
os.makedirs(os.path.join(ROOT, "apps/desktop/resources"), exist_ok=True)
letter.resize((256, 256), Image.LANCZOS).save(os.path.join(ROOT, "apps/desktop/resources/icon.png"))
# --- Desktop renderer: wordmark for the sidebar, letter mark if ever needed ---
brand_dir = os.path.join(ROOT, "apps/desktop/src/renderer/src/assets/brand")
os.makedirs(brand_dir, exist_ok=True)
word_w, word_h = word.size
word.resize((900, round(900 * word_h / word_w)), Image.LANCZOS).save(
os.path.join(brand_dir, "wordmark.png")
)
letter.resize((256, 256), Image.LANCZOS).save(os.path.join(brand_dir, "mark.png"))
print("done")
print("letter logo bbox size:", letter.size)
print("wordmark bbox size:", word.size)
+15
View File
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["ES2022"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"isolatedModules": true
}
}