This essentially reverts b042412416,
as YouTube seems to have fixed their servers.
At least I was able to query the YouTube endpoint around 150 times with
CURL_HTTP_VERSION_2TLS recently. They even advertise HTTP/3 support with
an `alt-svc` HTTP header now.
This unsets CURLOPT_HTTP_VERSION to let curl decide
on the version. This would support all curl versions and opens the
possibility for HTTP/3, but leads to inconsistent behavior depending
on the underlying curl version.
We don't set CURL_HTTP_VERSION_NONE explicitly, as it is always the curl
default and opens the path to let individual bridges override the HTTP
version where necessary.
Alternatively, setting CURL_HTTP_VERSION_2TLS explicitly would lead to consistent behavior
regardless of the curl version, but might uncover old curl bugs before the
developers enabled HTTP/2 by default.
Additionally, that requires at least PHP 7.0.7 (we require PHP 7.4
already) and curl 7.47.0 [1], released on Jan 27 2016 [2].
See also the discussion on https://github.com/RSS-Bridge/rss-bridge/pull/3249
[1] https://www.php.net/manual/curl.constants.php
[2] https://curl.se/docs/releases.html
* refactor: move function to class
* fix: use the computed bridge name as cache key
* refactor: extract method
* fix: set a feed item uid on errors
* docs
* fix: remove year from uid
* [core] Add html/convertLazyLoading($dom)
Looks for lazy-loading attributes such as 'data-src' and converts
them back to regular ones such as 'src', easier for RSS readers.
It also converts <picture> elements to plain <img> elements.
* [core] Document html/stripRecursiveHTMLSection()
Add documentation for that function (no code changes).
* [WordPressBridge] Use convertLazyLoading()
* [WordPressBridge] Unwrap image figures
<img> inside <figure> may not display on RSS readers.
This converts them back to <img>, without losing caption if present.
* [ZDNet] Convert lazy loading images
* [code] html/stripRecursiveHTMLSection: Fix typo
* fix: Call to a member function find() on bool
Happens when defaultLinkTo() is passed the empty string.
* fix: prevent exception in defaultLinkTo() when passed the empty string
* refactor
* fix: notice
* fix: Trying to get property content of non-object at bridges/PcGamerBridge.php line 36
* fix: better exception message
* fix: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
* fix: improve FeedExpander
Include the first libxml error in exception.
Give better error message if trying to parse the empty string.
Log all libxml errors if debug mode is enabled.
* error handling and logging tweak
* feat: improve logging and error handling
* trim absolute path from file name
* fix: suppress php errors from xml parsing
* fix: respect the error reporting level in the custom error handler
* feat: dont log error which is produced by bots
* ignore error about invalid bridge name
* upgrade bridge exception from warning to error
* remove remnants of using phps builin error handler
* move responsibility of printing php error from logger to error handler
* feat: include url in log record context
* fix: always include url in log record contect
Also ignore more non-interesting exceptions.
* more verbose httpexception
* fix
* fix
* 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
* 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
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`.
* docs: Do not use constant names when referring to config options
The options are customizable using a config file and no longer hardcoded in index.php since 8ac8e08abf
* Do not use constants for configuration
Since <8ac8e08abf>, they are just set to the configuration object values.
This moves the responsibility for getting a valid class name
to the users of BridgeFactory, avoiding the repeated sanitation.
Improper use can also be checked statically.
It was just getting out of sync:
- Minimum PHP version was bumped in 8365a7a34d
- Cache directory permission check was removed in 8e2b65556f
- Whitelist permission check was removed in d4e867f240
* refactor: fix exception handling
The removed catch is never uses in php versions above 7.
The need for multiple catch statements like this is to support both php 5 and 7.
* remove traces of old exception handling
* add typehints
* dont treat exception code 0 specially
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
* 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 94004c5104.
* [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>
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
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.
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
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
* [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
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.
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'.
* 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
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.
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.
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
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
* [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.