From 0cc2c4628c4c6f16dd78acdb417982d3325485d3 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 1 Nov 2019 11:47:31 +0100 Subject: Start 1.15.1-dev --- CHANGELOG.md | 4 ++++ constants.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1070566dc..46cd60709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # FreshRSS changelog +## 20XX-XX-XX FreshRSS 1.15.1-dev + + + ## 2019-10-31 FreshRSS 1.15.0 * CLI diff --git a/constants.php b/constants.php index 1228e5c29..54c38da94 100644 --- a/constants.php +++ b/constants.php @@ -2,7 +2,7 @@ //NB: Do not edit; use ./constants.local.php instead. // -define('FRESHRSS_VERSION', '1.15.0'); +define('FRESHRSS_VERSION', '1.15.1-dev'); define('FRESHRSS_WEBSITE', 'https://freshrss.org'); define('FRESHRSS_WIKI', 'https://freshrss.github.io/FreshRSS/'); -- cgit v1.2.3 From 6a317d876c1da6243f212c9c2967cd44179762d1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 2 Nov 2019 00:46:58 +0100 Subject: API 64-bit ID as string (#2621) Fix https://github.com/FreshRSS/FreshRSS/issues/2620 --- p/api/greader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p/api/greader.php b/p/api/greader.php index 66888b0ef..9c28125e7 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -696,7 +696,7 @@ function streamContentsItemsIds($streamId, $start_time, $stop_time, $count, $ord $itemRefs = array(); foreach ($ids as $id) { $itemRefs[] = array( - 'id' => $id, //64-bit decimal + 'id' => '' . $id, //64-bit decimal ); } -- cgit v1.2.3 From c277e15141b99cdcb392f4a32126757d58b44423 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 2 Nov 2019 13:38:04 +0100 Subject: Git fetch+reset instead of clean+fetch+merge (#2625) Fix https://github.com/FreshRSS/FreshRSS/issues/2619 Avoid potentially dangerous git clean, and use more robust fetch + reset strategy instead --- app/Controllers/updateController.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index ebe5e4cc8..cc3aef9fd 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -29,20 +29,22 @@ class FreshRSS_update_Controller extends Minz_ActionController { public static function gitPull() { $cwd = getcwd(); chdir(FRESHRSS_PATH); - $output = array(); + $output = ''; $return = 1; try { - exec('git clean -f -d -f', $output, $return); + exec('git fetch', $output, $return); if ($return == 0) { - exec('git pull --ff-only', $output, $return); - } else { - $line = is_array($output) ? implode('; ', $output) : '' . $output; - Minz_Log::warning('git clean warning:' . $line); + exec('git reset --hard FETCH_HEAD', $output, $return); } } catch (Exception $e) { - Minz_Log::warning('git pull error:' . $e->getMessage()); + Minz_Log::warning('Git error:' . $e->getMessage()); + if ($output == '') { + $output = $e->getMessage(); + } + $return = 1; } chdir($cwd); + deleteInstall(); $line = is_array($output) ? implode('; ', $output) : '' . $output; return $return == 0 ? true : 'Git error: ' . $line; } @@ -52,6 +54,8 @@ class FreshRSS_update_Controller extends Minz_ActionController { Minz_Error::error(403); } + include_once(LIB_PATH . '/lib_install.php'); + invalidateHttpCache(); $this->view->update_to_apply = false; -- cgit v1.2.3 From 67fc72fb618558f352acc7e098163d05294a6a66 Mon Sep 17 00:00:00 2001 From: MonsieurP0uet Date: Sat, 2 Nov 2019 23:49:02 +0100 Subject: Correction in the line 38 (#2628) --- docs/en/admins/07_LinuxUpdate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/admins/07_LinuxUpdate.md b/docs/en/admins/07_LinuxUpdate.md index 5c91fa3ca..7bd867639 100644 --- a/docs/en/admins/07_LinuxUpdate.md +++ b/docs/en/admins/07_LinuxUpdate.md @@ -35,7 +35,7 @@ If there's not an update, you're done! If there is, continue the following steps 5. Discard manual changes and delete manual additions ``` -get reset --hard +git reset --hard git clean -f -d ``` -- cgit v1.2.3 From 7819a43197d34ef7a6c5626e9e48d7db075c37c9 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 4 Nov 2019 17:45:15 +0100 Subject: Default or custom OPML (#2627) * Default or custom OPML Fix https://github.com/FreshRSS/FreshRSS/issues/2075 Replaces https://github.com/FreshRSS/FreshRSS/pull/2515 https://github.com/FreshRSS/FreshRSS/issues/2514 Uses the local ./data/opml.xml if it exists, otherwise ./opml.default.xml * Better message * Move to controller --- app/Controllers/userController.php | 16 +++++++++++++++- app/Models/UserDAO.php | 19 +++---------------- app/SQL/install.sql.mysql.php | 5 ----- app/SQL/install.sql.pgsql.php | 6 ------ app/SQL/install.sql.sqlite.php | 5 ----- config.default.php | 10 ---------- opml.default.xml | 14 ++++++++++++++ 7 files changed, 32 insertions(+), 43 deletions(-) create mode 100644 opml.default.xml diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 6afc91b4e..7ce6b298a 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -248,7 +248,21 @@ class FreshRSS_user_Controller extends Minz_ActionController { } if ($ok) { $newUserDAO = FreshRSS_Factory::createUserDao($new_user_name); - $ok &= $newUserDAO->createUser($insertDefaultFeeds); + $ok &= $newUserDAO->createUser(); + + if ($ok && $insertDefaultFeeds) { + $opmlPath = DATA_PATH . '/opml.xml'; + if (!file_exists($opmlPath)) { + $opmlPath = FRESHRSS_PATH . '/opml.default.xml'; + } + $importController = new FreshRSS_importExport_Controller(); + try { + $importController->importFile($opmlPath, $opmlPath, $new_user_name); + } catch (Exception $e) { + Minz_Log::error('Error while importing default OPML for user ' . $new_user_name . ': ' . $e->getMessage()); + } + } + $ok &= self::updateUser($new_user_name, $email, $passwordPlain, $apiPasswordPlain); } return $ok; diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 4e824cf01..266c8bc0e 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -1,34 +1,21 @@ pdo->dbType() . '.php'); try { $sql = $SQL_CREATE_TABLES . $SQL_CREATE_TABLE_ENTRYTMP . $SQL_CREATE_TABLE_TAGS; $ok = $this->pdo->exec($sql) !== false; //Note: Only exec() can take multiple statements safely. - if ($ok && $insertDefaultFeeds) { - $default_feeds = FreshRSS_Context::$system_conf->default_feeds; - $stm = $this->pdo->prepare($SQL_INSERT_FEED); - foreach ($default_feeds as $feed) { - $parameters = [ - ':url' => $feed['url'], - ':name' => $feed['name'], - ':website' => $feed['website'], - ':description' => $feed['description'], - ]; - $ok &= ($stm && $stm->execute($parameters)); - } - } } catch (Exception $e) { - Minz_Log::error('Error while creating database for user: ' . $e->getMessage()); + Minz_Log::error('Error while creating database for user ' . $this->current_user . ': ' . $e->getMessage()); } if ($ok) { return true; } else { $info = empty($stm) ? $this->pdo->errorInfo() : $stm->errorInfo(); - Minz_Log::error(__METHOD__ . ' error: ' . $info[2]); + Minz_Log::error(__METHOD__ . ' error: ' . json_encode($info)); return false; } } diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index 1eabfae8b..f8972b186 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -112,11 +112,6 @@ CREATE TABLE IF NOT EXISTS `_entrytag` ( -- v1.12 ENGINE = INNODB; SQL; -$SQL_INSERT_FEED = <<<'SQL' -INSERT IGNORE INTO `_feed` (url, category, name, website, description, ttl) - VALUES(:url, 1, :name, :website, :description, 86400); -SQL; - $SQL_DROP_TABLES = <<<'SQL' DROP TABLE IF EXISTS `_entrytag`, `_tag`, `_entrytmp`, `_entry`, `_feed`, `_category`; SQL; diff --git a/app/SQL/install.sql.pgsql.php b/app/SQL/install.sql.pgsql.php index 53afc8a17..c17a45127 100644 --- a/app/SQL/install.sql.pgsql.php +++ b/app/SQL/install.sql.pgsql.php @@ -100,12 +100,6 @@ CREATE TABLE IF NOT EXISTS `_entrytag` ( CREATE INDEX IF NOT EXISTS `_entrytag_id_entry_index` ON `_entrytag` ("id_entry"); SQL; -$SQL_INSERT_FEED = <<<'SQL' -INSERT INTO `_feed` (url, category, name, website, description, ttl) - SELECT :url::VARCHAR, 1, :name, :website, :description, 86400 - WHERE NOT EXISTS (SELECT id FROM `_feed` WHERE url = :url); -SQL; - $SQL_DROP_TABLES = <<<'SQL' DROP TABLE IF EXISTS `_entrytag`, `_tag`, `_entrytmp`, `_entry`, `_feed`, `_category`; SQL; diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 2a4763637..ff7c03354 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -102,11 +102,6 @@ CREATE TABLE IF NOT EXISTS `entrytag` ( CREATE INDEX IF NOT EXISTS entrytag_id_entry_index ON `entrytag` (`id_entry`); SQL; -$SQL_INSERT_FEED = <<<'SQL' -INSERT OR IGNORE INTO `feed` (url, category, name, website, description, ttl) - VALUES(:url, 1, :name, :website, :description, 86400); -SQL; - $SQL_DROP_TABLES = <<<'SQL' DROP TABLE IF EXISTS `entrytag`; DROP TABLE IF EXISTS `tag`; diff --git a/config.default.php b/config.default.php index d885a8dea..71f8d477c 100644 --- a/config.default.php +++ b/config.default.php @@ -156,16 +156,6 @@ return array( ], - # Configure the default feeds to which users will automatically be subscribed. - 'default_feeds' => array( - array( - 'url' => 'https://github.com/FreshRSS/FreshRSS/releases.atom', - 'name' => 'FreshRSS releases', - 'website' => 'https://github.com/FreshRSS/FreshRSS/', - 'description' => 'FreshRSS releases @ GitHub', - ), - ), - # Configuration to send emails. Be aware that PHP < 5.5 are not supported. # These options are basically a mapping of the PHPMailer class attributes # from the PHPMailer library. diff --git a/opml.default.xml b/opml.default.xml new file mode 100644 index 000000000..5814869b5 --- /dev/null +++ b/opml.default.xml @@ -0,0 +1,14 @@ + + + + + FreshRSS default OPML + Sat, 02 Nov 2019 12:00:00 + + + + + -- cgit v1.2.3 From 2495172a05725684fa4db2ed3417461d386c5cbf Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 4 Nov 2019 18:05:20 +0100 Subject: Better git fetch (#2626) Related to https://github.com/FreshRSS/FreshRSS/pull/2625 If for some reasons branches have diverged:, e.g.: ``` $ git status -sb --porcelain remote ## dev...origin/dev [ahead 4, behind 1] ``` --- app/Controllers/updateController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index cc3aef9fd..c0c1ef1c8 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -23,7 +23,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { } chdir($cwd); $line = is_array($output) ? implode('; ', $output) : '' . $output; - return strpos($line, '[behind') !== false; + return strpos($line, '[behind') !== false || strpos($line, '[ahead') !== false; } public static function gitPull() { -- cgit v1.2.3 From 122e4b412a29c90ec69c2a3fb68b6d8b2b3df5c7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 4 Nov 2019 18:13:13 +0100 Subject: Fix PostgreSQL size bug for uppercase (#2631) Crash for users with uppercase letters --- app/Models/DatabaseDAOPGSQL.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php index 1a6b3599e..7ca7799ae 100644 --- a/app/Models/DatabaseDAOPGSQL.php +++ b/app/Models/DatabaseDAOPGSQL.php @@ -58,14 +58,17 @@ class FreshRSS_DatabaseDAOPGSQL extends FreshRSS_DatabaseDAOSQLite { $stm->execute(); } else { $sql = "SELECT " - . "pg_total_relation_size('{$this->pdo->prefix()}category') + " - . "pg_total_relation_size('{$this->pdo->prefix()}feed') + " - . "pg_total_relation_size('{$this->pdo->prefix()}entry') + " - . "pg_total_relation_size('{$this->pdo->prefix()}entrytmp') + " - . "pg_total_relation_size('{$this->pdo->prefix()}tag') + " - . "pg_total_relation_size('{$this->pdo->prefix()}entrytag')"; + . "pg_total_relation_size('`{$this->pdo->prefix()}category`') + " + . "pg_total_relation_size('`{$this->pdo->prefix()}feed`') + " + . "pg_total_relation_size('`{$this->pdo->prefix()}entry`') + " + . "pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`') + " + . "pg_total_relation_size('`{$this->pdo->prefix()}tag`') + " + . "pg_total_relation_size('`{$this->pdo->prefix()}entrytag`')"; $stm = $this->pdo->query($sql); } + if ($stm == false) { + return 0; + } $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); return $res[0]; } -- cgit v1.2.3 From 90cb9a2162a5a6c9f4ea2fde6cd4a3df899025e3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 4 Nov 2019 18:24:08 +0100 Subject: fix: Gitignore opml.xml (#2632) This file is used to add default feeds to new users. It was added in 7819a43197d34ef7a6c5626e9e48d7db075c37c9 Problem is that the file is not ignored by Git and risk to be deleted during a git update. --- data/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/data/.gitignore b/data/.gitignore index 862bf4ad1..2537e6fc1 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -7,3 +7,4 @@ last_update.txt no-cache.txt update.php tos.html +opml.xml -- cgit v1.2.3 From c7222d433112249906189cf68b16525ea04d1c3b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 4 Nov 2019 22:05:26 +0100 Subject: Changelog 2621 2625 etc. --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46cd60709..ab8b526af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ # FreshRSS changelog -## 20XX-XX-XX FreshRSS 1.15.1-dev +## 2019-11-XX FreshRSS 1.15.1-dev +* Features + * New approch based on OPML to definite default feeds for new users [#2627](https://github.com/FreshRSS/FreshRSS/pull/2627) +* API + * Always send articles IDs as string, to fix compatibility with Reeder [#2621](https://github.com/FreshRSS/FreshRSS/pull/2621) +* Bug fixing + * Fix bug in database size estimation with PostgreSQL for users with uppercase names [#2631](https://github.com/FreshRSS/FreshRSS/pull/2631) +* Misc. + * Perform automatic git updates with safer fetch+reset instead of clean+fetch+merge [#2625](https://github.com/FreshRSS/FreshRSS/pull/2625) ## 2019-10-31 FreshRSS 1.15.0 -- cgit v1.2.3 From bba0b0565559fbecf5df170b472cadc58627027a Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 5 Nov 2019 16:42:29 +0100 Subject: Fix favorite display for "current" articles (#2634) Favorite articles have, in most of the themes, a gold background to distinguish them from the other articles. However, it can be distracting to have such a background when reading the articles, so we should turn them back to the "default" background when articles are opened (class `.current`). Bug introduced in e9ce27d8d991d7806ca2c2af7e5282279e378885 Related PRs: - https://github.com/FreshRSS/FreshRSS/pull/2477 - https://github.com/FreshRSS/FreshRSS/pull/2611 - https://github.com/FreshRSS/FreshRSS/pull/2612 Closes https://github.com/FreshRSS/FreshRSS/issues/2618 --- p/themes/Ansum/_list-view.scss | 22 ++++++++++------------ p/themes/Ansum/ansum.css | 21 ++++++++++----------- p/themes/Flat/flat.css | 5 ++++- p/themes/Mapco/_list-view.scss | 21 ++++++++++----------- p/themes/Mapco/mapco.css | 21 ++++++++++----------- p/themes/Origine-compact/origine-compact.css | 5 ++++- p/themes/Origine/origine.css | 5 ++++- p/themes/Pafat/pafat.css | 5 ++++- p/themes/Swage/swage.css | 10 +++++----- p/themes/Swage/swage.scss | 18 ++++++++---------- 10 files changed, 69 insertions(+), 64 deletions(-) diff --git a/p/themes/Ansum/_list-view.scss b/p/themes/Ansum/_list-view.scss index 8b8398c6f..e5a1f575a 100644 --- a/p/themes/Ansum/_list-view.scss +++ b/p/themes/Ansum/_list-view.scss @@ -20,24 +20,19 @@ border-left-color: $main-first; } - &.not_read { + &.not_read:not(.current) { background: $unread-bg; //-------------------- - // border-left-color: #FF5300; - &:hover { - background: $unread-bg-light; //-------------------- - } - - &:not(.current):hover .item.title { - background: $unread-bg-light; - + &:hover .item.title { + background: $unread-bg; } + } + &.not_read { .item.title { a { color: $unread-font-color; //-------------------- } - } .item.website { @@ -52,12 +47,15 @@ } &.favorite { - background: $fav-light; border-left-color: $fav-bg; @include transition(all, 0.15s, ease-in-out); + } - &:not(.current):hover .item.title { + &.favorite:not(.current) { + background: $fav-light; + + &:hover .item.title { background: $fav-light; } } diff --git a/p/themes/Ansum/ansum.css b/p/themes/Ansum/ansum.css index 525e7e079..7b4281d2b 100644 --- a/p/themes/Ansum/ansum.css +++ b/p/themes/Ansum/ansum.css @@ -963,25 +963,24 @@ form th { .flux.current { background: #fff; border-left-color: #ca7227; } - .flux.not_read { + .flux.not_read:not(.current) { background: #f2f6f8; } - .flux.not_read:hover { - background: #fdfdfe; } .flux.not_read:not(.current):hover .item.title { - background: #fdfdfe; } - .flux.not_read .item.title a { - color: #161a38; } - .flux.not_read .item.website a { - color: #161a38; } - .flux.not_read .item.date { - color: #161a3899; } + background: #f2f6f8; } + .flux.not_read .item.title a { + color: #161a38; } + .flux.not_read .item.website a { + color: #161a38; } + .flux.not_read .item.date { + color: #161a3899; } .flux.favorite { - background: #fff6da; border-left-color: #ffc300; -webkit-transition: all 0.15s ease-in-out; -moz-transition: all 0.15s ease-in-out; -o-transition: all 0.15s ease-in-out; transition: all 0.15s ease-in-out; } + .flux.favorite:not(.current) { + background: #fff6da; } .flux.favorite:not(.current):hover .item.title { background: #fff6da; } .flux .website a { diff --git a/p/themes/Flat/flat.css b/p/themes/Flat/flat.css index f7159b46f..0989321bf 100644 --- a/p/themes/Flat/flat.css +++ b/p/themes/Flat/flat.css @@ -803,10 +803,13 @@ a.btn { } .flux.favorite { - background: #fff6da; border-left-color: #ffc300; } +.flux.favorite:not(.current) { + background: #fff6da; +} + .flux.favorite:not(.current):hover .item.title { background: #fff6da; } diff --git a/p/themes/Mapco/_list-view.scss b/p/themes/Mapco/_list-view.scss index ab3001ee4..760aea96c 100644 --- a/p/themes/Mapco/_list-view.scss +++ b/p/themes/Mapco/_list-view.scss @@ -20,19 +20,15 @@ border-left-color: $main-first; } - &.not_read { + &.not_read:not(.current) { background: $unread-bg; //-------------------- - // border-left-color: #FF5300; - &:hover { - background: $unread-bg-light; //-------------------- - } - - &:not(.current):hover .item.title { - background: $unread-bg-light; - + &:hover .item.title { + background: $unread-bg; } + } + &.not_read { .item.title { a { color: $unread-font-color; //-------------------- @@ -52,12 +48,15 @@ } &.favorite { - background: $fav-light; border-left-color: $fav-bg; @include transition(all, 0.15s, ease-in-out); + } - &:not(.current):hover .item.title { + &.favorite:not(.current) { + background: $fav-light; + + &:hover .item.title { background: $fav-light; } } diff --git a/p/themes/Mapco/mapco.css b/p/themes/Mapco/mapco.css index b144dca58..bbbad8560 100644 --- a/p/themes/Mapco/mapco.css +++ b/p/themes/Mapco/mapco.css @@ -970,26 +970,25 @@ form th { .flux.current { background: #f9fafb; border-left-color: #36c; } - .flux.not_read { + .flux.not_read:not(.current) { background: #f2f6f8; } - .flux.not_read:hover { - background: #fdfdfe; } .flux.not_read:not(.current):hover .item.title { - background: #fdfdfe; } - .flux.not_read .item.title a { - color: #36c; } - .flux.not_read .item.website a { - color: #36c; } - .flux.not_read .item.date { - color: #36c99; } + background: #f2f6f8; } + .flux.not_read .item.title a { + color: #36c; } + .flux.not_read .item.website a { + color: #36c; } + .flux.not_read .item.date { + color: #36c99; } .flux.favorite { - background: #fff6da; border-left-color: #ffc300; -webkit-transition: all 0.15s ease-in-out; -moz-transition: all 0.15s ease-in-out; -o-transition: all 0.15s ease-in-out; -ms-transition: all 0.15s ease-in-out; transition: all 0.15s ease-in-out; } + .flux.favorite:not(.current) { + background: #fff6da; } .flux.favorite:not(.current):hover .item.title { background: #fff6da; } .flux .website a { diff --git a/p/themes/Origine-compact/origine-compact.css b/p/themes/Origine-compact/origine-compact.css index af8e66d17..9ce0b5da0 100644 --- a/p/themes/Origine-compact/origine-compact.css +++ b/p/themes/Origine-compact/origine-compact.css @@ -837,10 +837,13 @@ a.btn, } .flux.favorite { - background: #fff6da; border-left: 2px solid #ffc300; } +.flux.favorite:not(.current) { + background: #fff6da; +} + .flux.favorite:not(.current):hover .item.title { background: #fff6da; } diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index 7e826dd5f..4016ac5bd 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -794,10 +794,13 @@ a.btn { } .flux.favorite { - background: #fff6da; border-left: 2px solid #ffc300; } +.flux.favorite:not(.current) { + background: #fff6da; +} + .flux.favorite:not(.current):hover .item.title { background: #fff6da; } diff --git a/p/themes/Pafat/pafat.css b/p/themes/Pafat/pafat.css index 8b6bc5f62..2cbc539dc 100644 --- a/p/themes/Pafat/pafat.css +++ b/p/themes/Pafat/pafat.css @@ -798,10 +798,13 @@ a.btn { } .flux.favorite { - background: #fff6da; border-left: 2px solid #428bca; } +.flux.favorite:not(.current) { + background: #fff6da; +} + .flux.favorite:not(.current):hover .item.title { background: #fff6da; } diff --git a/p/themes/Swage/swage.css b/p/themes/Swage/swage.css index 6528d2305..3bf510099 100644 --- a/p/themes/Swage/swage.css +++ b/p/themes/Swage/swage.css @@ -585,14 +585,14 @@ form th { .flux:hover:not(.current):hover .item.title, .flux .current:not(.current):hover .item.title { background: #fff; } - .flux.not_read:not(.current) { - background: #fff3ed; } - .flux.not_read:not(.current):hover .item.title { - background: #fff3ed; } - .flux.favorite { + .flux.favorite:not(.current) { background: #fff6da; } .flux.favorite:not(.current):hover .item.title { background: #fff6da; } + .flux.not_read:not(.current) { + background: #fff3ed; } + .flux.not_read:not(.current):hover .item.title { + background: #fff3ed; } .flux .date { color: #969696; font-size: 0.7rem; } diff --git a/p/themes/Swage/swage.scss b/p/themes/Swage/swage.scss index 9c2702fc0..f37739d03 100644 --- a/p/themes/Swage/swage.scss +++ b/p/themes/Swage/swage.scss @@ -928,21 +928,19 @@ form { } } - &.not_read { - &:not(.current) { - background: $color_unread; - } + &.favorite:not(.current) { + background: $color_stared; - &:not(.current):hover .item.title { - background: $color_unread; + &:hover .item.title { + background: $color_stared; } } - &.favorite, { - background: $color_stared; + &.not_read:not(.current) { + background: $color_unread; - &:not(.current):hover .item.title { - background: $color_stared; + &:hover .item.title { + background: $color_unread; } } -- cgit v1.2.3 From 8b0f9fae9f34ef25458e79a477758a45873b7cd4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 5 Nov 2019 18:11:38 +0100 Subject: Cookie same-site (#2630) * Set-Cookie SameSite * https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00 * https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.3.7 * https://blog.mozilla.org/security/2018/04/24/same-site-cookies-in-firefox-60/ * https://blog.chromium.org/2019/10/developers-get-ready-for-new.html Set to Lax instead of Strict to allow linking to allow linking to FreshRSS sub-pages without having to log-in again --- Docker/README.md | 2 +- p/.htaccess | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Docker/README.md b/Docker/README.md index 15510a220..d06016fb9 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -320,7 +320,7 @@ server { # Other SSL stuff goes here # Needed for Freshrss cookie/session : - proxy_cookie_path / "/; HTTPOnly; Secure"; + proxy_cookie_path / "/; HTTPOnly; Secure; SameSite=Lax"; location / { try_files $uri $uri/ =404; diff --git a/p/.htaccess b/p/.htaccess index 74ba7ed11..909fb6cdc 100644 --- a/p/.htaccess +++ b/p/.htaccess @@ -37,4 +37,5 @@ AddDefaultCharset UTF-8 Header merge Cache-Control "public" + Header edit Set-Cookie ^(.*)$ "$1; SameSite=Lax" -- cgit v1.2.3 From 25bc1eea74602fdce5fbf63c21d6e84c61f2fa83 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 5 Nov 2019 22:31:55 +0100 Subject: Changelog 2630 2634 2635 --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab8b526af..bf4922bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,17 @@ # FreshRSS changelog -## 2019-11-XX FreshRSS 1.15.1-dev +## 2019-11-0X FreshRSS 1.15.1-dev * Features - * New approch based on OPML to definite default feeds for new users [#2627](https://github.com/FreshRSS/FreshRSS/pull/2627) + * New approach based on OPML to definite default feeds for new users [#2627](https://github.com/FreshRSS/FreshRSS/pull/2627) * API * Always send articles IDs as string, to fix compatibility with Reeder [#2621](https://github.com/FreshRSS/FreshRSS/pull/2621) * Bug fixing + * Fix database auto-creation at install (regression from 1.15.0) [#2635](https://github.com/FreshRSS/FreshRSS/pull/2635) * Fix bug in database size estimation with PostgreSQL for users with uppercase names [#2631](https://github.com/FreshRSS/FreshRSS/pull/2631) + * Fix UI style regressions [#2634](https://github.com/FreshRSS/FreshRSS/pull/2634) +* Security + * Improve cookie security with policy `SameSite=Lax` [#2630](https://github.com/FreshRSS/FreshRSS/pull/2630) * Misc. * Perform automatic git updates with safer fetch+reset instead of clean+fetch+merge [#2625](https://github.com/FreshRSS/FreshRSS/pull/2625) -- cgit v1.2.3 From 12cdd2cdf6d493a8bd110d1ae310288a0a47afa0 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 5 Nov 2019 22:54:21 +0100 Subject: Changelog wording More similar to previous releases --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf4922bd8..beb778f17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,10 @@ * New approach based on OPML to definite default feeds for new users [#2627](https://github.com/FreshRSS/FreshRSS/pull/2627) * API * Always send articles IDs as string, to fix compatibility with Reeder [#2621](https://github.com/FreshRSS/FreshRSS/pull/2621) -* Bug fixing - * Fix database auto-creation at install (regression from 1.15.0) [#2635](https://github.com/FreshRSS/FreshRSS/pull/2635) +* Bug fixing (regressions from 1.15.0) + * Fix database auto-creation at install [#2635](https://github.com/FreshRSS/FreshRSS/pull/2635) * Fix bug in database size estimation with PostgreSQL for users with uppercase names [#2631](https://github.com/FreshRSS/FreshRSS/pull/2631) - * Fix UI style regressions [#2634](https://github.com/FreshRSS/FreshRSS/pull/2634) + * Fix UI style details [#2634](https://github.com/FreshRSS/FreshRSS/pull/2634) * Security * Improve cookie security with policy `SameSite=Lax` [#2630](https://github.com/FreshRSS/FreshRSS/pull/2630) * Misc. -- cgit v1.2.3 From 22030155f8fd5cab102ddd897a914cf1a0ffd183 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 6 Nov 2019 15:16:00 +0100 Subject: Fix database autocreate at install (#2635) * Fix database autocreate at install Several bugs prevented the auto-creation of the database in Web and CLI installs. Fix https://github.com/YunoHost-Apps/freshrss_ynh/issues/84#issuecomment-549818408 * initDb https://github.com/FreshRSS/FreshRSS/pull/2635#discussion_r343107795 --- Docker/README.md | 5 +++-- app/Models/FeedDAO.php | 4 +++- app/install.php | 10 ++++++++-- cli/do-install.php | 19 ++++++++++++++++++- lib/Minz/ModelPdo.php | 4 +++- lib/lib_install.php | 21 ++++++++++++++------- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Docker/README.md b/Docker/README.md index d06016fb9..6920471df 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -162,10 +162,11 @@ docker build --pull --tag freshrss/freshrss -f Docker/Dockerfile . ## Command line ```sh -docker exec --user apache -it freshrss php ./cli/list-users.php +docker exec --user www-data -it freshrss php ./cli/list-users.php ``` See the [CLI documentation](../cli/) for all the other commands. +You might have to replace `--user www-data` by `--user apache` when using our images based on Linux Alpine. ## Debugging @@ -210,7 +211,7 @@ Remember not pass the `CRON_MIN` environment variable to your Docker run, to avo Example on Debian / Ubuntu: Create `/etc/cron.d/FreshRSS` with: ``` -7,37 * * * * root docker exec --user apache -it freshrss php ./app/actualize_script.php > /tmp/FreshRSS.log 2>&1 +7,37 * * * * root docker exec --user www-data -it freshrss php ./app/actualize_script.php > /tmp/FreshRSS.log 2>&1 ``` ### Option 3) Cron as another instance of the same FreshRSS Docker image diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index fa0001df7..2bff50d52 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -102,7 +102,9 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { 'httpAuth' => $feed->httpAuth(), 'attributes' => $feed->attributes(), ); - if ($feed->mute() || $feed->ttl() != FreshRSS_Context::$user_conf->ttl_default) { + if ($feed->mute() || ( + FreshRSS_Context::$user_conf != null && //When creating a new user + $feed->ttl() != FreshRSS_Context::$user_conf->ttl_default)) { $values['ttl'] = $feed->ttl() * ($feed->mute() ? -1 : 1); } diff --git a/app/install.php b/app/install.php index 96bee34a1..557ae9eab 100644 --- a/app/install.php +++ b/app/install.php @@ -132,7 +132,7 @@ function saveStep2() { $config_array = [ 'salt' => generateSalt(), 'base_url' => $base_url, - 'default_user' => 'admin', + 'default_user' => '_', 'db' => [ 'type' => $_SESSION['bd_type'], 'host' => $_SESSION['bd_host'], @@ -154,12 +154,18 @@ function saveStep2() { @unlink(DATA_PATH . '/config.php'); //To avoid access-rights problems file_put_contents(DATA_PATH . '/config.php', "getMessage(); $ok = false; diff --git a/cli/do-install.php b/cli/do-install.php index dea5d235e..fa6bac8c8 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -82,7 +82,24 @@ if (file_put_contents(join_path(DATA_PATH, 'config.php'), fail('FreshRSS could not write configuration file!: ' . join_path(DATA_PATH, 'config.php')); } -if (!checkDb()) { +if (function_exists('opcache_reset')) { + opcache_reset(); +} + +Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); +FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); + +Minz_Session::_param('currentUser', $config['default_user']); + +$ok = false; +try { + $ok = initDb(); +} catch (Exception $ex) { + $_SESSION['bd_error'] = $ex->getMessage(); + $ok = false; +} + +if (!$ok) { @unlink(join_path(DATA_PATH, 'config.php')); fail('FreshRSS database error: ' . (empty($_SESSION['bd_error']) ? 'Unknown error' : $_SESSION['bd_error'])); } diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 69785c253..6eb4881dc 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -28,6 +28,9 @@ class Minz_ModelPdo { if ($currentUser === null) { $currentUser = Minz_Session::param('currentUser'); } + if ($currentUser == '') { + throw new Minz_PDOConnectionException('Current user must not be empty!', '', Minz_Exception::ERROR); + } if ($currentPdo != null) { $this->pdo = $currentPdo; return; @@ -84,7 +87,6 @@ class Minz_ModelPdo { 'Invalid database type!', $db['user'], Minz_Exception::ERROR ); - break; } self::$sharedPdo = $this->pdo; } catch (Exception $e) { diff --git a/lib/lib_install.php b/lib/lib_install.php index ed361eb39..5ea1b4d2b 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -78,21 +78,28 @@ function generateSalt() { return sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); } -function checkDb() { +function initDb() { $conf = FreshRSS_Context::$system_conf; $db = $conf->db; if (empty($db['pdo_options'])) { $db['pdo_options'] = []; } $db['pdo_options'][PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; - $dbBase = isset($db['base']) ? $db['base'] : ''; + $conf->db = $db; //TODO: Remove this Minz limitation "Indirect modification of overloaded property" - $db['base'] = ''; //First connection without database name to create the database - Minz_ModelPdo::$usesSharedPdo = false; - $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); - $databaseDAO->create(); + if ($db['type'] !== 'sqlite') { + Minz_ModelPdo::$usesSharedPdo = false; + $dbBase = isset($db['base']) ? $db['base'] : ''; + $db['base'] = ''; + $conf->db = $db; + //First connection without database name to create the database + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $db['base'] = $dbBase; + $conf->db = $db; + $databaseDAO->create(); + } - $db['base'] = $dbBase; //New connection with the database name + //New connection with the database name $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); Minz_ModelPdo::$usesSharedPdo = true; return $databaseDAO->testConnection(); -- cgit v1.2.3 From 61878794a944d47bd3098ce0f18eaa303174fc67 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 6 Nov 2019 19:49:51 +0100 Subject: Fix name of default category (#2638) Fix https://github.com/FreshRSS/FreshRSS/issues/2637 --- app/Models/CategoryDAO.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index c1277751c..f4cef9726 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -45,6 +45,12 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable } else { $this->pdo->exec('DROP INDEX IF EXISTS feed_keep_history_index'); //SQLite at least drop index } + + $stm = $this->pdo->prepare('UPDATE `_category` SET name = :name WHERE id = :id'); + $stm->bindValue(':id', self::DEFAULTCATEGORYID, PDO::PARAM_INT); + $stm->bindValue(':name', 'Uncategorized'); + $stm->execute(); + return $ok; } } catch (Exception $e) { -- cgit v1.2.3 From ba56d650e94948ab68aa3c899b86dab2f0247c28 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 6 Nov 2019 19:53:31 +0100 Subject: Release 1.15.1 --- CHANGELOG.md | 3 ++- constants.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index beb778f17..e1ccec16d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # FreshRSS changelog -## 2019-11-0X FreshRSS 1.15.1-dev +## 2019-11-06 FreshRSS 1.15.1 * Features * New approach based on OPML to definite default feeds for new users [#2627](https://github.com/FreshRSS/FreshRSS/pull/2627) @@ -9,6 +9,7 @@ * Bug fixing (regressions from 1.15.0) * Fix database auto-creation at install [#2635](https://github.com/FreshRSS/FreshRSS/pull/2635) * Fix bug in database size estimation with PostgreSQL for users with uppercase names [#2631](https://github.com/FreshRSS/FreshRSS/pull/2631) + * Reset name of default category (which cannot be customised anymore) [#2638](https://github.com/FreshRSS/FreshRSS/pull/2638) * Fix UI style details [#2634](https://github.com/FreshRSS/FreshRSS/pull/2634) * Security * Improve cookie security with policy `SameSite=Lax` [#2630](https://github.com/FreshRSS/FreshRSS/pull/2630) diff --git a/constants.php b/constants.php index 54c38da94..1f9a0f01c 100644 --- a/constants.php +++ b/constants.php @@ -2,7 +2,7 @@ //NB: Do not edit; use ./constants.local.php instead. // -define('FRESHRSS_VERSION', '1.15.1-dev'); +define('FRESHRSS_VERSION', '1.15.1'); define('FRESHRSS_WEBSITE', 'https://freshrss.org'); define('FRESHRSS_WIKI', 'https://freshrss.github.io/FreshRSS/'); -- cgit v1.2.3 From 6d596e9e54308297d423b23bf65338d62eebc415 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 6 Nov 2019 20:49:04 +0100 Subject: More reset default category name (#2639) Improve https://github.com/FreshRSS/FreshRSS/pull/2638 --- CHANGELOG.md | 2 +- app/Models/CategoryDAO.php | 15 +++++++++++---- app/Models/DatabaseDAO.php | 3 +++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1ccec16d..9f5b590ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ * Bug fixing (regressions from 1.15.0) * Fix database auto-creation at install [#2635](https://github.com/FreshRSS/FreshRSS/pull/2635) * Fix bug in database size estimation with PostgreSQL for users with uppercase names [#2631](https://github.com/FreshRSS/FreshRSS/pull/2631) - * Reset name of default category (which cannot be customised anymore) [#2638](https://github.com/FreshRSS/FreshRSS/pull/2638) + * Reset name of default category (which cannot be customised anymore) [#2639](https://github.com/FreshRSS/FreshRSS/pull/2639) * Fix UI style details [#2634](https://github.com/FreshRSS/FreshRSS/pull/2634) * Security * Improve cookie security with policy `SameSite=Lax` [#2630](https://github.com/FreshRSS/FreshRSS/pull/2630) diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index f4cef9726..08dc4eef0 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -4,6 +4,16 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable const DEFAULTCATEGORYID = 1; + public function resetDefaultCategoryName() { + //FreshRSS 1.15.1 + $stm = $this->pdo->prepare('UPDATE `_category` SET name = :name WHERE id = :id'); + if ($stm) { + $stm->bindValue(':id', self::DEFAULTCATEGORYID, PDO::PARAM_INT); + $stm->bindValue(':name', 'Uncategorized'); + } + return $stm && $stm->execute(); + } + protected function addColumn($name) { Minz_Log::warning(__method__ . ': ' . $name); try { @@ -46,10 +56,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable $this->pdo->exec('DROP INDEX IF EXISTS feed_keep_history_index'); //SQLite at least drop index } - $stm = $this->pdo->prepare('UPDATE `_category` SET name = :name WHERE id = :id'); - $stm->bindValue(':id', self::DEFAULTCATEGORYID, PDO::PARAM_INT); - $stm->bindValue(':name', 'Uncategorized'); - $stm->execute(); + $this->resetDefaultCategoryName(); return $ok; } diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index a36b469b1..13330db23 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -178,6 +178,9 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { } public function minorDbMaintenance() { + $catDAO = FreshRSS_Factory::createCategoryDao(); + $catDAO->resetDefaultCategoryName(); + $this->ensureCaseInsensitiveGuids(); } -- cgit v1.2.3