Add group cloud: files index api, web UI, archive sync bot
The Telegram-like group file contract (packages/core shared-files.ts) becomes a working subsystem, built in three parallel tracks: API (NestJS): migration 029 group_files (chat_media_archive metadata-only index with partial replay-unique + RLS, group_file_shares with sha256 token persistence, archive_sync_state/outbox durable-claim seam incl. a unique claim_key index), group-files module (list/search with cursor pagination, direct upload ≤20 MiB streamed+hashed to oCIS WebDAV, download with ACL + retention rechecks, share links with expiry, retention modes incl. legalHold) — RBAC group-membership authz + audit chain events. Web: Files section per group — group picker, drag-drop upload (20 MiB cap), search + MIME/origin filters, cursor pagination, download via authenticated blob fetch, share dialog with expiry + shown-once token, admin retention dialog; bilingual EN/ES (wiki i18n pattern); nav sidebar/palette/bottom-nav wiring; MIME classes aligned to the DB CHECK (document/other). Archive bot (apps/archive-bot): plain sync-loop Matrix bot mirroring attachments from explicitly-mapped unencrypted archive rooms — raw /sync with durable since-cursor, outbox-claimed ingestion (hash-verified stream, no temp files), magic-byte MIME sniffing, safe-name normalization, WebDAV upload, indexed + replied with link, redaction→unavailable; health endpoint; Dockerfile. Tests 74/74, typecheck clean across api/web/bot.
This commit is contained in:
parent
eb1b60f67d
commit
d58db63fe6
58 changed files with 5543 additions and 4 deletions
24
apps/archive-bot/src/health.ts
Normal file
24
apps/archive-bot/src/health.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { createServer, type Server } from "node:http";
|
||||
import type { Logger } from "pino";
|
||||
import type { HealthSnapshot } from "./processor.js";
|
||||
|
||||
/** GET /health (or /) → 200 {rooms, cursor, pending, lastProcessedAt}; 503 when the DB count fails. */
|
||||
export function startHealthServer(port: number, snapshot: () => Promise<HealthSnapshot>, logger: Logger): Server {
|
||||
const server = createServer((req, res) => {
|
||||
if (req.method !== "GET" || (req.url !== "/" && req.url !== "/health")) {
|
||||
res.writeHead(404).end();
|
||||
return;
|
||||
}
|
||||
snapshot().then(
|
||||
(body) => {
|
||||
res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify(body));
|
||||
},
|
||||
(err: unknown) => {
|
||||
logger.warn({ err: err instanceof Error ? err.message : String(err) }, "health: snapshot failed");
|
||||
res.writeHead(503, { "content-type": "application/json" }).end(JSON.stringify({ status: "down" }));
|
||||
},
|
||||
);
|
||||
});
|
||||
server.listen(port, () => logger.info({ port }, "health: listening"));
|
||||
return server;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue