create-heresay 0.2.45 → 0.2.46
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/package.json +1 -1
- package/release/VERSION +1 -1
- package/release/firebase.json +4 -0
- package/release/functions/lib/core/chat.js +1 -1
- package/release/functions/lib/core/notifications.js +1 -1
- package/release/functions/lib/core/oauth.js +1 -1
- package/release/functions/lib/core/version.js +1 -1
- package/release/functions/lib/providers/firebase/node-server.js +4 -1
- package/release/public/dashboard.js +5 -5
- package/release/public/docs.html +4 -4
- package/src/cli.mjs +6 -6
- package/src/steps.mjs +3 -2
- package/release/public/index.html +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-heresay",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
4
4
|
"description": "Set up your own Heresay: in-app feedback that every report gets a hearing. Creates a Firebase project in your Google account and deploys the dashboard, API and SDK to it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/release/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.46
|
package/release/firebase.json
CHANGED
|
@@ -235,7 +235,7 @@ async function findApp(v, deps) {
|
|
|
235
235
|
throw new ToolError(`No app called "${want}". The apps are: ${ps.map((p) => p.name).join(', ') || 'none yet'}.`);
|
|
236
236
|
return hit;
|
|
237
237
|
}
|
|
238
|
-
const dashboardLink = (req, deps, p) => `${baseUrl(req, deps)}
|
|
238
|
+
const dashboardLink = (req, deps, p) => `${baseUrl(req, deps)}/#/apps/${p.id}`;
|
|
239
239
|
const appNames = (ps) => ps.map((p) => `${p.name} (${p.platform})`).join(', ');
|
|
240
240
|
/** A preview, nothing sent: which app, what type, the text, and where else it could go. */
|
|
241
241
|
async function draftRequest(a, member, via, deps) {
|
|
@@ -237,7 +237,7 @@ export async function notify(event, project, reportId, deps) {
|
|
|
237
237
|
const found = await deps.store.getReport(project.id, reportId).catch(() => null);
|
|
238
238
|
const type = (found && TYPE[found.type]) || null;
|
|
239
239
|
const origin = deps.selfOrigins?.[0];
|
|
240
|
-
const link = origin ? `${origin}
|
|
240
|
+
const link = origin ? `${origin}/#/apps/${encodeURIComponent(project.id)}` : null;
|
|
241
241
|
const meta = [type ? `${type[0]} ${type[1]}` : null, reportId];
|
|
242
242
|
const text = [`${emoji} ${head} · ${project.name}`, `${labels[event]}.`, meta.filter(Boolean).join(' · ')].join('\n') + (link ? `\n${link}` : '');
|
|
243
243
|
// Telegram gets bold and a link; the app name is the team's own, escaped, and nothing from a reporter is in it.
|
|
@@ -170,7 +170,7 @@ export async function authorize(req, deps) {
|
|
|
170
170
|
if (v)
|
|
171
171
|
keep.set(k, v);
|
|
172
172
|
}
|
|
173
|
-
return json(302, { redirect: true }, { location: `${baseUrl(req, deps)}
|
|
173
|
+
return json(302, { redirect: true }, { location: `${baseUrl(req, deps)}/#/authorize?${keep}` });
|
|
174
174
|
}
|
|
175
175
|
/** What the dashboard shows on the "Allow?" page, before anyone says yes. */
|
|
176
176
|
export async function describeAsk(q, deps) {
|
|
@@ -156,7 +156,10 @@ function reserved(res, path) {
|
|
|
156
156
|
}
|
|
157
157
|
async function file(res, path) {
|
|
158
158
|
let rel = path === '/sdk/v1.js' ? '/sdk.js' : path;
|
|
159
|
-
|
|
159
|
+
// The dashboard is the root of a Heresay; /app/ is its older address and keeps working.
|
|
160
|
+
if (rel === '/')
|
|
161
|
+
rel = '/app/index.html';
|
|
162
|
+
else if (rel.endsWith('/'))
|
|
160
163
|
rel += 'index.html';
|
|
161
164
|
const full = join(PUBLIC_DIR, normalize(rel));
|
|
162
165
|
if (!full.startsWith(PUBLIC_DIR + '/') || rel.split('/').some((p) => p.startsWith('.'))) {
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
gateMsg('Sending…');
|
|
189
189
|
// A chat app sent them here to say yes: come back to that page after the link.
|
|
190
190
|
if (/^#\/authorize\?/.test(location.hash)) localStorage.setItem('heresay.after', JSON.stringify({ hash: location.hash, at: Date.now() }));
|
|
191
|
-
auth.sendSignInLinkToEmail(email, { url: location.origin + '/
|
|
191
|
+
auth.sendSignInLinkToEmail(email, { url: location.origin + '/', handleCodeInApp: true })
|
|
192
192
|
.then(function () {
|
|
193
193
|
localStorage.setItem('heresay.email', email);
|
|
194
194
|
gateMsg('Check your inbox at ' + email + '. The link signs you in here. It can take a minute, and may land in spam.');
|
|
@@ -201,11 +201,11 @@
|
|
|
201
201
|
|
|
202
202
|
function finishLink(email) {
|
|
203
203
|
auth.signInWithEmailLink(email, location.href)
|
|
204
|
-
.then(function () { localStorage.removeItem('heresay.email'); history.replaceState(null, '',
|
|
204
|
+
.then(function () { localStorage.removeItem('heresay.email'); history.replaceState(null, '', location.pathname); finishingLink = false; })
|
|
205
205
|
.catch(function (x) {
|
|
206
206
|
gateMsg(x.code === 'auth/invalid-action-code'
|
|
207
207
|
? 'That link has expired or was already used. Ask for a new one.' : x.message, true);
|
|
208
|
-
history.replaceState(null, '',
|
|
208
|
+
history.replaceState(null, '', location.pathname); finishingLink = false;
|
|
209
209
|
$('link-form').querySelector('button').textContent = 'Email me a sign-in link';
|
|
210
210
|
});
|
|
211
211
|
}
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
try {
|
|
234
234
|
var after = JSON.parse(localStorage.getItem('heresay.after') || 'null');
|
|
235
235
|
localStorage.removeItem('heresay.after');
|
|
236
|
-
if (after && Date.now() - after.at < 15 * 60000 && !location.hash) history.replaceState(null, '',
|
|
236
|
+
if (after && Date.now() - after.at < 15 * 60000 && !location.hash) history.replaceState(null, '', location.pathname + after.hash);
|
|
237
237
|
} catch (e) { /* nothing saved */ }
|
|
238
238
|
route(); // first, so the view is already waiting when the app is shown
|
|
239
239
|
show('app');
|
|
@@ -2767,7 +2767,7 @@
|
|
|
2767
2767
|
draw(b.members);
|
|
2768
2768
|
form.reset();
|
|
2769
2769
|
err.className = 'ok-msg';
|
|
2770
|
-
err.textContent = 'Added. Send them this address; they sign in with that email: ' + location.origin
|
|
2770
|
+
err.textContent = 'Added. Send them this address; they sign in with that email: ' + location.origin;
|
|
2771
2771
|
}).catch(function (x) { err.className = 'err'; err.textContent = x.message; });
|
|
2772
2772
|
};
|
|
2773
2773
|
view.appendChild(el('section', { class: 'card' }, [el('h2', { text: 'Add someone' }), form]));
|
package/release/public/docs.html
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<div class="wrap">
|
|
14
14
|
<nav class="nav" aria-label="Main">
|
|
15
|
-
<a href="/" aria-label="Heresay home"><img src="/logo.svg" alt="Heresay" height="34"></a>
|
|
16
|
-
<div class="links"><a href="
|
|
15
|
+
<a href="https://sibhimanyu.github.io/heresay/" aria-label="Heresay home"><img src="/logo.svg" alt="Heresay" height="34"></a>
|
|
16
|
+
<div class="links"><a href="https://sibhimanyu.github.io/heresay/how-it-works.html">How it works</a><a href="/docs.html">Docs</a><a class="keep" href="/">Sign in</a></div>
|
|
17
17
|
<a class="btn btn-p btn-sm" href="#self-host">Set up</a>
|
|
18
18
|
</nav>
|
|
19
19
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
<h2 id="quick-start">Add it to an app</h2>
|
|
38
38
|
<ol>
|
|
39
|
-
<li><a href="/
|
|
39
|
+
<li><a href="/">Sign in</a> to your dashboard and choose <b>Add an app</b>. Pick the platform, give it a name, and list the websites it runs on, for example <code>https://app.example.com</code> and <code>http://localhost:3000</code>.</li>
|
|
40
40
|
<li>Copy the line the dashboard shows you (it has steps for Next.js, Nuxt and others too) and paste it before <code></body></code> on every page:</li>
|
|
41
41
|
</ol>
|
|
42
42
|
<pre><code><span class="k"><script</span> src="ORIGIN/sdk/v1.js" data-key="pk_your_key" defer<span class="k">></script></span></code></pre>
|
|
@@ -214,7 +214,7 @@ connect-src ORIGIN;</code></pre>
|
|
|
214
214
|
</main>
|
|
215
215
|
</div>
|
|
216
216
|
</div>
|
|
217
|
-
<footer class="site"><div class="wrap"><span>© 2026 Heresay</span><span><a href="/">Home</a> · <a href="/
|
|
217
|
+
<footer class="site"><div class="wrap"><span>© 2026 Heresay</span><span><a href="https://sibhimanyu.github.io/heresay/">Home</a> · <a href="/">Sign in</a></span></div></footer>
|
|
218
218
|
<script>
|
|
219
219
|
document.querySelectorAll('[data-origin]').forEach(function (el) { el.innerHTML = el.innerHTML.replace(/ORIGIN/g, location.origin); });
|
|
220
220
|
</script>
|
package/src/cli.mjs
CHANGED
|
@@ -262,7 +262,7 @@ async function setup(args) {
|
|
|
262
262
|
pc.dim(' docker build -t heresay-lite . && docker run --rm -p 8080:8080 --env-file lite.env heresay-lite'),
|
|
263
263
|
'',
|
|
264
264
|
`On a host, build that folder as a Docker service and add each line of lite.env as an environment variable. It must answer at ${pc.bold(ctx.origin)}.`,
|
|
265
|
-
`Then open ${ctx.origin}
|
|
265
|
+
`Then open ${ctx.origin} and sign in as ${ctx.owner}. Check with: npx create-heresay status`,
|
|
266
266
|
].join('\n'), 'Your Heresay is ready for a host');
|
|
267
267
|
p.outro('Every report gets a hearing.');
|
|
268
268
|
return;
|
|
@@ -278,7 +278,7 @@ async function setup(args) {
|
|
|
278
278
|
].join('\n'), 'Your Heresay is live');
|
|
279
279
|
if (!args.yes && process.stdout.isTTY) {
|
|
280
280
|
const open = bail(await p.confirm({ message: 'Open it now?' }));
|
|
281
|
-
if (open) openInBrowser(url(ctx.id)
|
|
281
|
+
if (open) openInBrowser(url(ctx.id));
|
|
282
282
|
}
|
|
283
283
|
p.outro('Every report gets a hearing.');
|
|
284
284
|
}
|
|
@@ -432,7 +432,7 @@ async function status() {
|
|
|
432
432
|
const rec = all[id];
|
|
433
433
|
const h = await health(id);
|
|
434
434
|
const lines = [
|
|
435
|
-
`${pc.dim('Dashboard')} ${url(id)}
|
|
435
|
+
`${pc.dim('Dashboard')} ${url(id)}`,
|
|
436
436
|
`${pc.dim('Region ')} ${rec.region}`,
|
|
437
437
|
`${pc.dim('Version ')} ${h ? h.version : pc.red('not answering')}${h && h.version !== bundled ? pc.dim(` (${bundled} available: npx create-heresay update)`) : ''}`,
|
|
438
438
|
`${pc.dim('Setup ')} ${rec.done?.verify ? 'complete' : pc.yellow('unfinished: run npx create-heresay to carry on')}`,
|
|
@@ -444,8 +444,8 @@ async function status() {
|
|
|
444
444
|
|
|
445
445
|
async function open(args) {
|
|
446
446
|
const id = await pickInstance('open', args);
|
|
447
|
-
openInBrowser(
|
|
448
|
-
console.log(
|
|
447
|
+
openInBrowser(url(id));
|
|
448
|
+
console.log(url(id));
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
async function removeCmd(args) {
|
|
@@ -519,7 +519,7 @@ async function restoreCmd(args) {
|
|
|
519
519
|
s.start('Writing');
|
|
520
520
|
try { await backup.restore(g, b, { base: FS, project: id, say: (m) => s.message(m) }); } catch (e) { s.error('Stopped part way; run it again to finish'); fail(e); }
|
|
521
521
|
s.stop(`Restored ${b.documents.length} documents`);
|
|
522
|
-
p.outro(`Sign in at ${url(id)}
|
|
522
|
+
p.outro(`Sign in at ${url(id)} with a team email. Reconnect repos with npx heresay connect --url ${url(id)}.`);
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
export async function main(argv) {
|
package/src/steps.mjs
CHANGED
|
@@ -305,8 +305,9 @@ export async function verify(ctx, say) {
|
|
|
305
305
|
for (;;) {
|
|
306
306
|
try {
|
|
307
307
|
const h = await (await fetch(`${base}/v1/health`)).json();
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
// The dashboard is the site's root page; check it really is the dashboard, not a leftover page.
|
|
309
|
+
const app = await fetch(`${base}/`);
|
|
310
|
+
if (h.ok && app.ok && (await app.text()).includes('/dashboard.js')) return `API ${h.version}, dashboard loads`;
|
|
310
311
|
} catch { /* hosting can take a moment to answer on a new site */ }
|
|
311
312
|
if (Date.now() > until) {
|
|
312
313
|
throw new StepError(`${base} isn’t answering yet.`, 'New sites can take a few minutes. Run npx create-heresay status in a little while.');
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>Heresay</title>
|
|
7
|
-
<meta http-equiv="refresh" content="0; url=/app/">
|
|
8
|
-
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
9
|
-
<style>body{font:16px/1.6 system-ui,sans-serif;color:#15171c;max-width:32rem;margin:15vh auto;padding:0 24px;text-align:center}a{color:#0b5e57}small{display:block;margin-top:24px;color:#5b6472}</style>
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<p><a href="/app/">Open the Heresay dashboard</a></p>
|
|
13
|
-
<small><a href="https://sibhimanyu.github.io/heresay/">What is Heresay?</a></small>
|
|
14
|
-
</body>
|
|
15
|
-
</html>
|