content: 2026-05-05 capture run — 28 finds, 2 reviews, set-pick tooling
Captured 27 finds from the daily sweep across 15 sources (Daring Fireball, HN Show HN, Kottke, Wallpaper, Outbound, Uncommon Goods, Kikkerland, BIFL, Quote Investigator, Marginalian, r/dadjokes, icanhazdadjoke, r/shortcuts, Recomendo, Messy Nessy) plus one user- suggested find (valchoose-barf-bags) and 11 additional reader- suggestion finds (appcleaner, blip, cleanmykeyboard, clocker, daisydisk, ia-writer, launchos, macfolio, mos, vivid, wallspace). New reviews: monitorcontrol (graduated from today's reader suggestion, category interface) and blip (graduated from today's reader suggestion, category indie). Both registered in hero.ts. Site tooling: new dev-only POST /api/set-pick middleware that rewrites HERO_SLUG in src/pages/index.astro for the Make today's pick action. EditConfirm reworked to support a non-copy "set-pick" mode; EditAction takes action and slug props; the reviews template switches the toolbar button over to the new wiring. Log + candidate-sources updated. Two new candidates: Routinehub.co and Moss & Fog.
This commit is contained in:
+32
-1
@@ -11,6 +11,8 @@ const EXCLUDED_PATHS = new Set([
|
||||
]);
|
||||
|
||||
const FIND_ROOT = path.resolve('src/content/find');
|
||||
const REVIEW_ROOT = path.resolve('src/content/reviews');
|
||||
const HOME_PAGE = path.resolve('src/pages/index.astro');
|
||||
const VALID_SLUG = /^[a-z0-9][a-z0-9-]*$/;
|
||||
const VALID_TAG = /^[a-z0-9][a-z0-9-]{0,40}$/i;
|
||||
|
||||
@@ -101,11 +103,40 @@ const editFindTagApi = {
|
||||
},
|
||||
};
|
||||
|
||||
const setPickApi = {
|
||||
name: 'set-pick-dev-api',
|
||||
apply: 'serve',
|
||||
configureServer(server) {
|
||||
server.middlewares.use('/api/set-pick', async (req, res, next) => {
|
||||
if (req.method !== 'POST') return next();
|
||||
try {
|
||||
const raw = await readBody(req);
|
||||
const { slug } = JSON.parse(raw || '{}');
|
||||
if (typeof slug !== 'string' || !VALID_SLUG.test(slug)) return send(res, 400, { error: 'invalid slug' });
|
||||
|
||||
const reviewPath = path.join(REVIEW_ROOT, slug, 'index.mdx');
|
||||
if (!reviewPath.startsWith(REVIEW_ROOT + path.sep)) return send(res, 400, { error: 'path escape' });
|
||||
try { await stat(reviewPath); } catch { return send(res, 404, { error: 'review not found' }); }
|
||||
|
||||
const text = await readFile(HOME_PAGE, 'utf8');
|
||||
const re = /^(const HERO_SLUG = ')([^']+)(';)/m;
|
||||
if (!re.test(text)) return send(res, 422, { error: 'HERO_SLUG line not found in src/pages/index.astro' });
|
||||
const out = text.replace(re, (_, a, _b, c) => `${a}${slug}${c}`);
|
||||
await writeFile(HOME_PAGE, out, 'utf8');
|
||||
|
||||
return send(res, 200, { slug });
|
||||
} catch (err) {
|
||||
return send(res, 500, { error: String(err && err.message ? err.message : err) });
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
site: 'https://unique.rzen.dev',
|
||||
trailingSlash: 'always',
|
||||
build: { format: 'directory' },
|
||||
vite: { plugins: [editFindTagApi] },
|
||||
vite: { plugins: [editFindTagApi, setPickApi] },
|
||||
integrations: [
|
||||
mdx(),
|
||||
sitemap({
|
||||
|
||||
Reference in New Issue
Block a user