chirkle 0.3.0 → 0.4.1
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 +99 -47
- package/bin/release/darwin-amd64/chirkle-server +4 -0
- package/bin/release/darwin-arm64/chirkle-server +0 -0
- package/bin/release/linux-amd64/chirkle-server +0 -0
- package/bin/release/linux-arm64/chirkle-server +0 -0
- package/package.json +9 -6
- package/pb_hooks/federation/inbox.js +2 -69
- package/pb_hooks/federation/messages.js +5 -3
- package/pb_hooks/federation/net.js +1 -0
- package/pb_hooks/federation/people.js +1 -0
- package/pb_hooks/federation.pb.js +1 -8
- package/pb_hooks/lib/access.js +33 -10
- package/pb_hooks/lib/account.js +542 -6
- package/pb_hooks/lib/anonymous.js +2 -129
- package/pb_hooks/lib/bulk.js +1 -2
- package/pb_hooks/lib/collections.js +4 -4
- package/pb_hooks/lib/dms.js +1 -1
- package/pb_hooks/lib/files.js +82 -120
- package/pb_hooks/lib/handles.js +2 -2
- package/pb_hooks/lib/inbox.js +40 -54
- package/pb_hooks/lib/invites.js +266 -0
- package/pb_hooks/lib/media.js +5 -43
- package/pb_hooks/lib/messages.js +72 -117
- package/pb_hooks/lib/moderation.js +2 -16
- package/pb_hooks/lib/reactions.js +28 -4
- package/pb_hooks/lib/retention.js +88 -0
- package/pb_hooks/lib/site.js +13 -2
- package/pb_hooks/lib/stats.js +6 -34
- package/pb_hooks/lib/users.js +88 -7
- package/pb_hooks/lib/worker.js +22 -1
- package/pb_hooks/main.pb.js +85 -94
- package/pb_hooks/telegram/api.js +64 -12
- package/pb_hooks/telegram/inbound.js +158 -31
- package/pb_hooks/telegram/links.js +4 -3
- package/pb_hooks/telegram/outbound.js +86 -45
- package/pb_hooks/telegram/people.js +3 -3
- package/pb_hooks/telegram/worker.js +59 -15
- package/pb_migrations/1760000045_password_reset.js +38 -0
- package/pb_migrations/1760000047_telegram_supergroup_ids.js +51 -0
- package/pb_migrations/1760000048_inbox_reactions_merged.js +24 -0
- package/pb_migrations/1760000049_inbox_room_index.js +22 -0
- package/pb_migrations/1760000050_messages_unread_index.js +22 -0
- package/pb_migrations/1760000051_users_kind.js +31 -0
- package/pb_migrations/1760000052_deleted_accounts.js +19 -0
- package/pb_migrations/1760000053_account_jobs.js +45 -0
- package/pb_migrations/1760000054_room_invites.js +39 -0
- package/pb_migrations/1760000055_invite_barred.js +16 -0
- package/pb_migrations/1760000056_telegram_fetch.js +21 -0
- package/pb_public/assets/{access-PB77EH4F.css → access-GPRLOZOO.css} +2 -2
- package/pb_public/assets/{access-PB77EH4F.css.map → access-GPRLOZOO.css.map} +2 -2
- package/pb_public/assets/access-UK3L54NR.js +2 -0
- package/pb_public/assets/access-UK3L54NR.js.map +7 -0
- package/pb_public/assets/account-CT2BVMAX.css +2 -0
- package/pb_public/assets/account-CT2BVMAX.css.map +7 -0
- package/pb_public/assets/account-api-J6A6IYVX.js +2 -0
- package/pb_public/assets/account-api-J6A6IYVX.js.map +7 -0
- package/pb_public/assets/app-HB3NZHQ2.js +3 -0
- package/pb_public/assets/app-HB3NZHQ2.js.map +7 -0
- package/pb_public/assets/app-XJ73EU5O.css +2 -0
- package/pb_public/assets/app-XJ73EU5O.css.map +7 -0
- package/pb_public/assets/chunk-56ACD3V5.js +2 -0
- package/pb_public/assets/chunk-56ACD3V5.js.map +7 -0
- package/pb_public/assets/chunk-AG73QNUN.js +2 -0
- package/pb_public/assets/chunk-AG73QNUN.js.map +7 -0
- package/pb_public/assets/chunk-DCLJRQ53.js +2 -0
- package/pb_public/assets/chunk-DCLJRQ53.js.map +7 -0
- package/pb_public/assets/chunk-DZC4SY4M.js +2 -0
- package/pb_public/assets/chunk-DZC4SY4M.js.map +7 -0
- package/pb_public/assets/chunk-N2OFGBCZ.js +2 -0
- package/pb_public/assets/chunk-N2OFGBCZ.js.map +7 -0
- package/pb_public/assets/chunk-OKIIBH7O.js +2 -0
- package/pb_public/assets/chunk-OKIIBH7O.js.map +7 -0
- package/pb_public/assets/chunk-RPCBA7VF.js +2 -0
- package/pb_public/assets/chunk-RPCBA7VF.js.map +7 -0
- package/pb_public/assets/chunk-UZDXAORM.js +2 -0
- package/pb_public/assets/chunk-UZDXAORM.js.map +7 -0
- package/pb_public/assets/chunk-VTOUI25E.js +4 -0
- package/pb_public/assets/chunk-VTOUI25E.js.map +7 -0
- package/pb_public/assets/chunk-WR25F7FU.js +2 -0
- package/pb_public/assets/chunk-WR25F7FU.js.map +7 -0
- package/pb_public/assets/{emoji-VA2WCEAC.css → emoji-WWNPWCF3.css} +2 -2
- package/pb_public/assets/{emoji-VA2WCEAC.css.map → emoji-WWNPWCF3.css.map} +2 -2
- package/pb_public/assets/{emoji-picker-65VVVGYW.js → emoji-picker-K6JTK2GV.js} +4 -4
- package/pb_public/assets/emoji-picker-K6JTK2GV.js.map +7 -0
- package/pb_public/assets/forward-267HRNPY.js +2 -0
- package/pb_public/assets/forward-267HRNPY.js.map +7 -0
- package/pb_public/assets/inbox-CLMYESNI.js +2 -0
- package/pb_public/assets/inbox-CLMYESNI.js.map +7 -0
- package/pb_public/assets/invite-OGT5E2MZ.js +2 -0
- package/pb_public/assets/invite-OGT5E2MZ.js.map +7 -0
- package/pb_public/assets/invite-api-7G7XPXQW.js +2 -0
- package/pb_public/assets/invite-api-7G7XPXQW.js.map +7 -0
- package/pb_public/assets/lazy-H3KIJVB5.js +2 -0
- package/pb_public/assets/lazy-H3KIJVB5.js.map +7 -0
- package/pb_public/assets/login-TK6K4WGB.js +2 -0
- package/pb_public/assets/login-TK6K4WGB.js.map +7 -0
- package/pb_public/assets/media-WZ4653L5.js +2 -0
- package/pb_public/assets/media-WZ4653L5.js.map +7 -0
- package/pb_public/assets/mention-suggest-ODJD2IC5.js +2 -0
- package/pb_public/assets/mention-suggest-ODJD2IC5.js.map +7 -0
- package/pb_public/assets/notify-EPDM772N.js +2 -0
- package/pb_public/assets/notify-EPDM772N.js.map +7 -0
- package/pb_public/assets/profile-3R6S5QYS.js +2 -0
- package/pb_public/assets/profile-3R6S5QYS.js.map +7 -0
- package/pb_public/assets/search-WCHOGAJQ.js +2 -0
- package/pb_public/assets/search-WCHOGAJQ.js.map +7 -0
- package/pb_public/assets/stats-GTO2H6PG.js +2 -0
- package/pb_public/assets/stats-GTO2H6PG.js.map +7 -0
- package/pb_public/assets/switcher-TFSO45KV.js +2 -0
- package/pb_public/assets/switcher-TFSO45KV.js.map +7 -0
- package/pb_public/assets/user-search-3HQOCQWL.js +2 -0
- package/pb_public/assets/user-search-3HQOCQWL.js.map +7 -0
- package/pb_public/assets/viewer-2Y5FJBW4.js +2 -0
- package/pb_public/assets/viewer-2Y5FJBW4.js.map +7 -0
- package/pb_public/index.html +10 -2
- package/pb_public/stats.html +1 -1
- package/scripts/service.mjs +201 -0
- package/scripts/start.mjs +21 -17
- package/pb_hooks/lib/enrich.js +0 -75
- package/pb_hooks/lib/lists.js +0 -179
- package/pb_hooks/lib/live.js +0 -137
- package/pb_hooks/lib/reads.js +0 -183
- package/pb_public/assets/access-GUDTDXIP.js +0 -2
- package/pb_public/assets/access-GUDTDXIP.js.map +0 -7
- package/pb_public/assets/app-3WX5JYL2.js +0 -3
- package/pb_public/assets/app-3WX5JYL2.js.map +0 -7
- package/pb_public/assets/app-WAFKVN2H.css +0 -2
- package/pb_public/assets/app-WAFKVN2H.css.map +0 -7
- package/pb_public/assets/emoji-picker-65VVVGYW.js.map +0 -7
- package/pb_public/assets/forward-66PELNWT.js +0 -2
- package/pb_public/assets/forward-66PELNWT.js.map +0 -7
- package/pb_public/assets/inbox-TZJWPRTG.js +0 -2
- package/pb_public/assets/inbox-TZJWPRTG.js.map +0 -7
- package/pb_public/assets/lazy-4CXRBHHM.js +0 -2
- package/pb_public/assets/lazy-4CXRBHHM.js.map +0 -7
- package/pb_public/assets/login-G7Y44CJ7.js +0 -2
- package/pb_public/assets/login-G7Y44CJ7.js.map +0 -7
- package/pb_public/assets/media-FPRU2QH5.js +0 -2
- package/pb_public/assets/media-FPRU2QH5.js.map +0 -7
- package/pb_public/assets/mention-suggest-R7MXUH6R.js +0 -2
- package/pb_public/assets/mention-suggest-R7MXUH6R.js.map +0 -7
- package/pb_public/assets/notify-RQ6ZLR46.js +0 -2
- package/pb_public/assets/notify-RQ6ZLR46.js.map +0 -7
- package/pb_public/assets/profile-2CNVT2KX.js +0 -2
- package/pb_public/assets/profile-2CNVT2KX.js.map +0 -7
- package/pb_public/assets/search-3UT4HMES.js +0 -2
- package/pb_public/assets/search-3UT4HMES.js.map +0 -7
- package/pb_public/assets/stats-JX52AQCO.js +0 -2
- package/pb_public/assets/stats-JX52AQCO.js.map +0 -7
- package/pb_public/assets/switcher-CEUKRLEY.js +0 -2
- package/pb_public/assets/switcher-CEUKRLEY.js.map +0 -7
- package/pb_public/assets/user-search-7GNEIXMN.js +0 -2
- package/pb_public/assets/user-search-7GNEIXMN.js.map +0 -7
- package/pb_public/assets/viewer-DXT7SKOU.js +0 -2
- package/pb_public/assets/viewer-DXT7SKOU.js.map +0 -7
- package/scripts/fetch-pocketbase.sh +0 -63
package/pb_hooks/lib/live.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/// <reference path="../../types/pocketbase.d.ts" />
|
|
2
|
-
// Live messages (docs/PERF.md §7): each message saved or deleted is sent once, by one hook call, to every realtime
|
|
3
|
-
// client subscribed to TOPIC that can see its room, as the clients' rooms and activity need it. Not by PocketBase's
|
|
4
|
-
// own `messages/*` subscriptions: for those it checks the list rule and runs the messages enrich hook (JS, lib/enrich.js)
|
|
5
|
-
// once for each subscriber, and with a hundred people listening every message and reaction cost seconds (PERF.md
|
|
6
|
-
// §6.1). Here the message is expanded once, a forward shows its original once (lib/messages.js showOriginal), and an
|
|
7
|
-
// anonymous room's message is hidden once (lib/anonymous.js hide), with its author's own view beside it.
|
|
8
|
-
//
|
|
9
|
-
// The event is what a `messages/*` subscription with the apps' live options sent: { action, record }, the record with the
|
|
10
|
-
// contract's message fields, expanded with `author` and `forwarded_from`. Who gets it is who that subscription's list rule lets see the message: anyone who can
|
|
11
|
-
// see its room (lib/access.js canSee; tests/integration/access.matrix.test.ts checks they agree). The view rule's
|
|
12
|
-
// other way in, a forward of it in a room you see, isn't one here: such a reader is told of the forward instead
|
|
13
|
-
// (lib/messages.js touches forwards when their original changes), as the apps' list subscriptions always were.
|
|
14
|
-
//
|
|
15
|
-
// Apps ask GET /api/chat/live first; a server from before has no such route (404), and they subscribe as before.
|
|
16
|
-
|
|
17
|
-
const { accessOf, canSee } = require(`${__hooks}/lib/access.js`);
|
|
18
|
-
|
|
19
|
-
const TOPIC = "chat/messages";
|
|
20
|
-
const EXPAND = ["author", "forwarded_from"];
|
|
21
|
-
/** What an event carries: the fields the apps ask the records API for (shared/contract.json, tests/unit/contract.test.ts). */
|
|
22
|
-
const FIELDS =
|
|
23
|
-
"id,room,text,created,updated,edited_at,deleted,files,file_names,file_sources,file_dims,reactions,previews,author,expand.author.id,expand.author.name,expand.author.avatar,expand.author.no_dms,expand.author.instance,reply_to,expand.reply_to.id,expand.reply_to.author,expand.reply_to.text,expand.reply_to.deleted,expand.reply_to.files,expand.reply_to.expand.author.id,expand.reply_to.expand.author.name,forwarded_from,forward_of,expand.forwarded_from.id,expand.forwarded_from.name,mentions";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* `value` (a record as JSON) with only `fields` (PocketBase's `fields` syntax, dotted paths), as the API's `fields` gives it.
|
|
27
|
-
* @param {any} value
|
|
28
|
-
* @param {string} fields
|
|
29
|
-
*/
|
|
30
|
-
function pick(value, fields) {
|
|
31
|
-
/** @type {Record<string, any>} */
|
|
32
|
-
const tree = {};
|
|
33
|
-
for (const path of fields.split(",")) {
|
|
34
|
-
let node = tree;
|
|
35
|
-
for (const key of path.split(".")) node = node[key] ??= {};
|
|
36
|
-
}
|
|
37
|
-
/** @param {any} v @param {Record<string, any>} t @returns {any} */
|
|
38
|
-
const walk = (v, t) => {
|
|
39
|
-
if (Array.isArray(v)) return v.map((x) => walk(x, t));
|
|
40
|
-
if (!v || typeof v !== "object" || !Object.keys(t).length) return v;
|
|
41
|
-
/** @type {Record<string, any>} */
|
|
42
|
-
const out = {};
|
|
43
|
-
for (const k of Object.keys(t)) if (k in v) out[k] = walk(v[k], t[k]);
|
|
44
|
-
return out;
|
|
45
|
-
};
|
|
46
|
-
return walk(value, tree);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Send `record` (a message just saved, or deleted) to the clients listening that can see its room.
|
|
51
|
-
* @param {core.App} app
|
|
52
|
-
* @param {core.Record} record
|
|
53
|
-
* @param {"create" | "update" | "delete"} action
|
|
54
|
-
*/
|
|
55
|
-
function send(app, record, action) {
|
|
56
|
-
const clients = app.subscriptionsBroker().clients();
|
|
57
|
-
/** @type {any[]} */
|
|
58
|
-
const listening = [];
|
|
59
|
-
for (const id of Object.keys(clients)) {
|
|
60
|
-
const client = clients[id];
|
|
61
|
-
if (client && !client.isDiscarded() && client.hasSubscription(TOPIC)) listening.push(client);
|
|
62
|
-
}
|
|
63
|
-
if (!listening.length) return;
|
|
64
|
-
let room;
|
|
65
|
-
try {
|
|
66
|
-
room = app.findRecordById("rooms", record.getString("room"));
|
|
67
|
-
} catch {
|
|
68
|
-
return; // the room is gone, and with it everyone's right to see the message
|
|
69
|
-
}
|
|
70
|
-
const access = accessOf(room);
|
|
71
|
-
const base = record.fresh();
|
|
72
|
-
app.expandRecord(base, EXPAND, /** @type {any} */ (null));
|
|
73
|
-
if (action !== "delete") require(`${__hooks}/lib/messages.js`).showOriginal(/** @type {any} */ ({ app, record: base }));
|
|
74
|
-
const anonymous = base.getBool("anonymous");
|
|
75
|
-
const forwardedAnonymous = base.getBool("forwarded_anonymous");
|
|
76
|
-
const author = base.getString("author");
|
|
77
|
-
const from = base.getString("forwarded_from");
|
|
78
|
-
|
|
79
|
-
/** @type {Record<string, string>} */
|
|
80
|
-
const payloads = {};
|
|
81
|
-
/**
|
|
82
|
-
* The event as `userId` sees it: the real author only to the author (and the forward's source only to its writer),
|
|
83
|
-
* as the enrich hook's hide would show it to them.
|
|
84
|
-
* @param {string} key
|
|
85
|
-
* @param {string} userId
|
|
86
|
-
*/
|
|
87
|
-
const payload = (key, userId) => {
|
|
88
|
-
if (payloads[key] === undefined) {
|
|
89
|
-
let rec = base;
|
|
90
|
-
if (key !== "real") {
|
|
91
|
-
rec = base.fresh();
|
|
92
|
-
rec.setExpand(base.expand());
|
|
93
|
-
const auth = { id: userId, isSuperuser: () => false };
|
|
94
|
-
require(`${__hooks}/lib/anonymous.js`).hide(/** @type {any} */ ({ app, record: rec, requestInfo: { auth } }));
|
|
95
|
-
}
|
|
96
|
-
payloads[key] = JSON.stringify({ action, record: pick(JSON.parse(JSON.stringify(rec)), FIELDS) });
|
|
97
|
-
}
|
|
98
|
-
return payloads[key];
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
for (const client of listening) {
|
|
102
|
-
/** @type {core.Record | null | undefined} */
|
|
103
|
-
const auth = client.get("auth");
|
|
104
|
-
const superuser = !!auth?.isSuperuser();
|
|
105
|
-
const userId = auth && !superuser ? auth.id : "";
|
|
106
|
-
if (!superuser && !canSee(access, userId)) continue;
|
|
107
|
-
const hidesAuthor = anonymous && author !== "" && author !== userId;
|
|
108
|
-
const hidesFrom = forwardedAnonymous && from !== "" && from !== userId;
|
|
109
|
-
const key = superuser || (!hidesAuthor && !hidesFrom) ? "real" : `${hidesAuthor ? "a" : ""}${hidesFrom ? "f" : ""}`;
|
|
110
|
-
client.send(new SubscriptionMessage({ name: TOPIC, data: payload(key, userId) }));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* send, with a failure logged instead of thrown: the save is committed already.
|
|
116
|
-
* @param {core.App} app
|
|
117
|
-
* @param {core.Record | undefined} record
|
|
118
|
-
* @param {"create" | "update" | "delete"} action
|
|
119
|
-
*/
|
|
120
|
-
function sendSafely(app, record, action) {
|
|
121
|
-
if (!record) return;
|
|
122
|
-
try {
|
|
123
|
-
send(app, record, action);
|
|
124
|
-
} catch (err) {
|
|
125
|
-
app.logger().error("live: a message event wasn't sent", "message", record.id, "action", action, "error", String(err));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* GET /api/chat/live: that this server sends messages on TOPIC (apps from before subscribe to `messages/*`).
|
|
131
|
-
* @param {core.RequestEvent} e
|
|
132
|
-
*/
|
|
133
|
-
function info(e) {
|
|
134
|
-
return e.json(200, { topic: TOPIC });
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
module.exports = { TOPIC, send, sendSafely, info };
|
package/pb_hooks/lib/reads.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/// <reference path="../../types/pocketbase.d.ts" />
|
|
2
|
-
// Unread counts (DESIGN.md §18): GET /api/chat/unread and POST /api/chat/reads.
|
|
3
|
-
|
|
4
|
-
const { SEES_SQL, visibleRoom } = require(`${__hooks}/lib/access.js`);
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Unread messages per room the caller can see (§23.1): other people's, not deleted, newer than the caller's read position
|
|
8
|
-
* (or their signup, for a room they never opened). One correlated count per room, so each one is a range scan on
|
|
9
|
-
* idx_messages_room_created, stopped at UNREAD_CAP (the badge shows "99+" past 99, so more is never needed).
|
|
10
|
-
* Hidden and archived rooms are counted too; the client doesn't show those (§18.4).
|
|
11
|
-
*/
|
|
12
|
-
const UNREAD_CAP = 100;
|
|
13
|
-
const UNREAD_SQL = `
|
|
14
|
-
SELECT room, n FROM (
|
|
15
|
-
SELECT r.id AS room, (
|
|
16
|
-
SELECT COUNT(*) FROM (
|
|
17
|
-
SELECT 1 FROM messages m
|
|
18
|
-
WHERE m.room = r.id
|
|
19
|
-
AND m.created > MAX(COALESCE((SELECT rr.last_read_at FROM room_reads rr WHERE rr.user = {:me} AND rr.room = r.id), ''), {:since})
|
|
20
|
-
AND m.author != {:me}
|
|
21
|
-
AND m.deleted = FALSE
|
|
22
|
-
LIMIT ${UNREAD_CAP}
|
|
23
|
-
)
|
|
24
|
-
) AS n
|
|
25
|
-
FROM rooms r
|
|
26
|
-
WHERE ${SEES_SQL}
|
|
27
|
-
) WHERE n > 0`;
|
|
28
|
-
|
|
29
|
-
/** How far back GET /api/chat/unread lists the messages its counts already account for (QA BUG-106). */
|
|
30
|
-
const ACCOUNTED_MS = 30_000;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* UNREAD_SQL's rows (`id` "") and, in the same statement so from the same snapshot, the ids of other people's
|
|
34
|
-
* messages in the rooms the caller sees created since {:from} (`room` ""): whatever its read position, the counts
|
|
35
|
-
* account for each of them. Their live events arrive late (or during the request), so the client skips those instead
|
|
36
|
-
* of guessing from `created`, which says nothing about when a message was committed (QA BUG-106). CROSS JOIN keeps
|
|
37
|
-
* rooms the outer loop (SQLite doesn't reorder it), so each room is a range scan on idx_messages_room_created, not a
|
|
38
|
-
* scan of every message (an integration test pins the plan).
|
|
39
|
-
*/
|
|
40
|
-
const COUNTS_SQL = `
|
|
41
|
-
SELECT room, n, '' AS id FROM (${UNREAD_SQL})
|
|
42
|
-
UNION ALL
|
|
43
|
-
SELECT * FROM (
|
|
44
|
-
SELECT '' AS room, 0 AS n, m.id AS id FROM rooms r CROSS JOIN messages m ON m.room = r.id
|
|
45
|
-
WHERE ${SEES_SQL}
|
|
46
|
-
AND m.created > {:from}
|
|
47
|
-
AND m.author != {:me}
|
|
48
|
-
LIMIT 1000
|
|
49
|
-
)`;
|
|
50
|
-
|
|
51
|
-
/** The oldest unread message in one room, by the same rule as UNREAD_SQL (§18.2). */
|
|
52
|
-
const FIRST_UNREAD_SQL = `
|
|
53
|
-
SELECT m.id, m.created FROM messages m
|
|
54
|
-
WHERE m.room = {:room}
|
|
55
|
-
AND m.created > MAX(COALESCE((SELECT rr.last_read_at FROM room_reads rr WHERE rr.user = {:me} AND rr.room = {:room}), ''), {:since})
|
|
56
|
-
AND m.author != {:me}
|
|
57
|
-
AND m.deleted = FALSE
|
|
58
|
-
ORDER BY m.created, m.id
|
|
59
|
-
LIMIT 1`;
|
|
60
|
-
|
|
61
|
-
/** @param {core.RequestEvent} e */
|
|
62
|
-
function me(e) {
|
|
63
|
-
if (!e.auth) throw new UnauthorizedError("The request requires a logged-in user.");
|
|
64
|
-
return e.auth;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** @param {string} message */
|
|
68
|
-
const badRequest = (message) =>
|
|
69
|
-
new BadRequestError("Failed to mark the room as read.", { at: new ValidationError("validation_invalid_value", message) });
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* GET /api/chat/unread → { at, rooms: { "<roomId>": count }, ids } for every room with unread messages (at most
|
|
73
|
-
* UNREAD_CAP each). `at` is when the counts were taken. `ids` are the recent messages (ACCOUNTED_SQL) the counts
|
|
74
|
-
* account for: the client adds the live ones it gets that aren't among them, and only those (§18.3, QA BUG-106).
|
|
75
|
-
* @param {core.RequestEvent} e
|
|
76
|
-
*/
|
|
77
|
-
function unread(e) {
|
|
78
|
-
const user = me(e);
|
|
79
|
-
const at = new DateTime().string();
|
|
80
|
-
const rows = arrayOf(new DynamicModel({ room: "", n: 0, id: "" }));
|
|
81
|
-
e.app
|
|
82
|
-
.db()
|
|
83
|
-
.newQuery(COUNTS_SQL)
|
|
84
|
-
// {:from} in PocketBase's format, "2006-01-02 15:04:05.000Z".
|
|
85
|
-
.bind({ me: user.id, since: user.getString("created"), from: new Date(Date.now() - ACCOUNTED_MS).toISOString().replace("T", " ") })
|
|
86
|
-
.all(rows);
|
|
87
|
-
/** @type {Record<string, number>} */
|
|
88
|
-
const out = {};
|
|
89
|
-
/** @type {string[]} */
|
|
90
|
-
const ids = [];
|
|
91
|
-
for (const row of rows) {
|
|
92
|
-
if (row.id) ids.push(row.id);
|
|
93
|
-
else out[row.room] = row.n;
|
|
94
|
-
}
|
|
95
|
-
// The inbox's unseen rows and each room's unread mentions and replies (§41).
|
|
96
|
-
const { inbox, mentions } = require(`${__hooks}/lib/inbox.js`).counts(e.app, user);
|
|
97
|
-
return e.json(200, { at, rooms: out, ids, inbox, mentions });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* GET /api/chat/unread/{room} → { id, created } of the oldest message in `room` that is unread for the caller, or
|
|
102
|
-
* { id: "", created: "" } when there is none. The room view opens there (§18.5).
|
|
103
|
-
* @param {core.RequestEvent} e
|
|
104
|
-
*/
|
|
105
|
-
function firstUnread(e) {
|
|
106
|
-
const user = me(e);
|
|
107
|
-
const roomId = e.request?.pathValue("room") ?? "";
|
|
108
|
-
if (!visibleRoom(e.app, roomId, user.id)) throw new NotFoundError("The room doesn't exist.");
|
|
109
|
-
const row = new DynamicModel({ id: "", created: "" });
|
|
110
|
-
try {
|
|
111
|
-
e.app
|
|
112
|
-
.db()
|
|
113
|
-
.newQuery(FIRST_UNREAD_SQL)
|
|
114
|
-
.bind({ me: user.id, room: roomId, since: user.getString("created") })
|
|
115
|
-
.one(row);
|
|
116
|
-
} catch {
|
|
117
|
-
// No rows: nothing unread.
|
|
118
|
-
}
|
|
119
|
-
return e.json(200, { id: row.id, created: row.created });
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @param {core.App} app
|
|
124
|
-
* @param {string} user
|
|
125
|
-
* @param {string} room
|
|
126
|
-
*/
|
|
127
|
-
function findRead(app, user, room) {
|
|
128
|
-
try {
|
|
129
|
-
return app.findFirstRecordByFilter("room_reads", "user = {:user} && room = {:room}", { user, room });
|
|
130
|
-
} catch {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* POST /api/chat/reads { room, at? }: the caller has read `room` up to `at` (a message's `created`; default now).
|
|
137
|
-
* Never moves the read position back, and never past now. Idempotent.
|
|
138
|
-
* @param {core.RequestEvent} e
|
|
139
|
-
*/
|
|
140
|
-
function markRead(e) {
|
|
141
|
-
const user = me(e);
|
|
142
|
-
const body = /** @type {Record<string, unknown>} */ (e.requestInfo().body);
|
|
143
|
-
const roomId = typeof body.room === "string" ? body.room : "";
|
|
144
|
-
// Someone else's DM (or private room) gets the same answer as a room that doesn't exist.
|
|
145
|
-
if (!roomId || !visibleRoom(e.app, roomId, user.id)) throw new NotFoundError("The room doesn't exist.");
|
|
146
|
-
|
|
147
|
-
const now = new DateTime();
|
|
148
|
-
let at = now;
|
|
149
|
-
if (body.at !== undefined) {
|
|
150
|
-
// "" too: DateTime("") would be now, which a client sending a message's `created` never means.
|
|
151
|
-
if (typeof body.at !== "string" || body.at === "") throw badRequest("Must be a date.");
|
|
152
|
-
try {
|
|
153
|
-
at = new DateTime(body.at);
|
|
154
|
-
} catch {
|
|
155
|
-
throw badRequest("Must be a date.");
|
|
156
|
-
}
|
|
157
|
-
if (at.isZero()) throw badRequest("Must be a date.");
|
|
158
|
-
if (at.after(now)) at = now;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
let row = findRead(e.app, user.id, roomId);
|
|
162
|
-
if (!row) {
|
|
163
|
-
const created = new Record(e.app.findCollectionByNameOrId("room_reads"));
|
|
164
|
-
created.set("user", user.id);
|
|
165
|
-
created.set("room", roomId);
|
|
166
|
-
created.set("last_read_at", at);
|
|
167
|
-
try {
|
|
168
|
-
e.app.save(created);
|
|
169
|
-
return e.json(200, { room: roomId, last_read_at: created.getString("last_read_at") });
|
|
170
|
-
} catch (err) {
|
|
171
|
-
// Lost a race with another tab: the unique (user, room) index kept it to one row. Update that one.
|
|
172
|
-
row = findRead(e.app, user.id, roomId);
|
|
173
|
-
if (!row) throw err;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (at.after(row.getDateTime("last_read_at"))) {
|
|
177
|
-
row.set("last_read_at", at);
|
|
178
|
-
e.app.save(row);
|
|
179
|
-
}
|
|
180
|
-
return e.json(200, { room: roomId, last_read_at: row.getString("last_read_at") });
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
module.exports = { unread, firstUnread, markRead };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var H=null;function ue(a){return H??=new Promise(l=>{let I=a("link",{rel:"stylesheet",href:"/assets/access-PB77EH4F.css",on:{load:()=>l(),error:()=>{I.remove(),H=null,l()}}});document.head.append(I)}),H}var he=["private","public","open"],Q={private:"ic i-lock",open:"ic i-globe",everyone:"ic i-users",selected:"ic i-check"},be={everyone:{label:"Everyone who can see it",icon:"",hint:"Guests of an Open Air room only read."},selected:{label:"Only people you choose",icon:"",hint:"Everyone else reads and reacts, but can't post."}};function me(a,l,t){return a===l?"":l==="open"?"Everything ever written here, and everything to come, becomes readable by anyone on the web.":a==="private"?"Everyone with an account will be able to read the whole history.":l==="private"?`Only ${t?"you and the people you add":"its creator and the people added"} will see this room. Everyone else loses it from their list.`:"People without an account won't see this room any more."}function pe(a){let{signal:l}=a,{h:t,uniqueId:I,avatar:X,createUserSearch:Z,SearchError:ee,reasonOf:te,isAddress:ne,postingOf:se,visibilityOf:_,VISIBILITY:ie}=a.kit,{maxMembers:A}=a.kit,w=I("access"),B=t("h2",{id:`${w}-title`}),D=t("p",{class:"dialog-sub"});function K(e,n,s){let o=t("legend",{}),c=new Map;return{el:t("fieldset",{class:"vis-choices"},[o,...e.map(i=>{let v=t("input",{type:"radio",name:`${w}-${e[0]}`,value:i,"aria-labelledby":`${w}-${i}-label`,"aria-describedby":`${w}-${i}-hint`,on:{change:()=>s(i)},signal:l});return c.set(i,v),t("label",{class:`vis-choice vis-${i}`},[v,t("span",{class:`vis-icon ${Q[i]??""}`,"aria-hidden":"true"},Q[i]?"":n[i].icon),t("span",{class:"vis-text"},[t("span",{id:`${w}-${i}-label`,class:"vis-label"},n[i].label),t("span",{id:`${w}-${i}-hint`,class:"vis-hint"},n[i].hint)])])})]),legend:o,radios:c}}let x=K(he,ie,e=>{p=e,G()});x.legend.textContent="Who can see it";let P=K(["everyone","selected"],be,e=>{$=e,G()});P.legend.textContent="Who can post";function N(e,n,s){let o=t("h3",{}),c=t("ul",{class:"member-list","aria-label":e}),r=t("button",{type:"button",class:"add-member ic i-plus",on:{click:()=>C(U)},signal:l},"Add people"),i=t("div",{class:"member-search"}),v=t("section",{class:n},[t("div",{class:"people-head"},[o,r]),i,c]),U={el:v,addBtn:r,slot:i,pickable:s,list:[],render(){let z=v.hidden?[]:U.list.filter(W);o.textContent=`${e} \xB7 ${z.length}`;let F=U.list.length>=A;r.hidden=!h||f?.p===U,r.disabled=F,r.title=F?`A room can have up to ${A} ${e.toLowerCase()}.`:"",c.replaceChildren(...z.map(y=>{let J=y.id===d?.created_by;return t("li",{class:"member",dataset:{userId:y.id}},[X(y,32,a.avatarUrl),t("span",{class:"member-name"},[y.name,y.id===T?t("span",{}," (you)"):null]),J?t("span",{class:"member-role"},"Creator"):null,y.instance?t("span",{class:"member-role"},y.instance):null,h&&!J?t("button",{type:"button",class:"remove-member","aria-label":`Remove ${y.name}`,on:{click:()=>ae(U,y.id)},signal:l},"Remove"):null])}))}};return U}let b=N("Members","members",()=>!0),u=N("Who can post","writers",e=>p!=="private"||L(b,e)),Y=t("p",{class:"access-warning",role:"status"}),V=t("p",{class:"access-shared"}),g=t("p",{class:"field-error",role:"alert"}),k=t("button",{type:"button",class:"cancel",on:{click:()=>E()},signal:l},"Cancel"),O=t("button",{type:"button",class:"primary save",on:{click:()=>{de()}},signal:l},"Save"),oe=t("div",{class:"dialog-actions"},[k,O]),R=t("button",{type:"button",class:"icon-button ic i-x",tabindex:"-1","aria-hidden":"true",on:{click:()=>E()},signal:l}),re=t("div",{class:"dialog-head"},[t("div",{},[B,D]),R]),le=t("div",{class:"access-body"},[V,x.el,b.el,P.el,u.el,Y,g]),m=t("dialog",{class:"access","aria-labelledby":B.id},[re,le,oe]),d=null,T,h=!1,p="public",$="everyone",L=(e,n)=>e.list.some(s=>s.id===n.id),W=e=>!e.no_dms||!!e.instance,q=()=>d?.shared?.with??[],f=null,M=!1;function G(){g.textContent="",p==="private"&&(u.list=u.list.filter(e=>L(b,e))),S()}function S(){if(!d)return;for(let[n,s]of x.radios)s.checked=n===p;for(let[n,s]of P.radios)s.checked=n===$;x.el.hidden=P.el.hidden=!h,b.el.hidden=p!=="private",u.el.hidden=$!=="selected",b.render(),u.render(),Y.textContent=h?me(_(d),p,d.created_by===T):"";let e=q();V.hidden=!e.length,V.textContent=e.length?d.shared?.home?`This room's home is ${d.shared.home}: who is in it is decided there.`:`Shared with ${e.join(", ")}: its messages are kept there too.${h?` Add people there by their address, like ann@${e[0]}.`:""}`:"",O.hidden=!h,k.textContent=h?"Cancel":"Close"}function ae(e,n){let s=e.el.querySelector("ul"),o=[...s.children].findIndex(r=>r.dataset.userId===n);e.list=e.list.filter(r=>r.id!==n),e===b&&(u.list=u.list.filter(r=>r.id!==n)),S();let c=[...s.querySelectorAll("button.remove-member")];(c[Math.min(o-1,c.length-1)]??e.addBtn).focus()}function ce(e,n){if(L(e,n))e.list=e.list.filter(s=>s.id!==n.id),e===b&&(u.list=u.list.filter(s=>s.id!==n.id));else if(e.list.length>=A){g.textContent=`A room can have up to ${A} ${e===b?"members":"people who post"}.`;return}else e.list=[...e.list,n];g.textContent="",S(),f?.ui.mark()}function C(e){if(e!==(f?.p??null))if(f?.ac.abort(),f?.p.slot.replaceChildren(),f=null,e){let n=new AbortController;l.addEventListener("abort",()=>n.abort(),{once:!0});let s=Z({kit:a.kit,search:async(o,c)=>{if(!ne(o)||!d||!q().length||!a.remoteUser)return(await a.searchUsers(o,c)).filter(r=>W(r)&&e.pickable(r));try{let r=await a.remoteUser(o,d.id);return e.pickable(r)?[r]:[]}catch(r){throw new ee(te(r))}},avatarUrl:a.avatarUrl,onPick:o=>ce(e,o),isPicked:o=>L(e,o),onClose:()=>{C(null),e.addBtn.focus()},signal:n.signal});f={ac:n,ui:s,p:e},e.slot.replaceChildren(s.el),S(),s.focus(),e.el.firstElementChild?.scrollIntoView?.({block:"start"})}else S()}async function de(){if(M||!d||!h)return;M=!0,O.disabled=k.disabled=R.disabled=!0,g.textContent="";let e=s=>s.list.map(o=>o.id),n=await a.onSave(p,e(b),$,e(u));if(M=!1,O.disabled=k.disabled=R.disabled=!1,!l.aborted){if(n===null)return E();g.textContent=n,m.open||m.showModal()}}function E(){C(null),m.open&&m.close()}m.addEventListener("cancel",e=>{if(M)e.preventDefault();else if(f){e.preventDefault();let n=f.p;C(null),n.addBtn.focus()}},{signal:l}),m.addEventListener("close",()=>C(null),{signal:l}),l.addEventListener("abort",E,{once:!0});function j(e,n,s,o){let c=new Map([...e.expand?.members??[],...s??[]].map(i=>[i.id,i]));return o&&!c.has(o.id)&&c.set(o.id,o),[...new Set(n.length?n:[e.created_by,T||e.created_by])].map(i=>c.get(i)??{id:i,name:"Unknown"}).sort((i,v)=>+(v.id===e.created_by)-+(i.id===e.created_by))}return{el:m,open(e,n,s){d=e,T=s?.id,h=n,p=_(e),$=se(e),b.list=j(e,e.members??[],void 0,s),u.list=j(e,e.writers??[],e.expand?.writers,s),B.textContent=h?"Room access":"Members",D.textContent=`#${e.name}`,g.textContent="",C(null),S(),ue(t).then(()=>{l.aborted||d!==e||(m.open||m.showModal(),(h?x.radios.get(p):k)?.focus())})},close:E}}export{pe as createAccessDialog};
|
|
2
|
-
//# sourceMappingURL=access-GUDTDXIP.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../web/src/views/room/access.ts"],
|
|
4
|
-
"sourcesContent": ["// Room access dialog (\u00A723.2, \u00A723.6): the creator (or a moderator, \u00A736) chooses who can see the room (Private, Public or Open Air) and, for a\n// private room, who its members are; then who can post: everyone who can see it, or only the people they choose.\n// Anyone else in a private room gets the same dialog to see who is in it (and who can post), read-only.\n// Telegram stand-ins (no_dms, \u00A726.3) are left out of it: the bridge adds them itself, so adding or removing one does\n// nothing. They stay members (and writers) when it is saved. People on linked instances (\u00A733) are listed with their\n// instance; in a room shared with theirs, the creator adds them by address (\"ann@b.example\"), and the dialog says\n// where else the room's messages are kept (\u00A733.9).\n// A modal <dialog>: it keeps focus inside, Escape closes it, and focus goes back to where it was.\n//\n// A lazy chunk, like search (\u00A729): the room view import()s it when the dialog is first opened, and it links its own\n// stylesheet (web/styles/access.css) before showing. It imports types only; what it needs from app.js comes in its\n// options (`kit`).\n\nimport type { reasonOf } from \"../../api.ts\";\nimport type { isAddress, postingOf, VISIBILITY, visibilityOf } from \"../../lib/rooms.ts\";\nimport type { Posting, Room, User, Visibility } from \"../../lib/types.ts\";\nimport type { AvatarUrl } from \"../../ui/avatar.ts\";\nimport type { createUserSearch, SearchError, SearchKit, UserSearch } from \"../../ui/user-search.ts\";\n\n/** What the dialog uses of app.js. */\nexport interface AccessKit extends SearchKit {\n /** The people search, another lazy chunk the room view loads with this one. */\n createUserSearch: typeof createUserSearch;\n SearchError: typeof SearchError;\n reasonOf: typeof reasonOf;\n isAddress: typeof isAddress;\n postingOf: typeof postingOf;\n visibilityOf: typeof visibilityOf;\n VISIBILITY: typeof VISIBILITY;\n /** Most members (and writers) a room has (LIMITS.roomMembers). */\n maxMembers: number;\n}\n\nexport interface AccessDialog {\n readonly el: HTMLDialogElement;\n /** Open it for `room`: to change its access when `editable`, else to see its members. `me` names you in the list. */\n open(room: Room, editable: boolean, me: User | null): void;\n close(): void;\n}\n\ndeclare const ACCESS_CSS: string;\n\nlet stylesheet: Promise<void> | null = null;\n/** The dialog's stylesheet, linked once, like the media grid's: a failed load is tried again next time, and it opens anyway. */\nfunction loadStylesheet(h: typeof import(\"../../dom.ts\")[\"h\"]): Promise<void> {\n stylesheet ??= new Promise((resolve) => {\n const failed = () => {\n link.remove();\n stylesheet = null;\n resolve();\n };\n const link = h(\"link\", { rel: \"stylesheet\", href: ACCESS_CSS, on: { load: () => resolve(), error: failed } });\n document.head.append(link);\n });\n return stylesheet;\n}\n\nconst CHOICES: readonly Visibility[] = [\"private\", \"public\", \"open\"];\n\n/** Who can post (\u00A723.6), shown like the visibilities. */\n/** The choices' icons (.i-* in icons.css); Public keeps its \"#\". */\nconst ICONS: Record<string, string> = { private: \"ic i-lock\", open: \"ic i-globe\", everyone: \"ic i-users\", selected: \"ic i-check\" };\n\nconst POSTING: Record<Posting, { label: string; icon: string; hint: string }> = {\n everyone: { label: \"Everyone who can see it\", icon: \"\", hint: \"Guests of an Open Air room only read.\" },\n selected: { label: \"Only people you choose\", icon: \"\", hint: \"Everyone else reads and reacts, but can't post.\" },\n};\n\n/** What a change of visibility does that may not be obvious, or \"\". */\nfunction warning(from: Visibility, to: Visibility, mine: boolean): string {\n if (from === to) return \"\";\n if (to === \"open\") return \"Everything ever written here, and everything to come, becomes readable by anyone on the web.\";\n if (from === \"private\") return \"Everyone with an account will be able to read the whole history.\";\n if (to === \"private\")\n return `Only ${mine ? \"you and the people you add\" : \"its creator and the people added\"} will see this room. Everyone else loses it from their list.`;\n return \"People without an account won't see this room any more.\";\n}\n\n/** A list of people with Add and Remove: the members, or who can post. */\ninterface People {\n readonly el: HTMLElement;\n readonly addBtn: HTMLButtonElement;\n /** Where its search goes. */\n readonly slot: HTMLElement;\n /** Who its search offers. */\n pickable(u: User): boolean;\n list: User[];\n render(): void;\n}\n\nexport function createAccessDialog(opts: {\n kit: AccessKit;\n searchUsers: (query: string, signal: AbortSignal) => Promise<User[]>;\n /** Someone on a linked instance by address, to add to this shared room (\u00A733.5). */\n remoteUser?: (address: string, room: string) => Promise<User>;\n avatarUrl: AvatarUrl;\n /** Save. Resolves to what went wrong, or null once it is saved (the dialog then closes). */\n onSave: (visibility: Visibility, members: string[], posting: Posting, writers: string[]) => Promise<string | null>;\n signal: AbortSignal;\n}): AccessDialog {\n const { signal } = opts;\n const { h, uniqueId, avatar, createUserSearch, SearchError, reasonOf, isAddress, postingOf, visibilityOf, VISIBILITY } = opts.kit;\n const { maxMembers } = opts.kit;\n const id = uniqueId(\"access\");\n const title = h(\"h2\", { id: `${id}-title` });\n const sub = h(\"p\", { class: \"dialog-sub\" });\n\n /** Radio cards: one fieldset of `values`, each with its icon, label and hint. */\n function cards<T extends string>(\n values: readonly T[],\n info: Record<T, { label: string; icon: string; hint: string }>,\n set: (v: T) => void,\n ) {\n const legend = h(\"legend\", {});\n const radios = new Map<T, HTMLInputElement>();\n const el = h(\"fieldset\", { class: \"vis-choices\" }, [\n legend,\n ...values.map((v) => {\n const input = h(\"input\", {\n type: \"radio\",\n name: `${id}-${values[0]}`,\n value: v,\n \"aria-labelledby\": `${id}-${v}-label`,\n \"aria-describedby\": `${id}-${v}-hint`,\n on: { change: () => set(v) },\n signal,\n });\n radios.set(v, input);\n return h(\"label\", { class: `vis-choice vis-${v}` }, [\n input,\n h(\"span\", { class: `vis-icon ${ICONS[v] ?? \"\"}`, \"aria-hidden\": \"true\" }, ICONS[v] ? \"\" : info[v].icon),\n h(\"span\", { class: \"vis-text\" }, [\n h(\"span\", { id: `${id}-${v}-label`, class: \"vis-label\" }, info[v].label),\n h(\"span\", { id: `${id}-${v}-hint`, class: \"vis-hint\" }, info[v].hint),\n ]),\n ]);\n }),\n ]);\n return { el, legend, radios };\n }\n\n const choices = cards(CHOICES, VISIBILITY, (v) => {\n visibility = v;\n changed();\n });\n choices.legend.textContent = \"Who can see it\";\n const postingChoices = cards([\"everyone\", \"selected\"] as const, POSTING, (p) => {\n posting = p;\n changed();\n });\n postingChoices.legend.textContent = \"Who can post\";\n\n /**\n * One list of people. `pickable` says who its search offers: the members are anyone; who can post, in a private\n * room, only its members.\n */\n function people(label: string, cls: string, pickable: (u: User) => boolean): People {\n const head = h(\"h3\", {});\n const ul = h(\"ul\", { class: \"member-list\", \"aria-label\": label });\n const addBtn = h(\n \"button\",\n { type: \"button\", class: \"add-member ic i-plus\", on: { click: () => toggleSearch(p) }, signal },\n \"Add people\",\n );\n const slot = h(\"div\", { class: \"member-search\" });\n // Search above the list, so it stays in reach however many people there are.\n const el = h(\"section\", { class: cls }, [h(\"div\", { class: \"people-head\" }, [head, addBtn]), slot, ul]);\n const p: People = {\n el,\n addBtn,\n slot,\n pickable,\n list: [],\n render() {\n // Hidden, it lists nobody: only the lists in use are in the page.\n const shown = el.hidden ? [] : p.list.filter(listed);\n head.textContent = `${label} \u00B7 ${shown.length}`;\n const full = p.list.length >= maxMembers;\n addBtn.hidden = !editable || search?.p === p;\n addBtn.disabled = full;\n addBtn.title = full ? `A room can have up to ${maxMembers} ${label.toLowerCase()}.` : \"\";\n ul.replaceChildren(\n ...shown.map((u) => {\n const owner = u.id === room?.created_by;\n return h(\"li\", { class: \"member\", dataset: { userId: u.id } }, [\n avatar(u, 32, opts.avatarUrl),\n h(\"span\", { class: \"member-name\" }, [u.name, u.id === myId ? h(\"span\", {}, \" (you)\") : null]),\n owner ? h(\"span\", { class: \"member-role\" }, \"Creator\") : null,\n u.instance ? h(\"span\", { class: \"member-role\" }, u.instance) : null,\n editable && !owner\n ? h(\n \"button\",\n {\n type: \"button\",\n class: \"remove-member\",\n \"aria-label\": `Remove ${u.name}`,\n on: { click: () => remove(p, u.id) },\n signal,\n },\n \"Remove\",\n )\n : null,\n ]);\n }),\n );\n },\n };\n return p;\n }\n\n const members = people(\"Members\", \"members\", () => true);\n const writers = people(\"Who can post\", \"writers\", (u) => visibility !== \"private\" || has(members, u));\n const warn = h(\"p\", { class: \"access-warning\", role: \"status\" });\n const sharedEl = h(\"p\", { class: \"access-shared\" });\n const error = h(\"p\", { class: \"field-error\", role: \"alert\" });\n const cancel = h(\"button\", { type: \"button\", class: \"cancel\", on: { click: () => close() }, signal }, \"Cancel\");\n const save = h(\"button\", { type: \"button\", class: \"primary save\", on: { click: () => void submit() }, signal }, \"Save\");\n const buttons = h(\"div\", { class: \"dialog-actions\" }, [cancel, save]);\n // For the pointer only: the footer's Cancel/Close and Escape do the same, so it isn't a second \"Close\" to tab to or hear.\n const x = h(\"button\", {\n type: \"button\",\n class: \"icon-button ic i-x\",\n tabindex: \"-1\",\n \"aria-hidden\": \"true\",\n on: { click: () => close() },\n signal,\n });\n const head = h(\"div\", { class: \"dialog-head\" }, [h(\"div\", {}, [title, sub]), x]);\n // The body scrolls; the title and the buttons stay put.\n const body = h(\"div\", { class: \"access-body\" }, [sharedEl, choices.el, members.el, postingChoices.el, writers.el, warn, error]);\n const el = h(\"dialog\", { class: \"access\", \"aria-labelledby\": title.id }, [head, body, buttons]);\n\n let room: Room | null = null;\n let myId: string | undefined;\n let editable = false;\n let visibility: Visibility = \"public\";\n let posting: Posting = \"everyone\";\n const has = (p: People, u: User) => p.list.some((x) => x.id === u.id);\n /** Who the lists show: not Telegram's stand-ins, but people on linked instances (\u00A733.4) even without DMs. */\n const listed = (u: User) => !u.no_dms || !!u.instance;\n const sharedHosts = () => room?.shared?.with ?? [];\n let search: { ac: AbortController; ui: UserSearch; p: People } | null = null;\n let busy = false;\n\n function changed() {\n error.textContent = \"\";\n // Made private: only members can post.\n if (visibility === \"private\") writers.list = writers.list.filter((u) => has(members, u));\n render();\n }\n\n function render() {\n if (!room) return;\n for (const [v, input] of choices.radios) input.checked = v === visibility;\n for (const [v, input] of postingChoices.radios) input.checked = v === posting;\n choices.el.hidden = postingChoices.el.hidden = !editable;\n members.el.hidden = visibility !== \"private\";\n writers.el.hidden = posting !== \"selected\";\n members.render();\n writers.render();\n warn.textContent = editable ? warning(visibilityOf(room), visibility, room.created_by === myId) : \"\";\n const hosts = sharedHosts();\n sharedEl.hidden = !hosts.length;\n sharedEl.textContent = !hosts.length\n ? \"\"\n : room.shared?.home\n ? `This room's home is ${room.shared.home}: who is in it is decided there.`\n : `Shared with ${hosts.join(\", \")}: its messages are kept there too.${editable ? ` Add people there by their address, like ann@${hosts[0]}.` : \"\"}`;\n save.hidden = !editable;\n cancel.textContent = editable ? \"Cancel\" : \"Close\";\n }\n\n function remove(p: People, userId: string) {\n const ul = p.el.querySelector(\"ul\")!;\n const at = [...ul.children].findIndex((li) => (li as HTMLElement).dataset.userId === userId);\n p.list = p.list.filter((u) => u.id !== userId);\n // A member taken out can't post either.\n if (p === members) writers.list = writers.list.filter((u) => u.id !== userId);\n render();\n // Focus stays in the list: on the next person's Remove, else the previous one's, else Add people.\n const buttons = [...ul.querySelectorAll<HTMLButtonElement>(\"button.remove-member\")];\n (buttons[Math.min(at - 1, buttons.length - 1)] ?? p.addBtn).focus();\n }\n\n /** A search result picked: add them, or take them out again when they are in. */\n function toggle(p: People, u: User) {\n if (has(p, u)) {\n p.list = p.list.filter((x) => x.id !== u.id);\n if (p === members) writers.list = writers.list.filter((x) => x.id !== u.id);\n } else if (p.list.length >= maxMembers) {\n error.textContent = `A room can have up to ${maxMembers} ${p === members ? \"members\" : \"people who post\"}.`;\n return;\n } else p.list = [...p.list, u];\n error.textContent = \"\";\n render();\n search?.ui.mark();\n }\n\n /** Open the people search under `p`'s Add button (closing any other), or close it (null). */\n function toggleSearch(p: People | null) {\n if (p === (search?.p ?? null)) return;\n search?.ac.abort();\n search?.p.slot.replaceChildren();\n search = null;\n if (p) {\n const ac = new AbortController();\n signal.addEventListener(\"abort\", () => ac.abort(), { once: true });\n const ui = createUserSearch({\n kit: opts.kit,\n search: async (q, sig) => {\n if (!isAddress(q) || !room || !sharedHosts().length || !opts.remoteUser) {\n return (await opts.searchUsers(q, sig)).filter((u) => listed(u) && p.pickable(u));\n }\n try {\n const u = await opts.remoteUser(q, room.id);\n return p.pickable(u) ? [u] : [];\n } catch (e) {\n throw new SearchError(reasonOf(e));\n }\n },\n avatarUrl: opts.avatarUrl,\n onPick: (u) => toggle(p, u),\n isPicked: (u) => has(p, u),\n onClose: () => {\n toggleSearch(null);\n p.addBtn.focus();\n },\n signal: ac.signal,\n });\n search = { ac, ui, p };\n p.slot.replaceChildren(ui.el);\n render();\n ui.focus();\n // Room for the results under it, on a small screen too.\n p.el.firstElementChild?.scrollIntoView?.({ block: \"start\" });\n } else render();\n }\n\n async function submit() {\n if (busy || !room || !editable) return;\n busy = true;\n save.disabled = cancel.disabled = x.disabled = true;\n error.textContent = \"\";\n const ids = (p: People) => p.list.map((u) => u.id);\n const problem = await opts.onSave(visibility, ids(members), posting, ids(writers));\n busy = false;\n save.disabled = cancel.disabled = x.disabled = false;\n if (signal.aborted) return;\n if (problem === null) return close();\n error.textContent = problem;\n if (!el.open) el.showModal();\n }\n\n function close() {\n toggleSearch(null);\n if (el.open) el.close();\n }\n\n // Escape in the people search closes the search, not the dialog; while saving, nothing closes it.\n el.addEventListener(\n \"cancel\",\n (e) => {\n if (busy) e.preventDefault();\n else if (search) {\n e.preventDefault();\n const p = search.p;\n toggleSearch(null);\n p.addBtn.focus();\n }\n },\n { signal },\n );\n el.addEventListener(\"close\", () => toggleSearch(null), { signal });\n signal.addEventListener(\"abort\", close, { once: true });\n\n /** The people `ids` names, as expanded, the creator first (as the server keeps them). */\n function users(r: Room, ids: string[], expanded: User[] | undefined, me: User | null) {\n const known = new Map([...(r.expand?.members ?? []), ...(expanded ?? [])].map((u) => [u.id, u]));\n // A room made private (or posting chosen) starts with its creator, who isn't expanded yet, and a moderator making\n // it so with themselves (\u00A736), who would otherwise lose it.\n if (me && !known.has(me.id)) known.set(me.id, me);\n const list = [...new Set(ids.length ? ids : [r.created_by, myId || r.created_by])].map(\n (uid) => known.get(uid) ?? { id: uid, name: \"Unknown\" },\n );\n return list.sort((a, b) => Number(b.id === r.created_by) - Number(a.id === r.created_by));\n }\n\n return {\n el,\n open(r, canEdit, me) {\n room = r;\n myId = me?.id;\n editable = canEdit;\n visibility = visibilityOf(r);\n posting = postingOf(r);\n members.list = users(r, r.members ?? [], undefined, me);\n writers.list = users(r, r.writers ?? [], r.expand?.writers, me);\n title.textContent = editable ? \"Room access\" : \"Members\";\n sub.textContent = `#${r.name}`;\n error.textContent = \"\";\n toggleSearch(null);\n render();\n void loadStylesheet(h).then(() => {\n if (signal.aborted || room !== r) return;\n if (!el.open) el.showModal();\n (editable ? choices.radios.get(visibility) : cancel)?.focus();\n });\n },\n close,\n };\n}\n"],
|
|
5
|
-
"mappings": "AA0CA,IAAIA,EAAmC,KAEvC,SAASC,GAAeC,EAAsD,CAC5E,OAAAF,IAAe,IAAI,QAASG,GAAY,CAMtC,IAAMC,EAAOF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EAAM,IAAID,EAAG,GAAIA,CAAE,EACnC,CAAC,GAAG,IAAI,IAAIL,EAAI,OAASA,EAAM,CAACG,EAAE,WAAY/B,GAAQ+B,EAAE,UAAU,CAAC,CAAC,EAAE,IAChFI,GAAQD,EAAM,IAAIC,CAAG,GAAK,CAAE,GAAIA,EAAK,KAAM,SAAU,CACxD,EACY,KAAK,CAACC,EAAGC,IAAM,EAAOA,EAAE,KAAON,EAAE,YAAc,EAAOK,EAAE,KAAOL,EAAE,WAAW,CAC1F,CAEA,MAAO,CACL,GAAAxC,EACA,KAAKwC,EAAGO,EAASL,EAAI,CACnBlC,EAAOgC,EACP/B,EAAOiC,GAAI,GACXtC,EAAW2C,EACX7D,EAAaf,EAAaqE,CAAC,EAC3BlD,EAAUpB,GAAUsE,CAAC,EACrB7B,EAAQ,KAAO4B,EAAMC,EAAGA,EAAE,SAAW,CAAC,EAAG,OAAWE,CAAE,EACtD9B,EAAQ,KAAO2B,EAAMC,EAAGA,EAAE,SAAW,CAAC,EAAGA,EAAE,QAAQ,QAASE,CAAE,EAC9DnE,EAAM,YAAc6B,EAAW,cAAgB,UAC/C5B,EAAI,YAAc,IAAIgE,EAAE,IAAI,GAC5BxB,EAAM,YAAc,GACpBlB,EAAa,IAAI,EACjB4B,EAAO,EACF5E,GAAeC,CAAC,EAAE,KAAK,IAAM,CAC5BY,EAAO,SAAW6C,IAASgC,IAC1BxC,EAAG,MAAMA,EAAG,UAAU,GAC1BI,EAAWnB,EAAQ,OAAO,IAAIC,CAAU,EAAI+B,IAAS,MAAM,EAC9D,CAAC,CACH,EACA,MAAAC,CACF,CACF",
|
|
6
|
-
"names": ["stylesheet", "loadStylesheet", "h", "resolve", "link", "CHOICES", "ICONS", "POSTING", "warning", "from", "to", "mine", "createAccessDialog", "opts", "signal", "uniqueId", "avatar", "createUserSearch", "SearchError", "reasonOf", "isAddress", "postingOf", "visibilityOf", "VISIBILITY", "maxMembers", "id", "title", "sub", "cards", "values", "info", "set", "legend", "radios", "v", "input", "choices", "visibility", "changed", "postingChoices", "p", "posting", "people", "label", "cls", "pickable", "head", "ul", "addBtn", "toggleSearch", "slot", "el", "shown", "listed", "full", "editable", "search", "u", "owner", "room", "myId", "remove", "members", "writers", "has", "warn", "sharedEl", "error", "cancel", "close", "save", "submit", "buttons", "x", "body", "sharedHosts", "busy", "render", "hosts", "userId", "at", "li", "toggle", "ac", "ui", "q", "sig", "e", "ids", "problem", "users", "r", "expanded", "me", "known", "uid", "a", "b", "canEdit"]
|
|
7
|
-
}
|