Changeset 8afbdd6 in Klonkt for src/routes/hub.js


Ignore:
Timestamp:
06/14/2026 06:07:51 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
c869272
Parents:
b94c08e
Message:

feat: viewer role + artists directory + Klonkt Hub Beta rebrand

Viewer role (replaces the separate view-mode/readonly toggle):

  • 'kijker' is now a real role (VALID_ROLES) selectable in Admin. May view EVERYTHING including Admin, but cannot modify anything.
  • isViewer(user) (= role kijker or legacy readonly flag) is the source; requireGod/requireSiteManager(BySlug) let a viewer through (viewing), the global guard 403s every write. Existing readonly accounts are migrated on each role change (readonly=0).
  • Write leaks via GET patched: /prutter/new (INSERT) blocks for viewers, /prutter/:id skips markAsRead (UPDATE); WS upgrade rejects viewers (the HTTP guard doesn't cover WebSockets).
  • Clean "Viewer mode" page (viewer-blocked) instead of raw 403 text; styled sticky banner; account page shows read-only UI instead of an upload button that silently 403s. canMutate hides write buttons.

Scalability (>50 artists):

  • Hub home shows max 24 (most active first) + "All N artists ->".
  • New searchable, paginated /artiesten directory (hub only).
  • 'user' + 'artiesten' reserved as slugs.

Rebrand PrutFolio v1 -> Klonkt Hub Beta (footer, PWA manifest, account/
admin texts, default page title, startup, README; internal package +
PWA id 'prutfolio' remain for stability).

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/hub.js

    rb94c08e r8afbdd6  
    3535  `).all();
    3636
    37   // ALLE PrutFolio's (elke user, incl. de admin z'n eigen site) voor de roster.
     37  // Uitgelichte PrutFolio's voor de home-roster: meest-actief eerst (aantal
     38  // gepubliceerde posts), dan nieuwste. Beperkt tot HOME_ROSTER_LIMIT zodat de
     39  // home schaalt — de volledige, doorzoekbare lijst staat op /artiesten.
     40  const HOME_ROSTER_LIMIT = 24;
    3841  const artists = db.prepare(`
    3942    SELECT s.slug, s.title, s.tagline, s.profile_photo, s.accent,
     
    4245    FROM sites s
    4346    LEFT JOIN users u ON u.id = s.owner_id
    44     ORDER BY s.created_at ASC
    45   `).all();
     47    ORDER BY post_count DESC, s.created_at DESC
     48    LIMIT ?
     49  `).all(HOME_ROSTER_LIMIT);
     50  const totalArtists = db.prepare('SELECT COUNT(*) AS c FROM sites').get().c;
    4651
    4752  // De hub-pagina is GENERIEK (van geen enkele user) — branding komt uit globale
     
    6065    hub,
    6166    artists,
     67    totalArtists,
     68    rosterLimit: HOME_ROSTER_LIMIT,
    6269    posts,
    6370  });
Note: See TracChangeset for help on using the changeset viewer.