Merge pull request #2329 from int2001/api_debug

Added 401 in case of missing key to api/radio for easier debugging
这个提交包含在:
Peter Goodhall 2023-07-26 13:35:05 +01:00 提交者 GitHub
当前提交 701404c820
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23

查看文件

@ -635,8 +635,9 @@ class API extends CI_Controller {
$obj = json_decode(file_get_contents("php://input"), true);
if(!isset($obj['key']) || $this->api_model->authorize($obj['key']) == 0) {
echo json_encode(['status' => 'failed', 'reason' => "missing api key"]);
die();
http_response_code(401);
echo json_encode(['status' => 'failed', 'reason' => "missing api key"]);
die();
}
$this->api_model->update_last_used($obj['key']);