chirkle 0.0.0-stage → 0.2.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/LICENSE +674 -0
- package/README.md +326 -2
- package/package.json +76 -4
- package/pb_hooks/federation/config.js +276 -0
- package/pb_hooks/federation/inbox.js +316 -0
- package/pb_hooks/federation/messages.js +420 -0
- package/pb_hooks/federation/mirror.js +277 -0
- package/pb_hooks/federation/net.js +247 -0
- package/pb_hooks/federation/peers.js +490 -0
- package/pb_hooks/federation/people.js +376 -0
- package/pb_hooks/federation/rooms.js +552 -0
- package/pb_hooks/federation/worker.js +413 -0
- package/pb_hooks/federation.pb.js +141 -0
- package/pb_hooks/lib/access.js +102 -0
- package/pb_hooks/lib/account.js +31 -0
- package/pb_hooks/lib/anonymous.js +189 -0
- package/pb_hooks/lib/bulk.js +187 -0
- package/pb_hooks/lib/collections.js +587 -0
- package/pb_hooks/lib/dms.js +123 -0
- package/pb_hooks/lib/emoji.js +28 -0
- package/pb_hooks/lib/enrich.js +75 -0
- package/pb_hooks/lib/features.js +31 -0
- package/pb_hooks/lib/files.js +375 -0
- package/pb_hooks/lib/http.js +146 -0
- package/pb_hooks/lib/images.js +160 -0
- package/pb_hooks/lib/keepalive.js +31 -0
- package/pb_hooks/lib/lists.js +173 -0
- package/pb_hooks/lib/media.js +635 -0
- package/pb_hooks/lib/messages.js +519 -0
- package/pb_hooks/lib/moderation.js +128 -0
- package/pb_hooks/lib/outbound.js +116 -0
- package/pb_hooks/lib/pages.js +171 -0
- package/pb_hooks/lib/previews.js +346 -0
- package/pb_hooks/lib/reactions.js +110 -0
- package/pb_hooks/lib/reads.js +181 -0
- package/pb_hooks/lib/records.js +77 -0
- package/pb_hooks/lib/rooms.js +148 -0
- package/pb_hooks/lib/site.js +102 -0
- package/pb_hooks/lib/text.js +110 -0
- package/pb_hooks/lib/users.js +81 -0
- package/pb_hooks/lib/worker.js +159 -0
- package/pb_hooks/main.pb.js +324 -0
- package/pb_hooks/telegram/api.js +129 -0
- package/pb_hooks/telegram/inbound.js +553 -0
- package/pb_hooks/telegram/links.js +157 -0
- package/pb_hooks/telegram/outbound.js +352 -0
- package/pb_hooks/telegram/people.js +166 -0
- package/pb_hooks/telegram/reactions.js +137 -0
- package/pb_hooks/telegram/rich.js +192 -0
- package/pb_hooks/telegram/worker.js +182 -0
- package/pb_hooks/telegram.pb.js +47 -0
- package/pb_migrations/1760000000_init.js +150 -0
- package/pb_migrations/1760000001_qa_fixes.js +69 -0
- package/pb_migrations/1760000002_avatars.js +39 -0
- package/pb_migrations/1760000003_direct_messages.js +142 -0
- package/pb_migrations/1760000004_attachments.js +28 -0
- package/pb_migrations/1760000005_file_names.js +16 -0
- package/pb_migrations/1760000006_room_reads.js +41 -0
- package/pb_migrations/1760000007_replies.js +23 -0
- package/pb_migrations/1760000008_lowercase_emails.js +24 -0
- package/pb_migrations/1760000009_reactions.js +32 -0
- package/pb_migrations/1760000010_fit_thumbs.js +18 -0
- package/pb_migrations/1760000011_forwarding.js +39 -0
- package/pb_migrations/1760000012_accounts.js +55 -0
- package/pb_migrations/1760000013_qa_pass5.js +19 -0
- package/pb_migrations/1760000014_room_access.js +96 -0
- package/pb_migrations/1760000015_site.js +46 -0
- package/pb_migrations/1760000016_forward_refs.js +43 -0
- package/pb_migrations/1760000017_no_dms.js +18 -0
- package/pb_migrations/1760000018_attachment_limits.js +24 -0
- package/pb_migrations/1760000019_telegram.js +109 -0
- package/pb_migrations/1760000020_service_messages.js +21 -0
- package/pb_migrations/1760000021_forward_view_index.js +41 -0
- package/pb_migrations/1760000022_link_previews.js +43 -0
- package/pb_migrations/1760000023_room_writers.js +49 -0
- package/pb_migrations/1760000024_message_search.js +51 -0
- package/pb_migrations/1760000025_search_dotted_i.js +16 -0
- package/pb_migrations/1760000026_push.js +67 -0
- package/pb_migrations/1760000027_push_tokens_per_user.js +31 -0
- package/pb_migrations/1760000028_media_grid_thumbs.js +18 -0
- package/pb_migrations/1760000029_media.js +71 -0
- package/pb_migrations/1760000030_collections.js +140 -0
- package/pb_migrations/1760000031_unread_limit.js +20 -0
- package/pb_migrations/1760000032_federation.js +227 -0
- package/pb_migrations/1760000033_federation_requests.js +44 -0
- package/pb_migrations/1760000034_telegram_parts.js +26 -0
- package/pb_migrations/1760000035_telegram_anonymous.js +16 -0
- package/pb_migrations/1760000036_chirkle.js +20 -0
- package/pb_migrations/1760000037_file_dims.js +35 -0
- package/pb_migrations/1760000038_drop_push.js +64 -0
- package/pb_migrations/1760000039_anonymous_rooms.js +40 -0
- package/pb_migrations/1760000040_moderators.js +42 -0
- package/pb_migrations/1760000041_shared_files.js +500 -0
- package/pb_migrations/1760000042_files_src.js +17 -0
- package/pb_migrations/1760000043_telegram_reactions.js +21 -0
- package/pb_public/assets/access-ALBW2MT2.js +2 -0
- package/pb_public/assets/access-ALBW2MT2.js.map +7 -0
- package/pb_public/assets/access-PB77EH4F.css +2 -0
- package/pb_public/assets/access-PB77EH4F.css.map +7 -0
- package/pb_public/assets/app-A3SXD3FF.css +2 -0
- package/pb_public/assets/app-A3SXD3FF.css.map +7 -0
- package/pb_public/assets/app-NDSIQW4L.js +3 -0
- package/pb_public/assets/app-NDSIQW4L.js.map +7 -0
- package/pb_public/assets/collections-DHJEOLHW.css +2 -0
- package/pb_public/assets/collections-DHJEOLHW.css.map +7 -0
- package/pb_public/assets/emoji-WSTVXAW5.css +2 -0
- package/pb_public/assets/emoji-WSTVXAW5.css.map +7 -0
- package/pb_public/assets/emoji-picker-QYRX6NYL.js +609 -0
- package/pb_public/assets/emoji-picker-QYRX6NYL.js.map +7 -0
- package/pb_public/assets/inter-cyrillic-JEOLYBOO.woff2 +0 -0
- package/pb_public/assets/inter-cyrillic-ext-IYF56FF6.woff2 +0 -0
- package/pb_public/assets/inter-greek-IRE366VL.woff2 +0 -0
- package/pb_public/assets/inter-latin-NRMW37G5.woff2 +0 -0
- package/pb_public/assets/inter-latin-ext-HA22NDSG.woff2 +0 -0
- package/pb_public/assets/lazy-4CXRBHHM.js +2 -0
- package/pb_public/assets/lazy-4CXRBHHM.js.map +7 -0
- package/pb_public/assets/media-7TCBG7WM.css +2 -0
- package/pb_public/assets/media-7TCBG7WM.css.map +7 -0
- package/pb_public/assets/media-FPRU2QH5.js +2 -0
- package/pb_public/assets/media-FPRU2QH5.js.map +7 -0
- package/pb_public/assets/notify-L6GERFNO.js +2 -0
- package/pb_public/assets/notify-L6GERFNO.js.map +7 -0
- package/pb_public/assets/search-3UT4HMES.js +2 -0
- package/pb_public/assets/search-3UT4HMES.js.map +7 -0
- package/pb_public/assets/switcher-CEUKRLEY.js +2 -0
- package/pb_public/assets/switcher-CEUKRLEY.js.map +7 -0
- package/pb_public/assets/viewer-DXT7SKOU.js +2 -0
- package/pb_public/assets/viewer-DXT7SKOU.js.map +7 -0
- package/pb_public/assets/viewer-P7GYCBYM.css +2 -0
- package/pb_public/assets/viewer-P7GYCBYM.css.map +7 -0
- package/pb_public/icons/apple-touch-icon.png +0 -0
- package/pb_public/icons/icon-192.png +0 -0
- package/pb_public/icons/icon-512.png +0 -0
- package/pb_public/icons/icon.svg +1 -0
- package/pb_public/icons/maskable-512.png +0 -0
- package/pb_public/index.html +21 -0
- package/pb_public/sw.js +1 -0
- package/scripts/fetch-pocketbase.sh +63 -0
- package/scripts/start.mjs +93 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Initial schema, API rules and rate limits — DESIGN.md §5.
|
|
3
|
+
|
|
4
|
+
const AUTH = '@request.auth.id != ""';
|
|
5
|
+
const NO_PUBLIC_EMAIL = "(@request.body.emailVisibility:isset = false || @request.body.emailVisibility = false)";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `new Collection({...})` from a plain object. The JSVM accepts this form (it is PocketBase's documented one), but the
|
|
9
|
+
* generated types describe the Go structs (fields with methods, JSONArray indexes, non-null rules), so cast here once.
|
|
10
|
+
* @param {Record<string, unknown>} data
|
|
11
|
+
*/
|
|
12
|
+
const collection = (data) => new Collection(/** @type {any} */ (data));
|
|
13
|
+
|
|
14
|
+
migrate(
|
|
15
|
+
(app) => {
|
|
16
|
+
// users (built-in auth collection, §5.1)
|
|
17
|
+
const users = app.findCollectionByNameOrId("users");
|
|
18
|
+
const name = users.fields.getByName("name");
|
|
19
|
+
name.required = true;
|
|
20
|
+
name.min = 1;
|
|
21
|
+
name.max = 32;
|
|
22
|
+
users.listRule = AUTH;
|
|
23
|
+
users.viewRule = AUTH;
|
|
24
|
+
users.createRule = NO_PUBLIC_EMAIL;
|
|
25
|
+
users.updateRule = `id = @request.auth.id && ${NO_PUBLIC_EMAIL}`;
|
|
26
|
+
users.deleteRule = "id = @request.auth.id";
|
|
27
|
+
app.save(users);
|
|
28
|
+
|
|
29
|
+
// rooms (§5.2)
|
|
30
|
+
const rooms = collection({
|
|
31
|
+
type: "base",
|
|
32
|
+
name: "rooms",
|
|
33
|
+
listRule: AUTH,
|
|
34
|
+
viewRule: AUTH,
|
|
35
|
+
createRule: [
|
|
36
|
+
AUTH,
|
|
37
|
+
"@request.body.created_by = @request.auth.id",
|
|
38
|
+
"(@request.body.archived:isset = false || @request.body.archived = false)",
|
|
39
|
+
"@request.body.archived_at:isset = false",
|
|
40
|
+
].join(" && "),
|
|
41
|
+
updateRule: [
|
|
42
|
+
"created_by = @request.auth.id",
|
|
43
|
+
"@request.body.created_by:isset = false",
|
|
44
|
+
"@request.body.archived_at:isset = false",
|
|
45
|
+
].join(" && "),
|
|
46
|
+
deleteRule: null,
|
|
47
|
+
fields: [
|
|
48
|
+
{ type: "text", name: "name", required: true, min: 1, max: 48 },
|
|
49
|
+
{ type: "relation", name: "created_by", required: true, maxSelect: 1, collectionId: users.id, cascadeDelete: false },
|
|
50
|
+
{ type: "bool", name: "archived" },
|
|
51
|
+
{ type: "date", name: "archived_at" },
|
|
52
|
+
{ type: "autodate", name: "created", onCreate: true, onUpdate: false },
|
|
53
|
+
{ type: "autodate", name: "updated", onCreate: true, onUpdate: true },
|
|
54
|
+
],
|
|
55
|
+
indexes: ["CREATE UNIQUE INDEX `idx_rooms_name` ON `rooms` (`name` COLLATE NOCASE)"],
|
|
56
|
+
});
|
|
57
|
+
app.save(rooms);
|
|
58
|
+
|
|
59
|
+
// messages (§5.3)
|
|
60
|
+
const messages = collection({
|
|
61
|
+
type: "base",
|
|
62
|
+
name: "messages",
|
|
63
|
+
listRule: AUTH,
|
|
64
|
+
viewRule: AUTH,
|
|
65
|
+
createRule: [
|
|
66
|
+
AUTH,
|
|
67
|
+
"@request.body.author = @request.auth.id",
|
|
68
|
+
"@request.body.room.archived = false",
|
|
69
|
+
"@request.body.deleted:isset = false",
|
|
70
|
+
"@request.body.deleted_at:isset = false",
|
|
71
|
+
"@request.body.edited_at:isset = false",
|
|
72
|
+
].join(" && "),
|
|
73
|
+
updateRule: [
|
|
74
|
+
"author = @request.auth.id",
|
|
75
|
+
"room.archived = false",
|
|
76
|
+
"deleted = false",
|
|
77
|
+
"@request.body.author:isset = false",
|
|
78
|
+
"@request.body.room:isset = false",
|
|
79
|
+
"@request.body.edited_at:isset = false",
|
|
80
|
+
"@request.body.deleted_at:isset = false",
|
|
81
|
+
"(@request.body.deleted:isset = false || @request.body.deleted = true)",
|
|
82
|
+
].join(" && "),
|
|
83
|
+
deleteRule: null,
|
|
84
|
+
fields: [
|
|
85
|
+
{ type: "relation", name: "room", required: true, maxSelect: 1, collectionId: rooms.id, cascadeDelete: true },
|
|
86
|
+
{ type: "relation", name: "author", required: true, maxSelect: 1, collectionId: users.id, cascadeDelete: false },
|
|
87
|
+
// Not `required`: a soft-deleted message has empty text. Non-empty is enforced by pb_hooks.
|
|
88
|
+
{ type: "text", name: "text", max: 2000 },
|
|
89
|
+
{ type: "date", name: "edited_at" },
|
|
90
|
+
{ type: "bool", name: "deleted" },
|
|
91
|
+
{ type: "date", name: "deleted_at" },
|
|
92
|
+
{ type: "autodate", name: "created", onCreate: true, onUpdate: false },
|
|
93
|
+
{ type: "autodate", name: "updated", onCreate: true, onUpdate: true },
|
|
94
|
+
],
|
|
95
|
+
indexes: ["CREATE INDEX `idx_messages_room_created` ON `messages` (`room`, `created`, `id`)"],
|
|
96
|
+
});
|
|
97
|
+
app.save(messages);
|
|
98
|
+
|
|
99
|
+
// hidden_rooms (§5.4)
|
|
100
|
+
const hidden = collection({
|
|
101
|
+
type: "base",
|
|
102
|
+
name: "hidden_rooms",
|
|
103
|
+
listRule: "user = @request.auth.id",
|
|
104
|
+
viewRule: "user = @request.auth.id",
|
|
105
|
+
createRule: `${AUTH} && @request.body.user = @request.auth.id`,
|
|
106
|
+
updateRule: null,
|
|
107
|
+
deleteRule: "user = @request.auth.id",
|
|
108
|
+
fields: [
|
|
109
|
+
{ type: "relation", name: "user", required: true, maxSelect: 1, collectionId: users.id, cascadeDelete: true },
|
|
110
|
+
{ type: "relation", name: "room", required: true, maxSelect: 1, collectionId: rooms.id, cascadeDelete: true },
|
|
111
|
+
{ type: "autodate", name: "created", onCreate: true, onUpdate: false },
|
|
112
|
+
],
|
|
113
|
+
indexes: ["CREATE UNIQUE INDEX `idx_hidden_rooms_user_room` ON `hidden_rooms` (`user`, `room`)"],
|
|
114
|
+
});
|
|
115
|
+
app.save(hidden);
|
|
116
|
+
|
|
117
|
+
// rate limits (§5.6): keep PocketBase's defaults, add ours in front.
|
|
118
|
+
const settings = app.settings();
|
|
119
|
+
const ours = [
|
|
120
|
+
{ label: "messages:create", audience: "", duration: 5, maxRequests: 10 },
|
|
121
|
+
{ label: "users:create", audience: "@guest", duration: 60, maxRequests: 20 },
|
|
122
|
+
];
|
|
123
|
+
const labels = ours.map((r) => r.label);
|
|
124
|
+
// Plain objects work here too; the generated RateLimitRule type is the Go struct (with methods).
|
|
125
|
+
settings.rateLimits.rules = [.../** @type {any[]} */ (ours), ...settings.rateLimits.rules.filter((r) => !labels.includes(r.label))];
|
|
126
|
+
settings.rateLimits.enabled = true;
|
|
127
|
+
app.save(settings);
|
|
128
|
+
},
|
|
129
|
+
(app) => {
|
|
130
|
+
for (const n of ["hidden_rooms", "messages", "rooms"]) {
|
|
131
|
+
app.delete(app.findCollectionByNameOrId(n));
|
|
132
|
+
}
|
|
133
|
+
const users = app.findCollectionByNameOrId("users");
|
|
134
|
+
const name = users.fields.getByName("name");
|
|
135
|
+
name.required = false;
|
|
136
|
+
name.min = 0;
|
|
137
|
+
name.max = 255;
|
|
138
|
+
users.listRule = "id = @request.auth.id";
|
|
139
|
+
users.viewRule = "id = @request.auth.id";
|
|
140
|
+
users.createRule = "";
|
|
141
|
+
users.updateRule = "id = @request.auth.id";
|
|
142
|
+
users.deleteRule = "id = @request.auth.id";
|
|
143
|
+
app.save(users);
|
|
144
|
+
|
|
145
|
+
const settings = app.settings();
|
|
146
|
+
settings.rateLimits.rules = settings.rateLimits.rules.filter((r) => !["messages:create", "users:create"].includes(r.label));
|
|
147
|
+
settings.rateLimits.enabled = false;
|
|
148
|
+
app.save(settings);
|
|
149
|
+
},
|
|
150
|
+
);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Fixes from the QA pass (DESIGN.md §5.2, §5.5, §5.6):
|
|
3
|
+
// - rooms.name_key: Unicode-aware unique room names ("Über" = "über", "Straße" = "STRASSE"), set by pb_hooks.
|
|
4
|
+
// - users can't delete their own account through the API: their messages and rooms reference them
|
|
5
|
+
// (required relations), so the delete always failed for anyone who had posted.
|
|
6
|
+
// - rate limits for message edits/deletes and for room creation.
|
|
7
|
+
|
|
8
|
+
const NEW_LIMITS = [
|
|
9
|
+
{ label: "messages:update", audience: "", duration: 10, maxRequests: 20 },
|
|
10
|
+
{ label: "rooms:create", audience: "", duration: 60, maxRequests: 5 },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Same as nameKey() in pb_hooks/lib/text.js (migrations can't load the hooks' modules).
|
|
15
|
+
* @param {string} name
|
|
16
|
+
*/
|
|
17
|
+
function roomKey(name) {
|
|
18
|
+
const s = name.replace(/[----]/g, "");
|
|
19
|
+
return (typeof s.normalize === "function" ? s.normalize("NFKC") : s).toUpperCase().toLowerCase();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
migrate(
|
|
23
|
+
(app) => {
|
|
24
|
+
const rooms = app.findCollectionByNameOrId("rooms");
|
|
25
|
+
rooms.fields.add(new TextField({ name: "name_key", hidden: true, max: 400 }));
|
|
26
|
+
app.save(rooms);
|
|
27
|
+
|
|
28
|
+
// Backfill with raw SQL (no hooks). Names that already clash keep a key made unique by their id.
|
|
29
|
+
const seen = new Set();
|
|
30
|
+
for (const r of app.findAllRecords("rooms")) {
|
|
31
|
+
if (!r) continue;
|
|
32
|
+
let key = roomKey(r.getString("name"));
|
|
33
|
+
if (seen.has(key)) key = `${key}#${r.id}`;
|
|
34
|
+
seen.add(key);
|
|
35
|
+
app.db().newQuery("UPDATE rooms SET name_key = {:key} WHERE id = {:id}").bind({ key, id: r.id }).execute();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const withIndex = app.findCollectionByNameOrId("rooms");
|
|
39
|
+
withIndex.addIndex("idx_rooms_name_key", true, "`name_key`", "`name_key` != ''");
|
|
40
|
+
app.save(withIndex);
|
|
41
|
+
|
|
42
|
+
const users = app.findCollectionByNameOrId("users");
|
|
43
|
+
// null = superusers only. The generated type says string (a Go *string), so cast.
|
|
44
|
+
/** @type {any} */ (users).deleteRule = null;
|
|
45
|
+
app.save(users);
|
|
46
|
+
|
|
47
|
+
const settings = app.settings();
|
|
48
|
+
const labels = NEW_LIMITS.map((r) => r.label);
|
|
49
|
+
const rest = settings.rateLimits.rules.filter((r) => !labels.includes(r.label));
|
|
50
|
+
// Ours first, as in the init migration. Plain objects work here; the generated type is the Go struct.
|
|
51
|
+
settings.rateLimits.rules = [.../** @type {any[]} */ (NEW_LIMITS), ...rest];
|
|
52
|
+
app.save(settings);
|
|
53
|
+
},
|
|
54
|
+
(app) => {
|
|
55
|
+
const rooms = app.findCollectionByNameOrId("rooms");
|
|
56
|
+
rooms.removeIndex("idx_rooms_name_key");
|
|
57
|
+
rooms.fields.removeByName("name_key");
|
|
58
|
+
app.save(rooms);
|
|
59
|
+
|
|
60
|
+
const users = app.findCollectionByNameOrId("users");
|
|
61
|
+
users.deleteRule = "id = @request.auth.id";
|
|
62
|
+
app.save(users);
|
|
63
|
+
|
|
64
|
+
const settings = app.settings();
|
|
65
|
+
const labels = NEW_LIMITS.map((r) => r.label);
|
|
66
|
+
settings.rateLimits.rules = settings.rateLimits.rules.filter((r) => !labels.includes(r.label));
|
|
67
|
+
app.save(settings);
|
|
68
|
+
},
|
|
69
|
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Avatars (DESIGN.md §15.1): configure the built-in users.avatar file field. Raster images only (no SVG),
|
|
3
|
+
// 2 MB, square thumbnails for 1× and 2× screens, public.
|
|
4
|
+
|
|
5
|
+
const AVATAR = {
|
|
6
|
+
maxSelect: 1,
|
|
7
|
+
maxSize: 2 * 1024 * 1024,
|
|
8
|
+
mimeTypes: ["image/jpeg", "image/png", "image/webp", "image/gif"],
|
|
9
|
+
thumbs: ["48x48", "96x96"],
|
|
10
|
+
protected: false,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** PocketBase's defaults for the field, restored on down. */
|
|
14
|
+
const DEFAULTS = {
|
|
15
|
+
maxSelect: 1,
|
|
16
|
+
maxSize: 0,
|
|
17
|
+
mimeTypes: ["image/jpeg", "image/png", "image/svg+xml", "image/gif", "image/webp"],
|
|
18
|
+
thumbs: [],
|
|
19
|
+
protected: false,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** @typedef {Parameters<Parameters<typeof migrate>[0]>[0]} AvatarMigrationApp */
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {AvatarMigrationApp} app
|
|
26
|
+
* @param {typeof AVATAR} settings
|
|
27
|
+
*/
|
|
28
|
+
function configure(app, settings) {
|
|
29
|
+
const users = app.findCollectionByNameOrId("users");
|
|
30
|
+
// The generated types model the Go field struct; the JSVM accepts plain property writes.
|
|
31
|
+
const avatar = /** @type {any} */ (users.fields.getByName("avatar"));
|
|
32
|
+
Object.assign(avatar, settings);
|
|
33
|
+
app.save(users);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
migrate(
|
|
37
|
+
(app) => configure(app, AVATAR),
|
|
38
|
+
(app) => configure(app, DEFAULTS),
|
|
39
|
+
);
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Direct messages (DESIGN.md §16): a DM is a room with kind = "dm" and its two members. Public rooms are
|
|
3
|
+
// unchanged apart from the new `kind`. Only the POST /api/chat/dms route (pb_hooks) creates DMs.
|
|
4
|
+
|
|
5
|
+
const SIGNED_IN = '@request.auth.id != ""';
|
|
6
|
+
const NO_DM_FIELDS = [
|
|
7
|
+
"@request.body.members:isset = false",
|
|
8
|
+
"@request.body.dm_key:isset = false",
|
|
9
|
+
"@request.body.last_message_at:isset = false",
|
|
10
|
+
];
|
|
11
|
+
/** The room in `rel` is public, or the caller is one of its members. */
|
|
12
|
+
const VISIBLE = (/** @type {string} */ rel) => `(${rel}kind = "public" || ${rel}members.id ?= @request.auth.id)`;
|
|
13
|
+
|
|
14
|
+
const RULES = {
|
|
15
|
+
rooms: {
|
|
16
|
+
listRule: `${SIGNED_IN} && ${VISIBLE("")}`,
|
|
17
|
+
viewRule: `${SIGNED_IN} && ${VISIBLE("")}`,
|
|
18
|
+
createRule: [
|
|
19
|
+
SIGNED_IN,
|
|
20
|
+
"@request.body.created_by = @request.auth.id",
|
|
21
|
+
"(@request.body.archived:isset = false || @request.body.archived = false)",
|
|
22
|
+
"@request.body.archived_at:isset = false",
|
|
23
|
+
'(@request.body.kind:isset = false || @request.body.kind = "public")',
|
|
24
|
+
...NO_DM_FIELDS,
|
|
25
|
+
].join(" && "),
|
|
26
|
+
updateRule: [
|
|
27
|
+
"created_by = @request.auth.id",
|
|
28
|
+
'kind = "public"',
|
|
29
|
+
"@request.body.created_by:isset = false",
|
|
30
|
+
"@request.body.archived_at:isset = false",
|
|
31
|
+
"@request.body.kind:isset = false",
|
|
32
|
+
...NO_DM_FIELDS,
|
|
33
|
+
].join(" && "),
|
|
34
|
+
},
|
|
35
|
+
messages: {
|
|
36
|
+
listRule: `${SIGNED_IN} && ${VISIBLE("room.")}`,
|
|
37
|
+
viewRule: `${SIGNED_IN} && ${VISIBLE("room.")}`,
|
|
38
|
+
createRule: [
|
|
39
|
+
SIGNED_IN,
|
|
40
|
+
"@request.body.author = @request.auth.id",
|
|
41
|
+
"@request.body.room.archived = false",
|
|
42
|
+
VISIBLE("@request.body.room."),
|
|
43
|
+
"@request.body.deleted:isset = false",
|
|
44
|
+
"@request.body.deleted_at:isset = false",
|
|
45
|
+
"@request.body.edited_at:isset = false",
|
|
46
|
+
].join(" && "),
|
|
47
|
+
},
|
|
48
|
+
hidden_rooms: {
|
|
49
|
+
createRule: `${SIGNED_IN} && @request.body.user = @request.auth.id && ${VISIBLE("@request.body.room.")}`,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** The MVP rules (1760000000_init.js), restored on down. */
|
|
54
|
+
const MVP_RULES = {
|
|
55
|
+
rooms: {
|
|
56
|
+
listRule: SIGNED_IN,
|
|
57
|
+
viewRule: SIGNED_IN,
|
|
58
|
+
createRule: [
|
|
59
|
+
SIGNED_IN,
|
|
60
|
+
"@request.body.created_by = @request.auth.id",
|
|
61
|
+
"(@request.body.archived:isset = false || @request.body.archived = false)",
|
|
62
|
+
"@request.body.archived_at:isset = false",
|
|
63
|
+
].join(" && "),
|
|
64
|
+
updateRule: ["created_by = @request.auth.id", "@request.body.created_by:isset = false", "@request.body.archived_at:isset = false"].join(
|
|
65
|
+
" && ",
|
|
66
|
+
),
|
|
67
|
+
},
|
|
68
|
+
messages: {
|
|
69
|
+
listRule: SIGNED_IN,
|
|
70
|
+
viewRule: SIGNED_IN,
|
|
71
|
+
createRule: [
|
|
72
|
+
SIGNED_IN,
|
|
73
|
+
"@request.body.author = @request.auth.id",
|
|
74
|
+
"@request.body.room.archived = false",
|
|
75
|
+
"@request.body.deleted:isset = false",
|
|
76
|
+
"@request.body.deleted_at:isset = false",
|
|
77
|
+
"@request.body.edited_at:isset = false",
|
|
78
|
+
].join(" && "),
|
|
79
|
+
},
|
|
80
|
+
hidden_rooms: { createRule: `${SIGNED_IN} && @request.body.user = @request.auth.id` },
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const DM_LIMIT = { label: "POST /api/chat/dms", audience: "", duration: 60, maxRequests: 10 };
|
|
84
|
+
|
|
85
|
+
/** @typedef {Parameters<Parameters<typeof migrate>[0]>[0]} DmMigrationApp */
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @param {DmMigrationApp} app
|
|
89
|
+
* @param {Record<string, Record<string, string>>} rules
|
|
90
|
+
*/
|
|
91
|
+
function applyRules(app, rules) {
|
|
92
|
+
for (const [name, r] of Object.entries(rules)) {
|
|
93
|
+
const c = app.findCollectionByNameOrId(name);
|
|
94
|
+
Object.assign(c, r);
|
|
95
|
+
app.save(c);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
migrate(
|
|
100
|
+
(app) => {
|
|
101
|
+
const users = app.findCollectionByNameOrId("users");
|
|
102
|
+
const rooms = app.findCollectionByNameOrId("rooms");
|
|
103
|
+
// DMs have no name (the title is the other member's): required only for public rooms, by pb_hooks.
|
|
104
|
+
/** @type {any} */ (rooms.fields.getByName("name")).required = false;
|
|
105
|
+
rooms.fields.add(new SelectField({ name: "kind", required: true, maxSelect: 1, values: ["public", "dm"] }));
|
|
106
|
+
rooms.fields.add(new RelationField({ name: "members", maxSelect: 2, collectionId: users.id, cascadeDelete: false }));
|
|
107
|
+
rooms.fields.add(new TextField({ name: "dm_key", hidden: true, max: 40 }));
|
|
108
|
+
rooms.fields.add(new DateField({ name: "last_message_at" }));
|
|
109
|
+
app.save(rooms);
|
|
110
|
+
|
|
111
|
+
app.db().newQuery("UPDATE rooms SET kind = 'public' WHERE kind = '' OR kind IS NULL").execute();
|
|
112
|
+
|
|
113
|
+
const indexed = app.findCollectionByNameOrId("rooms");
|
|
114
|
+
indexed.addIndex("idx_rooms_dm_key", true, "`dm_key`", "`dm_key` != ''");
|
|
115
|
+
// Every DM's name is "": the case-insensitive unique name index only covers named (public) rooms now.
|
|
116
|
+
indexed.removeIndex("idx_rooms_name");
|
|
117
|
+
indexed.addIndex("idx_rooms_name", true, "`name` COLLATE NOCASE", "`name` != ''");
|
|
118
|
+
app.save(indexed);
|
|
119
|
+
|
|
120
|
+
applyRules(app, RULES);
|
|
121
|
+
|
|
122
|
+
const settings = app.settings();
|
|
123
|
+
const rest = settings.rateLimits.rules.filter((r) => r.label !== DM_LIMIT.label);
|
|
124
|
+
settings.rateLimits.rules = [/** @type {any} */ (DM_LIMIT), ...rest];
|
|
125
|
+
app.save(settings);
|
|
126
|
+
},
|
|
127
|
+
// Rolling back turns existing DMs into nameless rooms visible to everyone: delete them first if that matters.
|
|
128
|
+
(app) => {
|
|
129
|
+
applyRules(app, MVP_RULES);
|
|
130
|
+
const rooms = app.findCollectionByNameOrId("rooms");
|
|
131
|
+
rooms.removeIndex("idx_rooms_dm_key");
|
|
132
|
+
rooms.removeIndex("idx_rooms_name");
|
|
133
|
+
rooms.addIndex("idx_rooms_name", true, "`name` COLLATE NOCASE", "");
|
|
134
|
+
for (const n of ["kind", "members", "dm_key", "last_message_at"]) rooms.fields.removeByName(n);
|
|
135
|
+
/** @type {any} */ (rooms.fields.getByName("name")).required = true;
|
|
136
|
+
app.save(rooms);
|
|
137
|
+
|
|
138
|
+
const settings = app.settings();
|
|
139
|
+
settings.rateLimits.rules = settings.rateLimits.rules.filter((r) => r.label !== DM_LIMIT.label);
|
|
140
|
+
app.save(settings);
|
|
141
|
+
},
|
|
142
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Attachments (DESIGN.md §17.1): up to 4 protected files per message, 8 MB each, thumbnails for images.
|
|
3
|
+
// Files never change after sending (only the soft delete wipes them, in pb_hooks).
|
|
4
|
+
|
|
5
|
+
const FILES = {
|
|
6
|
+
name: "files",
|
|
7
|
+
maxSelect: 4,
|
|
8
|
+
maxSize: 8 * 1024 * 1024,
|
|
9
|
+
protected: true,
|
|
10
|
+
thumbs: ["480x360", "240x180"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const NO_FILE_CHANGES = "@request.body.files:isset = false";
|
|
14
|
+
|
|
15
|
+
migrate(
|
|
16
|
+
(app) => {
|
|
17
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
18
|
+
messages.fields.add(new FileField(/** @type {any} */ (FILES)));
|
|
19
|
+
messages.updateRule = `${messages.updateRule} && ${NO_FILE_CHANGES}`;
|
|
20
|
+
app.save(messages);
|
|
21
|
+
},
|
|
22
|
+
(app) => {
|
|
23
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
24
|
+
messages.fields.removeByName("files");
|
|
25
|
+
messages.updateRule = (messages.updateRule ?? "").replace(` && ${NO_FILE_CHANGES}`, "");
|
|
26
|
+
app.save(messages);
|
|
27
|
+
},
|
|
28
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// QA BUG-28: keep attachments' original names. `messages.file_names` maps stored name → original name; only the
|
|
3
|
+
// create hook writes it (from the upload itself), so clients can't forge it.
|
|
4
|
+
|
|
5
|
+
migrate(
|
|
6
|
+
(app) => {
|
|
7
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
8
|
+
messages.fields.add(new JSONField({ name: "file_names", maxSize: 4096 }));
|
|
9
|
+
app.save(messages);
|
|
10
|
+
},
|
|
11
|
+
(app) => {
|
|
12
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
13
|
+
messages.fields.removeByName("file_names");
|
|
14
|
+
app.save(messages);
|
|
15
|
+
},
|
|
16
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Unread counts (DESIGN.md §18.1): how far each user has read each room. Users can list their own rows (and get
|
|
3
|
+
// them live); only POST /api/chat/reads (pb_hooks) writes them, so last_read_at only ever moves forward.
|
|
4
|
+
|
|
5
|
+
const READ_LIMIT = { label: "POST /api/chat/reads", audience: "", duration: 60, maxRequests: 120 };
|
|
6
|
+
|
|
7
|
+
migrate(
|
|
8
|
+
(app) => {
|
|
9
|
+
const users = app.findCollectionByNameOrId("users");
|
|
10
|
+
const rooms = app.findCollectionByNameOrId("rooms");
|
|
11
|
+
const reads = new Collection(
|
|
12
|
+
/** @type {any} */ ({
|
|
13
|
+
type: "base",
|
|
14
|
+
name: "room_reads",
|
|
15
|
+
listRule: "user = @request.auth.id",
|
|
16
|
+
viewRule: "user = @request.auth.id",
|
|
17
|
+
createRule: null,
|
|
18
|
+
updateRule: null,
|
|
19
|
+
deleteRule: null,
|
|
20
|
+
fields: [
|
|
21
|
+
{ type: "relation", name: "user", required: true, maxSelect: 1, collectionId: users.id, cascadeDelete: true },
|
|
22
|
+
{ type: "relation", name: "room", required: true, maxSelect: 1, collectionId: rooms.id, cascadeDelete: true },
|
|
23
|
+
{ type: "date", name: "last_read_at", required: true },
|
|
24
|
+
],
|
|
25
|
+
indexes: ["CREATE UNIQUE INDEX `idx_room_reads_user_room` ON `room_reads` (`user`, `room`)"],
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
app.save(reads);
|
|
29
|
+
|
|
30
|
+
const settings = app.settings();
|
|
31
|
+
const rest = settings.rateLimits.rules.filter((r) => r.label !== READ_LIMIT.label);
|
|
32
|
+
settings.rateLimits.rules = [/** @type {any} */ (READ_LIMIT), ...rest];
|
|
33
|
+
app.save(settings);
|
|
34
|
+
},
|
|
35
|
+
(app) => {
|
|
36
|
+
app.delete(app.findCollectionByNameOrId("room_reads"));
|
|
37
|
+
const settings = app.settings();
|
|
38
|
+
settings.rateLimits.rules = settings.rateLimits.rules.filter((r) => r.label !== READ_LIMIT.label);
|
|
39
|
+
app.save(settings);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Replies (DESIGN.md §19): `messages.reply_to` points at an earlier message of the same room. Set only on create
|
|
3
|
+
// (pb_hooks checks the room); never changed afterwards. Deleting the original only soft-deletes it, so the
|
|
4
|
+
// relation keeps pointing at its placeholder.
|
|
5
|
+
|
|
6
|
+
const NO_REPLY_CHANGES = "@request.body.reply_to:isset = false";
|
|
7
|
+
|
|
8
|
+
migrate(
|
|
9
|
+
(app) => {
|
|
10
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
11
|
+
messages.fields.add(
|
|
12
|
+
new RelationField(/** @type {any} */ ({ name: "reply_to", maxSelect: 1, collectionId: messages.id, cascadeDelete: false })),
|
|
13
|
+
);
|
|
14
|
+
messages.updateRule = `${messages.updateRule} && ${NO_REPLY_CHANGES}`;
|
|
15
|
+
app.save(messages);
|
|
16
|
+
},
|
|
17
|
+
(app) => {
|
|
18
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
19
|
+
messages.fields.removeByName("reply_to");
|
|
20
|
+
messages.updateRule = (messages.updateRule ?? "").replace(` && ${NO_REPLY_CHANGES}`, "");
|
|
21
|
+
app.save(messages);
|
|
22
|
+
},
|
|
23
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// QA BUG-47: emails are stored in lower case (pb_hooks lowers new ones), so an address can't make two accounts and
|
|
3
|
+
// logging in doesn't depend on its capitalization. Lower the existing ones, except where two accounts already differ
|
|
4
|
+
// only in case: those keep their emails, and each still logs in with its own as typed.
|
|
5
|
+
|
|
6
|
+
migrate(
|
|
7
|
+
(app) => {
|
|
8
|
+
/** @type {Map<string, string[]>} lowered email → ids */
|
|
9
|
+
const byEmail = new Map();
|
|
10
|
+
for (const u of app.findAllRecords("users")) {
|
|
11
|
+
if (!u) continue;
|
|
12
|
+
const key = u.email().trim().toLowerCase();
|
|
13
|
+
byEmail.set(key, [...(byEmail.get(key) ?? []), u.id]);
|
|
14
|
+
}
|
|
15
|
+
for (const [email, ids] of byEmail) {
|
|
16
|
+
if (ids.length !== 1) continue;
|
|
17
|
+
// Raw SQL: no hooks, and `updated` is left alone.
|
|
18
|
+
app.db().newQuery("UPDATE users SET email = {:email} WHERE id = {:id} AND email != {:email}").bind({ email, id: ids[0] }).execute();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
() => {
|
|
22
|
+
// Nothing to undo: the original capitalization isn't kept, and lower-case emails work either way.
|
|
23
|
+
},
|
|
24
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Reactions (DESIGN.md §20.1): `messages.reactions` lists each emoji with who reacted with it. Only
|
|
3
|
+
// POST /api/chat/reactions (pb_hooks) writes it; clients can't set it on create or update.
|
|
4
|
+
|
|
5
|
+
const NO_REACTIONS = "@request.body.reactions:isset = false";
|
|
6
|
+
const REACT_LIMIT = { label: "POST /api/chat/reactions", audience: "", duration: 10, maxRequests: 30 };
|
|
7
|
+
|
|
8
|
+
migrate(
|
|
9
|
+
(app) => {
|
|
10
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
11
|
+
messages.fields.add(new JSONField({ name: "reactions" }));
|
|
12
|
+
messages.createRule = `${messages.createRule} && ${NO_REACTIONS}`;
|
|
13
|
+
messages.updateRule = `${messages.updateRule} && ${NO_REACTIONS}`;
|
|
14
|
+
app.save(messages);
|
|
15
|
+
|
|
16
|
+
const settings = app.settings();
|
|
17
|
+
const rest = settings.rateLimits.rules.filter((r) => r.label !== REACT_LIMIT.label);
|
|
18
|
+
settings.rateLimits.rules = [/** @type {any} */ (REACT_LIMIT), ...rest];
|
|
19
|
+
app.save(settings);
|
|
20
|
+
},
|
|
21
|
+
(app) => {
|
|
22
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
23
|
+
messages.fields.removeByName("reactions");
|
|
24
|
+
messages.createRule = (messages.createRule ?? "").replace(` && ${NO_REACTIONS}`, "");
|
|
25
|
+
messages.updateRule = (messages.updateRule ?? "").replace(` && ${NO_REACTIONS}`, "");
|
|
26
|
+
app.save(messages);
|
|
27
|
+
|
|
28
|
+
const settings = app.settings();
|
|
29
|
+
settings.rateLimits.rules = settings.rateLimits.rules.filter((r) => r.label !== REACT_LIMIT.label);
|
|
30
|
+
app.save(settings);
|
|
31
|
+
},
|
|
32
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Attachment thumbnails keep the image's aspect ratio (DESIGN.md §17.5): "f" fits the image inside the box rather
|
|
3
|
+
// than cropping it to the box.
|
|
4
|
+
|
|
5
|
+
const FIT = ["800x480f", "480x240f"];
|
|
6
|
+
const CROP = ["480x360", "240x180"];
|
|
7
|
+
|
|
8
|
+
/** @param {any} app @param {string[]} thumbs */
|
|
9
|
+
function setThumbs(app, thumbs) {
|
|
10
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
11
|
+
/** @type {any} */ (messages.fields.getByName("files")).thumbs = thumbs;
|
|
12
|
+
app.save(messages);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
migrate(
|
|
16
|
+
(app) => setThumbs(app, FIT),
|
|
17
|
+
(app) => setThumbs(app, CROP),
|
|
18
|
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference path="../types/pocketbase.d.ts" />
|
|
2
|
+
// Forwarding and deleting several messages at once (DESIGN.md §21). `messages.forwarded_from` names who first wrote a
|
|
3
|
+
// forwarded message. Only POST /api/chat/forward (pb_hooks) sets it; clients can't set or change it.
|
|
4
|
+
|
|
5
|
+
const NO_FORWARD = "@request.body.forwarded_from:isset = false";
|
|
6
|
+
const LIMITS = [
|
|
7
|
+
{ label: "POST /api/chat/forward", audience: "", duration: 60, maxRequests: 20 },
|
|
8
|
+
{ label: "POST /api/chat/delete", audience: "", duration: 60, maxRequests: 20 },
|
|
9
|
+
];
|
|
10
|
+
const LABELS = LIMITS.map((r) => r.label);
|
|
11
|
+
|
|
12
|
+
migrate(
|
|
13
|
+
(app) => {
|
|
14
|
+
const users = app.findCollectionByNameOrId("users");
|
|
15
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
16
|
+
messages.fields.add(
|
|
17
|
+
new RelationField(/** @type {any} */ ({ name: "forwarded_from", maxSelect: 1, collectionId: users.id, cascadeDelete: false })),
|
|
18
|
+
);
|
|
19
|
+
messages.createRule = `${messages.createRule} && ${NO_FORWARD}`;
|
|
20
|
+
messages.updateRule = `${messages.updateRule} && ${NO_FORWARD}`;
|
|
21
|
+
app.save(messages);
|
|
22
|
+
|
|
23
|
+
const settings = app.settings();
|
|
24
|
+
const rest = settings.rateLimits.rules.filter((r) => !LABELS.includes(r.label));
|
|
25
|
+
settings.rateLimits.rules = [.../** @type {any[]} */ (LIMITS), ...rest];
|
|
26
|
+
app.save(settings);
|
|
27
|
+
},
|
|
28
|
+
(app) => {
|
|
29
|
+
const messages = app.findCollectionByNameOrId("messages");
|
|
30
|
+
messages.fields.removeByName("forwarded_from");
|
|
31
|
+
messages.createRule = (messages.createRule ?? "").replace(` && ${NO_FORWARD}`, "");
|
|
32
|
+
messages.updateRule = (messages.updateRule ?? "").replace(` && ${NO_FORWARD}`, "");
|
|
33
|
+
app.save(messages);
|
|
34
|
+
|
|
35
|
+
const settings = app.settings();
|
|
36
|
+
settings.rateLimits.rules = settings.rateLimits.rules.filter((r) => !LABELS.includes(r.label));
|
|
37
|
+
app.save(settings);
|
|
38
|
+
},
|
|
39
|
+
);
|