pre release v2

This commit is contained in:
mercury
2023-01-20 00:50:25 +04:00
parent cde037537f
commit 75fb0bbc6c
34 changed files with 2360 additions and 326 deletions
+30 -8
View File
@@ -1,14 +1,36 @@
<?php
// require __DIR__ . '/debug.php';
require __DIR__ . '/bot.php';
require __DIR__ . '/config.php';
date_default_timezone_set(getenv('TZ'));
$url = trim($_SERVER['REQUEST_URI'], '/');
if (!('POST' == $_SERVER['REQUEST_METHOD'] && $url == $key)) {
header('500', true, 500);
// bot
require __DIR__ . '/config.php';
if ('POST' == $_SERVER['REQUEST_METHOD'] && $_GET['k'] == $key) {
// require __DIR__ . '/debug.php';
require __DIR__ . '/bot.php';
$bot = new Bot($key);
$bot->input();
die();
}
$bot = new Bot($key);
$bot->input();
// pac
$type = $_GET['t'] ?? 'pac';
$address = $_GET['a'] ?: '127.0.0.1';
$port = $_GET['p'] ?: '1080';
$hash = $_GET['h'];
if ($hash == substr(md5($key), 0, 8)) {
if (file_exists($file = __DIR__ . "/zapretlists/$type")) {
$pac = file_get_contents($file);
header("Content-Type: text/plain");
echo str_replace([
'~address~',
'~port~',
], [
$address,
$port
], $pac);
die();
}
}
header('500', true, 500);
die();