create-pmos 0.587.0 → 0.589.0
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 +27 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/home.md +13 -2
- package/workspace/guide/notes.md +14 -0
- package/workspace/lib/jira-status.js +10 -3
- package/workspace/lib/meeting-guest-page.js +53 -0
- package/workspace/lib/outbox-store.js +9 -2
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-outbox.js +17 -2
- package/workspace/lib/routes-waiting.js +24 -0
- package/workspace/lib/share-store.js +3 -2
- package/workspace/lib/waiting-on.js +252 -0
- package/workspace/milestone-suggest-test.js +5 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/panels-test.js +1 -1
- package/workspace/program-order-test.js +3 -1
- package/workspace/public/pm/cozy-today.css +28 -0
- package/workspace/public/pm/good-morning.js +6 -2
- package/workspace/public/pm/home-app.js +60 -5
- package/workspace/public/pm/home-day.js +4 -1
- package/workspace/public/pm/home-list.js +3 -1
- package/workspace/public/pm/home-today.js +6 -3
- package/workspace/public/pm/home-top.js +102 -0
- package/workspace/public/pm/ini-tasks.js +6 -2
- package/workspace/public/pm/meeting-share.js +192 -0
- package/workspace/public/pm/move-rank.js +12 -3
- package/workspace/public/pm/outbox-view.js +54 -1
- package/workspace/public/pm/premium-vw-doc.css +28 -0
- package/workspace/public/pm/premium-vw-mtg.js +13 -8
- package/workspace/public/pm/premium-vw-share.js +70 -9
- package/workspace/server.js +41 -1
- package/workspace/share-server.js +14 -2
- package/workspace/sort-order-test.js +3 -1
- package/workspace/stage-card-tasks-test.js +2 -0
- package/workspace/test-lists/home-your-move-waiting.json +11 -0
- package/workspace/test-lists/meeting-share.json +9 -0
|
@@ -5,13 +5,29 @@
|
|
|
5
5
|
* the share copies folder through POST /api/shares; the share server (share-server.js, D97) serves it. Nothing is public before the press.
|
|
6
6
|
* Open links every open link with its end date and views, and Turn off (a second press confirms). Turn off deletes the copy at once.
|
|
7
7
|
* Reads GET /api/shares and GET /api/shares/password; writes only through the two page-press routes.
|
|
8
|
-
* shareMenu(btn, f) f is the file tab's record: { name, ws, rel, kind, text }
|
|
8
|
+
* shareMenu(btn, f) f is the file tab's record: { name, ws, rel, kind, text }, or a meeting note (shareable-meeting-notes):
|
|
9
|
+
* { name, note: { id, sheet, facts, people } }. A meeting's popover adds, above the link (design A, Exploring 2):
|
|
10
|
+
* What goes out the parts PMOS proposes as chips (meeting-share.js proposeCut); the transcript, recording and screens stay inside,
|
|
11
|
+
* one quiet line and no switch.
|
|
12
|
+
* ✦ row "PMOS kept 2 lines inside · 4 details out": opens the lines kept inside, each with an eye to put it back, and the
|
|
13
|
+
* details taken out, each a chip to keep it. The PM only approves, by pressing the link icon.
|
|
14
|
+
* Follow-up once the link is made: a ready email (subject, the shared parts, the link) that opens in the PM's own mail app
|
|
15
|
+
* (a mailto link) or goes to the clipboard. PMOS sends nothing.
|
|
16
|
+
* The server makes the meeting's copy from the note and the cut (POST /api/shares { note, cut, people }), never from text the page sends. */
|
|
9
17
|
import { pmGet, pmPost } from './http.js';
|
|
18
|
+
import { proposeCut, defaultCut, NEVER_LINE } from './meeting-share.js';
|
|
10
19
|
|
|
11
20
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
12
21
|
const day = (iso) => { try { return new Date(iso).toLocaleDateString(undefined, { day: 'numeric', month: 'short' }); } catch { return ''; } };
|
|
13
22
|
const LOCK = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg>';
|
|
14
23
|
const LINK = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/></svg>';
|
|
24
|
+
const SPARK = '<svg class="i sp" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/></svg>';
|
|
25
|
+
const CHEV = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>';
|
|
26
|
+
const EYE = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>';
|
|
27
|
+
const EYE_OFF = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 3l18 18M10.6 5.1A10 10 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-3.2 4.1M6.6 6.6A17 17 0 0 0 2 12s3.6 7 10 7a9.7 9.7 0 0 0 4.4-1"/><path d="M9.9 9.9a3 3 0 0 0 4.2 4.2"/></svg>';
|
|
28
|
+
const UP = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 15V4M8 8l4-4 4 4M6 12v7h12v-7"/></svg>';
|
|
29
|
+
const COPY = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a1 1 0 0 1 1-1h10"/></svg>';
|
|
30
|
+
const MAIL = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg>';
|
|
15
31
|
const SEND = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12l16-8-6 16-2-7z"/></svg>';
|
|
16
32
|
|
|
17
33
|
/** Whether this device can hand a file to the system share sheet (a phone, mostly). */
|
|
@@ -20,6 +36,33 @@ export function canSendFile(f) {
|
|
|
20
36
|
catch { return false; }
|
|
21
37
|
}
|
|
22
38
|
|
|
39
|
+
/** A meeting's cut (above the link): the chips, the line that never goes, and the ✦ row with what PMOS kept inside. Pure. */
|
|
40
|
+
export function cutHtml(S) {
|
|
41
|
+
const P = S.prop, cut = S.cut, back = new Set(cut.back);
|
|
42
|
+
const chips = P.sections.map((x) => `<button type="button" class="vwmchip" data-cut="${esc(x.k)}" aria-pressed="${cut.on.includes(x.k)}">${esc(x.label)}${x.n ? `<small>${x.n}</small>` : ''}</button>`).join('');
|
|
43
|
+
const inN = P.inside.filter((l) => !back.has('in:' + l.id)).length, outN = P.out.filter((o) => !back.has('out:' + o.k)).length;
|
|
44
|
+
const say = [inN ? `PMOS kept ${inN} ${inN === 1 ? 'line' : 'lines'} inside` : '', outN ? `${outN} ${outN === 1 ? 'detail' : 'details'} out` : ''].filter(Boolean).join(' · ')
|
|
45
|
+
|| (P.inside.length || P.out.length ? 'Everything PMOS kept inside is put back' : '');
|
|
46
|
+
const row = say ? `<button type="button" class="vwmprop" data-sh="prop" aria-expanded="${!!S.open}">${SPARK}<span>${esc(say)}</span>${CHEV}</button>` : '';
|
|
47
|
+
const open = !S.open ? '' : (P.inside.length ? `<div class="vwsh">Stays inside</div>` + P.inside.map((l) => { const b = back.has('in:' + l.id);
|
|
48
|
+
return `<div class="vwmin${b ? ' back' : ''}">${b ? EYE : EYE_OFF}<span><b>${esc(l.text)}</b><em>${esc(b ? 'Put back: it goes out' : l.why)}</em></span>`
|
|
49
|
+
+ `<button type="button" class="vwmeye" data-back="in:${esc(l.id)}" aria-pressed="${b}" aria-label="${esc(b ? 'Keep it inside' : 'Put it back')}" title="${esc(b ? 'Keep it inside' : 'Put it back')}">${b ? EYE_OFF : EYE}</button></div>`; }).join('') : '')
|
|
50
|
+
+ (P.out.length ? `<div class="vwsh">Taken out of the lines that go</div><div class="vwmc">` + P.out.map((o) => { const b = back.has('out:' + o.k);
|
|
51
|
+
return `<button type="button" class="vwmout" data-back="out:${esc(o.k)}" aria-pressed="${b}" title="${esc(b ? 'It goes out. Press to take it out again' : 'Press to keep it')}">${LINK}<span${b ? '' : ' class="st"'}>${esc(o.label)}</span></button>`; }).join('') + '</div>' : '')
|
|
52
|
+
+ `<p class="vwsn">Attendees show by first name. Nothing here changes your own note.</p>`;
|
|
53
|
+
return `<div class="vwsh">What goes out</div><div class="vwmc" role="group" aria-label="What goes out">${chips}</div>`
|
|
54
|
+
+ `<p class="vwmnv">${LOCK}<span>${esc(NEVER_LINE)}</span></p>` + (row ? '<div class="vwssep"></div>' + row : '') + open;
|
|
55
|
+
}
|
|
56
|
+
/** The follow-up draft once the link is made: it opens in the PM's mail app or goes to the clipboard. Pure. */
|
|
57
|
+
export function draftHtml(S) {
|
|
58
|
+
const d = S.made && S.made.draft; if (!d) return '';
|
|
59
|
+
const body = d.body.split('\n').filter((l) => l && !/^The notes: /.test(l) && !/^The password comes/.test(l)).slice(0, 8).map((l) => l.replace(/^- /, '· ')).join(' ');
|
|
60
|
+
return `<div class="vwssep"></div><div class="vwsh">Follow-up</div><div class="vwmdr"><b>${esc(d.subject)}</b><p>${esc(body)}</p><code>${LINK}${esc(S.made.url)}</code></div>`
|
|
61
|
+
+ `<p class="vwmnv">${LOCK}<span>${S.made.pass ? 'The password goes in a second message. ' : ''}Nothing is sent: it opens in your mail app.</span></p>`
|
|
62
|
+
+ `<div class="vwmfa"><span class="vwsok" role="status">${esc(S.dcopied || '')}</span><button type="button" class="vwib" data-sh="dcopy" aria-label="Copy the draft" title="Copy the draft">${COPY}</button>`
|
|
63
|
+
+ `<a class="vwmmail" href="${esc(d.mailto)}" aria-label="Open the draft in your mail app" title="Open in your mail app">${MAIL}</a></div>`;
|
|
64
|
+
}
|
|
65
|
+
|
|
23
66
|
/** The popover's inside as HTML. Pure. S = { pw, pass, days, made, err, busy, list, host, off, send } */
|
|
24
67
|
export function shareHtml(S) {
|
|
25
68
|
const send = S.send ? `<button type="button" class="vwsm" data-sh="send">${SEND}<span>Send a copy</span><small>share sheet</small></button><div class="vwssep"></div>` : '';
|
|
@@ -32,19 +75,24 @@ export function shareHtml(S) {
|
|
|
32
75
|
+ (S.made.pass ? `<div class="vwspw">${LOCK}<code>${esc(S.made.pass)}</code></div>` : '')
|
|
33
76
|
+ `<div class="vwsr"><button type="button" class="vwbtn pri" data-sh="copy">${S.made.pass ? 'Copy link and password' : 'Copy link'}</button><span class="vwsok" role="status">${esc(S.copied || '')}</span></div>`
|
|
34
77
|
+ `<p class="vwsn">Ends ${esc(day(S.made.ends))}.${S.made.pass ? ' Send the password in a different message.' : ''}</p></div>`
|
|
78
|
+
+ (S.prop ? draftHtml(S) : '')
|
|
35
79
|
+ (list ? '<div class="vwssep"></div>' + list : '');
|
|
36
80
|
}
|
|
37
|
-
|
|
81
|
+
const mtg = !!S.prop;
|
|
82
|
+
return send + (mtg ? cutHtml(S) + '<div class="vwssep"></div>' : '') + `<div class="vwsh">Public link</div>`
|
|
38
83
|
+ `<div class="vwsrow2">${LOCK}<span>Password</span><button type="button" class="vwsw" role="switch" aria-checked="${S.pw}" aria-label="Password" data-sh="pw"></button></div>`
|
|
39
84
|
+ (S.pw ? `<div class="vwspwi"><input id="vwsPass" type="text" spellcheck="false" autocomplete="off" aria-label="Password" value="${esc(S.pass)}"><button type="button" class="vwbtn" data-sh="new">New</button></div>` : '')
|
|
40
85
|
+ `<div class="vwsrow2"><span>Ends</span><div class="vwsg" role="group" aria-label="Link ends after">${[1, 7, 30].map((d) => `<button type="button" class="vwseg" data-days="${d}" aria-pressed="${S.days === d}">${d === 1 ? '1 day' : d + ' days'}</button>`).join('')}</div></div>`
|
|
41
|
-
+ `<p class="vwsn">Anyone with the link${S.pw ? ' and the password' : ''} can read a copy of this file as it is now. Later edits are not shared.</p>`
|
|
86
|
+
+ `<p class="vwsn">Anyone with the link${S.pw ? ' and the password' : ''} can read a copy of ${mtg ? 'what goes out' : 'this file'} as it is now. Later edits are not shared.</p>`
|
|
42
87
|
+ (S.err ? `<p class="vwserr" role="alert">${esc(S.err)}</p>` : '')
|
|
43
|
-
+ `<button type="button" class="
|
|
88
|
+
+ (mtg ? `<div class="vwmgo"><button type="button" class="vwmmk" data-sh="make" aria-label="${S.busy ? 'Making the link…' : 'Create link'}" title="Create link"${S.busy || !S.cut.on.length ? ' disabled' : ''}>${UP}</button></div>`
|
|
89
|
+
: `<button type="button" class="vwbtn pri vwsgo" data-sh="make"${S.busy ? ' disabled' : ''}>${S.busy ? 'Making the link…' : 'Create link'}</button>`)
|
|
44
90
|
+ (list ? '<div class="vwssep"></div>' + list : '');
|
|
45
91
|
}
|
|
46
92
|
|
|
93
|
+
const CSS = new URL('./premium-vw-doc.css', import.meta.url).href; // the popover's look: a meeting page may not have loaded it yet
|
|
47
94
|
export function shareMenu(btn, f) {
|
|
95
|
+
if (typeof document !== 'undefined' && !document.querySelector(`link[href="${CSS}"]`)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l); }
|
|
48
96
|
const box = btn.parentElement;
|
|
49
97
|
const old = box.querySelector('.vwshp');
|
|
50
98
|
const close = (focus) => { const k = box.querySelector('.vwshp'); if (k) k.remove(); btn.setAttribute('aria-expanded', 'false'); if (focus) btn.focus(); };
|
|
@@ -52,7 +100,11 @@ export function shareMenu(btn, f) {
|
|
|
52
100
|
// Escape closes the popover wherever the focus is (a press redraws it), before the dialog under it sees the key
|
|
53
101
|
const onKey = (e) => { if (e.key !== 'Escape') return; document.removeEventListener('keydown', onKey, true); if (!m.isConnected) return; e.stopPropagation(); close(true); };
|
|
54
102
|
box.querySelectorAll('.vmenu').forEach((m) => m.remove());
|
|
55
|
-
const
|
|
103
|
+
const N = f.note || null;
|
|
104
|
+
const propOf = (pm) => proposeCut({ sheet: N.sheet, facts: N.facts || [], people: N.people || [], pm });
|
|
105
|
+
const S = { pw: true, pass: '', days: 7, made: null, err: '', busy: false, list: [], host: null, off: null, send: !N && canSendFile(f), copied: '', dcopied: '',
|
|
106
|
+
prop: N ? propOf('') : null, cut: null, open: false, me: '' };
|
|
107
|
+
if (N) S.cut = defaultCut(S.prop);
|
|
56
108
|
const m = document.createElement('div');
|
|
57
109
|
m.className = 'vwshp'; m.setAttribute('role', 'dialog'); m.setAttribute('aria-label', 'Share ' + (f.name || 'this file')); m.dataset.escLayer = '1';
|
|
58
110
|
const draw = (focus) => {
|
|
@@ -61,7 +113,7 @@ export function shareMenu(btn, f) {
|
|
|
61
113
|
};
|
|
62
114
|
const load = async () => {
|
|
63
115
|
const [l, p] = await Promise.all([pmGet('/api/shares'), S.pass ? null : pmGet('/api/shares/password')]);
|
|
64
|
-
if (l && l.ok) { S.list = l.shares || []; S.host = l.host; }
|
|
116
|
+
if (l && l.ok) { S.list = l.shares || []; S.host = l.host; if (N && l.me && l.me !== S.me) { S.me = l.me; S.prop = propOf(l.me); S.cut = { on: S.cut.on, back: S.cut.back }; } }
|
|
65
117
|
const typed = m.querySelector('#vwsPass');
|
|
66
118
|
if (typed && typed.value) S.pass = typed.value; // the PM typed before the generated one arrived
|
|
67
119
|
else if (p && p.ok && !S.pass) S.pass = p.password;
|
|
@@ -72,6 +124,8 @@ export function shareMenu(btn, f) {
|
|
|
72
124
|
const b = e.target.closest('button'); if (!b) return;
|
|
73
125
|
const pass = m.querySelector('#vwsPass'); if (pass) S.pass = pass.value;
|
|
74
126
|
if (b.dataset.days) { S.days = Number(b.dataset.days); return draw(`[data-days="${S.days}"]`); }
|
|
127
|
+
if (b.dataset.cut) { const k = b.dataset.cut; S.cut.on = S.cut.on.includes(k) ? S.cut.on.filter((x) => x !== k) : [...S.cut.on, k]; S.err = ''; return draw(`[data-cut="${k}"]`); }
|
|
128
|
+
if (b.dataset.back) { const k = b.dataset.back; S.cut.back = S.cut.back.includes(k) ? S.cut.back.filter((x) => x !== k) : [...S.cut.back, k]; return draw(`[data-back="${k}"]`); }
|
|
75
129
|
if (b.dataset.off) {
|
|
76
130
|
if (S.off !== b.dataset.off) { S.off = b.dataset.off; return draw(`[data-off="${S.off}"]`); }
|
|
77
131
|
const r = await pmPost('/api/shares/off', { id: b.dataset.off });
|
|
@@ -80,6 +134,12 @@ export function shareMenu(btn, f) {
|
|
|
80
134
|
}
|
|
81
135
|
const k = b.dataset.sh;
|
|
82
136
|
if (k === 'pw') { S.pw = !S.pw; return draw('[data-sh="pw"]'); }
|
|
137
|
+
if (k === 'prop') { S.open = !S.open; return draw('[data-sh="prop"]'); }
|
|
138
|
+
if (k === 'dcopy') {
|
|
139
|
+
const d = S.made && S.made.draft; if (!d) return;
|
|
140
|
+
try { await navigator.clipboard.writeText(d.subject + '\n\n' + d.body); S.dcopied = 'Copied'; } catch { S.dcopied = 'The browser did not allow copying'; }
|
|
141
|
+
return draw('[data-sh="dcopy"]');
|
|
142
|
+
}
|
|
83
143
|
if (k === 'new') { const p = await pmGet('/api/shares/password'); if (p && p.ok) S.pass = p.password; return draw('[data-sh="new"]'); }
|
|
84
144
|
if (k === 'send') {
|
|
85
145
|
try { await navigator.share({ files: [new File([f.text || ''], f.name || 'file.txt', { type: 'text/plain' })], title: f.name }); close(true); }
|
|
@@ -89,10 +149,11 @@ export function shareMenu(btn, f) {
|
|
|
89
149
|
if (k === 'make') {
|
|
90
150
|
if (S.pw && String(S.pass || '').trim().length < 8) { S.err = 'The password needs at least 8 characters.'; return draw(); }
|
|
91
151
|
S.busy = true; S.err = ''; draw();
|
|
92
|
-
const
|
|
152
|
+
const what = N ? { note: N.id, cut: S.cut, people: N.people || [] } : { ws: f.ws, path: f.rel };
|
|
153
|
+
const r = await pmPost('/api/shares', { ...what, days: S.days, password: S.pw ? String(S.pass).trim() : null });
|
|
93
154
|
S.busy = false;
|
|
94
155
|
if (!r || !r.ok) { S.err = (r && r.error) || 'The link could not be made.'; return draw(); }
|
|
95
|
-
S.made = { url: r.url, ends: r.ends, pass: S.pw ? String(S.pass).trim() : '' };
|
|
156
|
+
S.made = { url: r.url, ends: r.ends, pass: S.pw ? String(S.pass).trim() : '', draft: r.draft || null };
|
|
96
157
|
const l = await pmGet('/api/shares'); if (l && l.ok) S.list = l.shares || [];
|
|
97
158
|
return draw('[data-sh="copy"]');
|
|
98
159
|
}
|
|
@@ -107,6 +168,6 @@ export function shareMenu(btn, f) {
|
|
|
107
168
|
draw();
|
|
108
169
|
box.append(m); btn.setAttribute('aria-expanded', 'true');
|
|
109
170
|
const first = m.querySelector('button'); if (first) first.focus();
|
|
110
|
-
setTimeout(() => document.addEventListener('click', function off(e) { if (!e.target.closest('.vwshp,[data-fsh]')) close(); if (!box.querySelector('.vwshp')) document.removeEventListener('click', off, true); }, true), 0);
|
|
171
|
+
setTimeout(() => document.addEventListener('click', function off(e) { if (!e.target.closest('.vwshp,[data-fsh],[data-cz-vw-p="share"]')) close(); if (!box.querySelector('.vwshp')) document.removeEventListener('click', off, true); }, true), 0);
|
|
111
172
|
load();
|
|
112
173
|
}
|
package/workspace/server.js
CHANGED
|
@@ -378,6 +378,39 @@ function startShareServer() {
|
|
|
378
378
|
mine.on('exit', () => { if (SHARE.child !== mine) return; SHARE.child = null; if (!SHARE.stopped && !SHARE.timer) { SHARE.timer = setTimeout(() => { SHARE.timer = null; startShareServer(); }, 5000); if (SHARE.timer.unref) SHARE.timer.unref(); } });
|
|
379
379
|
}
|
|
380
380
|
function stopShareServer() { SHARE.stopped = true; if (SHARE.timer) clearTimeout(SHARE.timer); const c = SHARE.child; SHARE.child = null; if (c) { try { c.kill('SIGTERM'); } catch { /* gone */ } } }
|
|
381
|
+
/** The PM's first name for a shared meeting note ("A read-only copy shared by Wawan"): git's user.name, as Home's greeting reads it. */
|
|
382
|
+
function shareMe() { try { const n = require('./lib/routes-brief-page.js').firstName(path.resolve(__dirname, '..')) || ''; return /^claude$/i.test(n) ? '' : n; } catch { return ''; } } // a guest page never says Claude (an agent's git name)
|
|
383
|
+
/** A meeting note's guest copy (shareable-meeting-notes): the note is read here, PMOS's proposal is made again from it (public/pm/meeting-share.js,
|
|
384
|
+
* the same one the popover showed), and only the sections that are on and the lines the PM put back go out. The transcript, the recording and the
|
|
385
|
+
* screen shots are never read into it. The page goes through the same secret scan as a file. → { ok, id, ends, draft(url) } | { ok: false, error, status } */
|
|
386
|
+
async function meetingShareCopy(body) {
|
|
387
|
+
const notes = require('./lib/notes.js');
|
|
388
|
+
const id = String(body.note || '');
|
|
389
|
+
const r = notes.read(STATE, id);
|
|
390
|
+
if (!r || !r.ok) return { ok: false, error: 'no such note', status: 404 };
|
|
391
|
+
if (r.note.private) return { ok: false, error: 'This note is private. Private notes are not shared.', status: 409 };
|
|
392
|
+
let place = null; try { place = require('./lib/notes-series.js').placeOf(STATE, id); } catch { place = null; }
|
|
393
|
+
let Meet, MS;
|
|
394
|
+
try { [Meet, MS] = await Promise.all([import('./public/pm/premium-vw-meet.js'), import('./public/pm/meeting-share.js')]); }
|
|
395
|
+
catch { return { ok: false, error: 'The copy could not be made.', status: 500 }; }
|
|
396
|
+
const sheet = Meet.noteSheet({ ok: true, note: r.note, place });
|
|
397
|
+
if (!sheet) return { ok: false, error: 'no such note', status: 404 };
|
|
398
|
+
const facts = MS.factsOf(r.note);
|
|
399
|
+
const people = (Array.isArray(body.people) ? body.people : []).map((x) => String(x || '').slice(0, 80)).filter(Boolean).slice(0, 40);
|
|
400
|
+
const pm = shareMe();
|
|
401
|
+
const prop = MS.proposeCut({ sheet, facts, pm, people });
|
|
402
|
+
const cut = { on: Array.isArray(body.cut && body.cut.on) ? body.cut.on.map(String) : MS.defaultCut(prop).on, back: Array.isArray(body.cut && body.cut.back) ? body.cut.back.map(String) : [] };
|
|
403
|
+
const copy = MS.applyCut(prop, cut, { sheet, facts, people, pm });
|
|
404
|
+
if (!copy.summary && !copy.decisions.length && !copy.steps.length && !copy.questions.length && !copy.facts.length && !copy.since.length) return { ok: false, error: 'Nothing is chosen to go out. Turn on a part first.', status: 400 };
|
|
405
|
+
const days = Number(body.days), now = Date.now();
|
|
406
|
+
const ends = shareStore.DAYS.includes(days) ? new Date(now + days * 86400000).toISOString() : '';
|
|
407
|
+
const page = require('./lib/meeting-guest-page.js').guestPage(copy, { by: pm, ends }), file = MS.guestMarkdown(copy, { by: pm, ends });
|
|
408
|
+
const hits = require('./lib/secret-scan').scan(page + '\n' + file);
|
|
409
|
+
if (hits.length) return { ok: false, error: 'The shared part holds what looks like a secret (' + hits.join(', ') + '). Leave that part inside, then share again.', secrets: hits, status: 422 };
|
|
410
|
+
const made = shareStore.create(STATE, { name: (copy.title || 'Meeting notes') + '.md', kind: 'meeting', page, file, days, now, password: body.password == null || body.password === '' ? null : String(body.password) });
|
|
411
|
+
if (!made.ok) return { ok: false, error: made.error, status: 400 };
|
|
412
|
+
return { ok: true, id: made.id, ends: made.ends, draft: (url) => MS.followUp(copy, { url, by: pm }) };
|
|
413
|
+
}
|
|
381
414
|
/** The hostname a share link names: PMOS_SHARE_HOST, else share.<the Online hostname's domain>, else null (Online is not set up). */
|
|
382
415
|
function shareHost() {
|
|
383
416
|
const env = String(process.env.PMOS_SHARE_HOST || '').trim().toLowerCase();
|
|
@@ -8508,7 +8541,7 @@ async function handleRequest(req, res) {
|
|
|
8508
8541
|
/* ── premium-viewer-share (D97): share links. Listing is a read; making and turning off a link is a page press, never an agent session. ── */
|
|
8509
8542
|
if (p === '/api/shares' && req.method === 'GET') {
|
|
8510
8543
|
const host = shareHost();
|
|
8511
|
-
return json(res, { ok: true, host, days: shareStore.DAYS, shares: shareStore.list(STATE).map((x) => ({ ...x, url: host ? `https://${host}/s/${x.id}` : null })) });
|
|
8544
|
+
return json(res, { ok: true, host, days: shareStore.DAYS, me: shareMe(), shares: shareStore.list(STATE).map((x) => ({ ...x, url: host ? `https://${host}/s/${x.id}` : null })) });
|
|
8512
8545
|
}
|
|
8513
8546
|
if (p === '/api/shares/password' && req.method === 'GET') return json(res, { ok: true, password: shareStore.newPassword() });
|
|
8514
8547
|
if ((p === '/api/shares' || p === '/api/shares/off') && req.method === 'POST') {
|
|
@@ -8524,6 +8557,13 @@ async function handleRequest(req, res) {
|
|
|
8524
8557
|
}
|
|
8525
8558
|
const host = shareHost();
|
|
8526
8559
|
if (!host) return json(res, { ok: false, error: 'Share links use your Online hostname. Set up Online in Settings first, or set PMOS_SHARE_HOST.' }, 409);
|
|
8560
|
+
// a meeting note (shareable-meeting-notes): the copy is made here from the note itself and the PM's cut, never from text the page sends
|
|
8561
|
+
if (body.note != null) {
|
|
8562
|
+
const r = await meetingShareCopy(body);
|
|
8563
|
+
if (!r.ok) return json(res, { ok: false, error: r.error, ...(r.secrets ? { secrets: r.secrets } : {}) }, r.status || 400);
|
|
8564
|
+
startShareServer();
|
|
8565
|
+
return json(res, { ok: true, id: r.id, ends: r.ends, url: `https://${host}/s/${r.id}`, draft: r.draft(`https://${host}/s/${r.id}`) });
|
|
8566
|
+
}
|
|
8527
8567
|
const w = docRootOf(body.ws);
|
|
8528
8568
|
const rel = String(body.path || '');
|
|
8529
8569
|
const got = readDocWhy(w, rel);
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* share hostname (share.pm-os.app) here, with no Access application in front; the workspace hostname keeps its Access check.
|
|
9
9
|
*
|
|
10
10
|
* GET /robots.txt Disallow: /
|
|
11
|
-
* GET /s/<id> the password page, or the copy in a sandboxed frame with Download
|
|
11
|
+
* GET /s/<id> the password page, or the copy in a sandboxed frame with Download; a meeting note (shareable-meeting-notes)
|
|
12
|
+
* is its guest page itself, under a CSP with no script
|
|
12
13
|
* POST /s/<id> the password form (pw=…): a right password sets a cookie for this link only, for 12 hours
|
|
13
14
|
* GET /s/<id>/view the copy itself, under a sandbox CSP (only with a valid cookie when the link has a password)
|
|
14
15
|
* GET /s/<id>/file the file's own text as an attachment (the same rule)
|
|
@@ -34,6 +35,9 @@ const BASE_HEADERS = {
|
|
|
34
35
|
};
|
|
35
36
|
const PAGE_CSP = "default-src 'none'; style-src 'unsafe-inline'; frame-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'";
|
|
36
37
|
// the copy itself: the viewer's own sandbox (premium-vw-file.js FRAME_CSP), shown only inside its own page
|
|
38
|
+
// a shared meeting note: no script at all, its own inline style, nothing else from anywhere
|
|
39
|
+
const MEETING_CSP = "default-src 'none'; style-src 'unsafe-inline'; img-src data:; form-action 'none'; frame-ancestors 'none'; base-uri 'none'";
|
|
40
|
+
const { FILE_TOKEN } = require('./lib/meeting-guest-page.js');
|
|
37
41
|
const VIEW_CSP = (scripts) => `sandbox${scripts ? ' allow-scripts' : ''}; default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:; script-src ${scripts ? "'unsafe-inline'" : "'none'"}; frame-ancestors 'self'; base-uri 'none'; form-action 'none'`;
|
|
38
42
|
|
|
39
43
|
function send(res, status, body, headers = {}) {
|
|
@@ -113,6 +117,14 @@ async function handle(req, res) {
|
|
|
113
117
|
return res.end(req.method === 'HEAD' ? undefined : text);
|
|
114
118
|
}
|
|
115
119
|
if (req.method === 'GET') store.view(DIR, id, now);
|
|
120
|
+
// a meeting note (shareable-meeting-notes) is the guest page itself: made by PMOS with no script, so it needs no frame, and its own
|
|
121
|
+
// download icon names the Download address
|
|
122
|
+
if (meta.kind === 'meeting') {
|
|
123
|
+
const page = store.readPart(DIR, id, 'page.html');
|
|
124
|
+
if (page == null) return gone(res);
|
|
125
|
+
res.writeHead(200, { ...BASE_HEADERS, 'Content-Type': 'text/html; charset=utf-8', 'Content-Security-Policy': MEETING_CSP, 'X-Frame-Options': 'DENY' });
|
|
126
|
+
return res.end(req.method === 'HEAD' ? undefined : page.split(FILE_TOKEN).join(`/s/${id}/file`));
|
|
127
|
+
}
|
|
116
128
|
return send(res, 200, doc(meta.name, `<div class="wrap"><iframe src="/s/${esc(id)}/view" title="${esc(meta.name)}" sandbox="${meta.kind === 'html' ? 'allow-scripts' : ''}" referrerpolicy="no-referrer"></iframe>`
|
|
117
129
|
+ `<div class="bar"><span>A shared copy, made ${esc(day(meta.made))}. The link ends ${esc(day(meta.ends))}.</span><a class="btn" href="/s/${esc(id)}/file" download>Download</a></div></div>`));
|
|
118
130
|
}
|
|
@@ -132,4 +144,4 @@ if (require.main === module) {
|
|
|
132
144
|
const parent = Number(process.env.PMOS_SHARE_PARENT);
|
|
133
145
|
if (parent > 0) setInterval(() => { try { process.kill(parent, 0); } catch { process.exit(0); } }, 5000).unref();
|
|
134
146
|
}
|
|
135
|
-
module.exports = { start, handle, VIEW_CSP, PAGE_CSP };
|
|
147
|
+
module.exports = { start, handle, VIEW_CSP, PAGE_CSP, MEETING_CSP };
|
|
@@ -147,7 +147,7 @@ const route = async (page) => {
|
|
|
147
147
|
await route(page);
|
|
148
148
|
const am = new Date(); am.setHours(10, 0, 0, 0); await page.clock.setFixedTime(am);
|
|
149
149
|
await page.goto(BASE + '/premium.html?theme=light');
|
|
150
|
-
await until(() => page.evaluate(() => !!document.querySelector('#hmList [data-po-list="@top"] > [data-po-id]')), 20000);
|
|
150
|
+
await until(() => page.evaluate(() => !!document.querySelector('#hmList [data-po-list="@top"] > [data-po-id]') && document.body.dataset.hmTop === '1'), 20000);
|
|
151
151
|
await page.waitForTimeout(300);
|
|
152
152
|
return { ctx, page, errors };
|
|
153
153
|
};
|
|
@@ -182,6 +182,8 @@ const route = async (page) => {
|
|
|
182
182
|
const grips = await p.evaluate(() => [...document.querySelectorAll('#hmList [data-po-grip]')].filter((g) => getComputedStyle(g).display !== 'none').length);
|
|
183
183
|
ok('P phone: no grip shows (hold instead)', grips === 0, String(grips));
|
|
184
184
|
const hk = await top(p, '#hmList');
|
|
185
|
+
// the top of Home (Your move, Waiting on others) sits above the groups: bring them into view first
|
|
186
|
+
await p.evaluate((k) => document.querySelector(`#hmList [data-po-list="@top"] > [data-po-id="${k}"]`).scrollIntoView({ block: 'center' }), hk[hk.length - 1]);
|
|
185
187
|
const s = await p.locator(`#hmList [data-po-list="@top"] > [data-po-id="${hk[hk.length - 1]}"] .hv-gh`).boundingBox();
|
|
186
188
|
const t = await p.locator(`#hmList [data-po-list="@top"] > [data-po-id="${hk[0]}"]`).boundingBox();
|
|
187
189
|
const cdp = await ctx.newCDPSession(p);
|
|
@@ -102,6 +102,7 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
|
|
|
102
102
|
return json(r, { ok: true });
|
|
103
103
|
});
|
|
104
104
|
if (where === 'home') await page.goto(BASE + '/premium.html?ini=self-serve-v2&ws=w1&board=w1&theme=' + theme);
|
|
105
|
+
if (where === 'home') await until(() => page.evaluate(() => document.body.dataset.hmTop === '1'), 20000); // the top of Home has read its two sources
|
|
105
106
|
else {
|
|
106
107
|
await page.goto(BASE + '/premium-board.html?theme=' + theme);
|
|
107
108
|
await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .ini2, #ibBody .bt-l').length > 0), 20000);
|
|
@@ -184,6 +185,7 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
|
|
|
184
185
|
ok('S3 Undo puts the old name back', ru && ru.body.title === 'Brief support on the device limit', JSON.stringify(ru));
|
|
185
186
|
|
|
186
187
|
/* S4 the status chip */
|
|
188
|
+
await until(() => p.evaluate(() => !document.body.dataset.hmTop || document.body.dataset.hmTop === '1'), 10000); // Undo's read again has settled
|
|
187
189
|
await p.click('#czViewer [data-iv-edit="task-b1"]');
|
|
188
190
|
await until(() => p.evaluate(() => !!document.querySelector('#czViewer .iv-ed')));
|
|
189
191
|
await p.click('#czViewer .iv-ed .iv-edst');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "home-your-move-waiting (batch 30, design A′ board HmA2): Waiting on others derived from records with its exit rule and nudges (lib/waiting-on.js), and the top of Home (pm/home-top.js). Node only; no browser suite (minimal testing).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"waiting-on.test.js",
|
|
5
|
+
"home-top.test.js"
|
|
6
|
+
],
|
|
7
|
+
"seconds": {
|
|
8
|
+
"waiting-on.test.js": 1,
|
|
9
|
+
"home-top.test.js": 1
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "shareable-meeting-notes (batch 31 item 1): the cut PMOS proposes for a meeting note (pm/meeting-share.js), the guest page and the follow-up draft, POST /api/shares with a note, and share-server.js serving it. Node only, a real server, no browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"meeting-share.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"meeting-share.test.js": 6
|
|
8
|
+
}
|
|
9
|
+
}
|