From a31b86ace3a68880461cc90b746cee395c023702 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 4 Sep 2016 16:54:43 +0200 Subject: Remove Persona folder https://github.com/FreshRSS/FreshRSS/issues/1219#issuecomment-244603417 --- data/persona/.gitignore | 1 - data/persona/index.html | 13 ------------- 2 files changed, 14 deletions(-) delete mode 100644 data/persona/.gitignore delete mode 100644 data/persona/index.html (limited to 'data') diff --git a/data/persona/.gitignore b/data/persona/.gitignore deleted file mode 100644 index 314f02b1b..000000000 --- a/data/persona/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.txt \ No newline at end of file diff --git a/data/persona/index.html b/data/persona/index.html deleted file mode 100644 index 85faaa37e..000000000 --- a/data/persona/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - -Redirection - - - - -

Redirection

- - -- cgit v1.2.3 From 2a5aa34ad2796df00fa09de41361c20764ccdfa8 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 11 Sep 2016 15:06:33 +0200 Subject: Better control of number of entries per page or RSS feed https://github.com/FreshRSS/FreshRSS/issues/1249 * Since X hours: `https://freshrss.example/i/?a=rss&hours=3` * Explicit number: `https://freshrss.example/i/?a=rss&nb=10` * Limited by `min_posts_per_rss` and `max_posts_per_rss` in user config --- CHANGELOG.md | 4 ++++ app/Controllers/indexController.php | 39 +++++++++++++++++++++++++++++++------ app/Models/Context.php | 1 + app/layout/layout.phtml | 3 +++ app/layout/nav_menu.phtml | 3 +++ app/views/auth/index.phtml | 2 +- data/users/_/config.default.php | 3 +++ 7 files changed, 48 insertions(+), 7 deletions(-) (limited to 'data') diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c46bdb6..f82f68fff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ ## 2016-XX-XX FreshRSS 1.6.0-dev * 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` + * Explicit number: `https://freshrss.example/i/?a=rss&nb=10` + * Limited by `min_posts_per_rss` and `max_posts_per_rss` in user config * Support custom ports `localhost:3306` for database servers [#1241](https://github.com/FreshRSS/FreshRSS/issues/1241) * Security * Prevent `` attacks with `window.opener` [#1245](https://github.com/FreshRSS/FreshRSS/issues/1245) diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 2332d225d..4e2717920 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -34,7 +34,9 @@ class FreshRSS_index_Controller extends Minz_ActionController { $this->view->callbackBeforeContent = function($view) { try { + FreshRSS_Context::$number++; //+1 for pagination $entries = FreshRSS_index_Controller::listEntriesByContext(); + FreshRSS_Context::$number--; $nb_entries = count($entries); if ($nb_entries > FreshRSS_Context::$number) { @@ -154,6 +156,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { * - order (default: conf->sort_order) * - nb (default: conf->posts_per_page) * - next (default: empty string) + * - hours (default: 0) */ private function updateContext() { // Update number of read / unread variables. @@ -180,10 +183,14 @@ class FreshRSS_index_Controller extends Minz_ActionController { FreshRSS_Context::$order = Minz_Request::param( 'order', FreshRSS_Context::$user_conf->sort_order ); - FreshRSS_Context::$number = Minz_Request::param( - 'nb', FreshRSS_Context::$user_conf->posts_per_page - ); + FreshRSS_Context::$number = intval(Minz_Request::param('nb', FreshRSS_Context::$user_conf->posts_per_page)); + if (FreshRSS_Context::$number > FreshRSS_Context::$user_conf->max_posts_per_rss) { + FreshRSS_Context::$number = max( + FreshRSS_Context::$user_conf->max_posts_per_rss, + FreshRSS_Context::$user_conf->posts_per_page); + } FreshRSS_Context::$first_id = Minz_Request::param('next', ''); + FreshRSS_Context::$sinceHours = intval(Minz_Request::param('hours', 0)); } /** @@ -201,11 +208,31 @@ class FreshRSS_index_Controller extends Minz_ActionController { $id = ''; } - return $entryDAO->listWhere( + $limit = FreshRSS_Context::$number; + + $date_min = 0; + if (FreshRSS_Context::$sinceHours) { + $date_min = time() - (FreshRSS_Context::$sinceHours * 3600); + $limit = FreshRSS_Context::$user_conf->max_posts_per_rss; + } + + $entries = $entryDAO->listWhere( $type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order, - FreshRSS_Context::$number + 1, FreshRSS_Context::$first_id, - FreshRSS_Context::$search + $limit, FreshRSS_Context::$first_id, + FreshRSS_Context::$search, $date_min ); + + if (FreshRSS_Context::$sinceHours && (count($entries) < FreshRSS_Context::$user_conf->min_posts_per_rss)) { + $date_min = 0; + $limit = FreshRSS_Context::$user_conf->min_posts_per_rss; + $entries = $entryDAO->listWhere( + $type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order, + $limit, FreshRSS_Context::$first_id, + FreshRSS_Context::$search, $date_min + ); + } + + return $entries; } /** diff --git a/app/Models/Context.php b/app/Models/Context.php index 2a58bd4ba..33e65a619 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -35,6 +35,7 @@ class FreshRSS_Context { public static $first_id = ''; public static $next_id = ''; public static $id_max = ''; + public static $sinceHours = 0; /** * Initialize the context. diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index 4d9ad5458..1f11e0af1 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -42,6 +42,9 @@ } if (isset($this->rss_title)) { $url_rss = $url_base; $url_rss['a'] = 'rss'; + if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) { + $url_rss['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss; + } ?> allow_robots) { ?> diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index d77c1abf9..c02232242 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -151,6 +151,9 @@ if (FreshRSS_Context::$user_conf->token) { $url_output['params']['token'] = FreshRSS_Context::$user_conf->token; } + if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) { + $url_output['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss; + } ?> diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml index 74e692ec5..7195bab5d 100644 --- a/app/views/auth/index.phtml +++ b/app/views/auth/index.phtml @@ -60,7 +60,7 @@ data-leave-validation=""/> - array('output' => 'rss', 'token' => $token)), 'html', true); ?> + array('output' => 'rss', 'token' => $token, 'hours' => FreshRSS_Context::$user_conf->since_hours_posts_per_rss)), 'html', true); ?> diff --git a/data/users/_/config.default.php b/data/users/_/config.default.php index 4a3403453..2c56d5f45 100644 --- a/data/users/_/config.default.php +++ b/data/users/_/config.default.php @@ -9,6 +9,9 @@ return array ( 'passwordHash' => '', 'apiPasswordHash' => '', 'posts_per_page' => 20, + 'since_hours_posts_per_rss' => 168, + 'min_posts_per_rss' => 2, + 'max_posts_per_rss' => 400, 'view_mode' => 'normal', 'default_view' => 'adaptive', 'default_state' => FreshRSS_Entry::STATE_NOT_READ, -- cgit v1.2.3 From 9291748c4745ff8f4be2beaa2998869fd26e907e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 26 Sep 2016 10:44:44 +0200 Subject: API implement user-info and fix edits https://github.com/FreshRSS/FreshRSS/issues/1254 https://github.com/jangernert/FeedReader/issues/59#issuecomment-249491580 --- app/Controllers/feedController.php | 20 +++++++++++----- app/Models/CategoryDAO.php | 3 +++ data/users/_/config.default.php | 1 + p/api/greader.php | 47 ++++++++++++++++++++++++++++++-------- 4 files changed, 55 insertions(+), 16 deletions(-) (limited to 'data') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index faf670e6e..ca7a818c6 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -473,17 +473,25 @@ class FreshRSS_feed_Controller extends Minz_ActionController { return $feedDAO->updateFeed($feed_id, array('name' => $feed_name)); } - public static function moveFeed($feed_id, $cat_id) { + public static function moveFeed($feed_id, $cat_id, $new_cat_name = '') { if ($feed_id <= 0) { return false; } - if ($cat_id <= 0) { - // If category was not given get the default one. - $catDAO = new FreshRSS_CategoryDAO(); + + $catDAO = new FreshRSS_CategoryDAO(); + if ($cat_id > 0) { + $cat = $catDAO->searchById($cat_id); + $cat_id = $cat == null ? 0 : $cat->id(); + } + if ($cat_id <= 1 && $new_cat_name != '') { + $cat_id = $catDAO->addCategory(array('name' => $new_cat_name)); + } + if ($cat_id <= 1) { $catDAO->checkDefault(); - $def_cat = $catDAO->getDefault(); - $cat_id = $def_cat->id(); + $cat = $catDAO->getDefault(); + $cat_id = $cat->id(); } + $feedDAO = FreshRSS_Factory::createFeedDao(); return $feedDAO->updateFeed($feed_id, array('category' => $cat_id)); } diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index fc431553e..c103163a1 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -50,6 +50,9 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable } public function deleteCategory($id) { + if ($id <= 1) { + return false; + } $sql = 'DELETE FROM `' . $this->prefix . 'category` WHERE id=?'; $stm = $this->bd->prepare($sql); diff --git a/data/users/_/config.default.php b/data/users/_/config.default.php index 2c56d5f45..6e1d497bc 100644 --- a/data/users/_/config.default.php +++ b/data/users/_/config.default.php @@ -5,6 +5,7 @@ return array ( 'old_entries' => 3, 'keep_history_default' => 0, 'ttl_default' => 3600, + 'mail_login' => '', 'token' => '', 'passwordHash' => '', 'apiPasswordHash' => '', diff --git a/p/api/greader.php b/p/api/greader.php index e2d7dc039..8b1e0ffb1 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -222,6 +222,17 @@ function checkToken($conf, $token) { unauthorized(); } +function userInfo() { //https://github.com/theoldreader/api#user-info + //logMe("userInfo()"); + $user = Minz_Session::param('currentUser', '_'); + exit(json_encode(array( + 'userId' => $user, + 'userName' => $user, + 'userProfileId' => $user, + 'userEmail' => FreshRSS_Context::$user_conf->mail_login, + ))); +} + function tagList() { //logMe("tagList()"); header('Content-Type: application/json; charset=UTF-8'); @@ -299,14 +310,24 @@ function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = ' $categoryDAO = new FreshRSS_CategoryDAO(); } $c_name = ''; - if ($add != '' && strpos($add, 'user/-/label/') === 0) { //user/-/label/Example - $c_name = substr($add, 13); + if ($add != '' && strpos($add, 'user/') === 0) { //user/-/label/Example ; user/username/label/Example + if (strpos($add, 'user/-/label/') === 0) { + $c_name = substr($add, 13); + } else { + $user = Minz_Session::param('currentUser', '_'); + $prefix = 'user/' . $user . '/label/'; + if (strpos($add, $prefix) === 0) { + $c_name = substr($add, strlen($prefix)); + } else { + $c_name = ''; + } + } $cat = $categoryDAO->searchByName($c_name); $addCatId = $cat == null ? -1 : $cat->id(); } else if ($remove != '' && strpos($remove, 'user/-/label/')) { $addCatId = 1; //Default category } - if ($addCatId <= 0 && $c_name = '') { + if ($addCatId <= 0 && $c_name == '') { $addCatId = 1; //Default category } $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -345,9 +366,7 @@ function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = ' break; case 'edit': if ($feedId > 0) { - if ($addCatId > 0) { - FreshRSS_feed_Controller::moveFeed($feedId, $addCatId); - } + FreshRSS_feed_Controller::moveFeed($feedId, $addCatId, $c_name); if ($title != '') { FreshRSS_feed_Controller::renameFeed($feedId, $title); } @@ -633,8 +652,8 @@ function renameTag($s, $dest) { badRequest(); } -function disableTag($s, $dest) { - //logMe("renameTag()"); +function disableTag($s) { + //logMe("disableTag($s)"); if ($s != '' && strpos($s, 'user/-/label/') === 0) { $s = substr($s, 13); $categoryDAO = new FreshRSS_CategoryDAO(); @@ -642,6 +661,9 @@ function disableTag($s, $dest) { if ($cat != null) { $feedDAO = FreshRSS_Factory::createFeedDao(); $feedDAO->changeCategory($cat->id(), 0); + if ($cat->id() > 1) { + $categoryDAO->deleteCategory($cat->id()); + } exit('OK'); } } @@ -798,8 +820,10 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo case 'disable-tag': //https://github.com/theoldreader/api $token = isset($_POST['T']) ? trim($_POST['T']) : ''; checkToken(FreshRSS_Context::$user_conf, $token); - $s = isset($_POST['s']) ? $_POST['s'] : ''; //user/-/label/Folder - disableTag($s); + $s_s = multiplePosts('s'); + foreach ($s_s as $s) { + disableTag($s); //user/-/label/Folder + } break; case 'mark-all-as-read': $token = isset($_POST['T']) ? trim($_POST['T']) : ''; @@ -814,6 +838,9 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo case 'token': token(FreshRSS_Context::$user_conf); break; + case 'user-info': + userInfo(); + break; } } elseif ($pathInfos[1] === 'check' && $pathInfos[2] === 'compatibility') { checkCompatibility(); -- cgit v1.2.3 From 44a57ba12db39439f6cc43fe7542efd92cf402bb Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 30 Sep 2016 23:30:16 +0200 Subject: Change default value for keep history Larger value by default, for limiting the risk of re-adding an article previously purged, e.g. with feeds which do not have good dates, which do not update so often, and for which the list of articles is not so stable. --- data/users/_/config.default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data') diff --git a/data/users/_/config.default.php b/data/users/_/config.default.php index 6e1d497bc..280b13422 100644 --- a/data/users/_/config.default.php +++ b/data/users/_/config.default.php @@ -3,7 +3,7 @@ return array ( 'language' => 'en', 'old_entries' => 3, - 'keep_history_default' => 0, + 'keep_history_default' => 50, 'ttl_default' => 3600, 'mail_login' => '', 'token' => '', -- cgit v1.2.3 From 79696f31adde2a3e0a224294104b19ccc77565cc Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 7 Oct 2016 22:54:23 +0200 Subject: Meta description option https://github.com/FreshRSS/FreshRSS/issues/1105 --- app/Models/Context.php | 2 ++ data/config.default.php | 3 +++ 2 files changed, 5 insertions(+) (limited to 'data') diff --git a/app/Models/Context.php b/app/Models/Context.php index 33e65a619..a38b1e0f1 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -144,11 +144,13 @@ class FreshRSS_Context { case 'a': self::$current_get['all'] = true; self::$name = _t('index.feed.title'); + self::$description = self::$system_conf->meta_description; self::$get_unread = self::$total_unread; break; case 's': self::$current_get['starred'] = true; self::$name = _t('index.feed.title_fav'); + self::$description = self::$system_conf->meta_description; self::$get_unread = self::$total_starred['unread']; // Update state if favorite is not yet enabled. diff --git a/data/config.default.php b/data/config.default.php index af1482d03..d3cd3bf22 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -27,6 +27,9 @@ return array( # Title of this FreshRSS instance in the Web user interface. 'title' => 'FreshRSS', + # Meta description used when `allow_robots` is true. + 'meta_description' => '', + # Name of the user that has administration rights. 'default_user' => '_', -- cgit v1.2.3 From 6ebbaaa7fabeedaa2d668d2274ee323d77cc0de9 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Oct 2016 23:24:02 +0200 Subject: Update gitignore rules --- data/.gitignore | 10 +++------- data/PubSubHubbub/feeds/.gitignore | 3 ++- data/users/.gitignore | 9 +++++---- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'data') diff --git a/data/.gitignore b/data/.gitignore index c2ed350a6..76314fc12 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,10 +1,6 @@ -application.ini config.php -*.sqlite -touch.txt -no-cache.txt -*.bak.php -*.lock.txt +config.php.bak.php +force-https.txt last_update.txt +no-cache.txt update.php -force-https.txt diff --git a/data/PubSubHubbub/feeds/.gitignore b/data/PubSubHubbub/feeds/.gitignore index 150f68c80..16b0ae4bc 100644 --- a/data/PubSubHubbub/feeds/.gitignore +++ b/data/PubSubHubbub/feeds/.gitignore @@ -1 +1,2 @@ -*/* +*/*.json +*/*.txt diff --git a/data/users/.gitignore b/data/users/.gitignore index a8b7cd60f..3705c06b7 100644 --- a/data/users/.gitignore +++ b/data/users/.gitignore @@ -1,4 +1,5 @@ -db.sqlite -config.php -log*.txt - +*/ +*/config.php +*/db.sqlite +!_/ +*/log*.txt -- cgit v1.2.3 From 3366945a90b58929cc3b9e980ce9a52027151556 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 14 Oct 2016 17:49:33 +0200 Subject: Default option mark as read during scroll --- CHANGELOG.md | 1 + data/users/_/config.default.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/CHANGELOG.md b/CHANGELOG.md index 3178e6ae7..a21e4a093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Experimental support for PostgreSQL [#1195](https://github.com/FreshRSS/FreshRSS/pull/1195) * New client supporting FreshRSS on Linux: FeedReader 2.0+ [#1252](https://github.com/FreshRSS/FreshRSS/issues/1252) * Features + * Rework the “mark as read during scroll” option, now enabled by default [#1258](https://github.com/FreshRSS/FreshRSS/issues/1258), [#1309](https://github.com/FreshRSS/FreshRSS/pull/1309) * 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` * Explicit number: `https://freshrss.example/i/?a=rss&nb=10` diff --git a/data/users/_/config.default.php b/data/users/_/config.default.php index 280b13422..f28ef9724 100644 --- a/data/users/_/config.default.php +++ b/data/users/_/config.default.php @@ -35,7 +35,7 @@ return array ( 'mark_when' => array ( 'article' => true, 'site' => true, - 'scroll' => false, + 'scroll' => true, 'reception' => false, ), 'theme' => 'Origine', -- cgit v1.2.3 From 2ac71f2bd683bae06f1e4056e2893d74cf4ad430 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 15 Oct 2016 13:37:21 +0200 Subject: Readme gitignore --- CHANGELOG.md | 1 + data/PubSubHubbub/feeds/.gitignore | 1 + 2 files changed, 2 insertions(+) (limited to 'data') diff --git a/CHANGELOG.md b/CHANGELOG.md index 3178e6ae7..a2d938436 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ * Fix auto-discovery of RSS feeds in Web pages served as `text/xml` [#1264](https://github.com/FreshRSS/FreshRSS/issues/1264) * Security * Prevent `` attacks with `window.opener` [#1245](https://github.com/FreshRSS/FreshRSS/issues/1245) + * Updated gitignore rules to keep user directories during a `git clean -f -d` [#1307](https://github.com/FreshRSS/FreshRSS/pull/1307) * UI * Download icon 💾 for podcasts [#1236](https://github.com/FreshRSS/FreshRSS/issues/1236) * Extensions diff --git a/data/PubSubHubbub/feeds/.gitignore b/data/PubSubHubbub/feeds/.gitignore index 16b0ae4bc..d8f9df042 100644 --- a/data/PubSubHubbub/feeds/.gitignore +++ b/data/PubSubHubbub/feeds/.gitignore @@ -1,2 +1,3 @@ +*/ */*.json */*.txt -- cgit v1.2.3