Externe Inhalte: Google Maps bei Freigabe direkt laden
privacy_embed() erhaelt autoLoad (Standard fuer Karten): liegt eine Freigabe fuer externe Inhalte vor, wird der iframe sofort ausgegeben. Ohne Freigabe bleibt der Platzhalter blockierend. YouTube bleibt Zwei-Klick. Hinweistexte entsprechend angepasst.
This commit is contained in:
parent
8503fa41a7
commit
6ad16474ac
4 changed files with 27 additions and 7 deletions
|
|
@ -579,18 +579,34 @@ function validate(array $rules): array
|
|||
|
||||
/**
|
||||
* Erzeugt einen datenschutzfreundlichen Platzhalter für externe Inhalte.
|
||||
* Der eigentliche iframe wird erst nach einem Klick (und nur mit Freigabe
|
||||
* für externe Inhalte) von public/js/privacy.js eingefügt.
|
||||
*
|
||||
* Liegt eine Freigabe für externe Inhalte vor und ist das automatische Laden
|
||||
* erlaubt (Standard bei Karten), wird der iframe direkt ausgegeben. Sonst
|
||||
* erscheint ein Platzhalter, den public/js/privacy.js erst nach einem Klick
|
||||
* durch den iframe ersetzt.
|
||||
*/
|
||||
function privacy_embed(string $src, string $title, string $description = '', string $kind = 'external'): string
|
||||
function privacy_embed(string $src, string $title, string $description = '', string $kind = 'external', ?bool $autoLoad = null): string
|
||||
{
|
||||
$kind = preg_replace('/[^a-z0-9-]/', '', strtolower($kind)) ?: 'external';
|
||||
$allowed = \App\Core\Privacy::externalMediaAllowed();
|
||||
$autoLoad ??= $kind === 'map';
|
||||
|
||||
if ($description === '') {
|
||||
$description = 'Dieser Inhalt wird von einem externen Anbieter geladen.';
|
||||
}
|
||||
|
||||
if ($allowed && $autoLoad) {
|
||||
$allow = $kind === 'video'
|
||||
? ' allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"'
|
||||
: '';
|
||||
|
||||
return '<div class="privacy-embed privacy-embed--' . e($kind) . ' is-loaded"'
|
||||
. ' data-privacy-embed data-src="' . e($src) . '" data-title="' . e($title) . '">'
|
||||
. '<iframe src="' . e($src) . '" title="' . e($title) . '" loading="lazy"'
|
||||
. ' referrerpolicy="no-referrer-when-downgrade" allowfullscreen' . $allow . '></iframe>'
|
||||
. '</div>';
|
||||
}
|
||||
|
||||
$action = $allowed
|
||||
? '<button type="button" class="btn btn-sm btn-primary" data-load-embed>Inhalt laden</button>'
|
||||
: '<a class="btn btn-sm btn-primary" href="/datenschutz#externe-inhalte">Externe Inhalte erlauben</a>';
|
||||
|
|
@ -655,7 +671,7 @@ function privacy_filter_embeds(string $html): string
|
|||
} elseif (preg_match('#google\.[a-z.]+/maps#i', $src)) {
|
||||
$kind = 'map';
|
||||
$title = $title !== 'Externer Inhalt' ? $title : 'Google Maps';
|
||||
$description = 'Die Karte wird erst nach deinem Klick von Google geladen.';
|
||||
$description = 'Die Karte wird erst nach deiner Freigabe für externe Inhalte von Google geladen.';
|
||||
}
|
||||
|
||||
return privacy_embed($src, $title, $description, $kind);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<?= privacy_embed(
|
||||
$mapUrl,
|
||||
'Google Maps – Stammtisch-Location & Parkplatz',
|
||||
'Die Karte wird erst nach deinem Klick von Google geladen. Dabei werden Daten an Google übertragen.',
|
||||
'Die Karte wird erst nach deiner Freigabe für externe Inhalte von Google geladen. Dabei werden Daten an Google übertragen.',
|
||||
'map'
|
||||
) ?>
|
||||
<p class="text-light small">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<ul class="privacy-consent-list">
|
||||
<li><strong>Fotos:</strong> Du wählst beim Hochladen selbst aus, welche Bilder übertragen werden.</li>
|
||||
<li><strong>Standort:</strong> Die App verwendet derzeit keine Standort- oder GPS-Daten.</li>
|
||||
<li><strong>Externe Inhalte:</strong> Google Maps und YouTube werden nur nach deiner Einwilligung und erst nach einem Klick geladen.</li>
|
||||
<li><strong>Externe Inhalte:</strong> Google Maps wird nur nach deiner Einwilligung geladen, YouTube-Videos zusätzlich erst nach einem Klick.</li>
|
||||
</ul>
|
||||
|
||||
<?php require __DIR__ . '/privacy_consent_form.php'; ?>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@
|
|||
<p class="mb-3">
|
||||
<strong>Externe Inhalte:</strong>
|
||||
<?= $externalMedia ? 'erlaubt' : 'deaktiviert' ?>.
|
||||
Google Maps und YouTube werden in jedem Fall erst nach einem Klick geladen.
|
||||
<?php if ($externalMedia): ?>
|
||||
Google Maps wird direkt geladen, YouTube-Videos erst nach einem Klick.
|
||||
<?php else: ?>
|
||||
Google Maps und YouTube bleiben blockiert, bis du sie hier freigibst.
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
|
||||
<form method="post" action="/datenschutz/externe-inhalte" class="mb-3">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue