mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-05 13:47:25 +02:00
Use the official JSON MIME type of 'application/json'.
This commit is contained in:
parent
2095052521
commit
34c7e11d84
@ -31,7 +31,7 @@
|
||||
|
||||
if (!empty($_SESSION["uid"])) {
|
||||
if (!Sessions::validate_session()) {
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
|
||||
print json_encode([
|
||||
"seq" => -1,
|
||||
|
16
backend.php
16
backend.php
@ -35,7 +35,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
header("Content-Type: text/json; charset=utf-8");
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
|
||||
if (Config::get(Config::SINGLE_USER_MODE)) {
|
||||
UserHelper::authenticate("admin", null);
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
if (!empty($_SESSION["uid"])) {
|
||||
if (!Sessions::validate_session()) {
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
|
||||
return;
|
||||
@ -113,7 +113,7 @@
|
||||
|
||||
if (str_starts_with($method, "_")) {
|
||||
user_error("Refusing to invoke method $method of handler $op which starts with underscore.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
|
||||
return;
|
||||
@ -142,7 +142,7 @@
|
||||
$handler->$method();
|
||||
} else {
|
||||
user_error("Refusing to invoke method $method of handler $op which has required parameters.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
}
|
||||
@ -150,7 +150,7 @@
|
||||
if (method_exists($handler, "catchall")) {
|
||||
$handler->catchall($method);
|
||||
} else {
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
|
||||
print Errors::to_json(Errors::E_UNKNOWN_METHOD, ["info" => get_class($handler) . "->$method"]);
|
||||
}
|
||||
@ -159,14 +159,14 @@
|
||||
$handler->after();
|
||||
return;
|
||||
} else {
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
user_error("Refusing to invoke method $method of handler $op with invalid CSRF token.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
|
||||
return;
|
||||
@ -174,6 +174,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNKNOWN_METHOD, [ "info" => (isset($handler) ? get_class($handler) : "UNKNOWN:".$op) . "->$method"]);
|
||||
|
||||
|
@ -30,7 +30,7 @@ class API extends Handler {
|
||||
|
||||
function before(string $method): bool {
|
||||
if (parent::before($method)) {
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
|
||||
if (empty($_SESSION["uid"]) && $method != "login" && $method != "isloggedin") {
|
||||
$this->_wrap(self::STATUS_ERR, array("error" => self::E_NOT_LOGGED_IN));
|
||||
|
@ -248,7 +248,7 @@ class Handler_Public extends Handler {
|
||||
array_push($feed['articles'], $article);
|
||||
}
|
||||
|
||||
header("Content-Type: text/json; charset=utf-8");
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
print json_encode($feed);
|
||||
|
||||
} else {
|
||||
@ -320,7 +320,7 @@ class Handler_Public extends Handler {
|
||||
|
||||
header("Location: " . $redirect_url);
|
||||
} else {
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
@ -806,17 +806,17 @@ class Handler_Public extends Handler {
|
||||
$plugin->$method();
|
||||
} else {
|
||||
user_error("PluginHandler[PUBLIC]: Requested private method '$method' of plugin '$plugin_name'.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
}
|
||||
} else {
|
||||
user_error("PluginHandler[PUBLIC]: Requested unknown method '$method' of plugin '$plugin_name'.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNKNOWN_METHOD);
|
||||
}
|
||||
} else {
|
||||
user_error("PluginHandler[PUBLIC]: Requested method '$method' of unknown plugin '$plugin_name'.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNKNOWN_PLUGIN, ['plugin' => $plugin_name]);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
if (str_starts_with($method, "_")) {
|
||||
user_error("Refusing to invoke method $method which starts with underscore.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
|
||||
return;
|
||||
@ -49,7 +49,7 @@
|
||||
$handler->$method();
|
||||
} else {
|
||||
user_error("Refusing to invoke method $method which has required parameters.", E_USER_WARNING);
|
||||
header("Content-Type: text/json");
|
||||
header("Content-Type: application/json");
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user