Changeset 834bcc3 in Klonkt for src/config/google.js


Ignore:
Timestamp:
06/23/2026 06:14:27 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
d774679
Parents:
bb42dfb
Message:

i18n: translate Dutch code comments to English across src/

Comments in routes/services/views/config/middleware/assets translated to
English for the public repo. A few dev-facing throw/console message strings
were Englished too. No user-facing UI strings or i18n dictionary values changed
(src/services/i18n.js untouched). Logic unchanged.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config/google.js

    rbb42dfb r834bcc3  
    1 // Google OAuth2 voor LUISTERAARS (reageren). Per-instance: de self-hoster zet
    2 // z'n EIGEN Google-client. Zo hangt elke site aan z'n eigen Google Cloud project
    3 // — geen centrale afhankelijkheid, geen gedeelde aansprakelijkheid.
     1// Google OAuth2 for LISTENERS (commenting). Per-instance: each self-hoster sets
     2// their OWN Google client. This way every site is tied to its own Google Cloud
     3// project — no central dependency, no shared liability.
    44//
    5 // Config-bron (in deze volgorde): app_settings (ingesteld via Beheer → Instellingen),
    6 // anders de env-vars. Niet ingesteld → geen "Login met Google"-knop; de rest van
    7 // de site werkt door. Google-login geeft NOOIT beheerrechten.
     5// Config source (in this order): app_settings (set via Admin → Settings),
     6// otherwise env vars. Not configured → no "Login with Google" button; the rest
     7// of the site keeps working. Google login NEVER grants admin rights.
    88//
    9 // De redirect-URI wordt afgeleid van PUBLIC_BASE_URL (<base>/auth/google/callback),
    10 // of expliciet via GOOGLE_REDIRECT_URI. Die exacte URL moet in Google Cloud staan.
     9// The redirect URI is derived from PUBLIC_BASE_URL (<base>/auth/google/callback),
     10// or explicitly via GOOGLE_REDIRECT_URI. That exact URL must be listed in Google Cloud.
    1111
    1212import { getSetting } from '../services/SettingsService.js';
     
    1616const USERINFO_URL = 'https://openidconnect.googleapis.com/v1/userinfo';
    1717
    18 // Dynamisch lezen (UI-wijziging werkt zonder herstart). app_settings wint, env = fallback.
     18// Read dynamically (UI changes take effect without a restart). app_settings wins, env = fallback.
    1919function clientId() {
    2020  return getSetting('google_client_id', '') || process.env.GOOGLE_CLIENT_ID || '';
     
    2929}
    3030
    31 export function currentClientId() { return clientId(); } // niet-geheim, voor het formulier
     31export function currentClientId() { return clientId(); } // not secret, used for the settings form
    3232export function clientSecretSet() { return !!clientSecret(); }
    3333export function googleConfigured() {
     
    6161    body,
    6262  });
    63   if (!r.ok) throw new Error(`Google token-exchange faalde: ${r.status}`);
     63  if (!r.ok) throw new Error(`Google token exchange failed: ${r.status}`);
    6464  return r.json(); // { access_token, id_token, ... }
    6565}
     
    6868export async function fetchUserinfo(accessToken) {
    6969  const r = await fetch(USERINFO_URL, { headers: { Authorization: `Bearer ${accessToken}` } });
    70   if (!r.ok) throw new Error(`Google userinfo faalde: ${r.status}`);
     70  if (!r.ok) throw new Error(`Google userinfo failed: ${r.status}`);
    7171  return r.json();
    7272}
Note: See TracChangeset for help on using the changeset viewer.