2023-11-20 14:45:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require '../../includes/csrf.php';
|
2025-01-21 04:59:57 -08:00
|
|
|
require_once '../../includes/session.php';
|
2024-03-11 18:52:34 +01:00
|
|
|
require_once '../../includes/config.php';
|
|
|
|
require_once '../../src/RaspAP/Auth/HTTPAuth.php';
|
|
|
|
require_once '../../includes/authenticate.php';
|
2023-11-20 14:45:55 +00:00
|
|
|
|
|
|
|
if (isset($_POST['csrf_token'])) {
|
|
|
|
if (csrfValidateRequest() && !CSRFValidate()) {
|
|
|
|
handleInvalidCSRFToken();
|
|
|
|
}
|
|
|
|
// set installer path + options
|
|
|
|
$path = getenv("DOCUMENT_ROOT");
|
2023-11-24 07:49:52 +00:00
|
|
|
$opts = " --update --yes --path $path";
|
|
|
|
$installer = "sudo /etc/raspap/system/raspbian.sh";
|
2023-11-20 14:45:55 +00:00
|
|
|
$execUpdate = $installer.$opts;
|
2023-11-23 08:45:40 +00:00
|
|
|
|
|
|
|
$response = shell_exec($execUpdate);
|
|
|
|
echo json_encode($response);
|
2023-11-20 14:45:55 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
handleInvalidCSRFToken();
|
|
|
|
}
|