visualproof 0.11.2 → 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.
- package/README.md +5 -1
- package/dist/server/app.js +18 -6
- package/dist/server/appaccess.js +7 -5
- package/dist/server/appcall.js +118 -0
- package/dist/server/appshare.js +27 -4
- package/dist/server/call.js +373 -0
- package/dist/server/children.js +6 -5
- package/dist/server/live.js +46 -2
- package/dist/server/livekit.js +193 -0
- package/dist/server/main.js +30 -0
- package/dist/server/options.js +45 -1
- package/dist/server/pipeline.js +4 -3
- package/dist/server/readonly.js +18 -4
- package/dist/server/readonlygate.js +5 -1
- package/dist/shared/call.js +5 -0
- package/dist/web/bundle/app.js +647 -42
- package/dist/web/bundle/call.js +33692 -0
- package/dist/web/index.html +27 -0
- package/dist/web/style.css +166 -8
- package/package.json +2 -1
package/dist/web/bundle/app.js
CHANGED
|
@@ -1758,8 +1758,8 @@ function layoutCluster(c3, pos) {
|
|
|
1758
1758
|
settle(items, potentials(c3));
|
|
1759
1759
|
}
|
|
1760
1760
|
const enc2 = items.length ? enclose_default(items.map((i2) => ({ x: i2.x, y: i2.y, r: i2.r }))) : { x: 0, y: 0, r: 0 };
|
|
1761
|
-
const
|
|
1762
|
-
c3.r = (enc2?.r ?? 0) +
|
|
1761
|
+
const pad2 = c3.parent ? 10 + Math.min(14, Math.sqrt(c3.count)) : 0;
|
|
1762
|
+
c3.r = (enc2?.r ?? 0) + pad2;
|
|
1763
1763
|
for (const it2 of items) {
|
|
1764
1764
|
const x2 = it2.x - (enc2?.x ?? 0);
|
|
1765
1765
|
const y2 = it2.y - (enc2?.y ?? 0);
|
|
@@ -5356,6 +5356,8 @@ function snapshotSource(info2) {
|
|
|
5356
5356
|
readOnlyLinks: async () => null,
|
|
5357
5357
|
makeReadOnly: async () => ({ error: "a snapshot has no server to share" }),
|
|
5358
5358
|
revokeReadOnly: async () => ({ error: "a snapshot has no server" }),
|
|
5359
|
+
readOnlyCall: async () => ({ error: "a snapshot has no server" }),
|
|
5360
|
+
callPost: async () => ({ status: 404, body: { error: "a snapshot has no call" } }),
|
|
5359
5361
|
chat: async () => null,
|
|
5360
5362
|
sendChat: async () => ({ error: "a snapshot has no server" }),
|
|
5361
5363
|
newChat: async () => ({ error: "a snapshot has no server" }),
|
|
@@ -5431,8 +5433,10 @@ function serverSource() {
|
|
|
5431
5433
|
myLink: () => fetch("/api/share/people/mine", { method: "POST", headers: headers(), body: "{}" }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5432
5434
|
renewMyLink: (stream) => fetch("/api/share/people/mine/renew", { method: "POST", headers: headers(), body: JSON.stringify(stream ? { stream } : {}) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5433
5435
|
readOnlyLinks: () => fetch("/api/share/readonly").then((r2) => r2.ok ? r2.json() : null).then((b2) => b2?.links ?? null).catch(() => null),
|
|
5434
|
-
makeReadOnly: () => fetch("/api/share/readonly", { method: "POST", headers: headers(), body:
|
|
5436
|
+
makeReadOnly: (call) => fetch("/api/share/readonly", { method: "POST", headers: headers(), body: JSON.stringify(call ? { call: true } : {}) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5435
5437
|
revokeReadOnly: (id) => fetch("/api/share/readonly/revoke", { method: "POST", headers: headers(), body: JSON.stringify({ id }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5438
|
+
readOnlyCall: (id, call) => fetch("/api/share/readonly/call", { method: "POST", headers: headers(), body: JSON.stringify({ id, call }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5439
|
+
callPost: (path, body) => fetch(path, { method: "POST", headers: headers(), body: JSON.stringify(body) }).then(async (r2) => ({ status: r2.status, body: await r2.json().catch(() => ({})) ?? {} })).catch(() => ({ status: 0, body: { error: "the server could not be reached" } })),
|
|
5436
5440
|
activity: () => fetch("/api/activity").then((r2) => r2.ok ? r2.json() : { events: [] }).then((b2) => b2.events).catch(() => []),
|
|
5437
5441
|
shareInfo: () => fetch("/api/share").then((r2) => r2.json()).then((b2) => ({ ...b2, path: typeof b2.path === "string" ? b2.path : null })),
|
|
5438
5442
|
updates: () => fetch("/api/updates").then((r2) => r2.ok ? r2.json() : null).then((b2) => b2 && typeof b2.running === "string" ? b2 : null).catch(() => null),
|
|
@@ -6346,7 +6350,7 @@ var FocusMenu = class {
|
|
|
6346
6350
|
};
|
|
6347
6351
|
|
|
6348
6352
|
// src/web/src/reload.ts
|
|
6349
|
-
var PAGE_VERSION = true ? "0.
|
|
6353
|
+
var PAGE_VERSION = true ? "0.12.0" : null;
|
|
6350
6354
|
var KEY = "visualproof:reload";
|
|
6351
6355
|
var FOR_KEY = "visualproof:reloaded-for";
|
|
6352
6356
|
var FRESH_MS = 10 * 6e4;
|
|
@@ -10561,6 +10565,10 @@ var Share = class {
|
|
|
10561
10565
|
/** a Revoke pressed once, waiting for the second press */
|
|
10562
10566
|
arming = null;
|
|
10563
10567
|
busy = false;
|
|
10568
|
+
/** the guest link opens the call's pre-join (`?call`, CallSpec decision 6): off until switched */
|
|
10569
|
+
callLink = false;
|
|
10570
|
+
/** a read-only link made now joins the call (CallSpec decision 4): off until switched */
|
|
10571
|
+
roCall = false;
|
|
10564
10572
|
constructor(btn, pop, hooks) {
|
|
10565
10573
|
this.btn = btn;
|
|
10566
10574
|
this.pop = pop;
|
|
@@ -10571,6 +10579,11 @@ var Share = class {
|
|
|
10571
10579
|
const tab = t2.closest("[data-tab]");
|
|
10572
10580
|
if (tab) return void this.show(tab.dataset.tab);
|
|
10573
10581
|
if (t2.closest("[data-exact]")) void this.setExact(!this.hooks.exact.get());
|
|
10582
|
+
else if (t2.closest("[data-call-link]")) void this.setCallLink(!this.callLink);
|
|
10583
|
+
else if (t2.closest("[data-ro-call]")) {
|
|
10584
|
+
this.roCall = !this.roCall;
|
|
10585
|
+
this.render();
|
|
10586
|
+
} else if (t2.closest("[data-ro-callsw]")) void this.switchReadOnlyCall(t2.closest("[data-ro-callsw]").dataset.roCallsw);
|
|
10574
10587
|
else if (t2.closest("[data-copy]")) void this.copyAgain(".sh-url", "[data-copy]");
|
|
10575
10588
|
else if (t2.closest("[data-copy-invite]")) void this.copyAgain(".sh-invite-url", "[data-copy-invite]");
|
|
10576
10589
|
else if (t2.closest("[data-copy-ro]")) void this.copyAgain(".sh-ro-url", "[data-copy-ro]");
|
|
@@ -10631,7 +10644,41 @@ var Share = class {
|
|
|
10631
10644
|
* read-only reader, the link they came by. */
|
|
10632
10645
|
async link() {
|
|
10633
10646
|
const { path } = await this.shareInfo();
|
|
10634
|
-
return `${this.hooks.base()}${path ?? "/"}${await this.fragment()}`;
|
|
10647
|
+
return `${this.hooks.base()}${path ?? "/"}${this.joinsCall() ? "?call" : ""}${await this.fragment()}`;
|
|
10648
|
+
}
|
|
10649
|
+
/** Whether the guest link opens the call's pre-join: switched on, where there is a call. */
|
|
10650
|
+
joinsCall() {
|
|
10651
|
+
return this.callLink && !!this.hooks.call?.();
|
|
10652
|
+
}
|
|
10653
|
+
/** Join the call switched (CallSpec decision 6): the guest link made again and copied. */
|
|
10654
|
+
async setCallLink(on) {
|
|
10655
|
+
this.callLink = on;
|
|
10656
|
+
const url = await this.link();
|
|
10657
|
+
this.person = { url, copied: await copy(url) };
|
|
10658
|
+
this.render();
|
|
10659
|
+
this.pop.querySelector("[data-call-link]")?.focus();
|
|
10660
|
+
}
|
|
10661
|
+
/** The switch Join the call, where there is a call: whoever opens the link finds its pre-join. */
|
|
10662
|
+
callRow() {
|
|
10663
|
+
if (!this.hooks.call?.()) return "";
|
|
10664
|
+
const on = this.joinsCall();
|
|
10665
|
+
return `<button type="button" class="sh-exact" role="switch" aria-checked="${on}" data-call-link title="Whoever opens the link finds the call ready to join"><span class="sh-switch" aria-hidden="true"></span>Join the call</button>`;
|
|
10666
|
+
}
|
|
10667
|
+
/** Whether a read-only link joins the call, switched by anyone let in (CallSpec decision 4). */
|
|
10668
|
+
async switchReadOnlyCall(id) {
|
|
10669
|
+
const l2 = this.readOnlyLinks?.find((x2) => x2.id === id);
|
|
10670
|
+
if (!l2) return;
|
|
10671
|
+
const r2 = await this.hooks.data.readOnlyCall(id, !l2.call);
|
|
10672
|
+
if (r2.links) this.readOnlyLinks = r2.links.filter((x2) => !x2.revoked);
|
|
10673
|
+
const ro = this.readOnly;
|
|
10674
|
+
if (ro.kind === "link" && ro.id === id) {
|
|
10675
|
+
const now = this.readOnlyLinks?.find((x2) => x2.id === id);
|
|
10676
|
+
if (now) {
|
|
10677
|
+
const base = now.link + (now.call ? "?call" : "");
|
|
10678
|
+
this.readOnly = { ...ro, base, link: base + await this.fragment() };
|
|
10679
|
+
}
|
|
10680
|
+
}
|
|
10681
|
+
this.render();
|
|
10635
10682
|
}
|
|
10636
10683
|
/** What a link carries after `#`: the address, and with Exactly what I see the snapshot of what the
|
|
10637
10684
|
* reader sees after it. */
|
|
@@ -10739,7 +10786,7 @@ var Share = class {
|
|
|
10739
10786
|
if (this.tab === "person") {
|
|
10740
10787
|
const { url, copied } = this.person;
|
|
10741
10788
|
const keyed = new URL(url, location.href).pathname.startsWith("/k/");
|
|
10742
|
-
body = `<input class="sh-url" readonly value="${escapeHtml(url)}" aria-label="The link" spellcheck="false">` + this.exactRow() + `<div class="sh-note muted">${copied ? "Copied. " : ""}` + (keyed ? "Anyone with it comes in as a guest." : "This server lets in anyone who can reach it.") + `</div><div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-copy>${copied ? "Copy again" : "Copy"}</button></div>`;
|
|
10789
|
+
body = `<input class="sh-url" readonly value="${escapeHtml(url)}" aria-label="The link" spellcheck="false">` + this.exactRow() + this.callRow() + `<div class="sh-note muted">${copied ? "Copied. " : ""}` + (keyed ? "Anyone with it comes in as a guest." : "This server lets in anyone who can reach it.") + `</div><div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-copy>${copied ? "Copy again" : "Copy"}</button></div>`;
|
|
10743
10790
|
} else body = this.tab === "readonly" ? this.readOnlyBody() : this.tab === "invite" ? this.inviteBody() : this.agentBody();
|
|
10744
10791
|
keepFocus(this.pop, () => this.pop.innerHTML = tabs + `<div class="sh-body">${body}</div>` + this.readOnlyList() + this.peopleList() + this.tokenList());
|
|
10745
10792
|
if (focus) this.pop.querySelector(`[data-f=${focus}]`)?.focus();
|
|
@@ -10753,7 +10800,7 @@ var Share = class {
|
|
|
10753
10800
|
const note = byAddress ? "Anyone who reaches this server may read the project: the address is the read-only link." : this.info.readOnly ? "The link you came by: it shows the project to whoever has it, read-only. Whoever made it can revoke it, which ends every page it opened." : this.info.public ? "This server lets anyone who reaches it read the project (it runs with --public): the address is the read-only link." : `Whoever has it sees what a guest sees, changes nothing and is not seen. It lasts until revoked below.${r2.made ? "" : " Shown again."}`;
|
|
10754
10801
|
return `<input class="sh-url sh-ro-url" readonly value="${escapeHtml(r2.link)}" aria-label="The read-only link" spellcheck="false">` + this.exactRow() + `<div class="sh-note muted">${r2.copied ? "Copied. " : ""}${note}</div><div class="modal-actions">${r2.id ? `<button class="rv-btn" data-ro-again>${this.info.public ? "The address" : "Another link"}</button>` : `<button class="rv-btn" data-close>Close</button>`}<button class="rv-btn primary" data-copy-ro>${r2.copied ? "Copy again" : "Copy"}</button></div>`;
|
|
10755
10802
|
}
|
|
10756
|
-
return `<div class="sh-note muted">Anyone with it can look, unseen, and change nothing, until you revoke it.</div>` + this.exactRow() + (r2.error ? `<div class="modal-err">${escapeHtml(r2.error)}</div>` : "") + `<div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-ro-create${this.busy ? " disabled" : ""}>Create link</button></div>`;
|
|
10803
|
+
return `<div class="sh-note muted">Anyone with it can look, unseen, and change nothing, until you revoke it.</div>` + this.exactRow() + (this.hooks.call?.() ? `<button type="button" class="sh-exact" role="switch" aria-checked="${this.roCall}" data-ro-call title="Whoever has it may join the call too, under a name they give: seen in the call, nowhere else"><span class="sh-switch" aria-hidden="true"></span>Can join the call</button>` : "") + (r2.error ? `<div class="modal-err">${escapeHtml(r2.error)}</div>` : "") + `<div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-ro-create${this.busy ? " disabled" : ""}>Create link</button></div>`;
|
|
10757
10804
|
}
|
|
10758
10805
|
/** The read-only links in force: who made each and when, when it was last used, the link shown
|
|
10759
10806
|
* again on a click on it, and Revoke. */
|
|
@@ -10766,22 +10813,23 @@ var Share = class {
|
|
|
10766
10813
|
const armed = this.arming === `r:${l2.id}`;
|
|
10767
10814
|
const shown2 = this.tab === "readonly" && this.readOnly.kind === "link" && this.readOnly.id === l2.id;
|
|
10768
10815
|
const id = escapeHtml(l2.id);
|
|
10769
|
-
return `<div class="sh-tok${shown2 ? " on" : ""}"><div class="sh-tok-text" data-ro-show="${id}" title="Show the link again"><div><b>Read-only link</b> <span class="sh-lvl">${id}</span></div><div class="muted">${l2.by ? `by ${escapeHtml(l2.by)}, ` : ""}${escapeHtml(ago(l2.created))} \xB7 ${l2.lastUsed ? `last used ${escapeHtml(ago(l2.lastUsed))}` : "not used yet"}</div></div
|
|
10816
|
+
return `<div class="sh-tok${shown2 ? " on" : ""}"><div class="sh-tok-text" data-ro-show="${id}" title="Show the link again"><div><b>Read-only link</b> <span class="sh-lvl">${id}</span></div><div class="muted">${l2.by ? `by ${escapeHtml(l2.by)}, ` : ""}${escapeHtml(ago(l2.created))} \xB7 ${l2.lastUsed ? `last used ${escapeHtml(ago(l2.lastUsed))}` : "not used yet"}${l2.call ? " \xB7 joins the call" : ""}</div></div>` + (this.hooks.call?.() ? `<button class="rv-btn sh-act" data-ro-callsw="${id}" aria-pressed="${!!l2.call}" title="${l2.call ? "Whoever has it may join the call: press to stop that (they leave it at once)" : "Let whoever has it join the call, under a name they give"}">${l2.call ? "Call \u2713" : "Call"}</button>` : "") + `<button class="rv-btn sh-act" data-ro-show="${id}" aria-pressed="${shown2}" title="The link, to give again">Show link</button><button class="rv-btn sh-act${armed ? " bad" : ""}" data-revoke-ro="${id}" title="It lets nobody in any more, and the pages it opened close, at once">${armed ? "Revoke it" : "Revoke"}</button></div>`;
|
|
10770
10817
|
}
|
|
10771
10818
|
/** Make a read-only link: under the reader's name if they have one (none is asked for). */
|
|
10772
10819
|
async makeReadOnly() {
|
|
10773
10820
|
if (this.busy) return;
|
|
10774
10821
|
this.busy = true;
|
|
10775
10822
|
this.render();
|
|
10776
|
-
const r2 = await this.hooks.data.makeReadOnly();
|
|
10823
|
+
const r2 = await this.hooks.data.makeReadOnly(this.roCall && !!this.hooks.call?.());
|
|
10777
10824
|
this.busy = false;
|
|
10778
10825
|
if ("error" in r2) {
|
|
10779
10826
|
this.readOnly = { kind: "form", error: r2.error };
|
|
10780
10827
|
return this.render();
|
|
10781
10828
|
}
|
|
10782
10829
|
this.readOnlyLinks = r2.links.filter((l2) => !l2.revoked);
|
|
10783
|
-
const
|
|
10784
|
-
|
|
10830
|
+
const base = r2.made.link + (r2.made.call ? "?call" : "");
|
|
10831
|
+
const link = base + await this.fragment();
|
|
10832
|
+
this.readOnly = { kind: "link", id: r2.made.id, base, link, made: true, copied: await copy(link) };
|
|
10785
10833
|
await this.show("readonly");
|
|
10786
10834
|
}
|
|
10787
10835
|
/** Show a read-only link again, in its tab, copied as showing a link copies it. */
|
|
@@ -10789,8 +10837,9 @@ var Share = class {
|
|
|
10789
10837
|
this.arming = null;
|
|
10790
10838
|
const l2 = this.readOnlyLinks?.find((x2) => x2.id === id);
|
|
10791
10839
|
if (!l2) return;
|
|
10792
|
-
const
|
|
10793
|
-
|
|
10840
|
+
const base = l2.link + (l2.call ? "?call" : "");
|
|
10841
|
+
const link = base + await this.fragment();
|
|
10842
|
+
this.readOnly = { kind: "link", id, base, link, made: false, copied: await copy(link) };
|
|
10794
10843
|
await this.show("readonly");
|
|
10795
10844
|
}
|
|
10796
10845
|
/** Revoke a read-only link, under the reader's name: the first press arms the button, the
|
|
@@ -11164,6 +11213,7 @@ var ITEMS = [
|
|
|
11164
11213
|
{ id: "export-btn", label: "Export" },
|
|
11165
11214
|
{ id: "activity-btn", label: "Activity" },
|
|
11166
11215
|
{ id: "talk-btn", label: "Conversations" },
|
|
11216
|
+
{ id: "call-btn", label: "Call" },
|
|
11167
11217
|
{ id: "who", label: "" },
|
|
11168
11218
|
{ id: "help-btn", label: "Help" }
|
|
11169
11219
|
];
|
|
@@ -11188,7 +11238,7 @@ var TALL_LEAST = 0.33;
|
|
|
11188
11238
|
var TALL_TOP_PX = 120;
|
|
11189
11239
|
var EDGE_PX = 12;
|
|
11190
11240
|
var SHEETS = ["panel", "activity", "lostfound"];
|
|
11191
|
-
var DOCKED = "#windows > :is(.sw-win, .pw-win, #convo):not(.collapsed, [hidden])";
|
|
11241
|
+
var DOCKED = "#windows > :is(.sw-win, .pw-win, #convo, #call):not(.collapsed, [hidden])";
|
|
11192
11242
|
function tallInsets() {
|
|
11193
11243
|
const $7 = (id) => document.getElementById(id);
|
|
11194
11244
|
const bar = $7("selbar");
|
|
@@ -11309,6 +11359,8 @@ var Phone = class {
|
|
|
11309
11359
|
const badges = {
|
|
11310
11360
|
"activity-btn": () => shown2("activity-badge", "act-badge"),
|
|
11311
11361
|
"talk-btn": () => shown2("talk-badge", "act-badge") + shown2("talk-at", "talk-at"),
|
|
11362
|
+
// how many are in the call (CallSpec)
|
|
11363
|
+
"call-btn": () => shown2("call-badge", "act-badge"),
|
|
11312
11364
|
// who follows the reader (the owner's decision of 2026-10-20), as the name's mark says it
|
|
11313
11365
|
who: () => {
|
|
11314
11366
|
const said2 = document.getElementById("who-fol")?.getAttribute("aria-label");
|
|
@@ -11610,6 +11662,10 @@ var YOURS = [
|
|
|
11610
11662
|
// link followed from a message — the reader's own tool changing a followed part, which says so
|
|
11611
11663
|
// itself (web/src/talk.ts) — and Esc; its button and a mention's notice open it
|
|
11612
11664
|
{ id: "conversation", what: "the conversation window \u2014 its channels, its thread, its box, a link to what you see \u2014, the conversation button and a mention's notice", where: "#convo, #talk-btn, #talk-notice", whole: true },
|
|
11665
|
+
// the reader's own call (CallSpec decisions 5 and 8): following never opens, closes or moves its
|
|
11666
|
+
// window, and nothing in it ends following — Follow and Ask everyone to follow me in it are the
|
|
11667
|
+
// people's menu's, which start following, as their initials' do
|
|
11668
|
+
{ id: "call", what: "the call: its window \u2014 the pre-join, the tiles, the controls, People \u2014, its button and its notices", where: "#call, #call-btn, #call-notice", whole: true },
|
|
11613
11669
|
{ id: "followingStrip", what: "the following strip: whom you follow, and its \u2715; once following has ended by a move, Follow again", where: "#following", whole: true },
|
|
11614
11670
|
{ id: "hoverCards", what: "hover cards", where: ".hcard" },
|
|
11615
11671
|
// the InfoView hidden or shown (ReviewSpec, "The InfoView"): how the reader looks at the source
|
|
@@ -13071,18 +13127,18 @@ function timeline(snaps) {
|
|
|
13071
13127
|
}
|
|
13072
13128
|
var RULER = { pad: 7, minStep: 8, maxStep: 22, minWidth: 90 };
|
|
13073
13129
|
function ruler(n3, room2) {
|
|
13074
|
-
const { pad, minStep, maxStep, minWidth } = RULER;
|
|
13130
|
+
const { pad: pad2, minStep, maxStep, minWidth } = RULER;
|
|
13075
13131
|
if (n3 <= 1) {
|
|
13076
13132
|
const w2 = Math.min(room2, minWidth);
|
|
13077
13133
|
return { n: n3, step: 0, width: w2, strip: w2 };
|
|
13078
13134
|
}
|
|
13079
|
-
let step2 = Math.max(minStep, Math.min(maxStep, (room2 - 2 *
|
|
13080
|
-
let width = Math.min(room2, (n3 - 1) * step2 + 2 *
|
|
13135
|
+
let step2 = Math.max(minStep, Math.min(maxStep, (room2 - 2 * pad2) / (n3 - 1)));
|
|
13136
|
+
let width = Math.min(room2, (n3 - 1) * step2 + 2 * pad2);
|
|
13081
13137
|
if (width < minWidth && room2 > width) {
|
|
13082
13138
|
width = Math.min(room2, minWidth);
|
|
13083
|
-
step2 = (width - 2 *
|
|
13139
|
+
step2 = (width - 2 * pad2) / (n3 - 1);
|
|
13084
13140
|
}
|
|
13085
|
-
return { n: n3, step: step2, width, strip: Math.max(width, (n3 - 1) * step2 + 2 *
|
|
13141
|
+
return { n: n3, step: step2, width, strip: Math.max(width, (n3 - 1) * step2 + 2 * pad2) };
|
|
13086
13142
|
}
|
|
13087
13143
|
function tickX(r2, i2) {
|
|
13088
13144
|
return r2.n <= 1 ? r2.width / 2 : RULER.pad + i2 * r2.step;
|
|
@@ -14458,9 +14514,9 @@ var TimeMachine = class {
|
|
|
14458
14514
|
let lastX = 0;
|
|
14459
14515
|
let timer = null;
|
|
14460
14516
|
const place2 = (clientX) => {
|
|
14461
|
-
const
|
|
14462
|
-
if (!
|
|
14463
|
-
const b2 =
|
|
14517
|
+
const svg2 = this.bar.querySelector(".tm-line svg");
|
|
14518
|
+
if (!svg2 || !this.ruler) return null;
|
|
14519
|
+
const b2 = svg2.getBoundingClientRect();
|
|
14464
14520
|
return { x: (clientX - b2.left) / Math.max(1, b2.width) * this.ruler.width, w: this.ruler.width };
|
|
14465
14521
|
};
|
|
14466
14522
|
const at = (clientX) => {
|
|
@@ -16219,6 +16275,10 @@ function meets(a3, b2) {
|
|
|
16219
16275
|
function coveredBy(me, others) {
|
|
16220
16276
|
return others.some((o2) => o2.z > me.z && o2.at.w > 0 && o2.at.h > 0 && meets(o2.at, me.at));
|
|
16221
16277
|
}
|
|
16278
|
+
function maximizedRect(vp, top = EDGE) {
|
|
16279
|
+
const y2 = Math.min(Math.max(top, EDGE), Math.max(EDGE, vp.h - EDGE - 80));
|
|
16280
|
+
return { x: EDGE, y: y2, w: Math.max(vp.w - 2 * EDGE, 120), h: Math.max(vp.h - y2 - EDGE, 80) };
|
|
16281
|
+
}
|
|
16222
16282
|
var EDGES = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
|
|
16223
16283
|
var DRAG_PX = 3;
|
|
16224
16284
|
var viewport = () => ({ w: document.documentElement.clientWidth || innerWidth, h: document.documentElement.clientHeight || innerHeight });
|
|
@@ -16241,6 +16301,8 @@ var FloatWindow = class {
|
|
|
16241
16301
|
/** the reader moved or resized it since its place was last set by the page (`ownPlace`, `unmove`):
|
|
16242
16302
|
* what the source and reference windows, paired, keep as the reader's choice */
|
|
16243
16303
|
byHand = false;
|
|
16304
|
+
/** maximized by its button: it fills the viewport under the bars until restored */
|
|
16305
|
+
maximized = false;
|
|
16244
16306
|
watch = null;
|
|
16245
16307
|
resized = () => this.layout();
|
|
16246
16308
|
constructor(el, o2) {
|
|
@@ -16265,6 +16327,7 @@ var FloatWindow = class {
|
|
|
16265
16327
|
const t2 = e2.target;
|
|
16266
16328
|
if (t2.closest(this.o.collapser)) this.collapse(true);
|
|
16267
16329
|
else if (t2.closest(this.o.opener)) this.collapse(false);
|
|
16330
|
+
else if (this.o.maximizer && t2.closest(this.o.maximizer)) this.maximize(!this.maximized);
|
|
16268
16331
|
});
|
|
16269
16332
|
window.addEventListener("resize", this.resized);
|
|
16270
16333
|
if (o2.fit && typeof ResizeObserver !== "undefined") {
|
|
@@ -16316,7 +16379,8 @@ var FloatWindow = class {
|
|
|
16316
16379
|
const vp = viewport();
|
|
16317
16380
|
const k2 = this.kept();
|
|
16318
16381
|
this.fitting = false;
|
|
16319
|
-
if (this.
|
|
16382
|
+
if (this.maximized && !this.collapsed) this.rect = maximizedRect(vp, this.o.top?.());
|
|
16383
|
+
else if (this.own) {
|
|
16320
16384
|
const r2 = clampRect(this.own, vp, this.o.min);
|
|
16321
16385
|
this.rect = this.o.top && !this.byHand ? underRect(r2, vp, this.o.top(), this.o.min) : r2;
|
|
16322
16386
|
} else if (k2.place) this.rect = rectOf(k2.place, vp, this.o.min);
|
|
@@ -16380,7 +16444,8 @@ var FloatWindow = class {
|
|
|
16380
16444
|
* windows too. */
|
|
16381
16445
|
reset() {
|
|
16382
16446
|
this.collapsed = false;
|
|
16383
|
-
this.
|
|
16447
|
+
this.maximized = false;
|
|
16448
|
+
this.el.classList.remove("collapsed", "maximized");
|
|
16384
16449
|
for (const k2 of ["left", "top", "right", "bottom", "width", "height", "maxWidth", "maxHeight", "minWidth", "minHeight", "zIndex"]) this.el.style[k2] = "";
|
|
16385
16450
|
stack = stack.filter((el) => el !== this.el);
|
|
16386
16451
|
restack();
|
|
@@ -16401,10 +16466,20 @@ var FloatWindow = class {
|
|
|
16401
16466
|
if (inside3) this.el.querySelector(on ? this.o.opener : this.o.collapser)?.focus();
|
|
16402
16467
|
this.o.collapsed?.(on);
|
|
16403
16468
|
}
|
|
16469
|
+
/** Maximize the window, or restore it where it was: nothing of it is kept. */
|
|
16470
|
+
maximize(on) {
|
|
16471
|
+
if (!this.o.live() || on === this.maximized) return;
|
|
16472
|
+
this.maximized = on;
|
|
16473
|
+
this.el.classList.toggle("maximized", on);
|
|
16474
|
+
if (on && this.collapsed) this.setCollapsed(false);
|
|
16475
|
+
else this.layout();
|
|
16476
|
+
this.front();
|
|
16477
|
+
this.o.maximized?.(on);
|
|
16478
|
+
}
|
|
16404
16479
|
/** A press on the title bar moves the window, on an edge or a corner resizes it; mouse, pen or
|
|
16405
|
-
* touch alike, the pointer captured until it is let go. */
|
|
16480
|
+
* touch alike, the pointer captured until it is let go. A maximized window stays where it is. */
|
|
16406
16481
|
press(e2) {
|
|
16407
|
-
if (!this.o.live() || this.collapsed || this.dragging || !e2.isPrimary || e2.pointerType === "mouse" && e2.button !== 0) return;
|
|
16482
|
+
if (!this.o.live() || this.collapsed || this.maximized || this.dragging || !e2.isPrimary || e2.pointerType === "mouse" && e2.button !== 0) return;
|
|
16408
16483
|
if (sheeted() || isMonitor()) return;
|
|
16409
16484
|
const t2 = e2.target;
|
|
16410
16485
|
const edge = t2.closest("[data-rz]");
|
|
@@ -46377,7 +46452,7 @@ var GraphCanvas = class {
|
|
|
46377
46452
|
[lab.width, lab.height] = [W2, rows];
|
|
46378
46453
|
this.ctx = lab.getContext("2d");
|
|
46379
46454
|
this.labelBase = [f2, 0, 0, f2, -rect.x * f2, -(rect.y * f2 + y0)];
|
|
46380
|
-
this.drawLabels((sx, sy,
|
|
46455
|
+
this.drawLabels((sx, sy, pad2) => sx > -pad2 && sy > -pad2 && sx < this.w + pad2 && sy < this.h + pad2, dotR);
|
|
46381
46456
|
out.drawImage(lab, 0, 0);
|
|
46382
46457
|
} finally {
|
|
46383
46458
|
this.cam = was.cam;
|
|
@@ -46395,7 +46470,7 @@ var GraphCanvas = class {
|
|
|
46395
46470
|
this.ctx = ctx;
|
|
46396
46471
|
this.labelBase = [1, 0, 0, 1, 0, 0];
|
|
46397
46472
|
try {
|
|
46398
|
-
this.drawLabels((sx, sy,
|
|
46473
|
+
this.drawLabels((sx, sy, pad2) => sx > -pad2 && sy > -pad2 && sx < this.w + pad2 && sy < this.h + pad2, this.dotPx());
|
|
46399
46474
|
} finally {
|
|
46400
46475
|
this.ctx = was;
|
|
46401
46476
|
this.labelBase = null;
|
|
@@ -47387,7 +47462,7 @@ var GraphCanvas = class {
|
|
|
47387
47462
|
this.buildScene();
|
|
47388
47463
|
}
|
|
47389
47464
|
const dotR = this.dotPx();
|
|
47390
|
-
const onScreen2 = (sx, sy,
|
|
47465
|
+
const onScreen2 = (sx, sy, pad2) => sx > -pad2 && sy > -pad2 && sx < this.w + pad2 && sy < this.h + pad2;
|
|
47391
47466
|
const activeDots = [];
|
|
47392
47467
|
if (this.active) {
|
|
47393
47468
|
for (const i2 of this.activeList) {
|
|
@@ -50087,7 +50162,7 @@ var Stickies = class {
|
|
|
50087
50162
|
const ir = d2.icon.getBoundingClientRect();
|
|
50088
50163
|
if (!(ir.width > 0)) continue;
|
|
50089
50164
|
const r2 = ir.width / 2, s2 = r2 / ICON_R;
|
|
50090
|
-
const ic = style(d2.icon),
|
|
50165
|
+
const ic = style(d2.icon), svg2 = d2.icon.querySelector("svg.sk-icon");
|
|
50091
50166
|
const dot = d2.icon.querySelector(".sk-dot");
|
|
50092
50167
|
let decl = null;
|
|
50093
50168
|
const dl = !d2.dlead.hidden ? ends(d2.dlead) : null;
|
|
@@ -50130,9 +50205,9 @@ var Stickies = class {
|
|
|
50130
50205
|
ring: ic.borderTopColor,
|
|
50131
50206
|
ringW: (parseFloat(ic.borderTopWidth) || 1.5) * s2,
|
|
50132
50207
|
dashed: ic.borderTopStyle === "dashed",
|
|
50133
|
-
glyph:
|
|
50208
|
+
glyph: svg2?.innerHTML ?? "",
|
|
50134
50209
|
glyphPx: 14 * s2,
|
|
50135
|
-
colour:
|
|
50210
|
+
colour: svg2 ? style(svg2).color : ic.borderTopColor,
|
|
50136
50211
|
dot: dot ? style(dot).backgroundColor : ic.borderTopColor,
|
|
50137
50212
|
surface,
|
|
50138
50213
|
decl,
|
|
@@ -52984,7 +53059,7 @@ var ArtFrame = class {
|
|
|
52984
53059
|
await Promise.all(ART_FACES.map((f2) => document.fonts?.load(f2).catch(() => []))).catch(() => {
|
|
52985
53060
|
});
|
|
52986
53061
|
if (kind === "svg") {
|
|
52987
|
-
const
|
|
53062
|
+
const svg2 = artSvg(rect, s2, bg, ART_SANS, this.measure, (pen) => {
|
|
52988
53063
|
const ctx = pen;
|
|
52989
53064
|
if (ground) drawBackdrop(ctx, s2.style, rect);
|
|
52990
53065
|
if (s2.border) {
|
|
@@ -53004,7 +53079,7 @@ var ArtFrame = class {
|
|
|
53004
53079
|
if (s2.border) pen.raw(`</g>`);
|
|
53005
53080
|
this.writeOver(ctx, s2, rect);
|
|
53006
53081
|
}, await faces());
|
|
53007
|
-
download(new Blob([
|
|
53082
|
+
download(new Blob([svg2], { type: "image/svg+xml" }), name);
|
|
53008
53083
|
return true;
|
|
53009
53084
|
}
|
|
53010
53085
|
this.busy = true;
|
|
@@ -53132,7 +53207,7 @@ function download(blob, name) {
|
|
|
53132
53207
|
// src/web/src/pageart.ts
|
|
53133
53208
|
function artPart(page) {
|
|
53134
53209
|
const { data, store: store2, S: S7 } = page;
|
|
53135
|
-
const ART_INERT = "#bar .brand, #bar .library-wrap, #export-btn, #activity-btn, #bar .talk-wrap, #bar .peers-wrap, #bar .who-wrap, #help-btn, #bar .more-wrap";
|
|
53210
|
+
const ART_INERT = "#bar .brand, #bar .library-wrap, #export-btn, #activity-btn, #bar .talk-wrap, #bar .call-wrap, #bar .peers-wrap, #bar .who-wrap, #help-btn, #bar .more-wrap";
|
|
53136
53211
|
const ART_KEYS = /* @__PURE__ */ new Set(["/", "1", "2", "3", "f", "+", "=", "-", "_", "e", "[", "]", "l"]);
|
|
53137
53212
|
page.artLook = null;
|
|
53138
53213
|
let gitNow = null;
|
|
@@ -54103,7 +54178,7 @@ var store = {
|
|
|
54103
54178
|
}
|
|
54104
54179
|
};
|
|
54105
54180
|
var sizes = typeof localStorage === "object" ? store.read() : {};
|
|
54106
|
-
var WINDOWS = "#windows > :is(.sw-win, .pw-win, #convo):not([hidden])";
|
|
54181
|
+
var WINDOWS = "#windows > :is(.sw-win, .pw-win, #convo, #call):not([hidden])";
|
|
54107
54182
|
var kindOf = (el) => el.classList.contains("sw-win") ? "source" : el.classList.contains("pw-win") ? "paper" : "talk";
|
|
54108
54183
|
var paneOpen = () => ["panel", "activity", "lostfound"].some((id) => $5(id)?.classList.contains("open"));
|
|
54109
54184
|
function current2() {
|
|
@@ -55181,6 +55256,527 @@ function peoplePart(page) {
|
|
|
55181
55256
|
return { people, asking, syncPeers };
|
|
55182
55257
|
}
|
|
55183
55258
|
|
|
55259
|
+
// src/shared/call.ts
|
|
55260
|
+
var CALL_TAB = /^[A-Za-z0-9_-]{16,64}$/;
|
|
55261
|
+
|
|
55262
|
+
// src/web/src/call/tab.ts
|
|
55263
|
+
var TAB_KEY = "visualproof:call:tab";
|
|
55264
|
+
var ASK_MS2 = 150;
|
|
55265
|
+
var ALPHANUMERIC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
55266
|
+
function newTab(random = (b2) => crypto.getRandomValues(b2)) {
|
|
55267
|
+
let tab = "";
|
|
55268
|
+
while (tab.length < 16) {
|
|
55269
|
+
for (const b2 of random(new Uint8Array(32))) if (b2 < 248 && tab.length < 16) tab += ALPHANUMERIC[b2 % 62];
|
|
55270
|
+
}
|
|
55271
|
+
return tab;
|
|
55272
|
+
}
|
|
55273
|
+
var browserDeps = () => {
|
|
55274
|
+
let storage = null;
|
|
55275
|
+
try {
|
|
55276
|
+
storage = sessionStorage;
|
|
55277
|
+
} catch {
|
|
55278
|
+
}
|
|
55279
|
+
return { storage, channel: typeof BroadcastChannel === "function" ? new BroadcastChannel("visualproof:call-tab") : null, random: (b2) => crypto.getRandomValues(b2), askMs: ASK_MS2 };
|
|
55280
|
+
};
|
|
55281
|
+
function callTab(deps = browserDeps()) {
|
|
55282
|
+
const keep2 = (tab2) => {
|
|
55283
|
+
try {
|
|
55284
|
+
deps.storage?.setItem(TAB_KEY, tab2);
|
|
55285
|
+
} catch {
|
|
55286
|
+
}
|
|
55287
|
+
return tab2;
|
|
55288
|
+
};
|
|
55289
|
+
let kept = null;
|
|
55290
|
+
try {
|
|
55291
|
+
kept = deps.storage?.getItem(TAB_KEY) ?? null;
|
|
55292
|
+
} catch {
|
|
55293
|
+
kept = null;
|
|
55294
|
+
}
|
|
55295
|
+
let tab = kept !== null && CALL_TAB.test(kept) ? kept : keep2(newTab(deps.random));
|
|
55296
|
+
const me = newTab(deps.random);
|
|
55297
|
+
const waiting = /* @__PURE__ */ new Set();
|
|
55298
|
+
const channel = deps.channel;
|
|
55299
|
+
if (channel)
|
|
55300
|
+
channel.onmessage = (e2) => {
|
|
55301
|
+
const m3 = e2.data;
|
|
55302
|
+
if (!m3 || typeof m3 !== "object") return;
|
|
55303
|
+
if ("ask" in m3 && m3.ask === tab && typeof m3.from === "string" && m3.from !== me) channel.postMessage({ taken: tab, to: m3.from });
|
|
55304
|
+
else if ("taken" in m3 && m3.to === me && typeof m3.taken === "string") for (const f2 of waiting) f2(m3.taken);
|
|
55305
|
+
};
|
|
55306
|
+
const renew = () => tab = keep2(newTab(deps.random));
|
|
55307
|
+
const ask = async () => {
|
|
55308
|
+
if (!channel) return false;
|
|
55309
|
+
const asked = tab;
|
|
55310
|
+
const taken = await new Promise((resolve) => {
|
|
55311
|
+
const on = (t2) => {
|
|
55312
|
+
if (t2 !== asked) return;
|
|
55313
|
+
waiting.delete(on);
|
|
55314
|
+
clearTimeout(timer);
|
|
55315
|
+
resolve(true);
|
|
55316
|
+
};
|
|
55317
|
+
const timer = setTimeout(() => {
|
|
55318
|
+
waiting.delete(on);
|
|
55319
|
+
resolve(false);
|
|
55320
|
+
}, deps.askMs);
|
|
55321
|
+
waiting.add(on);
|
|
55322
|
+
channel.postMessage({ ask: asked, from: me });
|
|
55323
|
+
});
|
|
55324
|
+
if (taken && tab === asked) renew();
|
|
55325
|
+
return taken;
|
|
55326
|
+
};
|
|
55327
|
+
const copy2 = ask();
|
|
55328
|
+
return {
|
|
55329
|
+
async get() {
|
|
55330
|
+
await copy2;
|
|
55331
|
+
await ask();
|
|
55332
|
+
return tab;
|
|
55333
|
+
},
|
|
55334
|
+
copy: copy2,
|
|
55335
|
+
renew,
|
|
55336
|
+
close() {
|
|
55337
|
+
if (channel) {
|
|
55338
|
+
channel.onmessage = null;
|
|
55339
|
+
channel.close();
|
|
55340
|
+
}
|
|
55341
|
+
}
|
|
55342
|
+
};
|
|
55343
|
+
}
|
|
55344
|
+
|
|
55345
|
+
// src/web/src/call/icons.ts
|
|
55346
|
+
var svg = (body, size = 16) => `<svg viewBox="0 0 16 16" width="${size}" height="${size}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`;
|
|
55347
|
+
var PATHS = {
|
|
55348
|
+
call: `<rect x="1.8" y="4.2" width="8.6" height="7.6" rx="1.6"/><path d="M10.4 7.1 14.2 5v6l-3.8-2.1"/>`,
|
|
55349
|
+
camOff: `<rect x="1.8" y="4.2" width="8.6" height="7.6" rx="1.6"/><path d="M10.4 7.1 14.2 5v6l-3.8-2.1M2 2l12 12"/>`,
|
|
55350
|
+
mic: `<rect x="6" y="1.8" width="4" height="7.6" rx="2"/><path d="M3.6 7.6a4.4 4.4 0 0 0 8.8 0M8 12v2.2"/>`,
|
|
55351
|
+
micOff: `<rect x="6" y="1.8" width="4" height="7.6" rx="2"/><path d="M3.6 7.6a4.4 4.4 0 0 0 8.8 0M8 12v2.2M2.2 2.2l11.6 11.6"/>`,
|
|
55352
|
+
screen: `<rect x="1.6" y="2.6" width="12.8" height="8.6" rx="1.4"/><path d="M5.5 14h5M8 11.2V14M8 9V5M6.2 6.6 8 4.8l1.8 1.8"/>`,
|
|
55353
|
+
hand: `<path d="M5.2 8.2V3.6a1 1 0 0 1 2 0v3.8M7.2 7V2.6a1 1 0 0 1 2 0V7M9.2 7.2V3.6a1 1 0 0 1 2 0v5.2M11.2 6.4a1 1 0 0 1 2 0v2.4c0 3-2 5.2-4.8 5.2-1.7 0-2.8-.8-3.8-2.3L3 9.4a1 1 0 0 1 1.6-1.1l.6.8"/>`,
|
|
55354
|
+
smile: `<circle cx="8" cy="8" r="6.2"/><path d="M5.4 9.4c.6 1 1.5 1.5 2.6 1.5s2-.5 2.6-1.5M6 6.3h.01M10 6.3h.01"/>`,
|
|
55355
|
+
people: `<circle cx="6" cy="5.4" r="2.3"/><path d="M1.8 13.4c.5-2.5 2.1-3.7 4.2-3.7s3.7 1.2 4.2 3.7M10.6 3.4a2.2 2.2 0 0 1 0 4.2M11.8 9.8c1.3.4 2.1 1.6 2.4 3.4"/>`,
|
|
55356
|
+
layout: `<rect x="1.8" y="2.6" width="12.4" height="10.8" rx="1.4"/><path d="M9.6 2.6v10.8M9.6 8h4.6"/>`,
|
|
55357
|
+
leave: `<path d="M2.2 9.6c3.4-3 8.2-3 11.6 0l-1.3 1.9-2.4-.9V8.9a7.6 7.6 0 0 0-4.2 0v1.7l-2.4.9z"/>`,
|
|
55358
|
+
up: `<path d="M4.5 9.8 8 6.3l3.5 3.5"/>`,
|
|
55359
|
+
more: `<circle cx="3.5" cy="8" r=".8"/><circle cx="8" cy="8" r=".8"/><circle cx="12.5" cy="8" r=".8"/>`,
|
|
55360
|
+
pin: `<path d="M9.8 2.2 13.8 6.2l-2 .6-2.6 2.6.2 2.8-1 1-2.4-2.4-3.2 3.2M5.2 9.2 2.8 6.8l1-1 2.8.2L9.2 3.4z"/>`,
|
|
55361
|
+
follow: `<path d="M1.6 8s2.4-4.4 6.4-4.4S14.4 8 14.4 8 12 12.4 8 12.4 1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/>`,
|
|
55362
|
+
link: `<path d="M6.5 9.5l3-3M7 4.5l1.2-1.2a2.6 2.6 0 0 1 3.7 3.7L10.7 8.2M9 11.5l-1.2 1.2a2.6 2.6 0 0 1-3.7-3.7L5.3 7.8"/>`,
|
|
55363
|
+
max: `<path d="M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"/>`,
|
|
55364
|
+
restore: `<path d="M6 3v3H3M10 3v3h3M6 13v-3H3M10 13v-3h3"/>`,
|
|
55365
|
+
weak: `<path d="M3 12.5v-1M6.3 12.5v-3M9.7 12.5V7.6M13 12.5V5" opacity=".9"/>`
|
|
55366
|
+
};
|
|
55367
|
+
var callIcon = (name, size = 16) => svg(PATHS[name], size);
|
|
55368
|
+
|
|
55369
|
+
// src/web/src/call/model.ts
|
|
55370
|
+
var ASPECT = 16 / 9;
|
|
55371
|
+
var pad = (n3) => String(n3).padStart(2, "0");
|
|
55372
|
+
function clockText(ms) {
|
|
55373
|
+
const s2 = Math.max(0, Math.floor(ms / 1e3));
|
|
55374
|
+
const h2 = Math.floor(s2 / 3600);
|
|
55375
|
+
const m3 = Math.floor(s2 % 3600 / 60);
|
|
55376
|
+
return h2 ? `${h2}:${pad(m3)}:${pad(s2 % 60)}` : `${m3}:${pad(s2 % 60)}`;
|
|
55377
|
+
}
|
|
55378
|
+
function namesLine(names2) {
|
|
55379
|
+
if (!names2.length) return "";
|
|
55380
|
+
if (names2.length === 1) return names2[0];
|
|
55381
|
+
if (names2.length === 2) return `${names2[0]} and ${names2[1]}`;
|
|
55382
|
+
if (names2.length === 3) return `${names2[0]}, ${names2[1]} and ${names2[2]}`;
|
|
55383
|
+
return `${names2[0]}, ${names2[1]} and ${names2.length - 2} others`;
|
|
55384
|
+
}
|
|
55385
|
+
|
|
55386
|
+
// src/web/src/pagecall.ts
|
|
55387
|
+
var MIN4 = { w: 300, h: 200 };
|
|
55388
|
+
var DEFAULT2 = { w: 720, h: 480 };
|
|
55389
|
+
var FOOT2 = 56;
|
|
55390
|
+
var REJOIN_MS = 5 * 6e4;
|
|
55391
|
+
var REJOIN_KEY = "visualproof:call:rejoin";
|
|
55392
|
+
function defaultRect2(vp) {
|
|
55393
|
+
const w2 = Math.min(DEFAULT2.w, vp.w - 2 * EDGE);
|
|
55394
|
+
const h2 = Math.min(DEFAULT2.h, vp.h - FOOT2 - EDGE);
|
|
55395
|
+
return clampRect({ x: vp.w - EDGE - w2, y: vp.h - FOOT2 - h2, w: w2, h: h2 }, vp, MIN4);
|
|
55396
|
+
}
|
|
55397
|
+
function callPart(page) {
|
|
55398
|
+
const { data, store: store2, reader, site } = page;
|
|
55399
|
+
const el = $("#call");
|
|
55400
|
+
const body = el.querySelector(".cl-body");
|
|
55401
|
+
const btn = $("#call-btn");
|
|
55402
|
+
const badge = $("#call-badge");
|
|
55403
|
+
const notice = $("#call-notice");
|
|
55404
|
+
const tab = data.snapshot ? null : callTab();
|
|
55405
|
+
let asked = new URLSearchParams(location.search).has("call");
|
|
55406
|
+
if (asked) {
|
|
55407
|
+
try {
|
|
55408
|
+
history.replaceState(history.state, "", location.pathname + location.hash);
|
|
55409
|
+
} catch {
|
|
55410
|
+
}
|
|
55411
|
+
}
|
|
55412
|
+
let rejoin = null;
|
|
55413
|
+
try {
|
|
55414
|
+
const r2 = JSON.parse(sessionStorage.getItem(REJOIN_KEY) ?? "null");
|
|
55415
|
+
if (r2 && typeof r2.session === "string" && Date.now() - r2.at < REJOIN_MS) rejoin = { session: r2.session, at: r2.at, mic: !!r2.mic, cam: !!r2.cam };
|
|
55416
|
+
} catch {
|
|
55417
|
+
rejoin = null;
|
|
55418
|
+
}
|
|
55419
|
+
const forgetRejoin = () => {
|
|
55420
|
+
rejoin = null;
|
|
55421
|
+
try {
|
|
55422
|
+
sessionStorage.removeItem(REJOIN_KEY);
|
|
55423
|
+
} catch {
|
|
55424
|
+
}
|
|
55425
|
+
};
|
|
55426
|
+
let state = null;
|
|
55427
|
+
let readOnlyCall = false;
|
|
55428
|
+
if (reader === "link" && !data.snapshot)
|
|
55429
|
+
void data.identity().then((id) => {
|
|
55430
|
+
readOnlyCall = !!id.readOnly?.call;
|
|
55431
|
+
drawButton();
|
|
55432
|
+
if (asked && state && may()) {
|
|
55433
|
+
asked = false;
|
|
55434
|
+
void open();
|
|
55435
|
+
}
|
|
55436
|
+
});
|
|
55437
|
+
let shown2 = false;
|
|
55438
|
+
let view = null;
|
|
55439
|
+
let loading = null;
|
|
55440
|
+
let roName = null;
|
|
55441
|
+
let droppedAt = -Infinity;
|
|
55442
|
+
let namedAt = -Infinity;
|
|
55443
|
+
const may = () => !data.snapshot && (reader === null || reader === "link" && readOnlyCall);
|
|
55444
|
+
const inCall = () => !!view?.inCall;
|
|
55445
|
+
const win2 = new FloatWindow(el, {
|
|
55446
|
+
min: MIN4,
|
|
55447
|
+
handle: ".cl-head",
|
|
55448
|
+
collapser: "[data-collapse]",
|
|
55449
|
+
opener: ".fl-pill-open",
|
|
55450
|
+
maximizer: "[data-cl-max]",
|
|
55451
|
+
keeper: {
|
|
55452
|
+
read: () => store2.data.call,
|
|
55453
|
+
write: (change) => {
|
|
55454
|
+
store2.data.call = { ...readKept(store2.data.call), ...change };
|
|
55455
|
+
store2.save();
|
|
55456
|
+
}
|
|
55457
|
+
},
|
|
55458
|
+
start: (vp) => defaultRect2(vp),
|
|
55459
|
+
live: () => shown2,
|
|
55460
|
+
// maximized, it keeps under the bars, which stay the reader's
|
|
55461
|
+
top: () => $("#viewbar").getBoundingClientRect().bottom + 8,
|
|
55462
|
+
collapsed: () => {
|
|
55463
|
+
view?.shownChanged();
|
|
55464
|
+
drawHead();
|
|
55465
|
+
},
|
|
55466
|
+
maximized: (on) => {
|
|
55467
|
+
const b2 = el.querySelector("[data-cl-max]");
|
|
55468
|
+
b2.innerHTML = callIcon(on ? "restore" : "max", 14);
|
|
55469
|
+
b2.title = on ? "Restore the window" : "Maximize the window";
|
|
55470
|
+
b2.setAttribute("aria-label", b2.title);
|
|
55471
|
+
}
|
|
55472
|
+
});
|
|
55473
|
+
const load = () => {
|
|
55474
|
+
const url = "/call.js";
|
|
55475
|
+
loading ??= import(url).then((m3) => m3.startCall);
|
|
55476
|
+
loading.catch(() => loading = null);
|
|
55477
|
+
return loading;
|
|
55478
|
+
};
|
|
55479
|
+
const open = async (o2 = {}) => {
|
|
55480
|
+
if (!may()) return;
|
|
55481
|
+
if (!shown2) {
|
|
55482
|
+
shown2 = true;
|
|
55483
|
+
el.hidden = false;
|
|
55484
|
+
win2.setCollapsed(false);
|
|
55485
|
+
btn.setAttribute("aria-pressed", "true");
|
|
55486
|
+
}
|
|
55487
|
+
win2.layout();
|
|
55488
|
+
win2.front();
|
|
55489
|
+
if (win2.collapsed) win2.collapse(false);
|
|
55490
|
+
notice.hidden = true;
|
|
55491
|
+
if (view) {
|
|
55492
|
+
if (!view.inCall) view.start(o2);
|
|
55493
|
+
return;
|
|
55494
|
+
}
|
|
55495
|
+
body.innerHTML = `<div class="cl-wait muted">Loading the call\u2026</div>`;
|
|
55496
|
+
let start;
|
|
55497
|
+
try {
|
|
55498
|
+
start = await load();
|
|
55499
|
+
} catch {
|
|
55500
|
+
body.innerHTML = `<div class="cl-wait">The call could not be loaded. <button type="button" class="rv-btn" data-cl-retry>Try again</button></div>`;
|
|
55501
|
+
return;
|
|
55502
|
+
}
|
|
55503
|
+
if (!shown2) return;
|
|
55504
|
+
view ??= start(env);
|
|
55505
|
+
view.start(o2);
|
|
55506
|
+
};
|
|
55507
|
+
const close = () => {
|
|
55508
|
+
if (!shown2) return;
|
|
55509
|
+
if (el.contains(document.activeElement)) document.activeElement.blur();
|
|
55510
|
+
shown2 = false;
|
|
55511
|
+
el.hidden = true;
|
|
55512
|
+
win2.reset();
|
|
55513
|
+
btn.setAttribute("aria-pressed", "false");
|
|
55514
|
+
view?.dispose();
|
|
55515
|
+
view = null;
|
|
55516
|
+
body.innerHTML = "";
|
|
55517
|
+
drawButton();
|
|
55518
|
+
};
|
|
55519
|
+
let closeArmed = 0;
|
|
55520
|
+
el.addEventListener("click", (e2) => {
|
|
55521
|
+
const t2 = e2.target;
|
|
55522
|
+
if (t2.closest("[data-cl-retry]")) return void open();
|
|
55523
|
+
if (t2.closest("[data-cl-link]")) return void copyLink2();
|
|
55524
|
+
if (t2.closest("[data-cl-mic]")) return view?.toggleMic();
|
|
55525
|
+
const x2 = t2.closest("[data-cl-close]");
|
|
55526
|
+
if (!x2) return;
|
|
55527
|
+
if (!inCall()) return close();
|
|
55528
|
+
if (Date.now() - closeArmed > 4e3) {
|
|
55529
|
+
closeArmed = Date.now();
|
|
55530
|
+
for (const b2 of el.querySelectorAll("[data-cl-close]")) {
|
|
55531
|
+
b2.classList.add("armed");
|
|
55532
|
+
b2.title = "Press again to leave the call";
|
|
55533
|
+
}
|
|
55534
|
+
setTimeout(() => el.querySelectorAll("[data-cl-close]").forEach((b2) => (b2.classList.remove("armed"), b2.title = "Leave the call and close")), 4e3);
|
|
55535
|
+
return;
|
|
55536
|
+
}
|
|
55537
|
+
closeArmed = 0;
|
|
55538
|
+
void view?.leave();
|
|
55539
|
+
});
|
|
55540
|
+
const drawHead = () => {
|
|
55541
|
+
const n3 = state?.participants.length ?? 0;
|
|
55542
|
+
const since = state?.session ? Date.parse(state.session.started) : NaN;
|
|
55543
|
+
const clock = Number.isFinite(since) && n3 ? clockText(Date.now() - since) : "";
|
|
55544
|
+
el.querySelector(".cl-count").textContent = n3 ? `\xB7 ${n3}` : "";
|
|
55545
|
+
el.querySelector(".cl-clock").textContent = clock;
|
|
55546
|
+
const pill = el.querySelector(".fl-pill-text");
|
|
55547
|
+
const text2 = `${callIcon("call", 14)}<span>Call${n3 ? ` \xB7 ${n3}` : ""}</span>${clock ? `<span class="fl-pill-state">${clock}</span>` : ""}`;
|
|
55548
|
+
if (pill.innerHTML !== text2) pill.innerHTML = text2;
|
|
55549
|
+
const mic = el.querySelector("[data-cl-mic]");
|
|
55550
|
+
mic.hidden = !inCall();
|
|
55551
|
+
const on = !!view?.mic;
|
|
55552
|
+
const m3 = callIcon(on ? "mic" : "micOff", 14);
|
|
55553
|
+
if (mic.innerHTML !== m3) mic.innerHTML = m3;
|
|
55554
|
+
mic.classList.toggle("off", !on);
|
|
55555
|
+
mic.title = on ? "Turn the microphone off" : "Turn the microphone on";
|
|
55556
|
+
};
|
|
55557
|
+
setInterval(() => {
|
|
55558
|
+
if (shown2 && state?.session) drawHead();
|
|
55559
|
+
}, 1e3);
|
|
55560
|
+
const drawButton = () => {
|
|
55561
|
+
btn.hidden = !may() || state === null;
|
|
55562
|
+
const ps = state?.participants ?? [];
|
|
55563
|
+
badge.hidden = ps.length === 0;
|
|
55564
|
+
badge.textContent = ps.length > 99 ? "99+" : String(ps.length);
|
|
55565
|
+
btn.classList.toggle("live", ps.length > 0);
|
|
55566
|
+
btn.classList.toggle("rejoin", !!rejoin && !inCall());
|
|
55567
|
+
const names2 = ps.map((p2) => p2.name ?? "someone");
|
|
55568
|
+
btn.title = inCall() ? `The call: you and ${Math.max(0, ps.length - 1)} more \u2014 click to show it` : ps.length ? `The call: ${namesLine(names2)} ${ps.length === 1 ? "is" : "are"} in it \u2014 click to join` : "The call: a video call with the people here \u2014 click to start one";
|
|
55569
|
+
btn.setAttribute("aria-label", ps.length ? `Call, ${ps.length} in it` : "Call");
|
|
55570
|
+
};
|
|
55571
|
+
let noticeTimer = null;
|
|
55572
|
+
const say = (html, acts2 = [], ms = 1e4) => {
|
|
55573
|
+
notice.innerHTML = `<div class="cn-text">${html}</div>` + (acts2.length ? `<div class="cn-acts">${acts2.map((a3, i2) => `<button type="button" class="rv-btn${a3.primary ? " primary" : ""}" data-cn="${i2}">${escapeHtml(a3.label)}</button>`).join("")}<button type="button" class="cn-x" data-cn="x" aria-label="Dismiss" title="Dismiss">\u2715</button></div>` : "");
|
|
55574
|
+
notice.hidden = false;
|
|
55575
|
+
noticeActs = acts2;
|
|
55576
|
+
if (noticeTimer) clearTimeout(noticeTimer);
|
|
55577
|
+
noticeTimer = ms ? setTimeout(() => notice.hidden = true, ms) : null;
|
|
55578
|
+
};
|
|
55579
|
+
let noticeActs = [];
|
|
55580
|
+
notice.addEventListener("click", (e2) => {
|
|
55581
|
+
const b2 = e2.target.closest("[data-cn]");
|
|
55582
|
+
if (!b2) return;
|
|
55583
|
+
notice.hidden = true;
|
|
55584
|
+
if (b2.dataset.cn === "x") {
|
|
55585
|
+
if (rejoin) forgetRejoin(), drawButton();
|
|
55586
|
+
return;
|
|
55587
|
+
}
|
|
55588
|
+
noticeActs[Number(b2.dataset.cn)]?.run();
|
|
55589
|
+
});
|
|
55590
|
+
btn.addEventListener("click", () => {
|
|
55591
|
+
if (!shown2) return void open(rejoin && state?.session?.id === rejoin.session ? { rejoin: takeRejoin() } : {});
|
|
55592
|
+
if (win2.collapsed || win2.covered) {
|
|
55593
|
+
if (win2.collapsed) win2.collapse(false);
|
|
55594
|
+
win2.front();
|
|
55595
|
+
return;
|
|
55596
|
+
}
|
|
55597
|
+
if (inCall()) win2.collapse(true);
|
|
55598
|
+
else close();
|
|
55599
|
+
});
|
|
55600
|
+
const takeRejoin = () => {
|
|
55601
|
+
const r2 = rejoin;
|
|
55602
|
+
forgetRejoin();
|
|
55603
|
+
return { mic: r2.mic, cam: r2.cam };
|
|
55604
|
+
};
|
|
55605
|
+
const chime = () => {
|
|
55606
|
+
try {
|
|
55607
|
+
const ctx = new AudioContext();
|
|
55608
|
+
const at = ctx.currentTime;
|
|
55609
|
+
for (const [f2, t2] of [[660, 0], [880, 0.16]]) {
|
|
55610
|
+
const o2 = ctx.createOscillator();
|
|
55611
|
+
const g2 = ctx.createGain();
|
|
55612
|
+
o2.frequency.value = f2;
|
|
55613
|
+
g2.gain.setValueAtTime(1e-4, at + t2);
|
|
55614
|
+
g2.gain.exponentialRampToValueAtTime(0.12, at + t2 + 0.02);
|
|
55615
|
+
g2.gain.exponentialRampToValueAtTime(1e-4, at + t2 + 0.22);
|
|
55616
|
+
o2.connect(g2).connect(ctx.destination);
|
|
55617
|
+
o2.start(at + t2);
|
|
55618
|
+
o2.stop(at + t2 + 0.25);
|
|
55619
|
+
}
|
|
55620
|
+
setTimeout(() => void ctx.close().catch(() => void 0), 800);
|
|
55621
|
+
} catch {
|
|
55622
|
+
}
|
|
55623
|
+
};
|
|
55624
|
+
const post = async (path, extra = {}) => {
|
|
55625
|
+
const stream = page.people.stream?.token;
|
|
55626
|
+
if (!stream) return { status: 0, body: { error: "This page is not connected to the server: wait a moment." } };
|
|
55627
|
+
const r2 = await data.callPost(path, { token: stream, ...extra });
|
|
55628
|
+
return r2;
|
|
55629
|
+
};
|
|
55630
|
+
const refusal = async (path, extra = {}) => {
|
|
55631
|
+
const r2 = await post(path, extra);
|
|
55632
|
+
return r2.status === 200 ? null : String(r2.body.error ?? "It could not be done.");
|
|
55633
|
+
};
|
|
55634
|
+
const link = async () => {
|
|
55635
|
+
const info2 = await data.shareInfo().catch(() => ({ path: null }));
|
|
55636
|
+
return `${site.base}${info2.path ?? "/"}?call${location.hash}`;
|
|
55637
|
+
};
|
|
55638
|
+
const copyLink2 = async () => {
|
|
55639
|
+
const l2 = await link();
|
|
55640
|
+
const keyed = /\/[kr]\//.test(new URL(l2).pathname);
|
|
55641
|
+
const ok = await copy(l2);
|
|
55642
|
+
page.say(ok ? `Call link copied: whoever opens it ${keyed ? "comes in by it and " : ""}finds the call ready to join.` : `Copy the call link: ${l2}`);
|
|
55643
|
+
};
|
|
55644
|
+
const env = {
|
|
55645
|
+
el: body,
|
|
55646
|
+
state: () => state,
|
|
55647
|
+
me: () => ({ name: page.people.name, readOnly: reader !== null, private: data.privateSession !== null, page: page.people.stream?.id ?? null }),
|
|
55648
|
+
here: () => page.people.peers.filter((p2) => !p2.agent && p2.name && p2.id !== page.people.stream?.id).map((p2) => ({ page: p2.id, name: p2.name, verified: !!p2.verified })),
|
|
55649
|
+
token: async (name) => {
|
|
55650
|
+
if (name !== null) roName = name;
|
|
55651
|
+
const r2 = await post("/api/call/token", { tab: await tab.get(), ...name !== null ? { name } : {} });
|
|
55652
|
+
if (r2.status === 200) return r2.body;
|
|
55653
|
+
return { error: String(r2.body.error ?? "The call could not be joined."), ...r2.body.who ? { who: true } : {}, ...r2.body.private ? { private: true } : {} };
|
|
55654
|
+
},
|
|
55655
|
+
end: () => refusal("/api/call/end"),
|
|
55656
|
+
remove: (identity) => refusal("/api/call/remove", { identity }),
|
|
55657
|
+
invite: (to) => refusal("/api/call/invite", { to }),
|
|
55658
|
+
left: () => {
|
|
55659
|
+
const stream = page.people.stream?.token;
|
|
55660
|
+
if (stream) void data.callPost("/api/call/leave", { token: stream });
|
|
55661
|
+
forgetRejoin();
|
|
55662
|
+
},
|
|
55663
|
+
ensureName: () => page.people.ensure(),
|
|
55664
|
+
goVisible: async () => {
|
|
55665
|
+
page.people.setPrivate(false);
|
|
55666
|
+
await new Promise((r2) => setTimeout(r2, 300));
|
|
55667
|
+
},
|
|
55668
|
+
follow: (id) => {
|
|
55669
|
+
const p2 = page.people.peers.find((x2) => x2.id === id);
|
|
55670
|
+
if (p2) page.people.follow(personKey(p2));
|
|
55671
|
+
},
|
|
55672
|
+
askToFollow: async (to) => {
|
|
55673
|
+
const stream = page.people.stream?.token;
|
|
55674
|
+
if (!stream) return "This page is not connected to the server: wait a moment.";
|
|
55675
|
+
const r2 = await data.askFollow(stream, to);
|
|
55676
|
+
return "error" in r2 ? r2.error : null;
|
|
55677
|
+
},
|
|
55678
|
+
copyLink: () => void copyLink2(),
|
|
55679
|
+
say: (t2) => page.say(t2),
|
|
55680
|
+
changed: () => {
|
|
55681
|
+
drawButton();
|
|
55682
|
+
drawHead();
|
|
55683
|
+
},
|
|
55684
|
+
seen: () => shown2 && !win2.collapsed && !document.hidden,
|
|
55685
|
+
dropped: (why) => {
|
|
55686
|
+
if (why === "elsewhere") {
|
|
55687
|
+
tab?.renew();
|
|
55688
|
+
close();
|
|
55689
|
+
say("Your call went on in another tab of this browser, a copy of this one.", [{ label: "Join here too", primary: true, run: () => void open() }], 0);
|
|
55690
|
+
} else if (why === "removed" || why === "ended") {
|
|
55691
|
+
droppedAt = Date.now();
|
|
55692
|
+
close();
|
|
55693
|
+
if (Date.now() - namedAt > 1e4) say(why === "ended" ? "The call was ended." : "You were removed from the call.", [], 8e3);
|
|
55694
|
+
}
|
|
55695
|
+
drawButton();
|
|
55696
|
+
},
|
|
55697
|
+
close: () => close()
|
|
55698
|
+
};
|
|
55699
|
+
window.addEventListener("beforeunload", (e2) => {
|
|
55700
|
+
if (!inCall()) return;
|
|
55701
|
+
e2.preventDefault();
|
|
55702
|
+
e2.returnValue = "";
|
|
55703
|
+
});
|
|
55704
|
+
window.addEventListener("pagehide", () => {
|
|
55705
|
+
if (!inCall() || !view) return;
|
|
55706
|
+
try {
|
|
55707
|
+
if (state?.session) sessionStorage.setItem(REJOIN_KEY, JSON.stringify({ session: state.session.id, at: Date.now(), mic: view.mic, cam: view.cam }));
|
|
55708
|
+
} catch {
|
|
55709
|
+
}
|
|
55710
|
+
const stream = page.people.stream?.token;
|
|
55711
|
+
if (stream) navigator.sendBeacon?.("/api/call/leave", JSON.stringify({ token: stream }));
|
|
55712
|
+
view.pageGone();
|
|
55713
|
+
});
|
|
55714
|
+
document.addEventListener("visibilitychange", () => view?.shownChanged());
|
|
55715
|
+
setInterval(() => {
|
|
55716
|
+
if (inCall() && data.privateSession !== null) {
|
|
55717
|
+
void view?.leave();
|
|
55718
|
+
page.say("You went private: you left the call, where everyone is seen.");
|
|
55719
|
+
}
|
|
55720
|
+
}, 1e3);
|
|
55721
|
+
const calls = {
|
|
55722
|
+
get on() {
|
|
55723
|
+
return state !== null && may();
|
|
55724
|
+
},
|
|
55725
|
+
get inCall() {
|
|
55726
|
+
return inCall();
|
|
55727
|
+
},
|
|
55728
|
+
heard(s2) {
|
|
55729
|
+
const was = state;
|
|
55730
|
+
state = s2;
|
|
55731
|
+
drawButton();
|
|
55732
|
+
drawHead();
|
|
55733
|
+
view?.stateChanged();
|
|
55734
|
+
if (!may()) return;
|
|
55735
|
+
if (asked) {
|
|
55736
|
+
asked = false;
|
|
55737
|
+
void open();
|
|
55738
|
+
return;
|
|
55739
|
+
}
|
|
55740
|
+
if (rejoin && !inCall()) {
|
|
55741
|
+
if (s2.session?.id === rejoin.session) {
|
|
55742
|
+
say("You were in the call when this page reloaded.", [{ label: "Rejoin", primary: true, run: () => void open({ rejoin: takeRejoin() }) }, { label: "Not now", run: () => (forgetRejoin(), drawButton()) }], 0);
|
|
55743
|
+
} else if (s2.session === null || s2.session.id !== rejoin.session) {
|
|
55744
|
+
forgetRejoin();
|
|
55745
|
+
drawButton();
|
|
55746
|
+
}
|
|
55747
|
+
return;
|
|
55748
|
+
}
|
|
55749
|
+
const mine = page.people.stream?.id;
|
|
55750
|
+
if (was && !was.session && s2.session && !inCall() && !shown2 && s2.participants.length && !s2.participants.some((p2) => p2.page === mine)) {
|
|
55751
|
+
const who = s2.participants[0].name ?? "Someone";
|
|
55752
|
+
say(`<b>${escapeHtml(who)}</b> started a call.`, [{ label: "Join", primary: true, run: () => void open() }], 12e3);
|
|
55753
|
+
}
|
|
55754
|
+
},
|
|
55755
|
+
invited(i2) {
|
|
55756
|
+
if (!may() || inCall()) return;
|
|
55757
|
+
chime();
|
|
55758
|
+
say(`<b>${escapeHtml(i2.from)}</b> invites you to the call.`, [{ label: "Join", primary: true, run: () => void open() }], 6e4);
|
|
55759
|
+
},
|
|
55760
|
+
removed(b2) {
|
|
55761
|
+
namedAt = Date.now();
|
|
55762
|
+
close();
|
|
55763
|
+
say(`${b2.by ? `<b>${escapeHtml(b2.by)}</b>` : "Someone"} removed you from the call.`, [], 8e3);
|
|
55764
|
+
},
|
|
55765
|
+
ended(b2) {
|
|
55766
|
+
if (!shown2 && !inCall() && Date.now() - droppedAt > 1e4) return;
|
|
55767
|
+
namedAt = Date.now();
|
|
55768
|
+
close();
|
|
55769
|
+
say(`${b2.by ? `<b>${escapeHtml(b2.by)}</b>` : "Someone"} ended the call.`, [], 8e3);
|
|
55770
|
+
},
|
|
55771
|
+
connected() {
|
|
55772
|
+
if (inCall()) void env.token(reader !== null ? roName : null);
|
|
55773
|
+
},
|
|
55774
|
+
link
|
|
55775
|
+
};
|
|
55776
|
+
if (data.snapshot) btn.hidden = true;
|
|
55777
|
+
return { calls };
|
|
55778
|
+
}
|
|
55779
|
+
|
|
55184
55780
|
// src/shared/pointer.ts
|
|
55185
55781
|
var LEAD_MS = 60;
|
|
55186
55782
|
var FOLLOW_MS = 100;
|
|
@@ -56557,6 +57153,8 @@ function sharePart(page) {
|
|
|
56557
57153
|
snapshot: () => writeSnapshot(followedOf(page.parts.read), page.canvas.screen),
|
|
56558
57154
|
// the reader's own conversation with the server's agent (AgentSpec decision 10)
|
|
56559
57155
|
talk: (agent) => page.talk.open(agent),
|
|
57156
|
+
// a call this reader may join (CallSpec decisions 4 and 6)
|
|
57157
|
+
call: () => page.calls.on,
|
|
56560
57158
|
exact: {
|
|
56561
57159
|
get: () => S7.shareExact !== false,
|
|
56562
57160
|
set: (on) => {
|
|
@@ -58177,6 +58775,7 @@ function livePart(page) {
|
|
|
58177
58775
|
if (page.exportModal.isOpen) return "the export window";
|
|
58178
58776
|
if (page.artLook) return "the artwork mode";
|
|
58179
58777
|
if (page.linear.shown) return "the linear form";
|
|
58778
|
+
if (page.calls.inCall) return "the call";
|
|
58180
58779
|
return null;
|
|
58181
58780
|
},
|
|
58182
58781
|
kept: () => ({
|
|
@@ -58232,6 +58831,7 @@ function livePart(page) {
|
|
|
58232
58831
|
const hello = JSON.parse(e2.data);
|
|
58233
58832
|
void page.people.connected(hello).then(() => !reader && page.talk.connected());
|
|
58234
58833
|
page.pointers.connected();
|
|
58834
|
+
page.calls.connected();
|
|
58235
58835
|
updatingTo = null;
|
|
58236
58836
|
reloader.hello(hello.server);
|
|
58237
58837
|
const release = hello.server?.version;
|
|
@@ -58267,6 +58867,10 @@ function livePart(page) {
|
|
|
58267
58867
|
es.addEventListener("ask", (e2) => page.asking.asked(JSON.parse(e2.data)));
|
|
58268
58868
|
es.addEventListener("ask-answer", (e2) => page.asking.answered(JSON.parse(e2.data)));
|
|
58269
58869
|
es.addEventListener("ask-end", (e2) => page.asking.ended(JSON.parse(e2.data).id));
|
|
58870
|
+
es.addEventListener("call", (e2) => page.calls.heard(JSON.parse(e2.data)));
|
|
58871
|
+
es.addEventListener("call-invite", (e2) => page.calls.invited(JSON.parse(e2.data)));
|
|
58872
|
+
es.addEventListener("call-removed", (e2) => page.calls.removed(JSON.parse(e2.data)));
|
|
58873
|
+
es.addEventListener("call-ended", (e2) => page.calls.ended(JSON.parse(e2.data)));
|
|
58270
58874
|
es.addEventListener("views", (e2) => {
|
|
58271
58875
|
const d2 = JSON.parse(e2.data);
|
|
58272
58876
|
if (d2.all && !reconnected) {
|
|
@@ -61668,12 +62272,12 @@ var Guide = class {
|
|
|
61668
62272
|
const s2 = this.steps[this.k];
|
|
61669
62273
|
if (!s2) return;
|
|
61670
62274
|
const r2 = (s2.views ? s2.views[this.v].at : s2.at)?.() ?? null;
|
|
61671
|
-
const
|
|
62275
|
+
const pad2 = 6;
|
|
61672
62276
|
const card = this.card;
|
|
61673
62277
|
const w2 = card.offsetWidth, h2 = card.offsetHeight;
|
|
61674
62278
|
this.spot.classList.toggle("none", !r2);
|
|
61675
62279
|
const W2 = innerWidth, H2 = innerHeight;
|
|
61676
|
-
const hole = r2 ? { l: r2.left -
|
|
62280
|
+
const hole = r2 ? { l: r2.left - pad2, t: r2.top - pad2, r: r2.right + pad2, b: r2.bottom + pad2 } : { l: W2 / 2, t: H2 / 2, r: W2 / 2, b: H2 / 2 };
|
|
61677
62281
|
const rect = (el, l2, t2, w22, h22) => Object.assign(el.style, { left: `${l2}px`, top: `${t2}px`, width: `${Math.max(0, w22)}px`, height: `${Math.max(0, h22)}px` });
|
|
61678
62282
|
rect(this.shades[0], 0, 0, W2, hole.t);
|
|
61679
62283
|
rect(this.shades[1], 0, hole.b, W2, H2 - hole.b);
|
|
@@ -61687,10 +62291,10 @@ var Guide = class {
|
|
|
61687
62291
|
const gap = 14;
|
|
61688
62292
|
const room2 = { below: innerHeight - r2.bottom, above: r2.top, right: innerWidth - r2.right, left: r2.left };
|
|
61689
62293
|
let x2, y2;
|
|
61690
|
-
if (room2.below >= h2 + gap +
|
|
61691
|
-
else if (room2.above >= h2 + gap +
|
|
61692
|
-
else if (room2.left >= w2 + gap +
|
|
61693
|
-
else if (room2.right >= w2 + gap +
|
|
62294
|
+
if (room2.below >= h2 + gap + pad2) [x2, y2] = [r2.left, r2.bottom + gap + pad2];
|
|
62295
|
+
else if (room2.above >= h2 + gap + pad2) [x2, y2] = [r2.left, r2.top - h2 - gap - pad2];
|
|
62296
|
+
else if (room2.left >= w2 + gap + pad2) [x2, y2] = [r2.left - w2 - gap - pad2, r2.top];
|
|
62297
|
+
else if (room2.right >= w2 + gap + pad2) [x2, y2] = [r2.right + gap + pad2, r2.top];
|
|
61694
62298
|
else [x2, y2] = [r2.left + 24, r2.bottom - h2 - 24];
|
|
61695
62299
|
x2 = Math.max(12, Math.min(x2, innerWidth - w2 - 12));
|
|
61696
62300
|
y2 = Math.max(12, Math.min(y2, innerHeight - h2 - 12));
|
|
@@ -62194,6 +62798,7 @@ async function boot() {
|
|
|
62194
62798
|
Object.assign(page, followPart(page));
|
|
62195
62799
|
Object.assign(page, talkPart(page));
|
|
62196
62800
|
Object.assign(page, peoplePart(page));
|
|
62801
|
+
Object.assign(page, callPart(page));
|
|
62197
62802
|
Object.assign(page, pointerPart(page));
|
|
62198
62803
|
Object.assign(page, tabsPart(page));
|
|
62199
62804
|
Object.assign(page, sharePart(page));
|