Profile accounts: invites, any-Google sign-in, claiming People, visibility, Discord
Migration 076 adds a member role below viewer (the site and its own profile, never the admin: /api/admin now needs viewer), invites, person claims, a Discord link on accounts and people.hide_* switches. Public reads of people go through v_people_public, which nulls hidden fields, and the views that read people are rebuilt over it. Admins invite an email from Data -> Profile accounts (link shown once, emailed on request). The invitee sets a password or signs in with any Google account under that email, asks to claim their People record, and once approved edits it and chooses what shows at /account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0cc2a3f721
commit
e4c7e165d1
34 changed files with 2483 additions and 74 deletions
|
|
@ -32,6 +32,8 @@ import pages from "./routes/pages.js";
|
|||
import feedback from "./routes/feedback.js";
|
||||
import requests from "./routes/requests.js";
|
||||
import auth from "./routes/auth.js";
|
||||
import account from "./routes/account.js";
|
||||
import profiles from "./routes/profiles.js";
|
||||
import admin from "./routes/admin.js";
|
||||
import panel from "./routes/panel.js";
|
||||
import adminEntities from "./routes/admin-entities.js";
|
||||
|
|
@ -43,7 +45,7 @@ import countdown from "./routes/countdown.js";
|
|||
import redirects from "./routes/redirects.js";
|
||||
import { CLIPS_DIR, startClipWorker } from "./clips.js";
|
||||
import { UPLOADS_DIR, writeMissingThumbs } from "./media.js";
|
||||
import { logSafe, startSessionSweeper } from "./auth.js";
|
||||
import { logSafe, requireStaff, startSessionSweeper } from "./auth.js";
|
||||
import { syncDescriptorsWithSchema } from "./admin-schema-sync.js";
|
||||
import { startGroupSync } from "./accessGroups.js";
|
||||
import { startAnalyticsReports } from "./analyticsReport.js";
|
||||
|
|
@ -134,7 +136,7 @@ app.use(
|
|||
so each is capped well above its longest real body (a 5000
|
||||
character message) and far below nginx's limit. */
|
||||
const smallBody = bodyLimit({ maxSize: 64 * 1024, onError: (c) => c.json({ error: "That's too long." }, 413) });
|
||||
for (const path of ["/api/csp-report", "/api/feedback", "/api/auth/login"]) app.use(path, smallBody);
|
||||
for (const path of ["/api/csp-report", "/api/feedback", "/api/auth/login", "/api/account/accept", "/api/account/claim", "/api/account/profile"]) app.use(path, smallBody);
|
||||
|
||||
/* What the policy above would have blocked. Browsers post these on
|
||||
their own; a short line per report is plenty to go on. */
|
||||
|
|
@ -206,9 +208,18 @@ app.use("/api/auth/login", rateLimit({ windowMs: 15 * 60_000, max: 10 }));
|
|||
// Looser than a password guess: each Google sign-in is two requests,
|
||||
// and Google has already checked the person by the second.
|
||||
app.use("/api/auth/google/*", rateLimit({ windowMs: 15 * 60_000, max: 40 }));
|
||||
// The whole admin is for viewer and up; a profile account (member)
|
||||
// is signed in but kept out. Each router still checks its own.
|
||||
app.use("/api/admin/*", requireStaff);
|
||||
app.route("/api/admin/panel", panel);
|
||||
app.route("/api/auth", auth);
|
||||
// A profile account's own page (076); setting a password from an
|
||||
// invite is held to the login's pace.
|
||||
app.use("/api/account/accept", rateLimit({ windowMs: 15 * 60_000, max: 10 }));
|
||||
app.use("/api/account/photo", rateLimit({ windowMs: 15 * 60_000, max: 20 }));
|
||||
app.route("/api/account", account);
|
||||
app.route("/api/admin", admin);
|
||||
app.route("/api/admin", profiles);
|
||||
// Before the entity routes, whose /:entity would claim /media.
|
||||
app.route("/api/admin", media);
|
||||
app.route("/api/admin", imports);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue