mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Handle OPTIONS requests in Fever
This commit is contained in:
parent
afb95e53b0
commit
8532c581a8
1 changed files with 5 additions and 3 deletions
|
@ -63,8 +63,10 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
}
|
}
|
||||||
switch ($req->getMethod()) {
|
switch ($req->getMethod()) {
|
||||||
case "OPTIONS":
|
case "OPTIONS":
|
||||||
// do stuff
|
return new EmptyResponse(204, [
|
||||||
break;
|
'Allow' => "POST",
|
||||||
|
'Accept' => "application/x-www-form-urlencoded",
|
||||||
|
]);
|
||||||
case "POST":
|
case "POST":
|
||||||
if (strlen($req->getHeaderLine("Content-Type")) && $req->getHeaderLine("Content-Type") !== "application/x-www-form-urlencoded") {
|
if (strlen($req->getHeaderLine("Content-Type")) && $req->getHeaderLine("Content-Type") !== "application/x-www-form-urlencoded") {
|
||||||
return new EmptyResponse(415, ['Accept' => "application/x-www-form-urlencoded"]);
|
return new EmptyResponse(415, ['Accept' => "application/x-www-form-urlencoded"]);
|
||||||
|
@ -297,7 +299,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
}
|
}
|
||||||
// Fever takes the date of the last read article less fifteen seconds as a cut-off.
|
// Fever takes the date of the last read article less fifteen seconds as a cut-off.
|
||||||
// We take the date of last mark (whether it be read, unread, saved, unsaved), which
|
// We take the date of last mark (whether it be read, unread, saved, unsaved), which
|
||||||
// not actually signify a mark, but we'll otherwise also count back fifteen seconds
|
// may not actually signify a mark, but we'll otherwise also count back fifteen seconds
|
||||||
$c = new Context;
|
$c = new Context;
|
||||||
$lastUnread = Date::normalize($lastUnread, "sql");
|
$lastUnread = Date::normalize($lastUnread, "sql");
|
||||||
$since = Date::sub("DT15S", $lastUnread);
|
$since = Date::sub("DT15S", $lastUnread);
|
||||||
|
|
Loading…
Reference in a new issue