7 Commits

Author SHA1 Message Date
pvrzz 202d933d4a Auto-scan library, mark/hide downloaded results, and fix download reliability
- Library now auto-rescans every 5s via a shared LibraryProvider instead
  of only on manual Rescan, so newly-installed maps show up without
  navigating away and back.
- Find maps: results already in the library show a checkmark and
  "Downloaded" instead of Install (disabled), and a "Show downloaded"
  toggle (off by default) hides them from results entirely. Installing
  now triggers an immediate library refresh.
- Downloads previously only ever tried the single mirror a search result
  came from; verified live that catboy.best's /d/ endpoint has its own
  short per-beatmapset cooldown independent of the general API rate
  limit, which could fail an install outright even though the map is
  available. installBeatmapSetWithFallback now retries the other
  enabled mirrors (same beatmapset ids across mirrors, since they all
  index the same osu.ppy.sh catalog) before giving up — verified this
  recovers a forced failure on the preferred source.
2026-09-18 07:30:27 -04:00
pvrzz 902e59f974 Fully custom titlebar, search status/sort filters, and import by link
- Replace Window Controls Overlay with a fully frameless window and
  custom minimize/maximize/close buttons, since even the native
  overlay always paints a flat rect that can't blend into this app's
  gradient/glass backgrounds. Sidebar and content now reach the true
  top of the window instead of leaving a reserved gap.
- Add ranked-status filter chips (ranked/qualified/loved/pending/wip/
  graveyard/approved) and a sort dropdown (favourites, plays,
  difficulty, newest/oldest) to Find maps, backed by real Favourites/
  Playcount fields confirmed present on catboy.best's API.
- Add "Import by link": paste an osu! beatmapset URL or bare numeric
  ID to fetch and install it directly, without a text search.
2026-09-17 21:26:12 -04:00
pvrzz 211025f840 Replace default window titlebar with a custom draggable overlay
Uses Windows' Window Controls Overlay (titleBarStyle: hidden +
titleBarOverlay) so minimize/maximize/close stay real, natively-drawn
buttons instead of custom ones, but recolored to match the active
theme. The renderer supplies a transparent draggable strip in place of
the default title/icon bar.
2026-09-17 21:02:23 -04:00
pvrzz 706ce537e0 Remove native menu bar and style scrollbars to match the app theme
The default File/Edit/View/Window/Help menu and unstyled OS scrollbars
made the window look like a generic Electron shell rather than a real
app. Menu.setApplicationMenu(null) drops the menu bar; theme.css now
themes scrollbars (thin, dark thumb) for both WebKit and Firefox.
2026-09-17 20:55:29 -04:00
pvrzz e792929eb6 Bump root package.json version to match 1.0.0 release 2026-09-17 20:09:06 -04:00
pvrzz a5b8a4867b Fix userData folder name to directify, not @directify/desktop 2026-09-17 20:06:22 -04:00
pvrzz 1f1674f441 Fix release naming, lockfile bloat, and source reorder UI 2026-09-17 20:06:21 -04:00
29 changed files with 709 additions and 5225 deletions
+5
View File
@@ -18,3 +18,8 @@ apps/web/
# Staging copies of fetched icons, already mirrored into the app itself
design/
# Generated against the full local monorepo (including the closed-source website),
# which pulls in platform binaries this repo doesn't need. A fresh clone of just
# apps/desktop + packages/* regenerates its own minimal lockfile via `pnpm install`.
pnpm-lock.yaml
+2
View File
@@ -0,0 +1,2 @@
supportedArchitectures.os[]=win32
supportedArchitectures.cpu[]=x64
+1 -1
View File
@@ -12,5 +12,5 @@ extraResources:
win:
target: portable
icon: build/icon.ico
artifactName: ${productName}-${version}-portable.${ext}
artifactName: directify_v${version}.${ext}
asar: true
+1
View File
@@ -1,5 +1,6 @@
{
"name": "@directify/desktop",
"productName": "directify",
"version": "1.0.0",
"description": "A feature-rich, unofficial client for catboy.best. Seamlessly search, download, and manage your osu! beatmaps and beatpacks.",
"author": "directify",
+7
View File
@@ -39,6 +39,7 @@ export interface DirectifyIpcApi {
restoreBackup(zipPath: string): Promise<void>;
searchBeatmaps(query: BeatmapSearchQuery): Promise<BeatmapSearchResult>;
getBeatmapSetById(beatmapSetId: number): Promise<BeatmapSet | null>;
installBeatmapSet(set: BeatmapSet): Promise<void>;
readCollections(): Promise<CollectionDatabase>;
@@ -46,4 +47,10 @@ export interface DirectifyIpcApi {
checkForUpdate(): Promise<UpdateCheckResult>;
openExternal(url: string): Promise<void>;
minimizeWindow(): Promise<void>;
toggleMaximizeWindow(): Promise<void>;
closeWindow(): Promise<void>;
isWindowMaximized(): Promise<boolean>;
onWindowMaximizedChange(callback: (maximized: boolean) => void): () => void;
}
+43 -18
View File
@@ -7,7 +7,7 @@ import {
type BeatmapSet,
type CollectionDatabase,
} from "@directify/shared";
import { app, BrowserWindow, dialog, ipcMain, shell } from "electron";
import { app, BrowserWindow, dialog, ipcMain, shell, Menu } from "electron";
import { existsSync } from "node:fs";
import { readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
@@ -22,11 +22,17 @@ import {
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 {
getBeatmapSetByIdWithFallback,
installBeatmapSetWithFallback,
searchWithFallback,
} from "./source-registry.js";
import { checkForUpdate } from "./updates.js";
const ALLOWED_EXTERNAL_HOSTS = ["github.com", "www.github.com"];
let mainWindow: BrowserWindow | null = null;
function requireInstallDir(): string {
const { osuInstallDir } = loadSettings();
if (!osuInstallDir) throw new Error("osu! install directory is not configured yet.");
@@ -80,22 +86,19 @@ function registerIpcHandlers(): void {
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("beatmaps:getById", (_e, beatmapSetId: number) =>
getBeatmapSetByIdWithFallback(loadSettings().searchSources, beatmapSetId)
);
ipcMain.handle("beatmaps:install", (_e, set: BeatmapSet) =>
installBeatmapSetWithFallback(loadSettings().searchSources, set.source, set.id, (downloadUrl) =>
installBeatmapSet(
requireInstallDir(),
downloadUrl,
`${set.id} ${set.artist} - ${set.title}`,
set.coverUrl
)
)
);
ipcMain.handle("collections:read", async () => {
const path = collectionDbPath(requireInstallDir());
@@ -109,6 +112,15 @@ function registerIpcHandlers(): void {
await writeFile(path, writeCollectionDb(db));
});
ipcMain.handle("window:minimize", () => mainWindow?.minimize());
ipcMain.handle("window:toggleMaximize", () => {
if (!mainWindow) return;
if (mainWindow.isMaximized()) mainWindow.unmaximize();
else mainWindow.maximize();
});
ipcMain.handle("window:close", () => mainWindow?.close());
ipcMain.handle("window:isMaximized", () => mainWindow?.isMaximized() ?? false);
ipcMain.handle("app:checkForUpdate", () => checkForUpdate(app.getVersion()));
ipcMain.handle("app:openExternal", (_e, url: string) => {
const host = new URL(url).hostname;
@@ -131,6 +143,11 @@ function createWindow(): void {
height: 800,
backgroundColor: "#171a1c",
icon: resolveIconPath(),
// Fully custom titlebar: the native one (and Windows' Window Controls
// Overlay, which always paints a flat-color rect behind its buttons)
// can't blend into this app's gradient/glass backgrounds. The renderer
// draws its own drag strip and minimize/maximize/close buttons instead.
frame: false,
webPreferences: {
preload: join(__dirname, "../preload/index.js"),
contextIsolation: true,
@@ -138,6 +155,12 @@ function createWindow(): void {
sandbox: true,
},
});
mainWindow = win;
win.on("closed", () => {
if (mainWindow === win) mainWindow = null;
});
win.on("maximize", () => win.webContents.send("window:maximizedChange", true));
win.on("unmaximize", () => win.webContents.send("window:maximizedChange", false));
if (process.env.ELECTRON_RENDERER_URL) {
win.loadURL(process.env.ELECTRON_RENDERER_URL);
@@ -146,6 +169,8 @@ function createWindow(): void {
}
}
Menu.setApplicationMenu(null);
app.whenReady().then(async () => {
const settings = loadSettings();
await applyProxySettings(settings.proxy);
+62 -13
View File
@@ -1,11 +1,18 @@
// 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";
// mirror faster than a search reasonably should. Downloads prefer the
// mirror a search result actually came from (freshest data), but fall back
// to any other enabled mirror on failure — beatmapset ids are the same
// across mirrors (they all index the same osu.ppy.sh catalog), so a mirror
// having a transient outage or its own rate limit doesn't need to fail the
// whole install.
import type {
BeatmapSearchQuery,
BeatmapSearchResult,
BeatmapSet,
BeatmapSourceConfig,
} from "@directify/shared";
import { MirrorSource } from "./sources/mirror-source.js";
const MIN_REQUEST_INTERVAL_MS = 350;
@@ -43,14 +50,56 @@ export async function searchWithFallback(
throw lastError instanceof Error ? lastError : new Error("All beatmap sources failed.");
}
export async function resolveDownloadUrlForResult(
export async function getBeatmapSetByIdWithFallback(
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);
): Promise<BeatmapSet | null> {
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);
const set = await new MirrorSource(config).getBeatmapSet(beatmapSetId);
if (set) return set;
} catch (err) {
lastError = err;
}
}
if (lastError) throw lastError instanceof Error ? lastError : new Error("All beatmap sources failed.");
return null;
}
export async function installBeatmapSetWithFallback(
sources: BeatmapSourceConfig[],
preferredSourceName: string,
beatmapSetId: number,
install: (downloadUrl: string) => Promise<void>
): Promise<void> {
const candidates = enabledInOrder(sources);
if (candidates.length === 0) {
throw new Error("No beatmap search sources are enabled.");
}
const ordered = [
...candidates.filter((c) => c.name === preferredSourceName),
...candidates.filter((c) => c.name !== preferredSourceName),
];
let lastError: unknown;
for (const config of ordered) {
try {
await throttle(config.id);
const url = await new MirrorSource(config).resolveDownloadUrl(beatmapSetId);
if (!url) continue;
await install(url);
return;
} catch (err) {
lastError = err;
}
}
throw lastError instanceof Error ? lastError : new Error("No source could download this beatmapset.");
}
@@ -11,6 +11,7 @@ import type {
BeatmapSearchQuery,
BeatmapSearchResult,
BeatmapSet,
BeatmapSortOption,
OsuMode,
RankedStatus,
} from "@directify/shared";
@@ -58,6 +59,7 @@ interface MirrorSearchBeatmap {
OD: number;
HP: number;
FileMD5: string;
Playcount?: number;
}
interface MirrorSearchResult {
@@ -71,6 +73,7 @@ interface MirrorSearchResult {
Genre?: { ID: number; Name: string };
Language?: { ID: number; Name: string };
ChildrenBeatmaps: MirrorSearchBeatmap[];
Favourites?: number;
}
function coverUrl(setId: number): string {
@@ -81,6 +84,35 @@ function previewUrl(setId: number): string {
return `https://b.ppy.sh/preview/${setId}.mp3`;
}
function maxDifficulty(set: BeatmapSet): number {
return set.beatmaps.reduce((max, b) => Math.max(max, b.difficultyRating), 0);
}
// The search API returns results in the mirror's own relevance order, which
// is left untouched unless the user explicitly asked for something else.
function sortResults(results: BeatmapSet[], sort: BeatmapSortOption | undefined): void {
switch (sort) {
case "favourites":
results.sort((a, b) => (b.favouriteCount ?? 0) - (a.favouriteCount ?? 0));
break;
case "plays":
results.sort((a, b) => (b.playCount ?? 0) - (a.playCount ?? 0));
break;
case "difficulty-desc":
results.sort((a, b) => maxDifficulty(b) - maxDifficulty(a));
break;
case "difficulty-asc":
results.sort((a, b) => maxDifficulty(a) - maxDifficulty(b));
break;
case "newest":
results.sort((a, b) => Date.parse(b.submittedAt) - Date.parse(a.submittedAt));
break;
case "oldest":
results.sort((a, b) => Date.parse(a.submittedAt) - Date.parse(b.submittedAt));
break;
}
}
export class MirrorSource implements BeatmapSource {
readonly id: string;
readonly name: string;
@@ -123,6 +155,8 @@ export class MirrorSource implements BeatmapSource {
updatedAt: raw.LastUpdate,
beatmaps,
source: this.name,
favouriteCount: raw.Favourites,
playCount: raw.ChildrenBeatmaps.reduce((sum, b) => sum + (b.Playcount ?? 0), 0),
};
}
@@ -173,6 +207,8 @@ export class MirrorSource implements BeatmapSource {
return true;
});
sortResults(results, query.sort);
return { results, page, pageSize, total: results.length };
}
@@ -210,6 +246,8 @@ export class MirrorSource implements BeatmapSource {
updatedAt: raw.last_updated ?? "",
beatmaps,
source: this.name,
favouriteCount: raw.favourite_count,
playCount: raw.play_count,
};
}
+11
View File
@@ -19,6 +19,7 @@ const api: DirectifyIpcApi = {
restoreBackup: (zipPath) => ipcRenderer.invoke("backup:restore", zipPath),
searchBeatmaps: (query) => ipcRenderer.invoke("beatmaps:search", query),
getBeatmapSetById: (beatmapSetId) => ipcRenderer.invoke("beatmaps:getById", beatmapSetId),
installBeatmapSet: (set) => ipcRenderer.invoke("beatmaps:install", set),
readCollections: () => ipcRenderer.invoke("collections:read"),
@@ -26,6 +27,16 @@ const api: DirectifyIpcApi = {
checkForUpdate: () => ipcRenderer.invoke("app:checkForUpdate"),
openExternal: (url) => ipcRenderer.invoke("app:openExternal", url),
minimizeWindow: () => ipcRenderer.invoke("window:minimize"),
toggleMaximizeWindow: () => ipcRenderer.invoke("window:toggleMaximize"),
closeWindow: () => ipcRenderer.invoke("window:close"),
isWindowMaximized: () => ipcRenderer.invoke("window:isMaximized"),
onWindowMaximizedChange: (callback) => {
const listener = (_e: unknown, maximized: boolean) => callback(maximized);
ipcRenderer.on("window:maximizedChange", listener);
return () => ipcRenderer.removeListener("window:maximizedChange", listener);
},
};
contextBridge.exposeInMainWorld("directify", api);
+22 -3
View File
@@ -13,6 +13,7 @@ import { SettingsPage } from "./pages/SettingsPage";
import { useSettings } from "./settings-context";
import { ShortcutsHelp } from "./ShortcutsHelp";
import { UpdateBanner } from "./UpdateBanner";
import { WindowControls } from "./WindowControls";
import type { UpdateCheckResult } from "../../main/updates";
const SHORTCUT_ROUTES = ["/", "/search", "/collections", "/backup", "/settings"];
@@ -59,14 +60,18 @@ export function App() {
if (!settings) return;
const root = document.documentElement;
function applyTheme(resolved: "dark" | "light") {
root.dataset.theme = resolved;
}
if (settings.theme === "system") {
const media = window.matchMedia("(prefers-color-scheme: dark)");
const apply = () => (root.dataset.theme = media.matches ? "dark" : "light");
const apply = () => applyTheme(media.matches ? "dark" : "light");
apply();
media.addEventListener("change", apply);
return () => media.removeEventListener("change", apply);
}
root.dataset.theme = settings.theme;
applyTheme(settings.theme);
}, [settings?.theme]);
useEffect(() => {
@@ -89,6 +94,20 @@ export function App() {
return (
<MotionConfig reducedMotion={settings?.reduceMotion ? "always" : "user"}>
<div style={{ display: "flex", flexDirection: "column", height: "100vh", overflow: "hidden" }}>
<div
style={
{
position: "fixed",
top: 0,
left: 0,
right: 0,
height: 32,
zIndex: 90,
WebkitAppRegion: "drag",
} as React.CSSProperties
}
/>
<WindowControls />
{updateInfo?.hasUpdate && updateInfo.latestVersion && updateInfo.releaseUrl && (
<UpdateBanner
latestVersion={updateInfo.latestVersion}
@@ -101,7 +120,7 @@ export function App() {
aria-label="Primary"
style={{
width: 220,
padding: "24px 12px",
padding: "36px 12px 24px",
borderRight: "1px solid var(--df-border)",
background: "var(--df-glass-bg)",
backdropFilter: "var(--df-glass-blur)",
@@ -19,6 +19,9 @@ export function UpdateBanner({
initial={{ opacity: 0, y: -12 }}
animate={{ opacity: 1, y: 0 }}
style={{
// Below the app's fixed title/window-controls strip (32px), so this
// banner's own buttons don't collide with it.
marginTop: 32,
display: "flex",
alignItems: "center",
justifyContent: "space-between",
@@ -0,0 +1,91 @@
// Custom titlebar buttons: Electron's native title bar (and even the Windows
// "Window Controls Overlay" API) always paints a flat, opaque rect behind
// itself, which can't blend into this app's gradient/glass backgrounds — so
// minimize/maximize/close are drawn here instead, themed to match.
import { useEffect, useState } from "react";
function WindowButton({
label,
onClick,
danger,
children,
}: {
label: string;
onClick: () => void;
danger?: boolean;
children: React.ReactNode;
}) {
return (
<button
aria-label={label}
onClick={onClick}
style={
{
WebkitAppRegion: "no-drag",
width: 46,
height: 32,
display: "flex",
alignItems: "center",
justifyContent: "center",
background: "transparent",
border: "none",
color: "var(--df-text-muted)",
cursor: "pointer",
} as React.CSSProperties
}
onMouseEnter={(e) => {
e.currentTarget.style.background = danger ? "#e81123" : "var(--df-surface-3)";
e.currentTarget.style.color = danger ? "#ffffff" : "var(--df-text)";
}}
onMouseLeave={(e) => {
e.currentTarget.style.background = "transparent";
e.currentTarget.style.color = "var(--df-text-muted)";
}}
>
{children}
</button>
);
}
export function WindowControls() {
const [maximized, setMaximized] = useState(false);
useEffect(() => {
window.directify.isWindowMaximized().then(setMaximized);
return window.directify.onWindowMaximizedChange(setMaximized);
}, []);
return (
<div style={{ display: "flex", position: "fixed", top: 0, right: 0, zIndex: 100 }}>
<WindowButton label="Minimize" onClick={() => window.directify.minimizeWindow()}>
<svg width="10" height="10" viewBox="0 0 10 10">
<path d="M0 5h10" stroke="currentColor" strokeWidth="1" />
</svg>
</WindowButton>
<WindowButton
label={maximized ? "Restore" : "Maximize"}
onClick={() => window.directify.toggleMaximizeWindow()}
>
{maximized ? (
<svg width="10" height="10" viewBox="0 0 10 10">
<path
d="M2 0h8v8h-2M0 2h8v8H0z"
fill="none"
stroke="currentColor"
strokeWidth="1"
/>
</svg>
) : (
<svg width="10" height="10" viewBox="0 0 10 10">
<rect x="0.5" y="0.5" width="9" height="9" fill="none" stroke="currentColor" strokeWidth="1" />
</svg>
)}
</WindowButton>
<WindowButton label="Close" danger onClick={() => window.directify.closeWindow()}>
<svg width="10" height="10" viewBox="0 0 10 10">
<path d="M0 0l10 10M10 0L0 10" stroke="currentColor" strokeWidth="1" />
</svg>
</WindowButton>
</div>
);
}
@@ -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="M20 6L9 17l-5-5"/></svg>

After

Width:  |  Height:  |  Size: 209 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 9l6 6l6-6"/></svg>

After

Width:  |  Height:  |  Size: 206 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="m18 15l-6-6l-6 6"/></svg>

After

Width:  |  Height:  |  Size: 210 B

@@ -0,0 +1,45 @@
// Shared installed-library state: scanned once on mount, then re-scanned
// automatically on an interval so newly-installed maps (from Find maps)
// show up in the Library without a manual rescan, and so Find maps can
// mark results that are already downloaded.
import type { BeatmapSet } from "@directify/shared";
import { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from "react";
const AUTO_SCAN_INTERVAL_MS = 5000;
interface LibraryContextValue {
sets: BeatmapSet[] | null;
installedIds: Set<number>;
refresh: () => Promise<void>;
}
const LibraryContext = createContext<LibraryContextValue | null>(null);
export function LibraryProvider({ children }: { children: ReactNode }) {
const [sets, setSets] = useState<BeatmapSet[] | null>(null);
const refresh = useCallback(async () => {
const scanned = await window.directify.scanLibrary();
setSets(scanned);
}, []);
useEffect(() => {
refresh();
const interval = setInterval(refresh, AUTO_SCAN_INTERVAL_MS);
return () => clearInterval(interval);
}, [refresh]);
const installedIds = useMemo(() => new Set((sets ?? []).map((s) => s.id)), [sets]);
return (
<LibraryContext.Provider value={{ sets, installedIds, refresh }}>
{children}
</LibraryContext.Provider>
);
}
export function useLibrary(): LibraryContextValue {
const ctx = useContext(LibraryContext);
if (!ctx) throw new Error("useLibrary must be used within LibraryProvider");
return ctx;
}
+19 -1
View File
@@ -36,7 +36,25 @@
"genre": "Genre",
"language": "Language",
"any": "Any",
"starRating": "Star rating"
"all": "All",
"starRating": "Star rating",
"status": "Status",
"sortBy": "Sort by",
"sortRelevance": "Relevance",
"sortFavourites": "Most favourited",
"sortPlays": "Most played",
"sortDifficultyDesc": "Difficulty: high to low",
"sortDifficultyAsc": "Difficulty: low to high",
"sortNewest": "Newest",
"sortOldest": "Oldest",
"importByLink": "Import by link",
"importByLinkPlaceholder": "Paste a beatmap link or ID...",
"importButton": "Import",
"importNotFound": "Couldn't find a beatmapset at that link.",
"importInvalidLink": "That doesn't look like a beatmap link or ID.",
"showDownloaded": "Show downloaded",
"downloaded": "Downloaded",
"allDownloaded": "You already have every result here — enable \"Show downloaded\" to see them."
},
"collections": {
"title": "Collections",
+19 -1
View File
@@ -36,7 +36,25 @@
"genre": "Género",
"language": "Idioma",
"any": "Cualquiera",
"starRating": "Dificultad (estrellas)"
"all": "Todos",
"starRating": "Dificultad (estrellas)",
"status": "Estado",
"sortBy": "Ordenar por",
"sortRelevance": "Relevancia",
"sortFavourites": "Más favoritos",
"sortPlays": "Más jugados",
"sortDifficultyDesc": "Dificultad: mayor a menor",
"sortDifficultyAsc": "Dificultad: menor a mayor",
"sortNewest": "Más recientes",
"sortOldest": "Más antiguos",
"importByLink": "Importar por enlace",
"importByLinkPlaceholder": "Pega un enlace o ID de beatmap...",
"importButton": "Importar",
"importNotFound": "No se encontró ningún beatmapset en ese enlace.",
"importInvalidLink": "Eso no parece un enlace o ID de beatmap válido.",
"showDownloaded": "Mostrar descargados",
"downloaded": "Descargado",
"allDownloaded": "Ya tienes todos los resultados aquí — activa \"Mostrar descargados\" para verlos."
},
"collections": {
"title": "Colecciones",
+19 -1
View File
@@ -35,7 +35,25 @@
"genre": "ジャンル",
"language": "言語",
"any": "指定なし",
"starRating": "スター難易度"
"all": "すべて",
"starRating": "スター難易度",
"status": "ステータス",
"sortBy": "並び替え",
"sortRelevance": "関連度",
"sortFavourites": "お気に入り数",
"sortPlays": "プレイ数",
"sortDifficultyDesc": "難易度: 高い順",
"sortDifficultyAsc": "難易度: 低い順",
"sortNewest": "新しい順",
"sortOldest": "古い順",
"importByLink": "リンクからインポート",
"importByLinkPlaceholder": "譜面のリンクまたはIDを貼り付け...",
"importButton": "インポート",
"importNotFound": "そのリンクの譜面セットが見つかりませんでした。",
"importInvalidLink": "有効な譜面リンクまたはIDではないようです。",
"showDownloaded": "ダウンロード済みを表示",
"downloaded": "ダウンロード済み",
"allDownloaded": "ここにある結果はすべてダウンロード済みです。「ダウンロード済みを表示」を有効にすると表示されます。"
},
"collections": {
"title": "コレクション",
+6 -3
View File
@@ -11,6 +11,7 @@ import { HashRouter } from "react-router-dom";
import { App } from "./App";
import "./i18n";
import { resolveDesktopIcon } from "./icon-map";
import { LibraryProvider } from "./library-context";
import { installMockDirectifyIfNeeded } from "./mock-directify";
import { SettingsProvider } from "./settings-context";
@@ -20,9 +21,11 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<IconProvider resolve={resolveDesktopIcon}>
<SettingsProvider>
<HashRouter>
<App />
</HashRouter>
<LibraryProvider>
<HashRouter>
<App />
</HashRouter>
</LibraryProvider>
</SettingsProvider>
</IconProvider>
</React.StrictMode>
@@ -185,6 +185,7 @@ export function installMockDirectifyIfNeeded(): void {
pageSize: 30,
total: 2,
}),
getBeatmapSetById: async () => null,
installBeatmapSet: async () => {},
readCollections: async () => collections,
@@ -196,6 +197,12 @@ export function installMockDirectifyIfNeeded(): void {
openExternal: async (url) => {
window.open(url, "_blank");
},
minimizeWindow: async () => {},
toggleMaximizeWindow: async () => {},
closeWindow: async () => {},
isWindowMaximized: async () => false,
onWindowMaximizedChange: () => () => {},
};
window.directify = mock;
@@ -1,12 +1,13 @@
// Library page: shows installed beatmapsets (scanned from Songs), lets the user filter, select, add to a collection, or delete.
// Library page: shows installed beatmapsets (auto-scanned from Songs by LibraryProvider), 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";
import { useLibrary } from "../library-context";
export function LibraryPage() {
const { t } = useTranslation();
const [sets, setSets] = useState<BeatmapSet[] | null>(null);
const { sets, refresh } = useLibrary();
const [collections, setCollections] = useState<CollectionDatabase | null>(null);
const [query, setQuery] = useState("");
const [selected, setSelected] = useState<Set<string>>(new Set());
@@ -16,23 +17,22 @@ export function LibraryPage() {
async function rescan() {
setStatus(t("library.scanning"));
try {
const [scanned, db] = await Promise.all([
window.directify.scanLibrary(),
window.directify.readCollections(),
]);
setSets(scanned);
const [, db] = await Promise.all([refresh(), window.directify.readCollections()]);
setCollections(db);
setSelected(new Set());
setStatus(t("library.foundCount", { count: scanned.length }));
} catch (err) {
setStatus((err as Error).message);
}
}
useEffect(() => {
rescan();
window.directify.readCollections().then(setCollections);
}, []);
useEffect(() => {
if (sets) setStatus(t("library.foundCount", { count: sets.length }));
}, [sets, t]);
const filtered = useMemo(() => {
if (!sets) return [];
const q = query.trim().toLowerCase();
@@ -1,8 +1,16 @@
// 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";
// Find-maps page: osu!lazer-style search — free text plus mode, key count, genre, language, status, star-rating, and sort filters — against the active (fallback-chain) beatmap source. Also supports pasting a beatmapset link/ID to fetch it directly.
import {
GENRES,
LANGUAGES,
type BeatmapSet,
type BeatmapSortOption,
type OsuMode,
type RankedStatus,
} from "@directify/shared";
import { Button, Card, DualRangeSlider, Icon, StatusBadge, TextInput } from "@directify/ui";
import { useEffect, useRef, useState } from "react";
import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { useLibrary } from "../library-context";
const MODES: { value: OsuMode | ""; label: string }[] = [
{ value: "", label: "All" },
@@ -14,6 +22,47 @@ const MODES: { value: OsuMode | ""; label: string }[] = [
const MANIA_KEY_COUNTS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const STATUSES: RankedStatus[] = [
"ranked",
"qualified",
"loved",
"pending",
"wip",
"graveyard",
"approved",
];
const SORT_OPTIONS: BeatmapSortOption[] = [
"relevance",
"favourites",
"plays",
"difficulty-desc",
"difficulty-asc",
"newest",
"oldest",
];
const SORT_LABEL_KEY: Record<BeatmapSortOption, string> = {
relevance: "search.sortRelevance",
favourites: "search.sortFavourites",
plays: "search.sortPlays",
"difficulty-desc": "search.sortDifficultyDesc",
"difficulty-asc": "search.sortDifficultyAsc",
newest: "search.sortNewest",
oldest: "search.sortOldest",
};
/** Pulls a beatmapset id out of an osu!/mirror URL, or a bare numeric id typed/pasted directly. */
function parseBeatmapSetId(input: string): number | null {
const trimmed = input.trim();
if (/^\d+$/.test(trimmed)) return Number(trimmed);
const match = trimmed.match(/beatmapsets\/(\d+)/);
if (match) return Number(match[1]);
return null;
}
function chipStyle(active: boolean): React.CSSProperties {
return {
padding: "6px 12px",
@@ -41,16 +90,22 @@ function selectStyle(): React.CSSProperties {
export function SearchPage() {
const { t } = useTranslation();
const { installedIds, refresh: refreshLibrary } = useLibrary();
const [showDownloaded, setShowDownloaded] = useState(false);
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 [rankedStatus, setRankedStatus] = useState<RankedStatus | "">("");
const [sort, setSort] = useState<BeatmapSortOption>("relevance");
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 [importLink, setImportLink] = useState("");
const [importing, setImporting] = useState(false);
const debounceRef = useRef<ReturnType<typeof setTimeout>>();
async function search() {
@@ -62,6 +117,8 @@ export function SearchPage() {
keys: mode === "mania" && keys ? keys : undefined,
genre: genre === "" ? undefined : genre,
language: language === "" ? undefined : language,
status: rankedStatus || undefined,
sort,
minStars: starRange[0] > 0 ? starRange[0] : undefined,
maxStars: starRange[1] < 10 ? starRange[1] : undefined,
page: 1,
@@ -82,7 +139,32 @@ export function SearchPage() {
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]]);
}, [query, mode, keys, genre, language, rankedStatus, sort, starRange[0], starRange[1]]);
async function importByLink() {
const beatmapSetId = parseBeatmapSetId(importLink);
if (!beatmapSetId) {
setStatus(t("search.importInvalidLink"));
return;
}
setImporting(true);
setStatus(t("common.loading"));
try {
const set = await window.directify.getBeatmapSetById(beatmapSetId);
if (!set) {
setStatus(t("search.importNotFound"));
return;
}
setResults([set]);
setStatus(t("search.resultCount", { count: 1 }));
setImportLink("");
} catch (err) {
setStatus((err as Error).message);
} finally {
setImporting(false);
}
}
async function install(set: BeatmapSet) {
setInstalling(set.id);
@@ -90,6 +172,7 @@ export function SearchPage() {
try {
await window.directify.installBeatmapSet(set);
setStatus(`${set.artist} - ${set.title}`);
await refreshLibrary();
} catch (err) {
setStatus((err as Error).message);
} finally {
@@ -97,6 +180,11 @@ export function SearchPage() {
}
}
const visibleResults = useMemo(
() => (showDownloaded ? results : results.filter((set) => !installedIds.has(set.id))),
[results, showDownloaded, installedIds]
);
return (
<div style={{ display: "flex", flexDirection: "column", gap: 20 }}>
<div style={{ position: "relative" }}>
@@ -114,6 +202,23 @@ export function SearchPage() {
/>
</div>
<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
<span style={{ fontSize: 12, color: "var(--df-text-muted)" }}>{t("search.importByLink")}</span>
<div style={{ display: "flex", gap: 8 }}>
<TextInput
value={importLink}
onChange={(e) => setImportLink(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && importByLink()}
placeholder={t("search.importByLinkPlaceholder")}
aria-label={t("search.importByLink")}
style={{ flex: 1 }}
/>
<Button variant="secondary" onClick={importByLink} disabled={importing || !importLink.trim()}>
{t("search.importButton")}
</Button>
</div>
</div>
<div
style={{
display: "flex",
@@ -147,7 +252,40 @@ export function SearchPage() {
</div>
)}
<div style={{ display: "flex", flexDirection: "column", gap: 4 }}>
<span style={{ fontSize: 12, color: "var(--df-text-muted)" }}>{t("search.status")}</span>
<div style={{ display: "flex", gap: 8, flexWrap: "wrap" }}>
<button style={chipStyle(rankedStatus === "")} onClick={() => setRankedStatus("")}>
{t("search.all")}
</button>
{STATUSES.map((s) => (
<button
key={s}
style={{ ...chipStyle(rankedStatus === s), textTransform: "capitalize" }}
onClick={() => setRankedStatus(rankedStatus === s ? "" : s)}
>
{s}
</button>
))}
</div>
</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.sortBy")}</span>
<select
value={sort}
onChange={(e) => setSort(e.target.value as BeatmapSortOption)}
style={selectStyle()}
>
{SORT_OPTIONS.map((opt) => (
<option key={opt} value={opt}>
{t(SORT_LABEL_KEY[opt])}
</option>
))}
</select>
</label>
<label style={{ display: "flex", flexDirection: "column", gap: 4 }}>
<span style={{ fontSize: 12, color: "var(--df-text-muted)" }}>{t("search.genre")}</span>
<select
@@ -192,13 +330,33 @@ export function SearchPage() {
/>
</div>
{status && (
<p role="status" style={{ color: "var(--df-text-muted)", fontSize: 13 }}>
{status}
</p>
)}
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", gap: 12 }}>
{status && (
<p role="status" style={{ color: "var(--df-text-muted)", fontSize: 13, margin: 0 }}>
{status}
</p>
)}
<label
style={{
display: "flex",
alignItems: "center",
gap: 6,
fontSize: 13,
color: "var(--df-text-muted)",
marginLeft: "auto",
whiteSpace: "nowrap",
}}
>
<input
type="checkbox"
checked={showDownloaded}
onChange={(e) => setShowDownloaded(e.target.checked)}
/>
{t("search.showDownloaded")}
</label>
</div>
{results.length === 0 ? (
{visibleResults.length === 0 ? (
<div
style={{
padding: 40,
@@ -208,7 +366,7 @@ export function SearchPage() {
borderRadius: "var(--df-radius-lg)",
}}
>
{t("search.emptyPrompt")}
{results.length > 0 ? t("search.allDownloaded") : t("search.emptyPrompt")}
</div>
) : (
<div
@@ -218,28 +376,35 @@ export function SearchPage() {
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>
))}
{visibleResults.map((set) => {
const downloaded = installedIds.has(set.id);
return (
<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 || downloaded}
aria-label={`${t("common.install")} ${set.title}`}
>
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<Icon name={downloaded ? "check" : "download"} size={14} />
{downloaded
? t("search.downloaded")
: installing === set.id
? t("common.installing")
: t("common.install")}
</span>
</Button>
</Card>
);
})}
</div>
)}
</div>
@@ -253,7 +253,7 @@ export function SettingsPage() {
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
gap: 12,
padding: "10px 14px",
borderRadius: "var(--df-radius-sm)",
background: "var(--df-surface-2)",
@@ -261,27 +261,56 @@ export function SettingsPage() {
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={{
display: "flex",
flexDirection: "column",
borderRadius: "var(--df-radius-sm)",
overflow: "hidden",
border: "1px solid var(--df-border)",
flexShrink: 0,
}}
>
<button
aria-label={t("settings.moveUp")}
disabled={index === 0}
onClick={() => moveSource(index, -1)}
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
width: 24,
height: 18,
background: "var(--df-surface-1)",
border: "none",
borderBottom: "1px solid var(--df-border)",
cursor: index === 0 ? "not-allowed" : "pointer",
opacity: index === 0 ? 0.35 : 1,
}}
>
<Icon name="chevron-up" size={12} />
</button>
<button
aria-label={t("settings.moveDown")}
disabled={index === settings.searchSources.length - 1}
onClick={() => moveSource(index, 1)}
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
width: 24,
height: 18,
background: "var(--df-surface-1)",
border: "none",
cursor: index === settings.searchSources.length - 1 ? "not-allowed" : "pointer",
opacity: index === settings.searchSources.length - 1 ? 0.35 : 1,
}}
>
<Icon name="chevron-down" size={12} />
</button>
</div>
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontWeight: 600, fontSize: 14 }}>
{source.name}{" "}
{source.builtIn && (
@@ -294,7 +323,8 @@ export function SettingsPage() {
{source.baseUrl}
</div>
</div>
<div style={{ display: "flex", gap: 8, alignItems: "center" }}>
<div style={{ display: "flex", gap: 8, alignItems: "center", flexShrink: 0 }}>
<label
style={{ display: "flex", alignItems: "center", gap: 6, fontSize: 12 }}
title={t("settings.enabled")}
@@ -312,6 +342,7 @@ export function SettingsPage() {
variant="ghost"
aria-label={`${t("common.remove")} ${source.name}`}
onClick={() => removeSource(source.id)}
style={{ padding: "6px 8px" }}
>
<Icon name="trash-2" size={14} />
</Button>
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "directify",
"private": true,
"version": "0.1.0",
"version": "1.0.0",
"description": "A feature-rich, unofficial client for catboy.best.",
"scripts": {
"dev:desktop": "pnpm --filter @directify/desktop dev",
+12
View File
@@ -48,6 +48,8 @@ export interface BeatmapSet {
source: string;
/** Present for beatmapsets found on disk; the Songs subfolder name, used for file operations. */
folderName?: string;
favouriteCount?: number;
playCount?: number;
}
/** osu!'s own genre enum (matches the IDs osu!/mirrors report; "any" omitted since it means "no filter"). */
@@ -85,6 +87,15 @@ export const LANGUAGES: Record<number, string> = {
14: "Other",
};
export type BeatmapSortOption =
| "relevance"
| "favourites"
| "plays"
| "difficulty-asc"
| "difficulty-desc"
| "newest"
| "oldest";
export interface BeatmapSearchQuery {
query?: string;
mode?: OsuMode;
@@ -97,6 +108,7 @@ export interface BeatmapSearchQuery {
language?: number;
/** Mania key count (4, 7, ...) — matched against difficulty CS. Ignored unless mode is "mania". */
keys?: number;
sort?: BeatmapSortOption;
page?: number;
pageSize?: number;
}
+6 -4
View File
@@ -37,18 +37,20 @@ const hoverGlow: Partial<Record<NonNullable<ButtonProps["variant"]>, string>> =
accent: "var(--df-glow-blue)",
};
export function Button({ variant = "primary", style, children, ...rest }: ButtonProps) {
export function Button({ variant = "primary", style, disabled, children, ...rest }: ButtonProps) {
return (
<motion.button
whileHover={{ y: -2, filter: "brightness(1.08)", boxShadow: hoverGlow[variant] }}
whileTap={{ y: 0, scale: 0.98 }}
disabled={disabled}
whileHover={disabled ? undefined : { y: -2, filter: "brightness(1.08)", boxShadow: hoverGlow[variant] }}
whileTap={disabled ? undefined : { 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",
cursor: disabled ? "not-allowed" : "pointer",
opacity: disabled ? 0.4 : 1,
...variantStyles[variant],
...style,
}}
+25
View File
@@ -153,3 +153,28 @@ body {
.df-range-thumb::-moz-range-track {
background: transparent;
}
* {
scrollbar-width: thin;
scrollbar-color: var(--df-surface-4) transparent;
}
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background-color: var(--df-surface-4);
border-radius: var(--df-radius-lg);
border: 2px solid transparent;
background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
background-color: var(--df-text-muted);
}
-5114
View File
File diff suppressed because it is too large Load Diff