44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$path = "/var/www/html/wtp-unified-dock.js";
|
|
$c = @file_get_contents($path);
|
|
$orig = strlen($c);
|
|
|
|
// Add wevia-widget.html + all chatbot public pages to PUBLIC_PATHS
|
|
$old = "var _AMBRE_PUBLIC_PATHS = ['/wevia.html', '/wevia', '/', '/index.html', '/consent.html', '/mirofish.html'];";
|
|
$new = "var _AMBRE_PUBLIC_PATHS = ['/wevia.html', '/wevia', '/', '/index.html', '/consent.html', '/mirofish.html', '/wevia-widget.html', '/wevia-widget', '/register.html', '/register', '/login', '/login.html'];";
|
|
|
|
if (strpos($c, $old) === false) {
|
|
echo json_encode(["error"=>"PUBLIC_PATHS pattern not found"]);
|
|
exit;
|
|
}
|
|
|
|
// Also add iframe detection → if we are in an iframe on a public parent → skip dock
|
|
$ext1 = " // === END AMBRE-V1-PUBLIC-GUARD ===";
|
|
$ext2 = " // === END AMBRE-V1-PUBLIC-GUARD ===
|
|
|
|
// === AMBRE-V2-IFRAME-GUARD 2026-04-22 · skip dock if embedded in iframe (public widget context) ===
|
|
try {
|
|
if (window.self !== window.top) {
|
|
// Running inside iframe - public widget context - DO NOT render dock
|
|
return;
|
|
}
|
|
} catch(e) {
|
|
// Cross-origin access error means we ARE in iframe - skip
|
|
return;
|
|
}
|
|
// === END AMBRE-V2-IFRAME-GUARD ===";
|
|
|
|
$c = str_replace($old, $new, $c);
|
|
$c = str_replace($ext1, $ext2, $c);
|
|
|
|
$backup = "/opt/wevads/vault/wtp-unified-dock.GOLD-" . date("Ymd-His") . "-wave262-widget-guard";
|
|
@copy($path, $backup);
|
|
$wrote = @file_put_contents($path, $c);
|
|
|
|
echo json_encode([
|
|
"delta" => strlen($c) - $orig,
|
|
"wrote" => $wrote,
|
|
"backup" => basename($backup),
|
|
]);
|