@phnx-labs/artifacts-cli 0.10.0 → 0.12.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.
@@ -7,6 +7,8 @@ import { SELECTION_TOOLBAR_SCRIPT } from '../selection-toolbar.js';
7
7
  import { READER_ANCHORS_SCRIPT } from '../reader-anchors.js';
8
8
  import { SHARE_PUBLISH_WORKER_SOURCE } from './worker-publish-template.js';
9
9
  import { SHARE_MEDIA_WORKER_SOURCE } from './worker-media-template.js';
10
+ import { SHARE_PEOPLE_WORKER_SOURCE } from './worker-people-template.js';
11
+ import { QR_MARK_CLOSE, QR_MARK_OPEN } from './qr.js';
10
12
  // The Cloudflare Worker that fronts the R2 share bucket.
11
13
  //
12
14
  // One tiny Worker does both sides:
@@ -80,6 +82,11 @@ import { SHARE_MEDIA_WORKER_SOURCE } from './worker-media-template.js';
80
82
  // revisioned by the SHA-256 of its bytes and gets the review scripts
81
83
  // injected when served.
82
84
  //
85
+ // - /__people/<user>/<slug>, /__lookup, /__mine, /__shared — the people a
86
+ // page is shared with by email, and the pages a signed-in person owns or
87
+ // was given (PHNX-4394, worker-people-template.ts). The list widens a
88
+ // me/org page's audience inside gateVisibility.
89
+ //
83
90
  // - GET /__version — {"version": "<artifacts-cli version that built
84
91
  // this Worker>"}. The release workflow checks it after each deploy, and the
85
92
  // CLI compares it with its own version to explain a missing route.
@@ -171,6 +178,7 @@ import jetbrainsMono from '@fontsource/jetbrains-mono/files/jetbrains-mono-latin
171
178
  import barInter from '../../../fonts/InterVariable.woff2';
172
179
  import barJost from '../../../fonts/Jost-wght.woff2';
173
180
  import barPhoenix from '../../../brand/phoenix-gold.webp';
181
+ import QRCode from 'qrcode';
174
182
 
175
183
  // GENERATED from src/lib/share/worker-template.ts — do not edit here; edit
176
184
  // that file and deploy with artifacts share update.
@@ -207,6 +215,8 @@ export default {
207
215
  // The share bar's two faces (Inter, Jost), served from this origin so a
208
216
  // shared page never calls a third-party font host.
209
217
  if ((request.method === 'GET' || request.method === 'HEAD') && Object.prototype.hasOwnProperty.call(BAR_ASSETS, path)) return handleBarAsset(request, path);
218
+ // Who a page is shared with, and the pages a person owns or was given (PHNX-4394).
219
+ if (firstSeg === '__people' || path === '__lookup' || path === '__mine' || path === '__shared') return handlePeopleRoute(request, env, url, path);
210
220
  if ((request.method === 'GET' || request.method === 'HEAD') && firstSeg.startsWith('__')) {
211
221
  return new Response('not found', { status: 404, headers: { 'content-type': 'text/plain' } });
212
222
  }
@@ -346,6 +356,10 @@ export default {
346
356
  // math, and even a first/no-revision publish must read before its
347
357
  // conditional write so two concurrent creates cannot both report 200.
348
358
  const existing = await env.BUCKET.get(path);
359
+ // A new page at a free or expired address starts with nobody on its
360
+ // people list; a republish of the live page keeps it. The path lock
361
+ // holds every later attempt to the same answer.
362
+ if (attempt === 0 && segments.length === 2) await clearStalePeople(env, path, existing);
349
363
  if (auth.kind === 'phoenix') {
350
364
  const existingSize = existing && typeof existing.size === 'number' ? existing.size : 0;
351
365
  const newCanonical = !existing;
@@ -675,7 +689,7 @@ export default {
675
689
  const pageVisibility = (page.customMetadata && page.customMetadata.visibility) || 'public';
676
690
  if (viewer.error && isIdentityGated(pageVisibility)) return viewer.error;
677
691
  const denied = await gateVisibility(url, env, page, viewer.identity || null);
678
- if (denied) return isIdentityGated(pageVisibility) ? sealedCover(request, url, page, segments[0], pagePath) : denied;
692
+ if (denied) return isIdentityGated(pageVisibility) && denied.status !== 503 ? sealedCover(request, url, page, segments[0], pagePath) : denied;
679
693
  // A token-gated page's cover is token-gated too (PHNX-3654): a crawler
680
694
  // fetching <slug>.png without the key gets 404, so no preview leaks.
681
695
  const coverTokenDenied = await gateTokenRead(request, url, page, viewer.identity || null);
@@ -804,6 +818,11 @@ export default {
804
818
  }
805
819
  // An expired video's derived files go with it (best-effort, after the refund).
806
820
  if (path.split('/').filter(Boolean).length === 2) await deleteMediaDerived(env, path);
821
+ // So do its people list and inbox entries. Best-effort: a list left
822
+ // behind grants nothing, since the next page here clears it first.
823
+ if (path.split('/').filter(Boolean).length === 2) {
824
+ try { await clearPeople(env, path); } catch (e) { /* cleared again by the next publish here */ }
825
+ }
807
826
  // An expired slug is reusable, so its threads go with it, off the
808
827
  // response path like the view counter.
809
828
  const expiredCollab = collabConfig(env);
@@ -839,7 +858,7 @@ export default {
839
858
  const identity = viewer.identity || null;
840
859
  const denied = await gateVisibility(url, env, gateObj, identity);
841
860
  if (denied) {
842
- if (isIdentityGated(visibility) && wantsSealedPage(request)) {
861
+ if (isIdentityGated(visibility) && denied.status !== 503 && wantsSealedPage(request)) {
843
862
  const sealed = renderSealedPage(url, env, gateObj, identity);
844
863
  if (sealed) return sealed;
845
864
  }
@@ -920,6 +939,7 @@ export default {
920
939
  const viewerPage = renderAssetViewer(url.pathname, kind, gateObj.customMetadata || {}, firstSeg, {
921
940
  isOwner,
922
941
  ownerDomain,
942
+ link: shareLink(url),
923
943
  media: kind === 'video' ? await mediaViewData(env, ctx, gateObj, path, isOwner) : null,
924
944
  canRetry: isOwner && !!mediaConfig(env),
925
945
  });
@@ -958,11 +978,12 @@ export default {
958
978
  if (counting && ctx && typeof ctx.waitUntil === 'function') {
959
979
  ctx.waitUntil(writeViews(env, path, views));
960
980
  }
961
- const withBar = injectAttributionBar(rawHtml, obj.customMetadata || {}, firstSeg, {
981
+ const withBar = injectAttributionBar(servedFooter(rawHtml), obj.customMetadata || {}, firstSeg, {
962
982
  isOwner,
963
983
  ownerDomain,
964
984
  views,
965
985
  uploaded: obj.uploaded,
986
+ link: shareLink(url),
966
987
  });
967
988
  headers.delete('etag');
968
989
  return new Response(withBar, { status: 200, headers });
@@ -1041,6 +1062,7 @@ export default {
1041
1062
  }
1042
1063
  // A video takes its derived files with it (best-effort, after the refund).
1043
1064
  if (!isMediaDerived(doomed) && path.split('/').filter(Boolean).length === 2) await deleteMediaDerived(env, path);
1065
+ if (!isMediaDerived(doomed) && !isCover && path.split('/').filter(Boolean).length === 2) await clearPeople(env, path);
1044
1066
  const purge = collab && doomed && doomed.customMetadata && doomed.customMetadata['body-revision'] && path.split('/').filter(Boolean).length === 2
1045
1067
  ? await purgeShare(collab, url, path)
1046
1068
  : null;
@@ -1279,7 +1301,7 @@ var SHARE_PLANS = {
1279
1301
  var DEFAULT_SHARE_PLAN = 'free';
1280
1302
  var RATE_WINDOW_MS = 3600 * 1000; // fixed 1h publish-rate window
1281
1303
  function planLimits(plan) { return Object.prototype.hasOwnProperty.call(SHARE_PLANS, plan) ? SHARE_PLANS[plan] : SHARE_PLANS[DEFAULT_SHARE_PLAN]; }
1282
- function freshUsage() { return { bytes: 0, count: 0, plan: DEFAULT_SHARE_PLAN, rlStart: 0, rlUsed: 0, multipartCharges: [] }; }
1304
+ function freshUsage() { return { bytes: 0, count: 0, plan: DEFAULT_SHARE_PLAN, rlStart: 0, rlUsed: 0, multipartCharges: [], peopleStart: 0, peopleUsed: 0, lookupStart: 0, lookupUsed: 0, mineStart: 0, mineUsed: 0 }; }
1283
1305
  function usageNumber(v, fallback) { return typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : fallback; }
1284
1306
 
1285
1307
  // Everything in customMetadata that ISN'T one of the reserved provenance/label
@@ -1583,12 +1605,14 @@ function renderAttributionBar(meta, handle, opts) {
1583
1605
  if (o.views != null) stats.push(STAT_EYE_ICON + '<b>' + escapeHtml(String(o.views)) + '</b>&nbsp;' + (Number(o.views) === 1 ? 'view' : 'views'));
1584
1606
  if (whenText) stats.push('<span title="' + escapeHtml(cm.date || '') + '">' + escapeHtml(whenText) + '</span>');
1585
1607
  var foot = stats.length ? '<p class="ash-foot">' + stats.join('<span class="ash-sep">·</span>') + '</p>' : '';
1608
+ var qr = o.link && o.link.length <= QR_LINK_MAX ? '<div class="ash-qr" role="img" aria-label="QR code that opens this link"><span class="ash-qrc">' + shareQrSvg(o.link) + '</span>' +
1609
+ '<span class="ash-qrt"><b>Open on your phone</b><span>Point your camera at the code. It opens this link, with the same access.</span></span></div>' : '';
1586
1610
  var share = '<span class="ash-vis">' +
1587
1611
  '<button type="button" class="ash-share" data-ash-share' + (o.isOwner ? ' data-ash-chip' : '') + ' aria-label="Share" aria-haspopup="dialog" aria-expanded="false" title="' + chip.label + '">' + cic + '<span class="ash-sl" aria-hidden="true">Share</span></button>' +
1588
1612
  '<div class="ash-pop" data-ash-pop role="dialog" aria-label="Share" aria-hidden="true">' +
1589
1613
  '<div class="ash-link"><span class="ash-url" data-ash-url></span>' +
1590
1614
  '<button type="button" class="ash-copy" data-ash-copy aria-label="Copy link" title="Copy link"><span class="ash-cpi" data-ash-copy-ic>' + COPY_ICON + '</span></button></div>' +
1591
- levels + foot +
1615
+ qr + levels + foot +
1592
1616
  '</div>' + note + '</span>';
1593
1617
 
1594
1618
  // Comments: hidden until the page's review script (collab.ts) finds this
@@ -1673,6 +1697,11 @@ var ASH_BAR_CSS =
1673
1697
  '.agents-share-bar .ash-copy:hover{background:rgba(255,255,255,.08) !important;color:#fafafa !important}' +
1674
1698
  '.agents-share-bar .ash-copy.ash-done{color:#6ee7b7 !important}' +
1675
1699
  '.agents-share-bar .ash-cpi{display:inline-flex}' +
1700
+ '.agents-share-bar .ash-qr{display:flex;align-items:center;gap:12px;margin:0 2px 6px;padding:10px;border-radius:12px;border:1px solid rgba(255,255,255,.08) !important;background:rgba(255,255,255,.03) !important}' +
1701
+ '.agents-share-bar .ash-qrc{flex:none;display:block;width:88px;height:88px;padding:6px;border-radius:8px;background:#fff !important}' +
1702
+ '.agents-share-bar .ash-qrc svg{display:block;width:100%;height:100%}' +
1703
+ '.agents-share-bar .ash-qrt{display:flex;flex-direction:column;gap:3px;font-size:12px;line-height:1.4;color:#a1a1aa !important}' +
1704
+ '.agents-share-bar .ash-qrt b{font-size:13px;font-weight:500;color:#e4e4e7 !important}' +
1676
1705
  '.agents-share-bar .ash-ro{display:flex;align-items:center;gap:9px;margin:0;padding:6px 12px 8px;font-size:13px;color:#d4d4d8 !important}' +
1677
1706
  '.agents-share-bar .ash-foot{display:flex;align-items:center;gap:6px;margin:6px 0 0;padding:10px 12px 6px;border-top:1px solid rgba(255,255,255,.08) !important;font-size:12px;color:#a1a1aa !important}' +
1678
1707
  '.agents-share-bar .ash-foot b{color:#e4e4e7 !important;font-weight:500;font-variant-numeric:tabular-nums}' +
@@ -1813,6 +1842,65 @@ function injectAttributionBar(html, meta, handle, opts) {
1813
1842
  return bar + html;
1814
1843
  }
1815
1844
 
1845
+ // The link the Share sheet copies, as the sheet's script builds it: no
1846
+ // view-only query parameters, but a protected page keeps its key (k) so the link
1847
+ // still opens. The sheet's QR encodes this same link.
1848
+ function shareLink(url) {
1849
+ var k = url.searchParams.get('k');
1850
+ return url.origin + url.pathname + (k ? '?k=' + encodeURIComponent(k) : '');
1851
+ }
1852
+
1853
+ // The phone handoff in the Share sheet: dark modules drawn on the sheet's white
1854
+ // card, one quiet-zone module around them. Built per request, so the key in a
1855
+ // protected link reaches only someone who already opened the page with it, and
1856
+ // never the stored HTML that a screenshot or printout would carry.
1857
+ // A real share link is under 150 characters. Anything far longer is a crafted
1858
+ // ?k= on a page that never checks it, and past about 2,300 bytes the encoder
1859
+ // throws; such a link gets no QR rather than a failed page.
1860
+ var QR_LINK_MAX = 512;
1861
+
1862
+ function shareQrSvg(link) {
1863
+ var modules = QRCode.create(link, { errorCorrectionLevel: 'M' }).modules;
1864
+ var n = modules.size;
1865
+ var d = '';
1866
+ for (var y = 0; y < n; y++) {
1867
+ for (var x = 0; x < n; x++) {
1868
+ if (modules.get(y, x)) d += 'M' + x + ' ' + y + 'h1v1h-1z';
1869
+ }
1870
+ }
1871
+ return '<svg viewBox="-1 -1 ' + (n + 2) + ' ' + (n + 2) + '" width="88" height="88" shape-rendering="crispEdges" aria-hidden="true"><path fill="#101713" d="' + d + '"/></svg>';
1872
+ }
1873
+
1874
+ // A page published before 0.12.0 carries the footer QR, and on a protected page
1875
+ // it encodes the viewer key. Served pages drop it; the Share sheet has the QR.
1876
+ var STORED_QR = new RegExp(${JSON.stringify(QR_MARK_OPEN)} + '[^]*?' + ${JSON.stringify(QR_MARK_CLOSE)}, 'g');
1877
+
1878
+ var MADE_WITH = '<a class="ash-made" href="https://getrush.ai">Made with Rush</a>' +
1879
+ '<style>.document-footer{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px}' +
1880
+ '.document-footer .footer-end{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px 14px;margin-left:auto}' +
1881
+ '.ash-made{color:var(--muted,#6b645a);text-decoration:none}.ash-made:hover{color:var(--text,#1d1a16)}</style>';
1882
+
1883
+ // The rendered page's footer, as served: the stored QR gone and a quiet
1884
+ // "Made with Rush" link at the start of the footer's right side, so the credit
1885
+ // travels with a printout or a cropped capture that loses the bar. Only an
1886
+ // artifacts-cli render (it styles .document-footer) gets one; arbitrary HTML is
1887
+ // left alone, with the bar as its credit.
1888
+ function servedFooter(html) {
1889
+ var page = html.replace(STORED_QR, '').replace(/<div class="footer-end"><[/]div>/g, '');
1890
+ if (page.indexOf('.document-footer{') === -1 || page.indexOf('class="ash-made"') !== -1) return page;
1891
+ var end = page.indexOf('<div class="footer-end">');
1892
+ if (end !== -1) {
1893
+ var at = end + '<div class="footer-end">'.length;
1894
+ return page.slice(0, at) + MADE_WITH + page.slice(at);
1895
+ }
1896
+ var footer = page.indexOf('<footer class="document-footer">');
1897
+ var close = footer === -1 ? -1 : page.indexOf('</footer>', footer);
1898
+ if (close !== -1) return page.slice(0, close) + '<div class="footer-end">' + MADE_WITH + '</div>' + page.slice(close);
1899
+ var main = page.search(/<[/]main>/i);
1900
+ if (main !== -1) return page.slice(0, main) + '<footer class="document-footer"><div class="footer-end">' + MADE_WITH + '</div></footer>' + page.slice(main);
1901
+ return page;
1902
+ }
1903
+
1816
1904
  function acceptsHtml(request) {
1817
1905
  return (request.headers.get('accept') || '').indexOf('text/html') !== -1;
1818
1906
  }
@@ -2165,21 +2253,19 @@ function commentPolicyOf(meta) {
2165
2253
  return 'off';
2166
2254
  }
2167
2255
 
2168
- // read is decided by the page's own gate before this runs. Commenting needs a
2169
- // signed-in reader, a policy other than off, and, under audience, membership:
2170
- // the owner for me, the stamped email domain for org, any signed-in reader
2171
- // for a link or public page. Resolving needs exactly what commenting needs.
2256
+ // read is decided by the page's own gate before this runs, and on a me or org
2257
+ // page that gate admits exactly the audience: the owner, the stamped email
2258
+ // domain, and the people the owner listed. Commenting needs a signed-in
2259
+ // reader and a policy other than off; any reader of a link or public page is
2260
+ // in its audience. Resolving needs exactly what commenting needs.
2172
2261
  function collabGrant(meta, identity, owner) {
2173
2262
  const visibility = meta.visibility || 'public';
2174
2263
  const policy = commentPolicyOf(meta);
2175
- let inAudience = true;
2176
- if (visibility === 'me') inAudience = owner;
2177
- else if (visibility === 'org') inAudience = !!identity && !!meta.org_domain && emailDomain(identity.email) === String(meta.org_domain).toLowerCase();
2178
2264
  // A page with no owner cannot be registered with Rush, so it takes no comments.
2179
- const comment = !!identity && !!meta.owner && policy !== 'off' && (policy === 'signed_in' || inAudience);
2265
+ const comment = !!identity && !!meta.owner && policy !== 'off';
2180
2266
  // Resolving closes a thread for everyone. A me/org page's audience may; on any
2181
2267
  // other page only the owner may, so a signed-in stranger cannot close threads.
2182
- const resolve = comment && (owner || ((visibility === 'me' || visibility === 'org') && inAudience));
2268
+ const resolve = comment && (owner || visibility === 'me' || visibility === 'org');
2183
2269
  return { read: true, comment: comment, resolve: resolve };
2184
2270
  }
2185
2271
 
@@ -2276,17 +2362,18 @@ function withCollabStatus(response, registration) {
2276
2362
  return response;
2277
2363
  }
2278
2364
 
2279
- // Registry calls ride the publish/delete response, so they are bounded and
2280
- // report rather than throw. Both are mutations: Rush requires an
2281
- // Idempotency-Key and an X-Collab-Share naming the same share as the call.
2365
+ // Calls to Rush's internal routes ride a Worker response, so they are bounded
2366
+ // and report rather than throw. Registry mutations need an Idempotency-Key and
2367
+ // an X-Collab-Share naming the same share as the call; the people lookup is
2368
+ // about no share and sends none. A success carries Rush's parsed JSON body.
2282
2369
  async function collabRegistryCall(collab, method, path, shareId, body, idempotencyKey) {
2283
2370
  const headers = {
2284
2371
  authorization: 'Bearer ' + collab.token,
2285
2372
  'user-agent': COLLAB_USER_AGENT,
2286
2373
  accept: 'application/json',
2287
2374
  'idempotency-key': idempotencyKey || crypto.randomUUID(),
2288
- 'x-collab-share': shareId,
2289
2375
  };
2376
+ if (shareId) headers['x-collab-share'] = shareId;
2290
2377
  if (body !== undefined) headers['content-type'] = 'application/json';
2291
2378
  let res;
2292
2379
  try {
@@ -2300,14 +2387,15 @@ async function collabRegistryCall(collab, method, path, shareId, body, idempoten
2300
2387
  return { error: 'collaboration service unreachable: ' + (error && error.message ? error.message : String(error)) };
2301
2388
  }
2302
2389
  let detail = '';
2390
+ let parsed = null;
2303
2391
  try {
2304
- const parsed = await res.json();
2392
+ parsed = await res.json();
2305
2393
  if (parsed && typeof parsed.error === 'string') detail = parsed.error;
2306
2394
  } catch {
2307
2395
  // a non-JSON body carries no detail worth surfacing
2308
2396
  }
2309
2397
  if (!res.ok) return { status: res.status, error: 'collaboration service answered ' + res.status + (detail ? ': ' + detail : '') };
2310
- return { status: res.status };
2398
+ return { status: res.status, body: parsed };
2311
2399
  }
2312
2400
 
2313
2401
  async function registerShare(env, collab, url, key, meta, idempotencyKey) {
@@ -2431,8 +2519,9 @@ async function handleCollab(request, env, url, path) {
2431
2519
  if (viewerKey) pageUrl.searchParams.set('k', viewerKey);
2432
2520
  const viewer = await resolveViewer(request, env, url);
2433
2521
  const identity = viewer.identity || null;
2434
- const readable = !(await gateVisibility(pageUrl, env, obj, identity)) && !(await gateTokenRead(request, pageUrl, obj, identity));
2435
- if (!readable) return collabJson({ error: 'forbidden' }, 403);
2522
+ const readDenied = (await gateVisibility(pageUrl, env, obj, identity)) || (await gateTokenRead(request, pageUrl, obj, identity));
2523
+ if (readDenied && readDenied.status === 503) return collabJson({ error: 'access_check_unavailable' }, 503);
2524
+ if (readDenied) return collabJson({ error: 'forbidden' }, 403);
2436
2525
  const owner = !!identity && (meta.owner === identity.userId || (await holdsHandleClaim(env.BUCKET, key.split('/')[0], identity.userId)));
2437
2526
  const grant = collabGrant(meta, identity, owner);
2438
2527
 
@@ -2544,6 +2633,7 @@ async function handleCollab(request, env, url, path) {
2544
2633
 
2545
2634
  ${SHARE_PUBLISH_WORKER_SOURCE}
2546
2635
  ${SHARE_MEDIA_WORKER_SOURCE}
2636
+ ${SHARE_PEOPLE_WORKER_SOURCE}
2547
2637
  // Ownership for an edit of an existing <handle>/<slug>: WRITE_TOKEN is the
2548
2638
  // endpoint admin; a Phoenix caller must own the handle the way PUT and DELETE
2549
2639
  // decide it (the __handles claim, transferring it on a same-email account
@@ -2620,6 +2710,8 @@ async function transferHandle(bucket, handle, oldUserId, newUserId, email) {
2620
2710
  httpMetadata: { contentType: 'application/json' },
2621
2711
  customMetadata: { userId: newUserId, email: email, visibility: 'unlisted' },
2622
2712
  });
2713
+ await bucket.put(handleIndexPrefix(newUserId) + handle, '', { customMetadata: { visibility: 'unlisted' } });
2714
+ await bucket.delete(handleIndexPrefix(oldUserId) + handle);
2623
2715
  let cursor;
2624
2716
  do {
2625
2717
  const list = await bucket.list({ prefix: handle + '/', cursor: cursor, include: ['customMetadata'] });
@@ -2653,9 +2745,16 @@ async function claimHandle(bucket, handle, userId, email) {
2653
2745
  httpMetadata: { contentType: 'application/json' },
2654
2746
  customMetadata: { userId: userId, email: email || '', visibility: 'unlisted' },
2655
2747
  });
2748
+ await bucket.put(handleIndexPrefix(userId) + handle, '', { customMetadata: { visibility: 'unlisted' } });
2656
2749
  return {};
2657
2750
  }
2658
2751
 
2752
+ // The handles a user holds, one empty key each, so /__mine finds an account's
2753
+ // alternate handles without scanning every claim. Written with the claim.
2754
+ function handleIndexPrefix(userId) {
2755
+ return '__handles-by-user/' + sanitizeNamespace(userId) + '/';
2756
+ }
2757
+
2659
2758
  function normalizeVisibility(raw) {
2660
2759
  const v = (raw || '').trim().toLowerCase();
2661
2760
  if (!v || v === 'public') return { value: 'public' };
@@ -2718,9 +2817,11 @@ function managedCoverHeaders(visibility) {
2718
2817
  return headers;
2719
2818
  }
2720
2819
 
2721
- // Gate a me/org read given the ALREADY-RESOLVED viewer identity. Pure/sync: the
2722
- // caller resolves the viewer once (it also needs the identity for the ownership
2723
- // check) and both the page GET and the ?revisions=json path share this gate.
2820
+ // Gate a me/org read given the ALREADY-RESOLVED viewer identity: the owner and
2821
+ // the stamped domain (viewerMayRead), the handle-claim holder, then the page's
2822
+ // people list. Every read of a page or anything derived from it (bytes, ranges,
2823
+ // covers, transcripts, review threads, revisions) answers to this one gate.
2824
+ // A 503 means the people list could not be read; callers pass it through.
2724
2825
  async function gateVisibility(url, env, obj, identity) {
2725
2826
  const visibility = (obj.customMetadata && obj.customMetadata.visibility) || 'public';
2726
2827
  if (!isIdentityGated(visibility)) return null;
@@ -2735,6 +2836,19 @@ async function gateVisibility(url, env, obj, identity) {
2735
2836
  // has to consult the claim rather than the stamp.
2736
2837
  const handle = decodeURIComponent(url.pathname).split('/').filter(Boolean)[0] || '';
2737
2838
  if (visibility === 'me' && handle && (await holdsHandleClaim(env.BUCKET, handle, identity.userId))) return null;
2839
+ // The people the owner listed (PHNX-4394) widen the audience. The list is
2840
+ // read on every request, so a removal takes effect at once, and a list
2841
+ // that cannot be read refuses the viewer instead of guessing.
2842
+ const email = String(identity.email || '').toLowerCase();
2843
+ if (email) {
2844
+ let people;
2845
+ try {
2846
+ people = await readPeople(env, obj.key);
2847
+ } catch (error) {
2848
+ return accessCheckUnavailable();
2849
+ }
2850
+ if (people.indexOf(email) !== -1) return null;
2851
+ }
2738
2852
  return new Response('not found', { status: 404, headers: { 'content-type': 'text/plain' } });
2739
2853
  }
2740
2854
  return null;
@@ -2851,6 +2965,12 @@ async function readUsage(env, owner) {
2851
2965
  multipartCharges: Array.isArray(parsed.multipartCharges)
2852
2966
  ? parsed.multipartCharges.filter(function (id) { return typeof id === 'string'; })
2853
2967
  : [],
2968
+ peopleStart: usageNumber(parsed.peopleStart, 0),
2969
+ peopleUsed: usageNumber(parsed.peopleUsed, 0),
2970
+ lookupStart: usageNumber(parsed.lookupStart, 0),
2971
+ lookupUsed: usageNumber(parsed.lookupUsed, 0),
2972
+ mineStart: usageNumber(parsed.mineStart, 0),
2973
+ mineUsed: usageNumber(parsed.mineUsed, 0),
2854
2974
  };
2855
2975
  }
2856
2976
  } catch (e) {
@@ -2893,13 +3013,30 @@ async function withUsage(env, owner, fn) {
2893
3013
  return json({ error: 'usage ledger contended, retry' }, 503);
2894
3014
  }
2895
3015
 
2896
- function rateLimited(retryAfterSec, ratePerHour) {
3016
+ function rateLimited(retryAfterSec, ratePerHour, error) {
2897
3017
  return new Response(
2898
- JSON.stringify({ error: 'rate limit: too many publishes, retry later', retryAfterSec: retryAfterSec, ratePerHour: ratePerHour }),
2899
- { status: 429, headers: { 'content-type': 'application/json', 'retry-after': String(retryAfterSec) } },
3018
+ JSON.stringify({ error: error || 'rate limit: too many publishes, retry later', retryAfterSec: retryAfterSec, ratePerHour: ratePerHour }),
3019
+ { status: 429, headers: { 'content-type': 'application/json', 'cache-control': 'no-store', 'retry-after': String(retryAfterSec) } },
2900
3020
  );
2901
3021
  }
2902
3022
 
3023
+ // Count amount against one of the ledger's fixed 1h windows (field + 'Start' /
3024
+ // field + 'Used', e.g. people, lookup) for owner. Returns a 429
3025
+ // {error:'rate_limited'} Response past perHour, or null once counted.
3026
+ async function chargeHourly(env, owner, field, perHour, amount) {
3027
+ const now = Date.now();
3028
+ const out = await withUsage(env, owner, function (usage) {
3029
+ if (now - usage[field + 'Start'] >= RATE_WINDOW_MS) { usage[field + 'Start'] = now; usage[field + 'Used'] = 0; }
3030
+ if (usage[field + 'Used'] + amount > perHour) {
3031
+ const retryAfterSec = Math.max(1, Math.ceil((usage[field + 'Start'] + RATE_WINDOW_MS - now) / 1000));
3032
+ return { reject: rateLimited(retryAfterSec, perHour, 'rate_limited') };
3033
+ }
3034
+ usage[field + 'Used'] += amount;
3035
+ return { commit: usage, result: null };
3036
+ });
3037
+ return out;
3038
+ }
3039
+
2903
3040
  // Charge one authed PUT against the owner's ledger. Rate → per-file cap → object
2904
3041
  // count → byte quota, each failing loud (429 / 413) before anything is written.
2905
3042
  // Returns { error: Response } on any rejection, else { limits } (the resolved
@@ -3202,9 +3339,13 @@ async function redeemTicket(ticket, env) {
3202
3339
  // {userId, email, name?} from a Phoenix identity body (/auth/me, /auth/ticket,
3203
3340
  // or a test hook's claims). name is optional: Phoenix sends it when the account
3204
3341
  // has one, and review threads fall back to the email local part without it.
3342
+ // Phoenix stores only Google-verified (or operator-confirmed) addresses and
3343
+ // does not send the flag; an answer that does say unverified carries no email,
3344
+ // so it can match neither a domain nor a people list.
3205
3345
  function phoenixIdentity(body) {
3206
3346
  if (!body || typeof body.userId !== 'string' || !body.userId) return null;
3207
- const identity = { userId: body.userId, email: typeof body.email === 'string' ? body.email : '' };
3347
+ const unverified = body.email_verified === false || body.emailVerified === false;
3348
+ const identity = { userId: body.userId, email: typeof body.email === 'string' && !unverified ? body.email : '' };
3208
3349
  if (typeof body.name === 'string' && body.name.trim()) identity.name = body.name.trim();
3209
3350
  return identity;
3210
3351
  }
@@ -1 +1 @@
1
- {"version":3,"file":"worker-template.js","sourceRoot":"","sources":["../../../src/lib/share/worker-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAm1B3B,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/artifacts-cli",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Your coding agent writes Markdown; artifacts turns it into one polished HTML page you can read, mark up and share as a link.",
5
5
  "homepage": "https://artifacts-cli.sh",
6
6
  "repository": {