A free, self-hostable news aggregator…
API subscription/quickadd
Alexandre Alapetitee1528845d882
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2c8dbec9b..a1fe033bc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,7 +3,7 @@## 2016-XX-XX FreshRSS 1.6.0-dev* API- * Support for editing feeds and categories from client applications [#1261](https://github.com/FreshRSS/FreshRSS/pull/1261)+ * Support for editing feeds and categories from client applications [#1254](https://github.com/FreshRSS/FreshRSS/issues/1254)* Features* Better control of number of entries per page or RSS feed [#1249](https://github.com/FreshRSS/FreshRSS/issues/1249)* Since X hours: `https://freshrss.example/i/?a=rss&hours=3`diff --git a/p/api/greader.php b/p/api/greader.phpindex e77ef3726..e2d7dc039 100644--- a/p/api/greader.php+++ b/p/api/greader.php@@ -361,6 +361,23 @@ function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = 'exit('OK');}+function quickadd($url) {+ //logMe("quickadd($url)");+ try {+ $feed = FreshRSS_feed_Controller::addFeed($url);+ exit(json_encode(array(+ 'numResults' => 1,+ 'streamId' => $feed->id(),+ )));+ } catch (Exception $e) {+ logMe("subscriptionEdit error subscribe: " . $e->getMessage());+ die(json_encode(array(+ 'numResults' => 0,+ 'error' => $e->getMessage(),+ )));+ }+}+function unreadCount() { //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count//logMe("unreadCount()");header('Content-Type: application/json; charset=UTF-8');@@ -531,7 +548,7 @@ function streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude$id = basename($streamId);} elseif (strpos($streamId, 'user/-/label/') === 0) {$type = 'c';- $c_name = basename($streamId);+ $c_name = substr($streamId, 13);$categoryDAO = new FreshRSS_CategoryDAO();$cat = $categoryDAO->searchByName($c_name);$id = $cat == null ? -1 : $cat->id();@@ -638,7 +655,7 @@ function markAllAsRead($streamId, $olderThanId) {$f_id = basename($streamId);$entryDAO->markReadFeed($f_id, $olderThanId);} elseif (strpos($streamId, 'user/-/label/') === 0) {- $c_name = basename($streamId);+ $c_name = substr($streamId, 13);$categoryDAO = new FreshRSS_CategoryDAO();$cat = $categoryDAO->searchByName($c_name);$entryDAO->markReadCat($cat === null ? -1 : $cat->id(), $olderThanId);@@ -749,6 +766,11 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfosubscriptionEdit($streamNames, $titles, $action, $add, $remove);}break;+ case 'quickadd': //https://github.com/theoldreader/api+ if (isset($_GET['quickadd'])) {+ quickadd($_GET['quickadd']);+ }+ break;}}break;