1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-06-21 10:29:59 +02:00
Commit Graph

74 Commits

Author SHA1 Message Date
Dag
9d6aa5ee38 fix: operator precedence bug () 2025-03-25 23:52:47 +01:00
Dag
935075072b fix: set default cache ttl of 1d () 2025-01-30 21:05:17 +01:00
Dag
4424ea54e9 chore: increase linter speed () 2024-08-11 02:31:50 +02:00
Dag
f358f1abec refactor: loadCacheValue/saveCacheValue () 2024-08-08 17:47:04 +02:00
Dag
4602f4f475 tweaks () 2024-04-06 18:07:45 +02:00
Dag
c4fceab7b3 refactor(FeedParser): () 2024-01-29 21:51:06 +01:00
Dag
9574c17ddc refactor/fix () 2024-01-25 13:03:00 +01:00
Dag
3ce94409ab feat: support itunes namespace in top channel feed ()
Also preserves other properties.
2024-01-09 20:18:33 +01:00
ad2d4c7b1b [BridgeAbstract] use getParameters instead of static to allow overriding it from bridges () 2023-12-26 12:20:49 +01:00
Dag
41df17bc46 refactor ()
* test: refactor test suite

* docs

* refactor

* yup

* docs
2023-10-01 19:23:30 +02:00
Dag
07f49225d9 fix: bug in refactor () 2023-09-23 16:52:39 +02:00
Dag
7329b83cc0 refactor: logger () 2023-09-21 22:05:55 +02:00
Dag
e6aef73a02 refactor () 2023-09-20 02:45:48 +02:00
4f5a492dde [BridgeAbstract] fix undefined index issue ()
* .

* attempt to fix 
https://github.com/RSS-Bridge/rss-bridge/issues/2943

* Revert "."

This reverts commit c0b6ccfea6.

* lint

* Revert "attempt to fix "

This reverts commit 9f1a66e48d.

* moved fix to BridgeAbstract

* fix undefined index

* lint
2023-09-11 13:18:00 +02:00
Dag
4b9f6f7e53 fix: rewrite and improve caching () 2023-09-10 21:50:15 +02:00
a786bbd4e0 DisplayAction: defaultchecked fix ()
* .

* attempt to fix 
https://github.com/RSS-Bridge/rss-bridge/issues/2943

* Revert "."

This reverts commit c0b6ccfea6.

* lint

* Revert "attempt to fix "

This reverts commit 9f1a66e48d.

* moved fix to BridgeAbstract
2023-09-10 04:15:05 +02:00
10f7b6f4f6 Fix php8.2 deprecated warning when using bridge specific configurations ()
* Fix php8.2 deprecated warning

Fix php8.2 warning: `Deprecated: Creation of dynamic property is deprecated`

* fix

* refactor: remove unused method

---------

Co-authored-by: Dag <me@dvikan.no>
2023-08-01 19:35:06 +02:00
Dag
7e4807530e fix: various small fixes () 2023-07-31 20:43:18 +02:00
Dag
6254b8593e refactor(cache): extract and encapsulate cache expiration logic ()
* refactor(cache): extract and encapsulate cache expiration logic

* fix: logic bug in getSimpleHTMLDOMCached

* fix: silly me, index should of course be on the key column

* silly me again, PRIMARY keys get index by default lol

* comment out the delete portion in loadData

* remove a few log statements

* tweak twitter cache timeout
2023-07-19 05:05:49 +02:00
Dag
6c0e186d3f fix(jornaln): Array to string conversion at lib/BridgeAbstract.php li… ()
* fix(jornaln): Array to string conversion at lib/BridgeAbstract.php line 320

* yup
2023-07-11 16:54:59 +02:00
Dag
c1c8304fc0 refactor: dont create multiple instances of the cache () 2023-07-08 17:03:12 +02:00
Dag
caac7f572c refacor: improve cache interface ()
* fix: proper typehint on setScope

* refactor: type hint setKey()

* typehint
2023-07-06 15:10:30 +02:00
Dag
a9fd3b9e61 fix(CacheInterface): logic bug in getTime ()
* fix(CacheInterface): logic bug in getTime

* test
2023-07-05 17:37:21 +02:00
Dag
748fc9fd65 fix: various small notice fixes ()
* fix(patreon): php notice

* fix(pepperbridge): php notice

* fix(ebay): php notice

* fix(tiktok): php notice

* fix(yandex): fix notice

* fix(justwatch): notice

* lint
2023-07-02 06:40:25 +02:00
343fd36671 [core] Remove hardcoded maximum duration of 24 hours in loadCacheValue () 2023-04-19 17:53:35 +02:00
f0e5ef0fc5 [Various] getKey replacements and docu ()
* [Various] getKey replacements and docu

* more bridges and fix to the abstract

* linting

* revert bandcampdaily. doing more than i thought
2023-03-06 20:01:51 +01:00
f3f98a117c [Core] Add getKey function ()
* [Core] Add getKey function
2023-03-02 13:25:57 +01:00
Dag
502799a74c feat: use bridge description and short name in search ()
* refactor: search.js

* feat: use bridge description and short name in search

* fix bug in previous merge commit

Also reformat string from tabs to spaces
2022-08-06 23:12:30 +02:00
Dag
2bbce8ebef refactor: general code base refactor ()
* refactor

* fix: bug in previous refactor

* chore: exclude phpcompat sniff due to bug in phpcompat

* fix: do not leak absolute paths

* refactor/fix: batch extensions checking, fix DOS issue
2022-08-06 22:46:28 +02:00
Dag
ecb486794b refactor: use static values for cache scope
This fixes a future problem when code is placed under a namespace because `get_class($bridge)` will then return e.g. `RssBridge\Bridge\TwitterBridge` instead of the the current value `TwitterBridge`.

Also a bit refactoring of `Configuration.php`.
2022-08-02 15:03:54 +02:00
951092eef3 Fix coding style missed by phpbcf ()
$ composer require --dev friendsofphp/php-cs-fixer

$ echo >.php-cs-fixer.dist.php "<?php

$finder = PhpCsFixer\Finder::create()
    ->in(__DIR__);

$rules = [
    '@PSR12' => true,
    // '@PSR12:risky' => true,
    '@PHP74Migration' => true,
    // '@PHP74Migration:risky' => true,
    // buggy, duplicates existing comment sometimes
    'no_break_comment' => false,
    'array_syntax' => true,
    'lowercase_static_reference' => true,
    'visibility_required' => false,
    // Too much noise
    'binary_operator_spaces' => false,
    'heredoc_indentation' => false,
    'trailing_comma_in_multiline' => false,
];

$config = new PhpCsFixer\Config();

return $config
    ->setRules($rules)
    // ->setRiskyAllowed(true)
    ->setFinder($finder);

"

$ vendor/bin/php-cs-fixer --version
PHP CS Fixer 3.8.0 BerSzcz against war! by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.7

$ vendor/bin/php-cs-fixer fix
$ rm .php-cs-fixer.cache
$ vendor/bin/php-cs-fixer fix
2022-07-08 13:00:52 +02:00
d107f8ed30 Improve Factory variable names () 2022-07-06 12:14:04 +02:00
Dag
321ec7c8c1 refactor: move cache logic into the factory () 2022-07-05 13:20:01 +02:00
Dag
4f75591060 Reformat codebase v4 ()
Reformat code base to PSR12

Co-authored-by: rssbridge <noreply@github.com>
2022-07-01 15:10:30 +02:00
Dag
07927008eb refactor: CacheFactory () 2022-06-22 18:29:28 +02:00
dag
5a733b3d82 feat: add limit options to the slowest bridges 2022-04-10 18:56:24 +02:00
f311fb8083 [BridgeAbstract] Add loadCacheValue() and saveCacheValue() ()
* [BridgeAbstract] Add loadCacheValue() and saveCacheValue()

Bridges currently need to implement value caching manually, which
results in duplicate code and more complex bridges.

This commit adds two protected functions to BridgeAbstract that make
it possible for bridges to store and retrieve values from a temporary
cache by key.

Co-Authored-By: Roliga <roliga.here@gmail.com>

Co-authored-by: Roliga <roliga.here@gmail.com>
2022-04-02 08:15:28 +02:00
ecaae735d9 [core] Support for bridge maintainers' donation URLs () 2021-06-26 00:45:25 +05:00
c580219627 [BridgeImplementationTest] Implement feature for testing detectParameters method 2021-06-05 09:34:16 +05:00
810a2503c9 [core] Add configuration for bridges, allowing private bridges () 2020-12-12 21:05:22 +05:00
fc81bed717 [BridgeAbstract] Correct getIcon method 2020-12-07 21:08:58 +04:00
5f64fe2516 [BridgeAbstract] Fix broken assignment of defaultValue
setInputs() currently looks if the global array defines a 'value'
for a given parameter, but that isn't supported by the API. It
needs to be 'defaultValue'.
2019-11-01 15:29:16 +01:00
1591e18027 core: Add context hinting for new feeds
RSS-Bridge currently has to guess the queried context from the data
provided by the user. This, however, can cause issues for bridges
that have multiple contexts with conflicting parameters (i.e. none).

This commit adds context hinting to queries via '&context=<context>'
which can be omitted in which case the context is determined as before.
2019-06-21 19:12:29 +02:00
e7d3a006c8 global: Fix code violations 2018-12-26 21:58:07 +01:00
49da67cb33 core: Automatically select a bridge based on a URL ()
* core: Add bridge parameter auto detection

This adds a new 'detect' action which accepts a URL from which an
appropriate bridge is selected and relevant parameters are extracted.
The user is then automatically redirected to the selected bridge.

For example to get a feed from: https://twitter.com/search?q=%23rss-bridge
we could send a request to:
'/?action=detect&format=Atom&url=twitter.com/search%3Fq%3D%2523rss-bridge'
which would redirect to:
'/?action=display&q=%23rss-bridge&bridge=Twitter&format=Atom'.

This auto detection happens on a per-bridge basis, so a new function
'detectParameters' is added to BridgeInterface which bridges may implement.
It takes a URL for an argument and returns a list of parameters that were
extracted, or null if the URL isn't relevant for the bridge.

* [TwitterBridge] Add parameter auto detection

* [BridgeAbstract] Add generic parameter detection

This adds generic "paramater detection" for bridges that don't have any
parameters defined. If the queried URL matches the URI defined in the
bridge (ignoring https://, www. and trailing /) an emtpy list of parameters is
returned.
2018-11-26 18:05:40 +01:00
c4550be812 lib: Add API documentation 2018-11-18 09:41:14 +01:00
4b7fea5ebc [RssBridge] Include interfaces once 2018-11-06 19:23:32 +01:00
b90bcee1fc Return exceptions in requested feed formats ()
* [Exceptions] Don't return header for bridge exceptions
* [Exceptions] Add link to list in exception message

This is an alternative when the button is not rendered
for some reason.

* [index] Don't return bridge exception for formats
* [index] Return feed item for bridge exceptions
* [BridgeAbstract] Rename 'getCacheTime' to 'getModifiedTime'
* [BridgeAbstract] Move caching to index.php to separate concerns

index.php needs more control over caching behavior in order to cache
exceptions. This cannot be done in a bridge, as the bridge might be
broken, thus preventing caching from working.

This also (and more importantly) separates concerns. The bridge should
not even care if caching is involved or not. Its purpose is to collect
and provide data.

Response times should be faster, as more complex bridge functions like
'setDatas' (evaluates all input parameters to predict the current
context) and 'collectData' (collects data from sites) can be skipped
entirely.

Notice: In its current form, index.php takes care of caching. This
could, however, be moved into a separate class (i.e. CacheAbstract)
in order to make implementation details cache specific.

* [index] Add '_error_time' parameter to $item['uri']

This ensures that error messages are recognized by feed readers as
new errors after 24 hours. During that time the same item is returned
no matter how often the cache is cleared.

References https://github.com/RSS-Bridge/rss-bridge/issues/814#issuecomment-420876162

* [index] Include '_error_time' in the title for errors

This prevents feed readers from "updating" feeds based on the title

* [index] Handle "HTTP_IF_MODIFIED_SINCE" client requests

Implementation is based on `BridgeAbstract::dieIfNotModified()`,
introduced in 422c125d8e and
simplified based on https://stackoverflow.com/a/10847262

Basically, before returning cached data we check if the client send
the "HTTP_IF_MODIFIED_SINCE" header. If the modification time is
more recent or equal to the cache time, we reply with "HTTP/1.1 304
 Not Modified" (same as before). Otherwise send the cached data.

* [index] Don't encode exception message with `htmlspecialchars`
* [Exceptions] Include error message in exception
* [index] Show different error message for error code 0
2018-10-15 17:21:43 +02:00
1d451610d6 [ParameterValidator] Move 'getQueriedContext' from BridgeAbstract 2018-09-22 17:04:55 +02:00
f853ffc07c [ParameterValidator] Refactor 'validation' into 'ParameterValidator'
Adds a new class 'ParameterValidator' to replace the functions from
'validator.php', separating private functions from 'validateData' to
class private functions in the process.

Instead of echoing error messages, adds messages to a private variable,
accessible via 'getInvalidParameters'.

BridgeAbstract now adds invalid parameter names to the error message.
2018-09-22 16:42:04 +02:00