1 Star 0 Fork 1

EdwinHui/ve

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
webhooks.php.sample 813 Bytes
Copy Edit Raw Blame History
EdwinHui authored 2021-06-10 23:52 . VE 立项
<?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;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/edwinhuish/ve.git
git@gitee.com:edwinhuish/ve.git
edwinhuish
ve
ve
master

Search