heyiam 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db.js +6 -6
- package/dist/export.js +33 -9
- package/dist/mount.js +23205 -0
- package/dist/render/templates/project.liquid +1 -1
- package/dist/routes/preview.js +5 -1
- package/dist/routes/publish.js +0 -2
- package/dist/routes/settings.js +1 -1
- package/dist/screenshot.js +8 -3
- package/dist/search.js +3 -2
- package/dist/server.js +11 -7
- package/package.json +2 -2
package/dist/db.js
CHANGED
|
@@ -23,7 +23,7 @@ export function getDatabase(dbPath = getDbPath()) {
|
|
|
23
23
|
_db = openDatabase(dbPath);
|
|
24
24
|
return _db;
|
|
25
25
|
}
|
|
26
|
-
function closeDatabase() {
|
|
26
|
+
export function closeDatabase() {
|
|
27
27
|
if (_db) {
|
|
28
28
|
_db.close();
|
|
29
29
|
_db = null;
|
|
@@ -127,10 +127,10 @@ function migrateToV2(db) {
|
|
|
127
127
|
// Upsert schema version
|
|
128
128
|
const existing = db.prepare('SELECT version FROM schema_version LIMIT 1').get();
|
|
129
129
|
if (existing) {
|
|
130
|
-
db.prepare('UPDATE schema_version SET version = ?').run(
|
|
130
|
+
db.prepare('UPDATE schema_version SET version = ?').run(2);
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
|
-
db.prepare('INSERT INTO schema_version (version) VALUES (?)').run(
|
|
133
|
+
db.prepare('INSERT INTO schema_version (version) VALUES (?)').run(2);
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
tx();
|
|
@@ -143,7 +143,7 @@ function migrateToV3(db) {
|
|
|
143
143
|
uuid TEXT NOT NULL
|
|
144
144
|
)
|
|
145
145
|
`);
|
|
146
|
-
db.prepare('UPDATE schema_version SET version = ?').run(
|
|
146
|
+
db.prepare('UPDATE schema_version SET version = ?').run(3);
|
|
147
147
|
});
|
|
148
148
|
tx();
|
|
149
149
|
}
|
|
@@ -156,7 +156,7 @@ function migrateToV5(db) {
|
|
|
156
156
|
if (!cols.some(c => c.name === 'output_tokens')) {
|
|
157
157
|
db.exec('ALTER TABLE sessions ADD COLUMN output_tokens INTEGER NOT NULL DEFAULT 0');
|
|
158
158
|
}
|
|
159
|
-
db.prepare('UPDATE schema_version SET version = ?').run(
|
|
159
|
+
db.prepare('UPDATE schema_version SET version = ?').run(5);
|
|
160
160
|
});
|
|
161
161
|
tx();
|
|
162
162
|
}
|
|
@@ -167,7 +167,7 @@ function migrateToV4(db) {
|
|
|
167
167
|
if (!cols.some(c => c.name === 'active_intervals')) {
|
|
168
168
|
db.exec('ALTER TABLE sessions ADD COLUMN active_intervals TEXT');
|
|
169
169
|
}
|
|
170
|
-
db.prepare('UPDATE schema_version SET version = ?').run(
|
|
170
|
+
db.prepare('UPDATE schema_version SET version = ?').run(4);
|
|
171
171
|
});
|
|
172
172
|
tx();
|
|
173
173
|
}
|
package/dist/export.js
CHANGED
|
@@ -260,7 +260,9 @@ export async function exportHtml(dirName, cache, sessions, outputPath, username
|
|
|
260
260
|
arc: result.arc,
|
|
261
261
|
fullSessions: sessions,
|
|
262
262
|
});
|
|
263
|
-
const projectHtml = buildStandalonePage(title, projectBody
|
|
263
|
+
const projectHtml = buildStandalonePage(title, projectBody, {
|
|
264
|
+
description: result.narrative?.slice(0, 200) || undefined,
|
|
265
|
+
});
|
|
264
266
|
totalBytes += writeAndTrack(join(outputPath, 'index.html'), projectHtml, files);
|
|
265
267
|
// Render session pages — only featured sessions (linked from project page)
|
|
266
268
|
const featuredSessions = pickFeaturedSessions(sessions, cache);
|
|
@@ -268,17 +270,19 @@ export async function exportHtml(dirName, cache, sessions, outputPath, username
|
|
|
268
270
|
mkdirSync(sessionsDir, { recursive: true });
|
|
269
271
|
for (const session of featuredSessions) {
|
|
270
272
|
const sessionSlug = slugify(session.title);
|
|
273
|
+
const enhanced = loadEnhancedData(session.id);
|
|
271
274
|
const renderData = buildSessionRenderData({
|
|
272
275
|
sessionId: session.id,
|
|
273
276
|
session,
|
|
274
|
-
enhanced
|
|
277
|
+
enhanced,
|
|
275
278
|
username,
|
|
276
279
|
projectSlug: slug,
|
|
277
280
|
sessionSlug,
|
|
278
281
|
sourceTool: session.source ?? 'unknown',
|
|
279
282
|
});
|
|
280
283
|
const sessionBody = renderSessionHtml(renderData);
|
|
281
|
-
const
|
|
284
|
+
const sessionDesc = (enhanced?.developerTake ?? session.developerTake ?? '').slice(0, 200) || undefined;
|
|
285
|
+
const sessionHtml = buildStandalonePage(session.title, sessionBody, { description: sessionDesc });
|
|
282
286
|
totalBytes += writeAndTrack(join(sessionsDir, `${sessionSlug}.html`), sessionHtml, files);
|
|
283
287
|
}
|
|
284
288
|
return { files, totalBytes, outputPath };
|
|
@@ -364,20 +368,24 @@ export function generateHtmlFiles(dirName, cache, sessions, username = 'local',
|
|
|
364
368
|
arc: result.arc,
|
|
365
369
|
fullSessions: sessions,
|
|
366
370
|
});
|
|
367
|
-
files.push({ path: 'index.html', content: buildStandalonePage(title, projectBody
|
|
371
|
+
files.push({ path: 'index.html', content: buildStandalonePage(title, projectBody, {
|
|
372
|
+
description: result.narrative?.slice(0, 200) || undefined,
|
|
373
|
+
}) });
|
|
368
374
|
const featuredSessions = pickFeaturedSessions(sessions, cache);
|
|
369
375
|
for (const session of featuredSessions) {
|
|
370
376
|
const sessionSlug = slugify(session.title);
|
|
377
|
+
const enhanced = loadEnhancedData(session.id);
|
|
371
378
|
const renderData = buildSessionRenderData({
|
|
372
379
|
sessionId: session.id,
|
|
373
|
-
session, enhanced
|
|
380
|
+
session, enhanced, username,
|
|
374
381
|
projectSlug: slug, sessionSlug,
|
|
375
382
|
sourceTool: session.source ?? 'unknown',
|
|
376
383
|
});
|
|
377
384
|
const sessionBody = renderSessionHtml(renderData);
|
|
385
|
+
const sessionDesc = (enhanced?.developerTake ?? session.developerTake ?? '').slice(0, 200) || undefined;
|
|
378
386
|
files.push({
|
|
379
387
|
path: `sessions/${sessionSlug}.html`,
|
|
380
|
-
content: buildStandalonePage(session.title, sessionBody),
|
|
388
|
+
content: buildStandalonePage(session.title, sessionBody, { description: sessionDesc }),
|
|
381
389
|
});
|
|
382
390
|
}
|
|
383
391
|
return files;
|
|
@@ -465,7 +473,11 @@ function crc32(buf) {
|
|
|
465
473
|
}
|
|
466
474
|
function getInlineMountJs() {
|
|
467
475
|
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
468
|
-
|
|
476
|
+
// In built dist: dist/mount.js (copied during build)
|
|
477
|
+
// In dev: ../../packages/ui/dist/mount.js (monorepo layout)
|
|
478
|
+
const builtPath = resolve(thisDir, 'mount.js');
|
|
479
|
+
const devPath = resolve(thisDir, '..', '..', 'packages', 'ui', 'dist', 'mount.js');
|
|
480
|
+
const mountPath = existsSync(builtPath) ? builtPath : devPath;
|
|
469
481
|
try {
|
|
470
482
|
return readFileSync(mountPath, 'utf-8');
|
|
471
483
|
}
|
|
@@ -473,19 +485,31 @@ function getInlineMountJs() {
|
|
|
473
485
|
return '';
|
|
474
486
|
}
|
|
475
487
|
}
|
|
476
|
-
function buildStandalonePage(title, bodyHtml) {
|
|
488
|
+
function buildStandalonePage(title, bodyHtml, opts) {
|
|
477
489
|
const css = getInlineCss();
|
|
478
490
|
const cssTag = css
|
|
479
491
|
? `<style>${css}\nbody { overflow: auto !important; min-height: auto !important; background: var(--color-surface, #f8f9fb); }</style>`
|
|
480
492
|
: '';
|
|
481
493
|
const mountJs = getInlineMountJs();
|
|
482
494
|
const scriptTag = mountJs ? `<script>${mountJs}</script>` : '';
|
|
495
|
+
const safeTitle = escapeHtml(title);
|
|
496
|
+
const safeDesc = opts?.description ? escapeHtml(opts.description) : '';
|
|
497
|
+
const ogTitle = `${safeTitle} — heyi.am`;
|
|
498
|
+
const ogTags = `<meta property="og:title" content="${ogTitle}" />
|
|
499
|
+
<meta property="og:site_name" content="heyi.am" />
|
|
500
|
+
<meta property="og:type" content="article" />
|
|
501
|
+
${safeDesc ? `<meta property="og:description" content="${safeDesc}" />` : ''}
|
|
502
|
+
${safeDesc ? `<meta name="description" content="${safeDesc}" />` : ''}
|
|
503
|
+
<meta name="twitter:card" content="summary" />
|
|
504
|
+
<meta name="twitter:title" content="${ogTitle}" />
|
|
505
|
+
${safeDesc ? `<meta name="twitter:description" content="${safeDesc}" />` : ''}`;
|
|
483
506
|
return `<!DOCTYPE html>
|
|
484
507
|
<html lang="en">
|
|
485
508
|
<head>
|
|
486
509
|
<meta charset="utf-8" />
|
|
487
510
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
488
|
-
<title>${
|
|
511
|
+
<title>${ogTitle}</title>
|
|
512
|
+
${ogTags}
|
|
489
513
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
490
514
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
491
515
|
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet" />
|