Commit Graph

504 Commits

Author SHA1 Message Date
Kristian Salonen 166ead902d
[Configuration.php] Update the version name to dev.2022-06-10 (#2811) 2022-06-10 15:05:34 +02:00
Jan Tojnar 347f9a3eda
[contents] Add MIME type for mp3 (#2809)
Without this, format tests fail on systems without `/etc/mime.types`.
2022-06-09 22:41:10 -04:00
Yaman Qalieh 37f211a37e Add Laravel framework license 2022-06-09 12:13:07 -04:00
Dag 6df5a4bc14
feat: backport php 7.3 functions (#2803)
* feat: backport php 7.3 functions

* fix: add license

* fix: formatting

* fix: add note in README regarding license
2022-06-09 18:00:51 +02:00
Jan Tojnar fb501652d5
Formats: Remove display & related method (#2776)
Format should not be responsible for sending HTTP response.
2022-06-07 18:05:33 +02:00
Dag cb05cacd6a
fix: add 429 to status codes (#2757) 2022-05-27 15:25:12 +02:00
Dag 5cc34b884a
[core] Improve getContents docs (#2742) 2022-05-22 21:27:23 -04:00
Dag 1d0a0b927b
fix: use accept header when fetching feed (#2737)
* fix: use accept header when fetching feed

* fix: include atom too, and reuse constants from format classes

* add a catch all accept header
2022-05-18 00:18:33 +02:00
Dag 4007afdcf5 Merge branch 'autoloading' into master 2022-05-17 23:59:18 +02:00
Dag 7d00b0c5df
fix: include http code in exception (#2726) 2022-05-17 23:47:12 +02:00
Dag 0212c4790f
fix: connectivityaction (#2725) 2022-05-17 23:46:37 +02:00
Dag 4d069fcf99 remove unnecessary includes 2022-05-13 09:35:25 +02:00
Yaman Qalieh bb6d553dd5
Revert "refactor: remove unnecesary includes" (#2723)
This reverts commit fd449be4eb.
2022-05-12 16:28:03 -04:00
Dag fd449be4eb refactor: remove unnecesary includes 2022-05-12 15:15:09 +02:00
Dag fcc3707210 refactor: swap the order of sprintf values 2022-05-11 22:37:59 +02:00
Dag d5e9dbf47d refactor: restore some useful comments 2022-05-11 22:35:03 +02:00
Yaman Qalieh 6547ed0c04
[docs] Add documentation for html.php functions (#2714) 2022-05-10 09:37:53 +02:00
Dag 8982995445 refactor: remove unused method 2022-05-09 23:32:45 +02:00
Dag f5a51038cc fix: error when passing null values
This bug was introduced by me when refactoring the http client.

Fixes:

Fatal error: Uncaught TypeError: Argument 2 passed to getContents() must be of the type array, null given
2022-05-08 04:42:24 +02:00
Dag 5d77d14f9d
feat: add retry logic to the http client (#2692)
* refactor: extract http client

* feat: add retry logic to http client
2022-05-08 03:58:57 +02:00
Dag 0c7a7f320f
refactor: BridgeFactory (#2691) 2022-05-08 03:58:42 +02:00
Dag 0ef298f9cc
refactor: add php autoloader (#2655) 2022-04-26 00:57:59 +02:00
Patrick Collins e1c898848f
[contents.php] Fix incorrect reference to UnexpectedResponseException's responseBody. (#2677) 2022-04-23 10:04:56 +05:00
Dag d62b977394
refactor: ./tests (#2649)
* refactor: ./tests

* test: consolidate testsuites

* refactor: move config setup into rssbridge.php

Makes it easier to unit test.

* lint
2022-04-13 21:04:10 +02:00
dag 5a733b3d82
feat: add limit options to the slowest bridges 2022-04-10 18:56:24 +02:00
dag dbee47f1d6
fix: give better error message when feed can't be parsed (#2618) 2022-04-10 18:54:32 +02:00
dag c3a106892d
fix: require curl extension (#2617) 2022-04-10 18:54:18 +02:00
dag cce11964a4
feat: add a timeout option for http client (#2600) 2022-04-08 21:22:13 +02:00
somini d123e6007e
Fixup deprecations on PHP 8 (#2592)
* Fixup deprecations on PHP 8

Fix #2448

* Configure a default fallback for getInput function

* Appease phpcs

* Avoid changing getInput function

Revert "Configure a default fallback for getInput function"

This reverts commit 94004c5104de6b84bd4c72356806d994c05a0119.
2022-04-03 09:53:13 +02:00
dag bed20e9f28
feat: extract curl ua to config value (#2568)
* exclude config.default.ini.php from phpcs
2022-04-03 09:37:39 +02:00
LogMANOriginal f311fb8083
[BridgeAbstract] Add loadCacheValue() and saveCacheValue() (#1380)
* [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
Stelfux 91b8e4196e
[FeedExpander.php] Preserve original icon (#2145) 2022-03-26 19:09:27 +01:00
Niehztog 55acf661b9
add support for more media types as enclosures, handle result of /tex… (#2324) 2022-03-25 00:30:14 +01:00
Jakub Valenta 8e2b65556f
[Config] Don't check PATH_CACHE for memcached (#1489) 2022-03-24 21:29:16 +01:00
Antoine Turmel 6a72432f76 Proposition : Open new feeds in a new tab #1389 2022-03-24 20:37:34 +01:00
Dag b6d1c7a58f fix: php notice
Fixes:
Notice: Undefined variable: message in /home/rssbridge/public/lib/contents.php on line 39
2022-03-24 13:52:02 +05:00
Dag 384790537b fix: bug in cloudflare response detection
The cloudflare server header was not recognized in
some cases such as when the server header is "server"
or when the header value is "Cloudflare".
2022-03-24 13:52:02 +05:00
Dag 7bdc53125c fix: properly verify the existence of the curl module
This fixes a bug where it didnt use curl from cli
even though it's installed.

I believe this preserves the original intention to
not require the curl module to be installed.

https://github.com/RSS-Bridge/rss-bridge/pull/979
2022-03-24 13:52:02 +05:00
Joseph d41aa84b13
[BridgeCard] Use full bridge name in data-ref tag (#1560)
Updates the data-ref tag of each bridge card to use the bridge's full name (eg. Apple Music) instead of its filename (eg. AppleMusic). This fixes issues with the search not returned some bridges.
2022-03-22 22:08:26 +01:00
Paul Staroch 18504f2356
[lib/contents.php] Use variable name 'retVal' instead of 'retval' as variable names are case-sensitive (#2498) 2022-03-14 05:46:30 +05:00
Eugene Molotov 05273a9278
[core] Make getContents exceptions to be handled correctly and correct exception message (#2447)
This commit fixes following issues:
1. 'Unexpected response' error message was returned, even if upstream did not return anything
2. Inability to handle non-20x messages with checking response body
2022-03-12 01:18:01 +05:00
Yaman Qalieh 6585ebc89b
[ActionFactory] Prevent leaking working directory (#2480) 2022-03-01 14:14:53 +05:00
Eugene Molotov 5df8bf956a Bump version to dev.2022-01-20 2022-01-20 10:17:59 +05:00
Bockiii b395fe2641
[core] Implemented feature to read config from environment variables (#2100) 2021-12-03 11:15:08 +05:00
Eugene Molotov 071fdef599
[core] Drop php 5.6 and php 7.0 support (#2224) 2021-12-03 04:12:16 +05:00
Martin Leyrer 3764348b76
[core] Accept additional "successful" 2xx status codes (#2310) 2021-10-30 01:38:25 +05:00
Eugene Molotov b86ed70376
[core] Backported str_starts_with, str_ends_with and str_contains from php 8 (#2318) 2021-10-30 01:06:04 +05:00
Niehztog 87b3aaa550
[XPathAbstract] Fix encoding of feed output (#2297) 2021-10-14 14:18:00 +05:00
Bockiii ecaae735d9
[core] Support for bridge maintainers' donation URLs (#2102) 2021-06-26 00:45:25 +05:00
Eugene Molotov c580219627 [BridgeImplementationTest] Implement feature for testing detectParameters method 2021-06-05 09:34:16 +05:00
Bockiii 63ebf5ceec
[BridgeCard] Make HTML default, remove other buttons (#2101) 2021-05-08 15:10:16 +05:00
Eugene Molotov b24b5ed3ee Bump version to dev.2021-04-25 2021-04-25 15:32:35 +05:00
ORelio b754d14698
[FeedExpander] Handle Atom enclosures (#2039) 2021-04-04 15:21:15 +05:00
Joseph 9e58735b01
[FormatFactory] Ignore case in format values (#1967) 2021-02-09 18:13:03 +05:00
Thomas 771b851b52
[contents.php] Fix logical error in getSimpleHTMLDOMCached function (#1974)
Previously content was only loaded from cache when debug mode was enabled (the opposite of the expected behavior)
2021-02-09 17:40:16 +05:00
Joseph 6224fbb6a2
[BridgeCard] Display configuration options (if enabled) when bridge has no parameters (#1968)
Updates displayBridgeCard() in BridgeCard to allow configuration options noproxy and cache_timeout to be displayed, if enabled, when a bridge has no parameters in its PARAMETERS array
2021-02-05 10:17:30 +05:00
Eugene Molotov 3226a5e31e [core] Use more correct text to indicate errored response from upstream 2020-12-23 17:49:11 +05:00
Lyra 810a2503c9
[core] Add configuration for bridges, allowing private bridges (#1343) 2020-12-12 21:05:22 +05:00
Eugene Molotov fc81bed717 [BridgeAbstract] Correct getIcon method 2020-12-07 21:08:58 +04:00
Eugene Molotov ff50e4918c Bump version to dev.2020-11-10 2020-11-10 16:26:08 +05:00
Niehztog 3ad138026d
[BridgeXPathAbstract + BlizzardNewsBridge + XPathBridge] Add new abstract class + two example implementations (#1671) 2020-11-08 12:22:41 +05:00
Joshua Coales d05a8b79fe
[contents.php] Fix return type hints (#1824) 2020-11-08 12:19:18 +05:00
Eugene Molotov 93cdf5e342 [core] Fixed passive XSS vulnerability
Reference: https://www.openbugbounty.org/reports/1140367/
2020-10-26 15:08:11 +05:00
Joseph 164b407f28
[BridgeCard] Fix parameter layout issue (#1816)
Fixes parameter layout issue on small screens.
2020-10-26 12:11:58 +05:00
Corentin Garcia ff98efe8dc
[core] Use Parsedown for Markdown parsing (#1783) 2020-10-09 23:29:02 +05:00
Jason Ghent 3a29347e60
[ParameterValidator] Ignore cache-busting param (#1723) 2020-09-14 14:01:55 +05:00
Eugene Molotov 4b8c3b9d36
[Multi] Minor improvements for my bridges (#1507)
* [DarkReading] Hide dummy articles

* [FuturaSciences] Strip inline scripts from content

* [FeedExpander] Fix PHP notice on missing uri field

(guid is valid uri AND item uri is not valid)
 => (guid is valid uri AND item uri is empty or not valid)

* [NextInpact] Fix subtitle extraction

* [Markdown] Fix images with empty replacement text

* [TheHackerNews] Fix Author name cleanup

* [LeMondeInformatique] Remove encoding conversion

Was previously needed due to actual encoding on the page
being inconsistent with encoding specified in <meta> tag

* [AnimeUltime] Remove encoding conversion

Was previously needed due to encoding on the page being incorrect

* [FuturaSciences] Fix content extraction

* [FuturaSciences] Fix unneeded unset()

* [GBAtemp] Fix tutorial mode URL extraction

* [GBAtemp] Fix tutorial mode Title extraction
2020-08-14 10:30:31 +05:00
ORelio 01cc32a0cc [Markdown] Fix images with empty replacement text 2020-08-12 20:08:24 +02:00
ORelio 8144488a9e [FeedExpander] Fix PHP notice on missing uri field
(guid is valid uri AND item uri is not valid)
 => (guid is valid uri AND item uri is empty or not valid)
2020-08-11 14:01:44 +02:00
triatic 3ad126cdf2
[core] Add headers to file_get_contents (#1623)
Add response headers to file_get_contents() method. Headers are used by some bridges.
2020-06-25 12:22:05 +02:00
Michael Bemmerl c4422bdbb5
[Core] Fix notice of undefined offset when in detached HEAD state. (#1569) 2020-05-27 23:08:06 +02:00
Lyra 0705a2e7bb
Bump version to dev.2020-02-26 2020-02-26 22:24:20 +01:00
logmanoriginal 99d4e1a43d Bump version to dev.2019-12-01 2019-12-01 13:40:17 +01:00
logmanoriginal 477de4e2df Bump version to 2019-12-01 2019-12-01 13:34:09 +01:00
logmanoriginal 3bc8c9468a phpcs: Always use long array syntax
Most of the code in RSS-Bridge uses the long array syntax.
This commit adds a check to enforce using this syntax over
the short array syntax.

All failures have been fixed.
2019-11-01 18:06:55 +01:00
logmanoriginal 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
LogMANOriginal cdc1d9c9ba
action: Add action to check bridge connectivity (#1147)
* action: Add action to check bridge connectivity

It is currently not simply possible to check if the remote
server for a bridge is reachable or not, which means some
of the bridges might no longer work because the server is
no longer on the internet.

In order to find those bridges we can either check each
bridge individually (which takes a lot of effort), or use
an automated script to do this for us.

If a server is no longer reachable it could mean that it is
temporarily unavailable, or shutdown permanently. The results
of this script will at least help identifying such servers.

* [Connectivity] Use Bootstrap container to properly display contents

* [Connectivity] Limit connectivity checks to debug mode

Connectivity checks take a long time to execute and can require a lot
of bandwidth. Therefore, administrators should be able to determine
when and who is able to utilize this action. The best way to prevent
regular users from accessing this action is by making it available in
debug mode only (public servers should never run in debug mode anyway).

* [Connectivity] Split implemenation into multiple files

* [Connectivity] Make web page responsive to user input

* [Connectivity] Make status message sticky

* [Connectivity] Add icon to the status message

* [contents] Add the ability for getContents to return header information

* [Connectivity] Add header information to the reply Json data

* [Connectivity] Add new status (blue) for redirected sites

Also adds titles to status icons (Successful, Redirected, Inactive, Failed)

* [Connectivity] Fix show doesn't work for inactive bridges

* [Connectivity] Fix typo

* [Connectivity] Catch errors in promise chains

* [Connectivity] Allow search by status and update dynamically

* [Connectivity] Add a progress bar

* [Connectivity] Use bridge factory

* [Connectivity] Import Bootstrap v4.3.1 CSS
2019-10-31 22:02:38 +01:00
LogMANOriginal 6bc83310b9
core: Add info button for input fields with title (#1173)
The current solution for titles on input boxes is not obvious to the
user as support varies between bridges. This commit adds an button to
all input boxes with titles in order to make it clear to the user that
additional information is available.
2019-10-31 21:09:44 +01:00
Roliga c8d5c85c76 formats: Add getMimeType() function (#1299)
Allows getting the expected MIME type of the format's output. A
corresponding MIME_TYPE constant is also defined in FormatAbstract for
the format implementations to overwrite.
2019-10-31 19:00:12 +01:00
LogMANOriginal 1022b5fdf9
core: Add an option to suppress error reporting (#1179)
Error reporting currently takes place for each error. This can result
in many error messages if a server has connectivity issues (i.e. when
it re-connects to the internet every 24 hours).

This commit adds a new option to the configuration file to define the
number of error reports to suppress before returning an error message
to the user.

Error reports are cached and therefore automatically purged after 24
hours. A successful bridge request does **not** clear the error count
as sporadic issues can be the result of actual problems on the server.

The implementation currently makes no assumption on the type of error,
which means it also suppresses bridge errors in debug mode. The default
value is, however, set to 1 which means all errors are reported.

References #994
2019-10-31 18:49:45 +01:00
LogMANOriginal e8536ac1b2
core: Add an option to return errors in different formats (#1071)
Bridge errors are currently included as part of the feed to
notify users about erroneous bridges (before that, bridges
silently failed).

This solution, however, can produce a high load of error
messages if servers are down (see #994 for more details).

Admins may also not want to include error messages in feeds
in order to keep those kind of problems away from users or
simply to silently fail by choice.

This commit adds a new configuration section "error" with
one option "output" which can be set to following values:

"feed": To include error messages in the feed (default)
"http": To return a HTTP header for each error
"none": To disable error reporting

Note that errors are always logged to 'error.log' independent
of the settings above.

Closes #1066
2019-10-31 18:40:51 +01:00
Roliga 4c78721f03 [ParameterValidator] Ensure context has all user provided parameters (#1211)
* [ParameterValidator] Ensure context has all fields

Previously if a bridge had a set of parameters like:

const PARAMETERS = array(
    'ContextA' => array(
        'Param1' => array(
            'name' => 'Param1',
            'required' => true
        )
    ),
    'ContextB' => array(
        'Param1' => array(
            'name' => 'Param1',
            'required' => true
        ),
        'Param2' => array(
            'name' => 'Param2',
            'required' => true
        )
    )
)

and a query specifying both Param1 and Param2 was provided a 'Mixed
context parameters' error would be returned. This change ensures
ContextA in the above example would not be considered a relevant context.
2019-10-28 17:50:55 +01:00
Lyra b1be45df6c
[Configuration] Bump version to dev.2019-09-12 2019-09-12 17:09:30 +02:00
Lyra b4f393a5cc
[Configuration] Bump version to 2019-07-06 2019-09-12 17:08:15 +02:00
triatic b6be18d585 [contents] Respect passed headers for file_get_contents() (#1234)
* [contents] Respect passed headers for file_get_contents()
2019-07-29 12:05:13 +02:00
logmanoriginal 5a0ea423c4 [Configuration] Bump version to dev.2019-07-06 2019-07-06 12:35:36 +02:00
logmanoriginal 2120cc42fb [Configuration] Bump version to 2019-07-06 2019-07-06 12:34:42 +02:00
logmanoriginal 987f42d6d4 logo: Add logo to the project
References #1087
2019-06-25 18:42:11 +02:00
logmanoriginal 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
logmanoriginal fc8421ed50 format: Refactor format factory to non-static class
The format factory can be based on the abstract factory class if it
wasn't static. This allows for higher abstraction and makes future
extensions possible. Also, not all parts of RSS-Bridge need to work
on the same instance of the factory.

References #1001
2019-06-18 19:15:20 +02:00
logmanoriginal 2460b67886 cache: Refactor cache factory to non-static class
The cache factory can be based on the abstract factory class if it
wasn't static. This allows for higher abstraction and makes future
extensions possible. Also, not all parts of RSS-Bridge need to work
on the same instance of the factory.

References #1001
2019-06-18 19:04:19 +02:00
logmanoriginal 705b9daa0b bridge: Refactor bridge factory to non-static class
The bridge factory can be based on the abstract factory class if it
wasn't static. This allows for higher abstraction and makes future
extensions possible. Also, not all parts of RSS-Bridge need to work
on the same instance of the bridge factory.

References #1001
2019-06-18 18:55:32 +02:00
logmanoriginal 1ada9c26f8 format: Sanitize format name in the format factory
RSS-Bridge currently sanitizes the format name only for the display
action, which can cause problems if other actions depend on formats
as well.

It is therefore better to do sanitization in the factory class for
formats. Additionally, formats should not require a perfect match,
so 'Atom' and 'aToM' make no difference. This will also allow users
to define formats in their own style (i.e. only lowercase via CLI).

References #1001
2019-06-18 18:36:16 +02:00
logmanoriginal dfa9c651cd [BridgeList] Change placeholder message in the search bar
The search bar should indicate that searching by URL is
supported.

References #1099
2019-06-13 19:55:10 +02:00
logmanoriginal 70542686bb [contents] Fix parsing of incomplete headers
Response headers may contain fields with no values.

Example:
  "Referrer-Policy: "

In this case the current implementation of explode() results in an
error because there is no content after ": ". Changing the delimiter
to ":" and trimming the value manually fixes that issue.
2019-06-09 17:18:08 +02:00
logmanoriginal 84ba0c4a9e [Configuration] Bump version to dev.2019-06-08 2019-06-08 20:12:04 +02:00
logmanoriginal c17b864242 [Configuration] Bump version to 2019-06-08 2019-06-08 20:04:57 +02:00
logmanoriginal 5a9519967b [Exceptions] Add button to search for similar issues on GitHub
Users currently only get one option: to open a new issue on GitHub.
This can, however, result in duplicate issues, which is not desired.

This commit adds a second button to the error message, which links
to the GitHub issues tracker with the search query set to find
errors for the current bridge. That way, users can collaborate
on the same issue.
2019-06-08 17:05:35 +02:00
logmanoriginal 35bd706391 [Configuration] Use common format to report errors to the user
Incorrect configuration values are currently handled individually
for each condition, resulting in a lot of repetitive operations.

This commit adds two new private functions to report errors to the
user and end execution of the script.
2019-06-07 20:27:20 +02:00
logmanoriginal 0e30468e0f [rssbridge] Use PATH_ROOT whenever possible 2019-06-07 19:51:06 +02:00