Changeset dd856db in Klonkt


Ignore:
Timestamp:
06/24/2026 05:23:33 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
48ca5fc
Parents:
34076d7
Message:

Remove hub mode (step 1/2): keystone coercion + drop hub UI

getTenancy() now only returns 'solo'|'circle' (legacy 'hub' -> 'solo'), so every
tenancy==='hub' branch is unreachable. Removed the Hub tenancy radio + hub-home
branding form from settings, and the dead hub premium gate. Solo + Circle paths
unchanged. Dead hub code (hub.js, artists.js, hub-home view, /user routing, etc.)
gets deleted in step 2.

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

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/routes/admin-settings.js

    r34076d7 rdd856db  
    9696
    9797    if (typeof req.body.tenancy !== 'undefined') {
    98       // Hub mode is a premium feature: only switch to hub if premium is
    99       // unlocked (premium layer off = free; on = Patreon required). Staying on
    100       // hub is always allowed, so an instance can never get stuck.
    101       if (req.body.tenancy === 'hub' && !premiumUnlocked() && getTenancy() !== 'hub') {
    102         return res.redirect('/admin/settings?error=' + encodeURIComponent('Hub-modus is een premium-functie — koppel Patreon in Beheer → Instellingen.'));
    103       }
    104       setTenancy(req.body.tenancy); // valideert naar solo | hub | circle
     98      // Hub mode is removed → setTenancy only accepts solo | circle (coerces the rest).
     99      setTenancy(req.body.tenancy);
    105100    }
    106101    if (typeof req.body.default_lang !== 'undefined') {
  • src/services/SettingsService.js

    r34076d7 rdd856db  
    11// Global app settings (key/value, cached). Primarily used for the tenancy mode.
    22//
    3 //   tenancy = 'solo'  -> exactly one site (the primary/owner site)
    4 //   tenancy = 'hub'   -> main site (company) + /user/, admin assigns Klonkt sites
     3//   tenancy = 'solo'   -> exactly one site (the primary/owner site)
     4//   tenancy = 'circle' -> solo site that federates with other solo Klonkt sites
     5//
     6// HUB MODE IS REMOVED (2026-06-24): multi-artist-per-domain was dropped in favour
     7// of solo + Cirkels. getTenancy() coerces any legacy 'hub' value to 'solo' so all
     8// the old `tenancy === 'hub'` branches are unreachable; the hub code is being
     9// deleted incrementally.
    510//
    611// The cache is updated immediately on setSetting, so a toggle in admin
     
    3641export function getTenancy() {
    3742  const v = getSetting('tenancy', 'solo');
    38   return v === 'hub' ? 'hub' : v === 'circle' ? 'circle' : 'solo';
     43  // 'hub' is removed → coerce legacy values to 'solo'.
     44  return v === 'circle' ? 'circle' : 'solo';
    3945}
    4046
    4147export function setTenancy(mode) {
    42   const m = (mode === 'hub' || mode === 'circle') ? mode : 'solo';
     48  const m = mode === 'circle' ? 'circle' : 'solo';
    4349  setSetting('tenancy', m);
    4450}
  • src/views/pages/admin-settings.ejs

    r34076d7 rdd856db  
    1818          <strong><%= t('aset.solo') %></strong> — <%= t('aset.solo_title') %>
    1919          <small><%= t('aset.solo_desc') %></small>
    20         </span>
    21       </label>
    22       <% var _hubLocked = (typeof premiumUnlocked !== 'undefined') && !premiumUnlocked && tenancy !== 'hub'; %>
    23       <label class="set-opt">
    24         <input type="radio" name="tenancy" value="hub" <%= tenancy === 'hub' ? 'checked' : '' %> <%= _hubLocked ? 'disabled' : '' %>>
    25         <span>
    26           <strong><%= t('aset.hub') %></strong> — <%= t('aset.hub_title') %> <code>/user/</code>.
    27           <% if (_hubLocked) { %><span style="display:inline-block;font-size:.7rem;font-weight:700;color:var(--accent);border:1px solid var(--accent);border-radius:999px;padding:.05rem .45rem;margin-left:.3rem;vertical-align:1px;">🔒 <%= t('aset.premium_badge') %></span><% } %>
    28           <small><%= t('aset.hub_desc') %><% if (_hubLocked) { %> <em><%= t('aset.hub_locked_note') %></em><% } %></small>
    2920        </span>
    3021      </label>
     
    7869  </section>
    7970
    80   <%# Mode-specific config — placed directly below the Mode card so it visually
    81       belongs to the selected mode (Hub under hub, Circle under circle). %>
    82   <% if (tenancy === 'hub') { %>
    83   <section class="set-card set-card--mode" style="margin-top:1rem">
    84     <h2><%= t('aset.hub_home') %></h2>
    85     <p class="set-help">
    86       <%= t('aset.hub_home_help_1') %> (<code>/</code>) <%= t('aset.hub_home_help_2') %> <code>/user/</code>.
    87     </p>
    88     <form method="post" action="/admin/settings" class="set-form" enctype="multipart/form-data">
    89       <label class="set-field">
    90         <span><%= t('aset.name') %></span>
    91         <input type="text" name="hub_title" maxlength="80" value="<%= hubTitle %>" placeholder="<%= t('aset.name_ph') %>">
    92       </label>
    93       <label class="set-field">
    94         <span><%= t('aset.tagline') %></span>
    95         <input type="text" name="hub_tagline" maxlength="120" value="<%= hubTagline %>" placeholder="<%= t('aset.tagline_ph') %>">
    96       </label>
    97       <label class="set-field">
    98         <span><%= t('aset.intro') %></span>
    99         <textarea name="hub_intro" maxlength="400" rows="3" placeholder="<%= t('aset.intro_ph') %>"><%= hubIntro %></textarea>
    100       </label>
    101       <label class="set-field">
    102         <span><%= t('aset.hero_image') %> <small style="font-weight:400;color:var(--ink-muted)">— <%= t('aset.hero_image_hint') %></small></span>
    103         <input type="text" name="hub_hero_image" maxlength="300" value="<%= hubHeroImage %>" placeholder="/media/... of https://...">
    104       </label>
    105       <label class="set-field">
    106         <span><%= t('aset.hero_upload') %> <small style="font-weight:400;color:var(--ink-muted)">— <%= t('aset.hero_upload_hint') %></small></span>
    107         <input type="file" name="hub_hero_file" accept="image/png,image/jpeg,image/webp,image/gif">
    108       </label>
    109       <label class="set-field">
    110         <span><%= t('aset.hero_overlay') %> <small style="font-weight:400;color:var(--ink-muted)">— <%= t('aset.hero_overlay_hint') %></small></span>
    111         <span style="display:flex;align-items:center;gap:0.75rem">
    112           <input type="range" name="hub_hero_overlay" min="0" max="100" step="5" value="<%= hubHeroOverlay %>" style="flex:1"
    113             oninput="this.parentNode.querySelector('.ov-val').textContent=this.value+'%';var o=document.getElementById('hero-ov-preview');if(o)o.style.opacity=this.value/100">
    114           <span class="ov-val" style="min-width:3.5ch;text-align:right;font-variant-numeric:tabular-nums"><%= hubHeroOverlay %>%</span>
    115         </span>
    116       </label>
    117       <% if (hubHeroImage) { %>
    118       <div class="set-field">
    119         <span style="font-weight:400;color:var(--ink-muted);font-size:0.9rem"><%= t('aset.preview_overlay') %></span>
    120         <div style="position:relative;width:100%;aspect-ratio:16/7;margin-top:0.4rem;border-radius:8px;overflow:hidden;border:1px solid var(--rule);background:var(--paper-2)">
    121           <img src="<%= hubHeroImage %>" alt="<%= t('aset.hero_preview_alt') %>" style="display:block;width:100%;height:100%;object-fit:cover">
    122           <div id="hero-ov-preview" style="position:absolute;inset:0;background:#000;opacity:<%= (hubHeroOverlay/100).toFixed(2) %>;pointer-events:none"></div>
    123         </div>
    124       </div>
    125       <% } %>
    126       <button type="submit" class="btn btn-primary"><%= t('aset.save') %></button>
    127     </form>
    128   </section>
    129   <% } %>
    130 
     71  <%# Mode-specific config — Circle settings below the mode card. (Hub removed.) %>
    13172  <% if (tenancy === 'circle') { %>
    13273  <section class="set-card set-card--mode" style="margin-top:1rem">
Note: See TracChangeset for help on using the changeset viewer.