1 Star 0 Fork 117

youcanyin/course-tencent-cloud-docker

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webhooks.php.sample 813 Bytes
一键复制 编辑 原始数据 按行查看 历史
酷瓜云课堂 提交于 2021-02-14 21:59 . 修正路径
<?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 助手
尝试更多
代码解读
代码找茬
代码优化
Docker
1
https://gitee.com/youcanyin/course-tencent-cloud-docker.git
git@gitee.com:youcanyin/course-tencent-cloud-docker.git
youcanyin
course-tencent-cloud-docker
course-tencent-cloud-docker
master

搜索帮助