60 Commits

Author SHA1 Message Date
Alexandre Alapetite
5eba322cbd New stats overview of dates with most unread articles (#8089)
New view with direct links to dates with most unread articles:

<img width="734" height="581" alt="image" src="https://github.com/user-attachments/assets/159a39b3-3a06-4ae9-9cc0-62ae36d9db9c" />
2025-10-14 11:05:17 +02:00
Alexandre Alapetite
bc3e4c8fa4 Add option for CSP frame-ancestors (#7857)
* Add option for CSP frame-ancestors
https://github.com/FreshRSS/FreshRSS/discussions/7856

* Revert contentSelectorPreviewAction

* Same for f.php and api

* Fix double init in f.php

* No sandbox for API page
2025-09-21 13:29:58 +02:00
Inverle
e20b0c8c02 Fix displaying of current date in main statistics (#7892)
Before

<img width="1034" height="543" alt="image" src="https://github.com/user-attachments/assets/09408f81-42f1-4613-948b-b2c7e3ff2409" />

After

<img width="1031" height="536" alt="image" src="https://github.com/user-attachments/assets/d4dd3702-c8a5-4f8d-9014-b419a982d9ec" />

The current day is now included within statistics.

The `-1` thing started happening after #7752 but I'm not sure whether the correct solution is to display the current day or just fix it in the JS

For reference here's what the chart used to looked like:

<img width="1027" height="536" alt="image" src="https://github.com/user-attachments/assets/47a27bad-6593-4e84-a04f-e4385f601c6a" />
2025-09-01 23:25:58 +02:00
Inverle
7df6c201f2 Put CSP everywhere (#7810)
* Puts CSP everywhere in `p/api`
   * including the HTML query page 
   * Also in `p/ext.php`
* Puts `X-Content-Type-Options: nosniff` everywhere
* Fixes custom icon configuration not showing `blob:` icon in statsController (idle feeds)
   * Also removes `style-src 'unsafe-inline'` since it doesn't seem to be needed
* Improves CSP of `p/f.php`

* Add `sandbox` directive
2025-08-11 19:35:54 +02:00
Inverle
6f7bea4a5a Update chart.js from 3.5.1 to 4.5.0 (#7752) 2025-07-25 23:05:13 +02:00
Inverle
a6948218fb frame-ancestors CSP (#7677) 2025-06-18 22:20:17 +02:00
Alexandre Alapetite
5368f38753 Reduce undeeded use of elvis operator ?: (#7204) 2025-01-10 08:13:09 +01:00
Alexandre Alapetite
b1d24fbdb7 PHPStan 2.0 (#7131)
* PHPStan 2.0
fix https://github.com/FreshRSS/FreshRSS/issues/6989
https://github.com/phpstan/phpstan/releases/tag/2.0.0
https://github.com/phpstan/phpstan/blob/2.0.x/UPGRADING.md

* More

* More

* Done

* fix i18n CLI

* Restore a PHPStan Next test
For work towards PHPStan Level 10

* 4 more on Level 10

* fix getTagsForEntry

* API at Level 10

* More Level 10

* Finish Minz at Level 10

* Finish CLI at Level 10

* Finish Controllers at Level 10

* More Level 10

* More

* Pass bleedingEdge

* Clean PHPStan options and add TODOs

* Level 10 for main config

* More

* Consitency array vs. list

* Sanitize themes get_infos

* Simplify TagDAO->getTagsForEntries()

* Finish reportAnyTypeWideningInVarTag

* Prepare checkBenevolentUnionTypes and checkImplicitMixed

* Fixes

* Refix

* Another fix

* Casing of __METHOD__ constant
2024-12-27 12:12:49 +01:00
Alexandre Alapetite
350edf398c PHP 8.3 #[\Override] (#6273)
* PHP 8.3 #[\Override]
https://php.watch/versions/8.3/override-attr

With PHPStan `checkMissingOverrideMethodAttribute` https://phpstan.org/config-reference#checkmissingoverridemethodattribute

And modified the call to phpstan-next on the model of https://github.com/FreshRSS/Extensions/pull/228 (more robust than the find method, which gave some strange errors)

* Update extension example accordingly
2024-04-10 15:33:43 +02:00
Alexandre Alapetite
39cc1c11ec New feature: shareable user query (#6052)
* New feature: shareable user query
Share the output of a user query by RSS / HTML / OPML with other people through unique URLs.
Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people.
Also add a new HTML output for people without an RSS reader.

fix https://github.com/FreshRSS/FreshRSS/issues/3066#issuecomment-648977890
fix https://github.com/FreshRSS/FreshRSS/issues/3178#issuecomment-769435504

* Remove unused method

* Fix token saving

* Implement HTML view

* Update i18n for master token

* Revert i18n get_favorite

* Fix missing i18n for user queries from before this PR

* Remove irrelevant tests

* Add link to RSS version

* Fix getGet

* Fix getState

* Fix getSearch

* Alternative getSearch

* Default getOrder

* Explicit default state

* Fix test

* Add OPML sharing

* Remove many redundant SQL queries from original implementation of user queries

* Fix article tags

* Use default user settings

* Prepare public search

* Fixes

* Allow user search on article tags

* Implement user search

* Revert filter bug

* Revert wrong SQL left outer join change

* Implement checkboxes

* Safe check of OPML

* Fix label

* Remove RSS button to favour new sharing method
That sharing button was using a global admin token

* First version of HTTP 304

* Disallow some recusrivity
fix https://github.com/FreshRSS/FreshRSS/issues/6086

* Draft of nav

* Minor httpConditional

* Add support for offset for pagination

* Fix offset pagination

* Fix explicit order ASC

* Add documentation

* Help links i18n

* Note about deprecated master token

* Typo

* Doc about format
2024-02-26 09:01:03 +01:00
Alexandre Alapetite
d65f77c081 More robust assignment of categories to feeds (#5986)
Several minor cases, none of which should really be necessary
Might help:
https://github.com/FreshRSS/FreshRSS/issues/5981
https://github.com/FreshRSS/FreshRSS/issues/5982
2023-12-27 15:18:36 +01:00
Alexandre Alapetite
a3ed826913 Remove variable default_category (#5945)
Not really used, and causing bug in https://github.com/FreshRSS/FreshRSS/pull/5942

```
Fatal error: Uncaught Error: Typed property FreshRSS_View::$default_category must not be accessed before initialization in /var/www/FreshRSS/app/views/helpers/category/update.phtml:218 Stack trace: #0 /var/www/FreshRSS/lib/Minz/View.php(93): include() #1 /var/www/FreshRSS/lib/Minz/View.php(143): Minz_View->includeFile() #2 /var/www/FreshRSS/app/views/category/update.phtml(9): Minz_View->renderHelper() #3 /var/www/FreshRSS/lib/Minz/View.php(93): include('...') #4 /var/www/FreshRSS/lib/Minz/View.php(115): Minz_View->includeFile() #5 /var/www/FreshRSS/lib/Minz/View.php(75): Minz_View->render() #6 /var/www/FreshRSS/lib/Minz/Dispatcher.php(59): Minz_View->build() #7 /var/www/FreshRSS/lib/Minz/FrontController.php(61): Minz_Dispatcher->run() #8 /var/www/FreshRSS/p/i/index.php(59): Minz_FrontController->run() #9 {main} thrown in /var/www/FreshRSS/app/views/helpers/category/update.phtml on line 218
```
2023-12-14 22:11:04 +01:00
Alexandre Alapetite
76cbfadcdf Fix types for extensions (#5901)
* Fix types for extensions
To accompany https://github.com/FreshRSS/Extensions/pull/185

* Avoid bug redeclared function
2023-11-24 14:50:03 +01:00
Luc SANCHEZ
30c7a61a9b Use strict_types (#5830)
* Little's optimisations and booleans in conditions

* Apply strict type

* Apply strict type

* Apply strict type

* Fix multiple bugs with PHP 8.2 and 8.3

* Many declares missing, more errors fixed

* Apply strict type

* Another approach

* Stronger typing for Minz_Session

* Fix case of SQLite

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-11-16 22:43:00 +01:00
Alexandre Alapetite
98559cebc3 Remove obsolete TTL migration code (#5625)
Remove `updateTTL` function used to help migration to 5+ year-old FreshRSS 1.10 and FreshRSS 0.7.3 https://github.com/FreshRSS/FreshRSS/pull/1750
This function contributed to locking the database https://github.com/FreshRSS/FreshRSS/pull/5574
Subset of https://github.com/FreshRSS/FreshRSS/pull/3558
2023-09-06 21:41:17 +02:00
Luc SANCHEZ
f8f163d054 Chore/processing of depreciations and updating code to php72 minimum (#5504)
* processing of depreciations and updating of code to php7.2 minimum

* Autoformat many strange array indenting
And revert a few unwanted changes

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-07-07 22:36:27 +02:00
Alexandre Alapetite
6e2f2f1c1e A few additional PHPStan rules (#5388)
A subset of
https://github.com/phpstan/phpstan-strict-rules
2023-05-11 13:02:04 +02:00
Alexandre Alapetite
fe7d9bbcd6 Typed view model classes (#5380)
* Typed view model classes
* Add ability to provide a typed view model class to a controller
* Use `::class` instead of string for referring to classes
* Examplified with `stats` and `javascript` controllers / views (more to do)
* Also useful for extensions (my usecase today), which did not have the ability to define own view model attributes before.

* Typo
2023-05-11 12:53:32 +02:00
Alexandre Alapetite
bd9fa803f1 PHPStan Level 7 complete DAOs (#5354)
* PHPStan Level 7 complete DAOs

* Finalise PHPStan Level 7 for CategoryDAO

* PHPStan Level 7 for Context and Search

* Apply suggestions from code review

Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com>
2023-05-02 14:38:32 +02:00
Alexandre Alapetite
c72914bba2 PHPStan Level 7 for more DAO PDO (#5328)
* PHPStan Level 7 for more DAO PDO
With new function to address common type and check problems

* A bit more

* PHPStan Level 7 for FreshRSS_Entry
2023-04-28 14:01:11 +02:00
Alexandre Alapetite
f3760f138d Complete PHPStan Level 6 (#5305)
* Complete PHPStan Level 6
Fix https://github.com/FreshRSS/FreshRSS/issues/4112
And initiate PHPStan Level 7

* PHPStan Level 6 for tests
* Use phpstan/phpstan-phpunit
* Update to PHPStan version 1.10

* Fix mixed bug

* Fix mixed return bug

* Fix paginator bug

* Fix FreshRSS_UserConfiguration

* A couple more Minz_Configuration bug fixes

* A few trivial PHPStan Level 7 fixes

* A few more simple PHPStan Level 7

* More files passing PHPStan Level 7
Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251

* A few more PHPStan Level 7 preparations

* A few last details
2023-04-17 08:30:21 +02:00
Alexandre Alapetite
6c01e4e7d6 Use typed access to request parameters (#5267)
* Use typed access to request parameters
This was a big source of mixed datatypes in many places

* Fix notifications

* Fix bookmarkAction
2023-04-07 00:13:49 +02:00
Alexandre Alapetite
1ee2a3d72d Fix repartitionAction (#5228)
* Fix repartitionAction
Fix https://github.com/FreshRSS/FreshRSS/issues/5227

* Better types

* PHPStan level 6
2023-03-26 21:42:56 +02:00
Luc SANCHEZ
247215ffaa Typehint some Controllers (#5106)
* Typehint to Controllers

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
2023-03-21 18:57:57 +01:00
Alexandre Alapetite
1c434971d4 statsController at phpStan level 9 (#5028)
Follow up of https://github.com/FreshRSS/FreshRSS/pull/5024

```
vendor/bin/phpstan analyse --level 9 app/Controllers/statsController.php
```

Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112
2023-01-21 23:20:44 +01:00
Luc SANCHEZ
75a203fff2 Type hinting statsController.php (#5024) 2023-01-20 23:37:41 +01:00
Alexandre Alapetite
f89819bd64 Custom logo HTML (#4369)
* Custom logo HTML
Add option for custom HTML logo/title in the main Web UI view.
Can potentially be different per user.
#fix https://github.com/FreshRSS/FreshRSS/pull/3830/files#r850472247

* logo_html in main config
With new `./data/config.custom.php` to provide custom values before install

* Docker documentation

* whitespace

* Auto relax CSP to allow images for HTML logo

* Documentation
2022-05-23 14:03:19 +02:00
maTh
807ea755e0 fix preview (#4291)
* fix

* Update extra.js

* reorga the scripts

* Update extra.js

* Several fixes
https://github.com/FreshRSS/FreshRSS/pull/4291#issuecomment-1125472321

* More fixes

* Cleaning

* fix pr 4291

* Reorganise some script functions

* Remove unused popup-txt
And associated function openPopupWithMessage

* Fix archiving categories
https://github.com/FreshRSS/FreshRSS/pull/4291#issuecomment-1126924602

* Fix stats
https://github.com/FreshRSS/FreshRSS/pull/4291#issuecomment-1126983134

* Fix direct subscription
E.g. http://localhost/i/?c=subscription&id=735

* Fix subscription add
https://github.com/FreshRSS/FreshRSS/pull/4291#issuecomment-1126991621

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-05-15 21:52:52 +02:00
Alexandre Alapetite
6f018cc674 Show errored, empty, muted feeds in statistics (#4276) 2022-03-21 12:51:26 +01:00
maTh
be9c06fd5c Improved: Idle feeds list in a new layout (#4192)
* that should work fine

* fixed phpcs

* fixed phpcs
2022-02-05 10:57:36 +01:00
Alexandre Alapetite
4e2dff4591 Add spell checking with typos (#4138)
* Add spell checking with typos
Implement https://github.com/FreshRSS/FreshRSS/pull/4134#issuecomment-1008027558

* GitHub Actions attempt

* Quiet wget

* Makefile
2022-01-09 18:21:40 +01:00
Alexandre Alapetite
1335a0e3cf PHPStan level 5 (#4110)
* Fix most PHPDocs errors
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types

* Avoid func_get_args
Use variadic syntax instead https://php.net/manual/functions.arguments#functions.variable-arg-list
And avoid dynamic functions names when possible to more easily identify calls and unused functions.
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103

* PHPStan level 3

* PHPStand level 4

* Update default to PHPStan level 4

* Towards level 5

* Fix level 4 regression

* Towards level 5

* Pass PHPStan level 5

* Towards level 6

* Remove erronenous regression from changelog
https://github.com/FreshRSS/FreshRSS/pull/4116
2022-01-04 13:59:09 +01:00
Alexandre Alapetite
77e9877316 Add PHPStan (#4021)
* Add PHPStan
#fix https://github.com/FreshRSS/FreshRSS/issues/4016
https://phpstan.org/

```sh
composer run-script phpstan
```

* More fixes

* Fix global variables

* Add .phtml

* Fix merge
https://github.com/FreshRSS/FreshRSS/pull/4090

* Fix more warnings

* Fix view errors and enable in CI

* ReturnTypeWillChange

* Dynamic view type

* Fix Minz static/self bug
2021-12-31 17:00:51 +01:00
maTh
02641de32e Stats: replace flotr2 with chart.js (#3858)
* include Chart.js

* page: main statistics. Flotr.js replaced with Chart.js

* main stats + repartition

* Delete: repartition.js + stats.js

* delete flotr2

* add libs in README

* polish

* code polish

* fixed amount of week days and months

* added manget link for LibreJS

* added: @license-end

* phpcbf + jshint formatting

* delete old code

* fix stats

* fix Comments

* finally I found the issue and fixed its best

* fix the month stats

* Whitespace fixes

* Remove flotr2

* Rename to chart.min.js

* Remove console.log

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-10-16 12:00:07 +02:00
maTh
93e73855ec Delete jQuery (#3847)
* delete jquery.min.js lib
2021-09-13 08:02:09 +02:00
Anton Smirnov
11b6668cbf More inactive cutoffs (#2831)
* Fill additional cutoffs

* Update phpdoc

* Add translation strings

* Update app/i18n/fr/gen.php

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

* Add Dutch translation

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2020-03-22 01:10:28 +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
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
8ee8a573f1 Custom labels (#2027)
* First draft of custom tags

https://github.com/FreshRSS/FreshRSS/issues/928
https://github.com/FreshRSS/FreshRSS/issues/1367

* SMALLINT to BIGINT for id_entry

And uppercase SQL types

* Fix layout for unreads

* Start UI menu

* Change menu order

* Clean database helpers

https://github.com/FreshRSS/FreshRSS/pull/2027#discussion_r217971535

* Travis rules do not understand PostgreSQL constants

Grrr

* Tag controller + UI

* Add column attributes to tags

* Use only favicon for now, for label

* Fix styling for different themes

* Constant for maximum InnoDB index length in Unicode

https://github.com/FreshRSS/FreshRSS/pull/2027#discussion_r219052200
(I would have personnally prefered keeping the readability of a real
value instead of a constant, in this case of many SQL fields)

* Use FreshRSS_Factory::createCategoryDao

* Add view of all articles containing any tag

* Fix search in tags

* Mark as read tags

* Partial auto-update unread tags

* More auto update tag unreads

* Add tag deletion

* Do not purge tagged articles

* Minor comment

* Fix SQLite and UI bug

* Google Reader API support for user tags

Add SQL check that tag names must be distinct from category names

* whitespace

* Add missing API for EasyRSS

* Compatibility SQLite

Problematic parentheses

* Add SQL DISTINCT for cases with multiple tags

* Fix for PostgreSQL

PostgreSQL needs some additional type hint to avoid "could not determine
data type of parameter $1"

http://www.postgresql-archive.org/Could-not-determine-data-type-of-parameter-1-tp2171092p2171094.html
2018-09-29 20:47:17 +02:00
Alexandre Alapetite
ccb56bcbf3 Simplify SQL in statistics
Reduce the use of product-specific date functions. Improve performances.
Remove redundant functions.
2016-09-11 11:24:32 +02:00
Marien Fressinaud
f43b273706 Update i18n for statistics 2014-12-11 16:10:39 +01:00
Alexis Degrugillier
38cf7a109e Add more info in article repartition page
I added the same information than on the main stat page (total, read, unread and favorite) on the repartition page. Some refactoring was needed.
2014-11-08 09:26:01 -05:00
Marien Fressinaud
58deab37cd Fix Minz_Error::error() -> use default values 2014-10-30 19:57:08 +01:00
Marien Fressinaud
79aa5beaf4 Refactor authentication system.
Big work, not finished. A lot of features have been removed.

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-06 23:29:20 +02:00
Marien Fressinaud
9a0d01be0c Coding style
Remove spaces before parenthesis.

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-05 18:24:28 +02:00
Marien Fressinaud
6c8b36f04e Let's begin the big refactoring!
Minz_Translate::t\s? replaces by _t

See https://github.com/marienfressinaud/FreshRSS/issues/655
2014-10-05 15:55:20 +02:00
Alexis Degrugillier
cd88414abc Add an average per day for the 30 day period 2014-09-29 18:54:03 -04:00
Alexis Degrugillier
5889ef35c8 Change todo align 2014-09-21 12:01:36 -04:00
Alexis Degrugillier
0420a98939 Add comments on the stat controller 2014-09-21 11:51:53 -04:00
Alexis Degrugillier
f002dbe4ce Add average on repartition charts.
It needs some verification on the value used to calculate the averages.
2014-09-01 20:58:05 -04:00