3b0dbd7a8b
Add a second tab in the node Icon picker to choose from the ~2250 brand icons hosted by homarr-labs/dashboard-icons (Plex, Sonarr, Home Assistant, etc.) served via jsDelivr CDN. The Generic tab keeps the existing lucide picker unchanged. Storage uses a 'brand:<slug>' prefix on custom_icon, so existing nodes referencing lucide keys keep working with zero migration. A new resolveCustomIcon helper returns a discriminated union (lucide | brand) and a NodeIcon component centralizes rendering for both kinds. Includes a manifest fetch script (scripts/fetch-dashboard-icons.mjs) and a checked-in dashboardIcons.json snapshot.
28 lines
958 B
JavaScript
28 lines
958 B
JavaScript
#!/usr/bin/env node
|
|
// Regenerate frontend/src/data/dashboardIcons.json from the upstream
|
|
// homarr-labs/dashboard-icons repo. Run manually to refresh the manifest.
|
|
//
|
|
// node scripts/fetch-dashboard-icons.mjs
|
|
|
|
import { writeFileSync, mkdirSync } from 'node:fs'
|
|
import { dirname, resolve } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const TREE_URL = 'https://raw.githubusercontent.com/homarr-labs/dashboard-icons/main/tree.json'
|
|
const OUT = resolve(dirname(fileURLToPath(import.meta.url)), '../src/data/dashboardIcons.json')
|
|
|
|
const res = await fetch(TREE_URL)
|
|
if (!res.ok) {
|
|
console.error(`fetch failed: ${res.status} ${res.statusText}`)
|
|
process.exit(1)
|
|
}
|
|
const tree = await res.json()
|
|
const slugs = (tree.svg ?? [])
|
|
.filter((f) => f.endsWith('.svg'))
|
|
.map((f) => f.slice(0, -4))
|
|
.sort()
|
|
|
|
mkdirSync(dirname(OUT), { recursive: true })
|
|
writeFileSync(OUT, JSON.stringify(slugs))
|
|
console.log(`wrote ${slugs.length} slugs → ${OUT}`)
|