This commit is contained in:
developer 2026-01-22 15:27:18 +08:00
commit f8a82ed2c8

31
public/pull.php Normal file
View File

@ -0,0 +1,31 @@
<?php
// комментарий
$key = "developer@zachem.info";
$payload = trim(file_get_contents("php://input"));
$hash = hash_hmac('sha256', $payload, $key, false);
$signature = $_SERVER['HTTP_X_GITEA_SIGNATURE']?? '';
// check payload signature against header signature
if ($hash !== $signature)
{
error_log('FAILED - payload signature mismatch');
exit("wrong signature");
}
$json = json_decode($payload, true);
if (json_last_error() !== JSON_ERROR_NONE)
{
error_log('FAILED - json decode - '. json_last_error());
exit(json_last_error());
}
if($json['total_commits'] > 0)
{
$result = shell_exec("cd /var/www/lk && git reset --hard HEAD && git pull");
echo "<p>$result</p>";
}