Fetch the repository succeeded.
<?php
$baseDir = '/root/ctc-docker';
$secret = '1qaz2wsx3edc';
$branch = 'master';
$requestBody = file_get_contents('php://input');
if (empty($requestBody)) {
header('HTTP/1.1 400 Bad Request');
die('Bad Request');
}
$payload = json_decode($requestBody, true);
if (!isset($payload['timestamp']) || !isset($payload['sign'])) {
header('HTTP/1.1 400 Bad Request');
die('Invalid Payload');
}
$content = "{$payload['timestamp']}\n{$secret}";
$mySign = base64_encode(hash_hmac('sha256', $content, $secret, true));
if ($payload['sign'] != $mySign) {
header('HTTP/1.1 403 Permission Denied');
die('Permission Denied');
}
if ($payload['ref'] == "refs/heads/{$branch}" && $payload['total_commits_count'] > 0) {
$result = shell_exec("bash {$baseDir}/upgrade.sh");
echo $result;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。