mirror of https://github.com/ThunixdotNet/www.git
Fixed up config.pgp, re-added files that will need to exist still
This commit is contained in:
parent
a777ea330a
commit
a500b3449a
|
@ -3,10 +3,10 @@
|
||||||
$site_name="☣ thunix ☣";
|
$site_name="☣ thunix ☣";
|
||||||
|
|
||||||
//Root for the site, in a browser
|
//Root for the site, in a browser
|
||||||
$site_root="https://thunix.net/~ubergeek/thunix_site";
|
$site_root="https://dev.thunix.cf";
|
||||||
|
|
||||||
//Local base root for app files
|
//Local base root for app files
|
||||||
$doc_root="/home/ubergeek/public_html/thunix_site";
|
$doc_root="/var/www/dev.thunix.cf";
|
||||||
|
|
||||||
//Site style
|
//Site style
|
||||||
// site is the default. Specify something else here to switch
|
// site is the default. Specify something else here to switch
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* gitea deploy webhook */
|
||||||
|
|
||||||
|
/* security */
|
||||||
|
$access_token = '1234567890';
|
||||||
|
$ansible_lastrun = '/dev/shm/ansible-hook-last-run';
|
||||||
|
$ansible_dropfile = '/dev/shm/run-ansible';
|
||||||
|
$www_lastrun = '/dev/shm/www-hook-last-run';
|
||||||
|
$www_dropfile = '/dev/shm/run-www';
|
||||||
|
$remoteip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
$allowedip = '195.201.242.48';
|
||||||
|
$ratelimit = 300;
|
||||||
|
|
||||||
|
/* get json data */
|
||||||
|
$json = file_get_contents('php://input');
|
||||||
|
$data = json_decode($json, true);
|
||||||
|
|
||||||
|
$client_token = $data["secret"];
|
||||||
|
if ($client_token !== $access_token)
|
||||||
|
{
|
||||||
|
http_response_code(403);
|
||||||
|
echo "HTTP 403 - Forbidden.";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($remoteip !== $allowedip)
|
||||||
|
{
|
||||||
|
http_repsonse_code(403);
|
||||||
|
echo "HTTP 403 - Forbidden.";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//* if you need get full json input */
|
||||||
|
//fwrite($fs, 'DATA: '.print_r($data, true).PHP_EOL);
|
||||||
|
|
||||||
|
if ($data["repository"]["full_name"] == 'thunix/ansible') {
|
||||||
|
syslog(LOG_INFO, 'Ansible Webhook recieved.');
|
||||||
|
if ( time () - filemtime ( $ansible_lastrun ) > $ratelimit ) {
|
||||||
|
touch ( $ansible_dropfile );
|
||||||
|
touch ( $ansible_lastrun );
|
||||||
|
echo "HTTP 200 - Ansible webhook recieved.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
http_response_code(429);
|
||||||
|
echo "HTTP 429 - Rate Limited.";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($data["repository"]["full_name"] == 'thunix/www') {
|
||||||
|
syslog(LOG_INFO, 'WWW Webhook recieved.');
|
||||||
|
if ( time () - filemtime ( $lastrun ) > $ratelimit ) {
|
||||||
|
touch ( $www_dropfile );
|
||||||
|
touch ( $www_lastrun );
|
||||||
|
http_response_code(200);
|
||||||
|
echo "HTTP 200 - WWW webhook recieved.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
http_response_code(429);
|
||||||
|
echo "HTTP 429 - Rate Limited.";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
http_response_code(418);
|
||||||
|
echo "HTTP 418 - I'm a teapot.";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
http_response_code(418);
|
||||||
|
echo "HTTP 418 - I'm a teapot.";
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue