Commit Graph

561 Commits

Author SHA1 Message Date
Offerel
68863fbac8 Show Favorites as Unread (#2766)
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Marien Fressinaud <dev@marienfressinaud.fr>
2020-01-16 17:11:04 +01:00
Alexis Degrugillier
3c099c7853 Add an admin flag on users (#2709)
Now FRSS supports more than one admin. Admins have the same rights as
the default user. Admins can promote or demote other users. The default
user is considered as an admin even if it does not have the admin flag
enabled.

See #2096
2020-01-06 20:28:04 +01:00
Marien Fressinaud
7802fd33a6 tec: Allow to change CSP header from controllers
For an extension, I needed to call a script from an external domain.
Unfortunately, the CSP headers didn't allow this domain and I had to
patch manually the FreshRSS FrontController for my extension. It's
obviously not a long-term solution since it has nothing to do in the
core of FRSS, and I don't want to apply this patch manually at each
update.

With this patch, I allow changing the CSP header from inside the
controller actions. It allows extensions to modify headers. It's also an
opportunity to remove a bit of code from the FrontController. I wasn't
happy with the previous implementation anyhow.

Reference: https://github.com/flusio/xExtension-Flus/commit/ed12d56#diff-ff12e33ed31b23bda327499fa6e84eccR143
2019-12-22 15:01:02 +01:00
Clemens Neubauer
08c6a1bdc1 Extend hooks (#2704)
It adds two new hooks to have more options for influencing with extensions.
2019-12-07 12:59:53 +01:00
Alexis Degrugillier
d13a8a0eb1 Add user language display
When managing users, I've added the language they selected to be able
to communicate with them with the selected language (if I know it).
It could be useful when managing a community or a paid service.
2019-12-07 12:57:52 +01:00
Marien Fressinaud
d0f1f9f141 Separate the update API password endpoint (#2675)
* Extract hashPassword method from userController

* Extract and refactor fever key-related methods

* Move update of API password to dedicated action

* Simplify the controller by refactoring feverUtil

* Add locales
2019-12-03 23:11:06 +01:00
Alexis Degrugillier
0de7e84380 Upgrade user management page (#2417)
Before, the use of the user management page was a little bit tedious
when there was many users. One must select a user to view some
metrics, to update it, or to delete it.
Now, the view is clearer because it shows all users at once with
their metrics. I introduced a detail page that repeats the metrics
but also allow to purge the user's feeds, to update or delete the
user.

This is the first step to make that page more useful and user-friendly.
I have in mind to add a pager for when there is a lot of users, a metric
to know when was the last time the user was using the application, and
a flag to know if the user has admin rights.

See #2096 and #2504 for ideas and inspiration
2019-12-03 22:32:17 +01:00
Purexo
86dda60431 FIX email token check if not in user-config (#2686)
* FIX email token check if not in user-config

* fix missing semicolon
2019-11-26 19:26:07 +01:00
Alexandre Alapetite
bb5d15f7c6 Do not obbey rel=self if WebSub is disabled (#2659)
* Do not obbey rel=self if WebSub is disabled

https://github.com/FreshRSS/FreshRSS/issues/2654

* Correct variable

https://github.com/FreshRSS/FreshRSS/pull/2659#discussion_r347552063

* Update app/Controllers/feedController.php
2019-11-21 16:23:20 +01:00
Alexis Degrugillier
d3735d04fc Add log in fever api saving process (#2664)
Before, there was no user log when the fever api credential saving process
was failing. There was one though for the admin user but it did not appear
in the interface.
Now, there is a user log showing what the problem is. The admin log is still
there but catch only unknown errors.

See #2663
2019-11-18 10:04:32 +01:00
Alexis Degrugillier
59f284d229 Rename sharing action (#2643)
Before, some ad-blocker rules were preventing to display the sharing page
because of its name. I've renamed that page to integration but kept every
thing else identical. So it's still called sharing through out the
application.
If needed, this can be addressed as well.

See #2509 and #2419
2019-11-08 23:49:43 +01:00
Alexandre Alapetite
2495172a05 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]
```
2019-11-04 18:05:20 +01:00
Alexandre Alapetite
7819a43197 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
2019-11-04 17:45:15 +01:00
Alexandre Alapetite
c277e15141 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
2019-11-02 13:38:04 +01:00
Alexis Degrugillier
f6e10579f2 Add category order (#2592)
* Add category order

Each category has a new 'priority' attribute. It is used to sort categories in
views. Categories with the same priority are sorted alphabetically. Categories
with no priority are displayed after those with one.

For example, if we have the following categories:
- A (priority: 2)
- B (no priority)
- C (priority: 1)
- D (priority: 2)
- E (no priority)
- F (priority: 1)

They will be displayed in the following order:
- C
- F
- A
- D
- B
- E

See #190

* Shorten help text

It took too much room and will not be so necessary once we have drag &
drop
2019-10-26 13:16:15 +02:00
Alexis Degrugillier
cc0db9af4f Feature/new archiving (#2335)
* Change archiving config page layout

I've changed some wording and moved actions into a
maintenance section.

* Update purge action

Now we have more control on the purge action. The configuration allows
us to choose what to keep and what to discard in a more precise way.
At the moment, the configuration applies for all feeds.

* Add purge configuration on feed level

Now the extend purge configuration is available on feed level.
It is stored as attributes and will be used in the purge action.

* Update purge action

Now the purge action uses the feed configuration if it exists and
defaults on user configuration if not.

* Add empty option in period list

* Fix configuration warnings

* Add archiving configuration on categories

See #2369

* Add user info back

* Add explanations in UI

* Fixes for SQLite + error + misc.

* Fix invalid feed reference

* Short array syntax

Only for new code, so far

* Fix prefix error

* Query performance, default values

Work in progress

* Fix default values and confirm before leaving

Form cancel and confirm changes before leaving were broken.
And start taking advantage of the short echo syntax `<?= ?>` as we have
moved to PHP 5.4+

* More work

* Tuning SQL

* Fix MariaDB + performance issue

* SQL performance

* Fix SQLite bug

* Fix some attributes JSON encoding bugs

Especially for SQLite export/import

* More uniform, fix bugs

More uniform between global, category, feed settings

* Drop special cases for old articles during refresh

Instead will use lastSeen date with the new archiving logic.
This was generating problems anyway
https://github.com/FreshRSS/FreshRSS/issues/2154

* Draft drop index keep_history

Not needed anymore

* MySQL typo

Now properly tested with MySQL, PostgreSQL, SQLite

* More work for legacy values

Important to avoid overriding user's preference and risking deleting
data erroneously

* Fix PHP 7.3 / 7.4 warnings

@aledeg "Trying to use values of type null, bool, int, float or resource
as an array (such as $null["key"]) will now generate a notice. "
https://php.net/migration74.incompatible

* Reintroduce min articles and take care of legacy parameters

* A few changes forgotten

* Draft of migration + DROP of feed.keep_history

* Fix several errors

And give up using const for SQL to allow multiple database types (and we
cannot redefine a const)

* Add keep_min to categories + factorise archiving logic

* Legacy fix

* Fix bug yield from

* Minor: Use JSON_UNESCAPED_SLASHE for attributes

And make more uniform

* Fix sign and missing variable

* Fine tune the logic
2019-10-23 00:52:15 +02:00
Alexandre Alapetite
077e3cff45 Increase import size (#2563)
* Increase import size

This is merely a temporary workaround to allow at least some medium size
imports
https://framateam.org/freshrss/pl/7wbt4tcyetrfmris9xdcbq7uuw
The import module should be rewritten to process files one by one and as
data streams instead of loading multiple copies of the whole dataset in
memory as is the case now :-(
https://github.com/FreshRSS/FreshRSS/issues/1890
Note that the new SQLite export/import is distinct from this case.

* Use parameter
2019-10-08 20:52:03 +02:00
Alexandre Alapetite
e3e5954394 PDO refactoring for code simplification (#2522)
* PDO refactor

* Automatic prefix when using the syntax `_tableName`
* Uniformity: MySQL is now PDO::ATTR_EMULATE_PREPARES = false just like SQLite and PostgreSQL, with consequences such as only one statement per query
* Use PDO methods exec(), query(), prepare() + execute() in a more efficient way
* Remove auto-update SQL code for versions older than FreshRSS 1.5 (3 years old)
* The name of the default category is set in PHP instead of in the DB (simplies SQL and allows changing the name according to the FreshRSS language)
* Rename `->bd` to `->pdo` (less of a frenshism, and more informative)
* Fix some requests, which were not compatible with MySQL prepared statements

* Whitespace

* Fix syntax for PostgreSQL sequences

+ MySQL install

* Minor formatting

* Fix lastInsertId for PostgreSQL

* Use PHP 5.6+ const

Take advantage of https://github.com/FreshRSS/FreshRSS/pull/2527
https://www.php.net/manual/en/migration56.new-features.php

* A bit of forgotten PHP 5.6 simplification for cURL

* Forgotten $s

* Mini fix custom user config

https://github.com/FreshRSS/FreshRSS/pull/2490/files#r326290346

* More work on install.php but not finished

* install.php working

* More cleaning of PDO in install

* Even more simplification

Take advantage of PDO->exec() to run multiple statements

* Disallow changing the name of the default category

https://github.com/FreshRSS/FreshRSS/pull/2522#discussion_r326967724
2019-09-29 16:22:50 +02:00
Marien Fressinaud
410c4af6bb Redirect connected users accessing registration page (#2530) 2019-09-18 17:25:31 +02:00
Marien Fressinaud
a2ed6626c2 Add support for terms of service
This feature is optional. It is based on the presence of a
`data/tos.html` file that an administrator can create. If this file
exists, FreshRSS will automatically add a "ToS" checkbox on the
registration page that users must check to be able to create their
account.
2019-09-17 09:21:23 +02:00
Joris Kinable
80590daeb3 Configure user defaults (#2490)
* new users inherit defaults from config-user.php

* installer creates ./data/config-user.php

* fixed typo

* .gitignore fix

* fixed style issues

* Fixed comments

* Update according to feedback

- rename file into `data/config-user.custom.php`
- make it optional (and so, don't copy it during installation)

* fixup! Update according to feedback
2019-09-16 21:18:42 +02:00
Alexandre Alapetite
c76a318193 CLI to export/import any database to/from SQLite (#2496)
* CLI to export/import any database to/from SQLite

Require PHP 5.5+ https://github.com/FreshRSS/FreshRSS/pull/2495

* Travis

* Execution rights

* Fix wrong static fields

* Fix MySQL bad default buffering

https://stackoverflow.com/questions/6895098/pdo-mysql-memory-consumption-with-large-result-set/6935271#6935271
https://php.net/manual/ref.pdo-mysql

* Fix count on progression

* Avoid static DB information

To ease working with two DBs at the same time

* Less static, simplify

Needs some testing

* Small corrections

* Special case for SQLite to SQLite

* Modify special case for SQLite

* Remove special case for SQLite

More uniform logic for the 3 databases.
Fix wrong DROP TABLE for SQLite.

* Drop indexes

* Revert "Drop indexes"

This reverts commit f28d2bae09.

* Fix deletion

* Fix classic export

* Update cli/README.md

Co-Authored-By: Marien Fressinaud <dev@marienfressinaud.fr>

* Addressing part of review

* Remove goto 😢

* Travis

* Comment for SQLite case

* Fix missing fields when inserting
2019-09-15 21:36:53 +02:00
Marien Fressinaud
84f9311fd5 fix: Fix "validate email"-related issues (#2512)
* fix: Make sure $disable_aside is initialized

There was a warning for an uninitialized variable, hidden in production
but visible in development mode.

* fix: Allow to delete account when email isn't validated
2019-08-29 18:08:43 +02:00
Marien Fressinaud
75632e70f0 Provide email address verification feature (#2481)
* Add an email field to the profile page

I reuse the `mail_login` from the configuration. I'm not sure if it's
useful today (I would say it was used when Persona login was available).

A good improvement would be to rename `mail_login` into `email` so it
would be more intuitive to use.

* Add boolean to the conf to force email validation

This commit only adds a configuration item.

* Add email during registration if email must be validated

* Set email token to validate when email changes

* Block access to FreshRSS if email is not validated

* Send email when address is changed

* Allow to resend the validation email

* Allow the user to change its email while blocked

* Document the email validation feature

* fixup! Allow the user to change its email while blocked

* tec: Autoload PHPMailer lib

* Validate email address format

* Add feedback on validation email resend action

* Allow to logout when user is blocked

* fix: Change default email "from"

* Reorganize i18n keys

* Complete all the locales with default english

* Hide sidebar (profile page) if email is not validated

* Check email requirements on registration

* Allow admin to specify email when creating users

* Don't check email format if value is empty

* Remove trailing comma in userController

Co-Authored-By: Alexandre Alapetite <alexandre@alapetite.fr>

* Set PHPMailer validator to html5 before sending email

* fixup! Remove trailing comma in userController
2019-08-29 12:02:05 +02:00
Alexandre Alapetite
fd33d92d41 Require PHP 5.5+ (#2495)
* Require PHP 5.5+

https://github.com/FreshRSS/FreshRSS/issues/2469#issuecomment-522255093
I think it would be reasonable to require PHP 5.5+ for the core of
FreshRSS after all.

As Frenzie said, WordPress currently requires PHP 5.6.20+, and it is the
most popular PHP application.

We would loose about 20% of the PHP servers according to
https://w3techs.com/technologies/details/pl-php/5/all but I expect this
number to drop fast after the release of CentOS 8 (CentOS accounts for
17% of Linux servers
https://w3techs.com/technologies/details/os-linux/all/all ).

Distributions:
* no impact on Ubuntu, Fedora, Alpine, OpenWRT, FreeBSD, OpenSuze,
Mageia, as all active versions have PHP > 7
* no impact on OpenSuze, Synology, as all active versions have PHP > 5.5
* we drop Debian 8 Jessie (-2020) - we keep supporting Debian 9 Stretch
(2017-06) - current is Debian 10 Buster
* we drop Red Hat 7 (-2024) - we keep supporting RHEL 8 (2019-05)
* we drop CentOS 7 (-2024) - we will support CentOS 8 (to be released
soonish)

When dropping older versions, I can better like when it is for a good
reason, and there is actually one with PHP 5.5, namely generators
(yield) https://php.net/language.generators.overview which I consider
using.

* Version note for JSON.php

* hex2bin

* Update .travis.yml

Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
2019-08-20 14:55:43 +02:00
Marien Fressinaud
de26531178 tec: Provide a Minz_Mailer class (#2476)
* Add Minz_View::_path method (replace change_view)

The `_path` method is more powerful since it allows to choose the file
extension. It is also Minz_Request-agnostic, which is useful to reuse
the Minz_View class in other places.

`change_view` is now deprecated and a warning is logged if we use it.

* Provide a Minz_Mailer to send emails

It uses PHPMailer under the hood and only supports PHP >= 5.5
2019-08-15 17:19:12 +02:00
Joris Kinable
cb31874085 Added option to display authors under article titles (#2487)
This feature is particularly useful to display authors underneath scientific articles.
2019-08-14 15:16:06 +02:00
Marien Fressinaud
49e1a2c579 Allow to change the view layout (#2467)
The `_useLayout` function is marked as deprecated, replaced by a more
powerful `_layout` function.
2019-08-02 11:40:57 +02:00
Marien Fressinaud
89427e45e5 Clean access checks on userController (#2471)
The access was checked several times in some actions and had incoherent
behaviours. Also, the `firstAction` condition was a bit tricky to
understand.

This PR duplicates conditions across all the controller actions and
remove the `firstAction` which becomes useless.
2019-07-31 13:52:20 +02:00
Alexandre Alapetite
ad19b6bf2e Fix wrong mark-as-read maxId argument (#2431)
Fix https://github.com/FreshRSS/FreshRSS/issues/2429
2019-06-29 20:47:38 +02:00
Alexis Degrugillier
2decc82c3e Change category configuration (#2410)
* Change category configuration

Before, we had a drop-down list to interract on categories. It was not
working the same way as feeds.
Now, categories and feeds behave in a similar manner. At the moment,
there is no change in features but it will allow to expand them.

See #2369

* Minor whitespace
2019-06-21 08:42:06 +02:00
Alexis Degrugillier
7f1ff77f25 Allow email as username (#2407)
* Allow email as username

Before, it was possible to register email as username on cli but not in the
interface. This was caused by a bug in the pattern which was not working as
expected. If your input was "user@example.com", the PHP verification was
catching only "user" and was acting like the whole thing was catched. But
on the interface, the catching was unsuccesful.
Now, the catching should be working properly.

I needed to add "$|^" in the pattern because without, I was catching either
the beginning of a string either the last char. This was introduced as a
workaround for IE/Edge pattern matching on April 27, 2017. See #1511 for
more information.

I tested it only on FF. Tests on other browsers wanted.

See #2391

* Relax and fix username check

Allow @ + -

* Remove + for now

https://github.com/FreshRSS/FreshRSS/pull/2407#issuecomment-502469137
2019-06-16 20:10:01 +02:00
Alexander Steinhöfer
0904f159b3 Configurable amount of feeds that gets refreshed.
Enhanced actualizeFeed with a maxFeeds-Parameter, so that a
user can control how many feeds he wants to refresh instead
of being force to choose between "10 or all".
2019-04-29 09:59:18 +02:00
Alexandre Alapetite
295cb89af3 Fix PHP 5.5 compat for array const (#2360)
https://github.com/FreshRSS/FreshRSS/issues/2359
2019-04-07 21:39:48 +02:00
Alexis Degrugillier
0eea6d5ab5 Revert "Update git command (#2331)"
This reverts commit afd1a8784c.
2019-04-03 17:38:17 +02:00
Alexis Degrugillier
afd1a8784c Update git command (#2331)
I removed an unnecessary option and rewrote a short option
to use the long option. I find it's easier to understand
long options when you don't type them.
2019-04-03 08:02:43 +02:00
Alexandre Alapetite
d9e246ecf7 Shortcuts legacy (#2320)
Fix https://github.com/FreshRSS/FreshRSS/issues/2316
2019-04-02 00:08:51 +02:00
Alexandre Alapetite
1804c0e0bc Filter actions (#2275)
* Draft of filter actions

* Travis

* Implement UI + finish logic

* Travis
2019-03-23 22:52:47 +01:00
Alexandre Alapetite
ebd8c31c02 Rework CSRF interaction with sessions (#2290)
* Rework CSRF interaction with sessions

Fix https://github.com/FreshRSS/FreshRSS/issues/2288
Improve security in some edge cases
Maybe relevant for
https://github.com/FreshRSS/FreshRSS/issues/2125#issuecomment-474992671

* Forgotten mime type
2019-03-22 19:05:38 +01:00
Alexandre Alapetite
834ffacce2 No old ID (#2276)
* No old ID

https://github.com/FreshRSS/FreshRSS/issues/2273

* PostgreSQL insert or ignore
2019-03-19 20:14:31 +01:00
Alexandre Alapetite
2856f7b8b4 Revert wrong boolean 2019-03-02 21:06:56 +01:00
Alexandre Alapetite
7d76acad04 Re-introduce Travis workaround 2019-03-02 20:56:03 +01:00
Alexandre Alapetite
f1978da394 Boolean error 2019-03-02 20:43:51 +01:00
Alexandre Alapetite
2b2d9583cd Fix mark_updated_article_unread
https://github.com/FreshRSS/FreshRSS/issues/2200
2019-03-02 20:39:18 +01:00
Alexandre Alapetite
2374374ba9 Less jQuery (#2234)
* Less jQuery

Follow-up of https://github.com/FreshRSS/FreshRSS/pull/2199

* Even less jQuery + global view unread title fix

* Even less jQuery

* Yet even less jQuery

* Even less jQuery

* Reduce some events

* Even less jQuery

* jQuery gone from main view

+Fixed English i18n

* Fix feed folded view

* Remove Firefox 64 workaround

Remove workaround for Gecko bug 1514498 in Firefox 64, fixed in Firefox
65

* Split to extra.js

Avoid loading unneeded JavaScript code for the main view.
+ several adjustements

* Improve CSS transition fold category

* Rewrite shortcuts

Remove library. Much faster, shorter, one listener instead of many.
Control of the shortcut context.
Fix https://github.com/FreshRSS/FreshRSS/issues/2215

* Remove debug

* Minor syntax

* Filter out unwanted shortcut modifiers

* Menu overflow fix

* Typo

* Fix unfolding in mobile view

* Remove jQuery from category.js

* Remove jQuery from Global view
2019-02-13 15:06:28 +01:00
Alexandre Alapetite
ef6df8aeca Merge branch 'dev' into dev-1.14.0 2019-01-26 21:08:27 +01:00
Alexandre Alapetite
7902d10b3a Import FeedBin (#2228)
* Import FeedBin

https://github.com/FreshRSS/FreshRSS/issues/2227
And more tolerant import

* Mute import fake feed + Changelog

* strtotime for published dates in string
2019-01-26 12:55:12 +01:00
Alexandre Alapetite
f1ac6dd550 Export/import articles read/unread state (#2226) 2019-01-24 20:44:45 +01:00
Alexandre Alapetite
f0684d7018 Fix import labels (#2225)
All labelled articles were wrongly marked as starred.
2019-01-24 19:54:34 +01:00
Alexandre Alapetite
34fe41ac78 Merge branch 'FreshRSS/dev' into FreshRSS/dev-1.14.0 2019-01-17 21:36:29 +01:00