feat: initial Luma implementation

Full self-hosted photo manager with:
- Ingestion worker (chokidar + sharp + exifr, dHash perceptual hashing)
- SQLite schema with WAL mode (photos, tags, collections, duplicate_pairs)
- Express API with keyset pagination, tag/collection/search/date filters
- React + Vite UI: timeline, lightbox, detail panel, tag/collection editors
- Duplicate detection (Union-Find grouping) with review + dismiss UI
- Map view (Leaflet + OpenStreetMap, marker clustering)
- Docker multi-stage build + Compose with inline env config
- GitHub Actions: CI build check + ghcr.io image publish on main/tags

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 4.6 committed 2026-08-17 16:33:55 -04:00
1 parent 03e6d6b628
commit e0f4e8ff0d
32 files changed
+4845

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
import 'dotenv/config';
import chokidar from 'chokidar';
import path from 'path';
import { openDb } from './db.js';
import { ingestFile, isSupported } from './ingest.js';
const PHOTO_DIR = process.env.PHOTO_DIR ?? './photos';
const DB_PATH = process.env.DB_PATH ?? './data/library.db';
const POSTER_DIR = process.env.POSTER_DIR ?? './data/posters';
const db = openDb(DB_PATH);
console.log(`[worker] watching ${path.resolve(PHOTO_DIR)}`);
console.log(`[worker] db at ${path.resolve(DB_PATH)} (${db.count()} photos indexed)`);
// Serial queue: chokidar fires many 'add' events at once on startup;
// process them one at a time to keep memory and I/O pressure low.
const queue = [];
let busy = false;
async function drain() {
if (busy) return;
busy = true;
while (queue.length > 0) {
const fp = queue.shift();
try {
await ingestFile(fp, db, POSTER_DIR);
} catch (err) {
console.error(`[worker] ${path.basename(fp)}: ${err.message}`);
}
}
busy = false;
}
const watcher = chokidar.watch(PHOTO_DIR, {
persistent: true,
ignoreInitial: false,
awaitWriteFinish: { stabilityThreshold: 2000, pollInterval: 100 },
ignored: /(^|[/\\])\../, // skip dotfiles
});
watcher.on('add', (fp) => {
if (!isSupported(fp)) return;
queue.push(path.resolve(fp));
drain();
});
watcher.on('unlink', (fp) => {
const resolved = path.resolve(fp);
db.removePhoto(resolved);
console.log(`[worker] removed ${path.basename(fp)}`);
});
watcher.on('error', (err) => console.error('[worker] watcher error:', err));
process.on('SIGINT', () => {
console.log('\n[worker] shutting down');
watcher.close();
process.exit(0);
});