aboutsummaryrefslogtreecommitdiff
path: root/p/api/greader.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-01-03 18:13:11 +0100
committerGravatar GitHub <noreply@github.com> 2021-01-03 18:13:11 +0100
commit0567e3894745f541cef2acd7a85486c0f2e40656 (patch)
treedc8050601a4a345cb158e681122fe250ef3fd0c2 /p/api/greader.php
parent75440c6765fadb81ea8d1f0fbb37496eaa4c4e9b (diff)
API more BazQux compatibility (#3320)
Implement compatibility fix, to allow the streamID / inclusion criteria to be given as `&s=` parameter instead of in the URL path. https://github.com/bazqux/bazqux-api#fetching-streams This form of request is apparently sometimes used by FeedMe: ``` /api/greader.php/reader/api/0/stream/contents?output=json&n=100&xt=user%2F-%2Fstate%2Fcom.google%2Fread&ot=0&s=user%2F-%2Flabel%2FBlogs ```
Diffstat (limited to 'p/api/greader.php')
-rw-r--r--p/api/greader.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/p/api/greader.php b/p/api/greader.php
index ad7a322bd..f93540285 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -979,8 +979,15 @@ if ($pathInfos[1] === 'accounts') {
if (!ctype_digit($continuation)) {
$continuation = '';
}
- if (isset($pathInfos[5]) && $pathInfos[5] === 'contents' && isset($pathInfos[6])) {
- if (isset($pathInfos[7])) {
+ if (isset($pathInfos[5]) && $pathInfos[5] === 'contents') {
+ if (!isset($pathInfos[6]) && isset($_GET['s'])) {
+ // Compatibility BazQux API https://github.com/bazqux/bazqux-api#fetching-streams
+ $streamIdInfos = explode('/', $_GET['s']);
+ foreach ($streamIdInfos as $streamIdInfo) {
+ $pathInfos[] = $streamIdInfo;
+ }
+ }
+ if (isset($pathInfos[6]) && isset($pathInfos[7])) {
if ($pathInfos[6] === 'feed') {
$include_target = $pathInfos[7];
if ($include_target != '' && !ctype_digit($include_target)) {
@@ -1005,7 +1012,7 @@ if ($pathInfos[1] === 'accounts') {
streamContents($pathInfos[8], $include_target, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation);
}
}
- } else { //EasyRSS
+ } else { //EasyRSS, FeedMe
$include_target = '';
streamContents('reading-list', $include_target, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation);
}