Commit Graph

537 Commits

Author SHA1 Message Date
Alexis Degrugillier
e1ee58816b Add a file for each PDO class (#3297)
Before, we had 5 classes in the ModelPdo file. It was bad for 2 reasons.
The first reason is that it is considered bad practice to have multiple
class in one file. This is especially true when using autoloading. On top
of that it is less readable considering the size of the file. The second
reason is that so far we were lucky. Everytime we needed to access the
database, it was through the ModelPdo class which loads all the other
classes. If we want to access directly the connection, it wont be loaded.
On top of that, the system is configured to work on a single database,
but as we have every connection definition in a single file, all classes
were loaded at the same time. Thus using memory and processing time for
nothing.
Now, we have a file for each class. To work with autoloading, classes
were slightly renamed to match autoloading rules.
2020-12-28 16:44:08 +01:00
Alexandre Alapetite
ac0d90c100 Auto-renew cookie (#3287)
#fix https://github.com/FreshRSS/FreshRSS/issues/3169#issuecomment-685983797
Supplement https://github.com/FreshRSS/FreshRSS/pull/3170

When we get the long-term login cookie (i.e. when starting a new session), renew it at the same time for the same duration
2020-12-28 13:09:57 +01:00
Martin
6ecfc01c1f bump default logout from 30 days to 3 months (#3170)
* bump default logout from 30 to 365 days

* * Change cookie duration to constant
* Change cookie duration to three months

* use class

* use 90 days (otherwise login form says 91.3 days)

* change class

* also this works now

Co-authored-by: Martin Rys <martin@rys.pw>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2020-12-26 23:40:24 +01:00
Alexis Degrugillier
4abb30228b Fix user queries with labels (#3285)
Before user queries with labels were not translated. Actually, it was not
even processed.
Now those user queries are translated properly.

See #3215
2020-12-26 12:50:09 +01:00
Alexandre Alapetite
08a5cf5946 Ensure maximum date int (#3259)
#fix https://github.com/FreshRSS/FreshRSS/issues/3258
2020-11-23 23:04:06 +01:00
Prashant Tholia
6f23999c7b Remember open categories (#3185)
* feature(normal) - Remember opened categories in the left menu

Session storage based implementation to remember opened categories in left menu

Issue Ref: #2248

* lib_phpQuery updates

* Updates covering feedback points and functionality fixes

* Feedback updates

* Revert "lib_phpQuery updates"

This reverts commit dcd23b9418.

* First review

Change variable name to "remember" instead of "open".
Start using localStorage instead of sessionStorage.
Simplify code.

* Simplify remember categories init function

Replace 'session' with 'local' in function names and comment

Set open categories CSS as same as when category is opened in 'active' unfold mode

* Remove URLSearchParams check in remember categories init function

* Delete open categories on login and logout

* JSHint check fix

* Second review

* Make new mode the default for new users
* Always open active category
* Reduce / simplify code

* i18n French

* Revert default value

Wait a bit more for this decision / change

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2020-11-02 12:03:16 +01:00
Alexandre Alapetite
f33e261163 Fix sanitize feed description (#3222)
* Fix sanitize feed description

#fix https://github.com/FreshRSS/FreshRSS/issues/3221

* Simplification
2020-10-11 13:32:23 +02:00
Alexandre Alapetite
0319cc9d23 Minz allow parallel sessions (#3096)
* Minz allow parallel sessions

#fix https://github.com/FreshRSS/FreshRSS/issues/3093

* Array optimisation

* Array optimisation missing

* Reduce direct access to $_SESSION except in install process

* Fix session start headers warning

* Use cookie only the first time the session is started:
`PHP Warning:  session_start(): Cannot start session when headers
already sent in /var/www/FreshRSS/lib/Minz/Session.php on line 39`

* New concept of volatile session for API calls

Optimisation: do not use cookies or local storage at all for API calls
without a Web session
Fix warning:

```
PHP Warning:  session_destroy(): Trying to destroy uninitialized session
in Unknown on line 0
```

* Only call Minz_Session::init once in our index

It was called twice (once indirectly via FreshRSS->init())

* Whitespace

* Mutex for notifications

Implement mutex for notifications
https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499509809

* Typo

* Install script is not ready for using Minz_Session
2020-10-06 23:19:45 +02:00
Alexandre Alapetite
be5f9f2dce When ssl_verify is false, decrease SSL security (#3171)
When ssl_verify option is set to false for a feed, allow lower security such as SHA-1 signatures.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900984
https://stackoverflow.com/questions/58342699/php-curl-curl-error-35-error1414d172ssl-routinestls12-check-peer-sigalgwr
Fix error of type `cURL error 35: error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature`
Example of feeds:
https://www.version2.dk/it-nyheder/rss
https://ing.dk/rss/nyheder
2020-09-03 10:35:23 +02:00
Alexandre Alapetite
6fac0e40c4 Fix tag in user query (#3168)
* Fix tag in user query

#fix https://github.com/FreshRSS/FreshRSS/issues/3163

* Fix Travis
2020-09-02 08:55:43 +02:00
Luc SANCHEZ
ca965a490d Fix variable undeclared ($sql) (#3165)
* Fix variable undeclared ($sql)

* Update DatabaseDAOSQLite.php

modify
2020-09-01 12:50:00 +02:00
Alexis Degrugillier
ee31722072 Change feed order in a category (#3131)
Before, the sorting was not human readable. Lower-cased feed names were
displayed after upper-cased feed names.
Now, the sorting is human readable. The sorting is done without taking into
account the name case.

See #3128
2020-08-05 09:40:58 +02:00
Alexandre Alapetite
c523f5a4e7 Relaxed to allow underscore _ in URL hostnames (#3133)
* Relaxed to allow underscore _ in URL hostnames

#fix https://github.com/FreshRSS/FreshRSS/issues/3132
https://bugs.php.net/bug.php?id=64948

* Minor fix in favicons redirect

* Minor fix in relative HREF for favicons
2020-07-31 16:33:45 +02:00
Alexis Degrugillier
909fdaca31 Add tag management page (#3121)
The new page allows to create, delete and rename tags.

See #3058
2020-07-23 11:31:38 +02:00
Alexis Degrugillier
8d8211b2a5 Add machine-readable dates in views (#3106)
This will allow to make some transformations on dates when needed.
See #3103 and #853
2020-07-14 10:51:45 +02:00
Alexandre Alapetite
3f9518b377 Hide feed credentials when adding a new feed (#3099)
Avoid showing HTTP Basic Auth credentials in feed error log and in feed
title (when there is no title provided)
2020-07-07 10:54:28 +02:00
bpatath
5c9d6a5396 Add auto-registration when using http_auth (#3003)
* Add auto-registration when using http_auth

* Document HTTP auth auto-registration

* Check email variable for HTTP auth auto-registration

* Auto-create HTTP users by default

* Fix Context init

(I will provide in another PR a better fix requiring a bit of global refactoring)

* Init language

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2020-06-19 23:01:19 +02:00
Alexandre Alapetite
6edbeaaf6a Add error log (#3055)
For https://github.com/FreshRSS/FreshRSS/issues/3054
2020-06-13 21:19:19 +02:00
Alexis Degrugillier
d4554fa087 Change add feed action (#3027)
* Docker Alpine 3.12 (#3025)

https://alpinelinux.org/posts/Alpine-3.12.0-released.html
With PHP 7.3.18 (from 7.3.17) (and Apache 2.4.43 unchanged).
No other significant change spotted

* Ensure feed attributes are used before load

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2020-06-05 10:09:31 +02:00
Alexandre Alapetite
e58ad65902 Fix display_categories upgrade from 1.16.0 again (#3019)
* Fix display_categories upgrade from 1.16.0 again

#fix https://github.com/FreshRSS/FreshRSS/issues/3017
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/3018
There were two bugs. I forgot that `ConfigurationSetter.php` is not
called when reading `config.php`

* Changelog 3019
2020-05-30 22:48:00 +02:00
Alexandre Alapetite
f6bfcba827 Fix display_categories upgrade from 1.16.0 (#3018)
* Fix display_categories upgrade from 1.16.0

#fix https://github.com/FreshRSS/FreshRSS/issues/3017
The property `'display_categories' => boolean,` in 1.16.0 is not properly converted to `'display_categories' => 'string',` in 1.16.1 due to a weak type comparison bug.
2020-05-30 21:06:46 +02:00
Alexandre Alapetite
fe1e02dab9 Fix PostgreSQL database auto-create with limited rights (#3013)
* Fix PostgreSQL database auto-create with limited rights

#fix https://github.com/FreshRSS/FreshRSS/issues/3009
Install would fail if the user is not even allowed to connect to the default `postgres` database.

* Confused by custom Minz_PDOConnectionException
2020-05-29 23:55:53 +02:00
Alexandre Alapetite
e1ef88d815 Fix memory leak when using lib_phpQuery (#3004)
* Fix memory leak when using lib_phpQuery

This library keeps documents in static class, so it requires a special
call to clean them.

* Another unload
2020-05-25 16:02:52 +02:00
Alexandre Alapetite
857f588790 Fix fetch preview (#2993)
* Fix fetch preview

#fix https://github.com/FreshRSS/FreshRSS/issues/2923
In MariaDB / MySQL, we cannot start a new query if we have not consumed
the previous buffered query fully.

* Fix for reload

* Typo in comment
2020-05-21 20:55:06 +02:00
Alexandre Alapetite
b906d79d61 getContentByParsing follow HTML redirections (#2985)
* getContentByParsing follow HTML redirections

Add the ability to follow HTML redirections in getContentByParsing:

```html
<meta http-equiv="Refresh" content="1; url=https://example.net/article123.html" />
```

* Better regex

* Trim http-equiv
2020-05-21 11:56:55 +02:00
Alexandre Alapetite
83b5944dcb Stream instead of memory copy of SimplePie entries (#2972)
* Stream instead of memory copy of SimplePie entries

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

* Undo lines delete

* Typo

* Remove unaccessible code

https://github.com/FreshRSS/FreshRSS/pull/2972/files#r425624163

* Back-compatibility for Feed->entries

https://github.com/FreshRSS/FreshRSS/pull/2972/files#r425631913
2020-05-17 00:04:51 +02:00
Alexandre Alapetite
aea3806590 Attempt to reduce max memory usage during actualize (#2955)
* Attempt to reduce max memory usage during actualize

#Fix https://github.com/FreshRSS/FreshRSS/issues/2952

* Use memory_get_peak_usage
2020-05-10 21:34:12 +02:00
Alexandre Alapetite
b1aac20839 Fever integer type for numbers (#2946)
* Fever integer type for feed ID

#Fix
https://github.com/FreshRSS/FreshRSS/issues/2940#issuecomment-623022435

* Fix feed_id

* Ensure string for entry ID

To be compatible with 32-bit platforms.
Before, the type was inconsistent depending on architecture + database

* Integer for entry count functions
2020-05-03 13:39:16 +02:00
Alexandre Alapetite
83ba09c2a5 Fever integer type for last_refreshed_on_time 2 (#2945)
#Fix fever_last_refreshed_on_time
Try again https://github.com/FreshRSS/FreshRSS/pull/2944
2020-05-02 23:55:10 +02:00
Alexandre Alapetite
dba40e5870 WebSub move fixes (#2922)
Small fixes related to when WebSub changes address:
* When unsubscribing, one must use the current/old address, not the
newly found selfUrl;
* This change
https://github.com/FreshRSS/FreshRSS/pull/2659#discussion_r347263068 was
wrong, so reverted to the first version. We must obey the rules also for
feeds for which the initial WebSub enabling is not finished, otherwise
we never have a chance to redirect the feed to the proper selfUrl.
2020-04-24 16:29:19 +02:00
Alexandre Alapetite
ae70374b03 Filter by multiple feed IDs (#2892)
Add the possibility to filter by feed ID like `f:123 more-search`
or multiple feed IDs, like `f:123,234,345 more-search` or an exclusion
like `!f:456,789 more-search`
2020-04-17 10:57:35 +02:00
Alexandre Alapetite
a49db010e4 A wrong login must return HTTP 403 (#2903)
* A wrong login must produce HTTP 403

#fix https://github.com/FreshRSS/FreshRSS/issues/2901
https://github.com/FreshRSS/FreshRSS/pull/2794/files#r389319248

* Just for consistency
2020-04-17 10:56:06 +02:00
Alexandre Alapetite
bdc4da6ad0 Expose podcast in API (#2898)
* Expose podcast in API

Expose RSS enclosures in our API, e.g. for clients supporting podcasts

* PHP CS?

* Annoying linter

* Light optimisation
2020-04-16 18:11:26 +02:00
Alexandre Alapetite
5ddae68953 Option to control which categories to unfold (#2888)
#fix https://github.com/FreshRSS/FreshRSS/issues/2324
2020-04-16 18:09:54 +02:00
Alexandre Alapetite
61c8026ac9 Implement negation for searching by date intervals (#2869)
* Implement negation for searching by date intervals

#fix https://github.com/FreshRSS/FreshRSS/issues/2866
Allow searching for e.g. `!date:P1W` to exlude all articles newer than
one week.
More generally, allows exclusion on some date intervals.

* Fix OR
2020-04-01 17:26:19 +02:00
Alexandre Alapetite
5858aaf7fc API return proper newestItemTimestampUsec (#2854)
* API return proper newestItemTimestampUsec

#fix https://github.com/FreshRSS/FreshRSS/issues/2853

* Minor naming

* Add newestItemTimestampUsec for labels

* Do not use t.name after all
2020-04-01 02:08:45 +02:00
Alexandre Alapetite
be582713fe Fix action filter when filtering on author (#2863)
#fix https://github.com/FreshRSS/FreshRSS/issues/2806
Bug: array instead of string
2020-03-31 17:57:05 +02:00
Alexandre Alapetite
cedbbff582 Allow feed to be actualized after being truncated (#2862)
Before, on had to wait for the cache to expire before being able to
refresh a feed that had been truncated via the Web interface.
Now, one can "delete all articles" and hit "actualize" imediately after
without problem.
Useful for testing filters, debugging e.g.
https://github.com/FreshRSS/FreshRSS/issues/2806
2020-03-31 14:15:51 +02:00
Alexandre Alapetite
128b336788 Fix share warning with Wallabag (#2817)
#fix https://github.com/FreshRSS/FreshRSS/issues/2812

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2020-03-08 00:08:20 +01:00
Alexandre Alapetite
0f94402b7e Better performance with yield (#2588)
* Better performance with yield

Largely decrease the time to first byte, and reduced memory consumtion.
Before, we used to make several copies in memory of the whole list of
articles before sending them to the client. Now streamed as they are
processed.

* Travis
2020-02-29 18:19:09 +01:00
Alexandre Alapetite
e9f879b411 Fallback to GUID when entry title is empty (#2813)
When entries have an empty title, our UI was a bit broken. In this
(rare) case, we revert to GUID, which is always non-empty.
2020-02-29 18:14:29 +01:00
shn7798
0b6d39a795 Fix wrong foreach in applyFilterActions (#2809) 2020-02-29 16:12:04 +01:00
Alexandre Alapetite
925319653d No pre for enclosure-description (#2808)
* No pre for enclosure-description

#fix https://github.com/FreshRSS/FreshRSS/issues/2807
In browsers, the styling `white-space:pre-line` will be applied by CSS,
but no styling will be done for clients via API.

* Corresponding CSS change
2020-02-29 15:58:31 +01:00
Julien-Pierre Avérous
d30ac40772 Enhance content path feature (#2778)
- Add a maintenance section to be able to clear cache and force reload a feed.
- Add an icon next to path field to show a pop-up with the result of the content path.

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Marien Fressinaud <dev@marienfressinaud.fr>
2020-02-13 18:22:35 +01:00
Alexandre Alapetite
e537bcc397 Fix null array index bug for PHP 7.4 (#2780)
Fix https://github.com/FreshRSS/FreshRSS/issues/2775
Especially for PHP 7.4+ "Array-style access of non-arrays"
https://php.net/migration74.incompatible
2020-01-20 19:28:13 +01:00
Alexandre Alapetite
cd5ebcee05 Fix SQLite CONCAT used for search (#2777)
Used e.g. for searches `inurl:xxx`

Co-authored-by: Marien Fressinaud <dev@marienfressinaud.fr>
2020-01-20 11:42:44 +01:00
Julien-Pierre Avérous
f3ff4a59e6 Fix 'dateAdded()' getter (#2774)
Be homogeneous in field used, to prevent weird behavior in the future.
2020-01-20 11:23:55 +01:00
Julien-Pierre Avérous
01576e6317 [API, extension] Use 'dateAdded()' to forge 'crawlTimeMsec' & 'timestampUsec' field in greader API. (#2773)
- Add the ability to customize 'dateAdded()', so an extension can change it if needed.
2020-01-18 11:58:46 +01:00
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
Marien Fressinaud
d7ac234036 fix: Make sure to have user conf in hasAccess (#2769)
The `FreshRSS_Auth::hasAccess` method is called during auth
initialization (`app/FreshRSS.php:78`), only for `user#create` action.
However, at this step, the `user` configuration namespace hasn't be
initialized yet, and so users weren't able to register because of the
exception... quite critical!
2020-01-16 14:25:51 +01:00