Files
html/api/ambre-pdf-patch.php
opus a632ef9b6e
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
auto-sync-0220
2026-04-22 02:20:02 +02:00

22 lines
1.3 KiB
PHP

<?php
header("Content-Type: application/json");
$path = "/var/www/html/api/ambre-tool-pdf-premium.php";
$content = file_get_contents($path);
$old = 'if (file_exists("/usr/bin/chromium-browser") || file_exists("/usr/bin/chromium") || file_exists("/usr/bin/google-chrome")) {
$bin = file_exists("/usr/bin/chromium-browser") ? "/usr/bin/chromium-browser" : (file_exists("/usr/bin/chromium") ? "/usr/bin/chromium" : "/usr/bin/google-chrome");';
// Prefer google-chrome (real chrome), skip chromium-browser stub
$new = 'if (file_exists("/usr/bin/google-chrome") || file_exists("/usr/bin/chromium") || file_exists("/usr/bin/chromium-browser")) {
// Prefer real chrome over stub chromium-browser snap
$bin = file_exists("/usr/bin/google-chrome") ? "/usr/bin/google-chrome" : (file_exists("/usr/bin/chromium") ? "/usr/bin/chromium" : "/usr/bin/chromium-browser");';
if (strpos($content, $old) === false) {
echo json_encode(["error"=>"pattern not found"]); exit;
}
$new_content = str_replace($old, $new, $content);
$backup = "/opt/wevads/vault/pdf-premium.GOLD-" . date("Ymd-His");
@copy($path, $backup);
$wrote = @file_put_contents($path, $new_content);
echo json_encode(["delta" => strlen($new_content)-strlen($content), "wrote"=>$wrote, "backup"=>basename($backup)]);