добавил api авторизацию

This commit is contained in:
kirillius 2025-01-10 02:47:20 +03:00
parent 7080f92d9f
commit f5325b5852
1 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,12 @@ class API extends Plugin
$this->config["key"] = sha1(rand() . uniqid());
$this->context->getConfig()->save();
}
$headers = getallheaders();
if ($headers and isset($headers["X-Auth"]) and $headers["X-Auth"] == md5($this->config["key"])) {
$_SESSION["auth"] = true;
}
}
public function getKey(): string