Changeset 31680c3 in Klonkt for src/services/ap-inbox.js


Ignore:
Timestamp:
09/30/2026 08:39:24 AM (3 hours ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
746d98a
Parents:
76bd53c
Message:

[Add to HUB] on the Connect page — the click is the owner's yes

Putting a klonkt on the Klonkt Hub means the hub sends a Follow. With the
owner gate on (the default) that Follow then waits for the owner — the same
person who just asked for it. Without this they would sign up on the hub and
then have to approve their own sign-up on /connect.

The button POSTs to /connect/add-to-hub, which records a one-day invitation
and redirects to the hub's sign-up form with the site's handle filled in
(?add=). A Follow from the hub's host, signed by the hub itself, passes the
owner gate while that invitation holds. It is not used up on the first
Follow: a hub that re-sends after a timeout would otherwise land in the queue
for something already decided.

Narrow on purpose: only the hub's host, only signed by it, only for a day.
Anyone else still waits for the owner, and a WARD's guardians still decide —
their gate sits before this one and this path never reaches it.

If a request from the hub is already waiting (someone signed the klonkt up
earlier), the click is exactly the yes it waits for: it is accepted on the
spot and the button goes to the channel on the hub instead of the form. Once
the hub follows, /connect shows a confirmation instead of the button. Hidden
after a move, where the outgoing side is locked.

KLONKT_HUB_URL lets a self-hoster point the button at another hub; default
​https://hub.klonkt.com.

Co-Authored-By: Claude Opus 5.5 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ap-inbox.js

    r76bd53c r31680c3  
    2929import { parsePoll, recordPollBallot } from './ap-polls.js';
    3030import { fwStmts } from './ap-following.js';
     31import * as HubInvite from './hub-invite.js';
    3132
    3233/**
    … …  
    559560    // Wards vallen hier nooit: de guardianpoort hierboven gaat vóór.
    560561    const ownerGate = db.prepare('SELECT approve_followers FROM sites WHERE slug = ?').get(slug);
    561     if (ownerGate && ownerGate.approve_followers) {
     562    // Behalve als de eigenaar dat ja al gaf: [Add to HUB] op /connect geldt
     563    // een dag als toestemming voor een Follow van de hub. Alleen als de hub
     564    // hem ZELF ondertekende. Zie services/hub-invite.js.
     565    const alGoedgekeurd = !!(verified && verified.id === who && HubInvite.isInvited(slug, who));
     566    if (alGoedgekeurd) console.log('[AP] Follow', who, '→', slug, '(pre-approved via Add to HUB)');
     567    if (ownerGate && ownerGate.approve_followers && !alGoedgekeurd) {
    562568      const followId = (typeof act.id === 'string' && act.id) || `${who}#follow-${Date.now()}-${rid()}`;
    563569      Guardianship.follows.recordPending(slug, {
Note: See TracChangeset for help on using the changeset viewer.