Changeset 2520dcc in Klonkt


Ignore:
Timestamp:
06/21/2026 04:57:54 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
e579a98
Parents:
d6bdbae
Message:

feat(cirkel): add site without typing https://

A bare domain (artiest.klonkt.com) is automatically prefixed with https://; a
typed http:// is upgraded to https:// (federation is intentionally https-only).
Field is now type=text (type=url blocked a bare domain before submission) with
inputmode=url + placeholder without a scheme.

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

Location:
src
Files:
2 edited

Legend:

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

    rd6bdbae r2520dcc  
    5151  const site = primarySite();
    5252  if (!site) return res.redirect('/admin/circle?error=' + encodeURIComponent('Geen site gevonden'));
    53   const url = (req.body.remote_url || '').toString().trim().replace(/\/+$/, '');
     53  // Schema automatisch aanvullen: een kale domeinnaam → https://, een getypte
     54  // http:// → https:// (federatie is bewust https-only, getekende feeds). Zo hoeft
     55  // de gebruiker nooit zelf http(s):// te typen.
     56  let url = (req.body.remote_url || '').toString().trim().replace(/\/+$/, '');
     57  if (url && !/^[a-z]+:\/\//i.test(url)) url = 'https://' + url;
     58  url = url.replace(/^http:\/\//i, 'https://');
    5459  if (!/^https:\/\/[^\s/]+(\/[^\s]*)?$/i.test(url)) {
    55     return res.redirect('/admin/circle?error=' + encodeURIComponent('Voer een geldige https-URL in'));
     60    return res.redirect('/admin/circle?error=' + encodeURIComponent('Voer een geldig site-adres in (bv. voorbeeld.nl)'));
    5661  }
    5762  const label = (req.body.label || '').toString().slice(0, 80).trim() || null;
  • src/views/pages/admin-circle.ejs

    rd6bdbae r2520dcc  
    3333      <label class="set-field">
    3434        <span><%= t('acir.url') %></span>
    35         <input type="url" name="remote_url" placeholder="https://artiest.klonkt.com" required>
     35        <input type="text" name="remote_url" inputmode="url" autocapitalize="off" autocorrect="off" spellcheck="false" placeholder="artiest.klonkt.com" required>
    3636      </label>
    3737      <label class="set-field">
Note: See TracChangeset for help on using the changeset viewer.