From b6df4c64af979adb9e0692e69aaa384543669db2 Mon Sep 17 00:00:00 2001 From: s4luorth Date: Mon, 8 Jun 2026 07:39:34 +0200 Subject: [PATCH] revert: lokales Google-Fonts-Hosting entfernt + scan zeigt nur hinweis - Feature "Schriften lokal hosten" komplett zurueckgebaut (class-fonts.php, tab, ajax-endpunkte, output-buffer, admin-js-handler, optionen). - Scan: wird fonts.googleapis.com / fonts.gstatic.com erkannt, steht in der Aktion-spalte jetzt der nicht-klickbare hinweis "Schriftart fuer DSGVO-konformen Betrieb lokal hosten." statt eines buttons. - i18n entsprechend bereinigt (123 strings). Co-Authored-By: Claude Opus 4.8 --- gdpr-content-blocker/assets/admin.js | 47 +- gdpr-content-blocker/gdpr-content-blocker.php | 2 - gdpr-content-blocker/includes/class-fonts.php | 529 ------------------ .../includes/class-settings.php | 15 +- .../languages/gdpr-content-blocker-en_US.mo | Bin 14016 -> 11897 bytes .../languages/gdpr-content-blocker-en_US.po | 58 +- hilfsdaten/strings.txt | 22 +- hilfsdaten/translations-en.json | 18 +- 8 files changed, 22 insertions(+), 669 deletions(-) delete mode 100644 gdpr-content-blocker/includes/class-fonts.php diff --git a/gdpr-content-blocker/assets/admin.js b/gdpr-content-blocker/assets/admin.js index 73a3c26..74a84b7 100644 --- a/gdpr-content-blocker/assets/admin.js +++ b/gdpr-content-blocker/assets/admin.js @@ -222,9 +222,18 @@ } $tr.append( $st ); - // Action: take over as a new service (only useful for uncovered third parties) + // Action column. const $act = $( '' ); - if ( f.third_party && ! f.covered ) { + const host = ( f.host || '' ).toLowerCase(); + const isGoogleFont = host === 'fonts.googleapis.com' || host === 'fonts.gstatic.com'; + + if ( isGoogleFont ) { + // Google Fonts can't be consent-gated meaningfully — the right fix is + // hosting them locally. Show a non-clickable hint, no button. + $act.append( $( '' ) + .css( { color: '#8a6d3b', fontStyle: 'italic' } ) + .text( i18n.fontHint || 'Host this font locally for GDPR-compliant operation.' ) ); + } else if ( f.third_party && ! f.covered ) { // Prefill from the matching preset (full data) if there is one, // otherwise just seed host + pattern. const data = preset @@ -250,40 +259,6 @@ $out.append( $table ); } - /* ── Local Google Fonts: download & embed ── */ - $( '#cb-fonts-fetch' ).on( 'click', function () { - const i18n = cbAdmin.i18n || {}; - const $btn = $( this ).prop( 'disabled', true ); - const $st = $( '#cb-fonts-status' ).text( i18n.fontsFetching || 'Downloading…' ); - - $.post( cbAdmin.ajaxUrl, { action: 'cb_fonts_fetch', nonce: cbAdmin.fontsNonce } ) - .done( function ( resp ) { - if ( ! resp || ! resp.success ) { - const msg = resp && resp.data && resp.data.message ? resp.data.message : 'Error'; - $st.text( ( i18n.fontsError || 'Error:' ) + ' ' + msg ); - return; - } - $st.text( resp.data.message || 'OK' ); - setTimeout( function () { window.location.reload(); }, 900 ); - } ) - .fail( function ( xhr ) { - $st.text( ( i18n.fontsError || 'Error:' ) + ' ' + xhr.status ); - } ) - .always( function () { - $btn.prop( 'disabled', false ); - } ); - } ); - - $( '#cb-fonts-clear' ).on( 'click', function () { - const i18n = cbAdmin.i18n || {}; - if ( ! window.confirm( i18n.fontsClearConfirm || 'Delete local fonts?' ) ) { - return; - } - $( this ).prop( 'disabled', true ); - $.post( cbAdmin.ajaxUrl, { action: 'cb_fonts_clear', nonce: cbAdmin.fontsNonce } ) - .always( function () { window.location.reload(); } ); - } ); - /* ── Activate a tab by key ── */ function activateTab( tab ) { $( '.cb-tab-content' ).hide(); diff --git a/gdpr-content-blocker/gdpr-content-blocker.php b/gdpr-content-blocker/gdpr-content-blocker.php index 016514a..12b06b7 100644 --- a/gdpr-content-blocker/gdpr-content-blocker.php +++ b/gdpr-content-blocker/gdpr-content-blocker.php @@ -37,7 +37,6 @@ require_once CB_DIR . 'includes/class-renderer.php'; require_once CB_DIR . 'includes/class-autodetect.php'; require_once CB_DIR . 'includes/class-license.php'; require_once CB_DIR . 'includes/class-updater.php'; -require_once CB_DIR . 'includes/class-fonts.php'; // Language policy: German source strings for any German locale (de_*), English // for everything else. We map the plugin's locale accordingly and ship an @@ -60,7 +59,6 @@ function cb_init(): void { CB_Autodetect::init(); CB_License::init(); CB_Updater::init(); - CB_Fonts::init(); } // Schedule / clear the daily license re-check. diff --git a/gdpr-content-blocker/includes/class-fonts.php b/gdpr-content-blocker/includes/class-fonts.php deleted file mode 100644 index 77aaf74..0000000 --- a/gdpr-content-blocker/includes/class-fonts.php +++ /dev/null @@ -1,529 +0,0 @@ - (also protocol-relative) - * - @import / direct gstatic URLs inside inline