Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 240 #4245

Merged
merged 2 commits into from
Aug 30, 2024
Merged

Fix 240 #4245

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions bridges/AO3Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ public function collectData()
*/
private function collectList($url)
{
$httpClient = RssBridge::getHttpClient();
$version = 'v0.0.1';
$agent = ['useragent' => "rss-bridge $version (https://github.com/RSS-Bridge/rss-bridge)"];
$headers = [
"useragent: rss-bridge $version (https://github.com/RSS-Bridge/rss-bridge)"
];
$response = getContents($url, $headers);

$response = $httpClient->request($url, $agent);
$html = \str_get_html($response->getBody());
$html = \str_get_html($response);
$html = defaultLinkTo($html, self::URI);

// Get list title. Will include page range + count in some cases
Expand Down Expand Up @@ -128,14 +129,15 @@ private function collectList($url)
case ('last'):
// only way to get this is using the navigate page unfortunately
$url .= '/navigate';
$response = $httpClient->request($url, $agent);
$html = \str_get_html($response->getBody());
$response = getContents($url, $headers);
$html = \str_get_html($response);
$html = defaultLinkTo($html, self::URI);
$url = $html->find('ol.index.group > li > a', -1)->href;
break;
}
$response = $httpClient->request($url, $agent);
$html = \str_get_html($response->getBody());
$response = getContents($url, $headers);

$html = \str_get_html($response);
$html = defaultLinkTo($html, self::URI);
// remove duplicate fic summary
if ($ficsum = $html->find('#workskin > .preface > .summary', 0)) {
Expand All @@ -159,16 +161,18 @@ private function collectList($url)
*/
private function collectWork($url)
{
$httpClient = RssBridge::getHttpClient();
$version = 'v0.0.1';
$agent = ['useragent' => "rss-bridge $version (https://github.com/RSS-Bridge/rss-bridge)"];
$headers = [
"useragent: rss-bridge $version (https://github.com/RSS-Bridge/rss-bridge)"
];
$response = getContents($url . '/navigate', $headers);

$response = $httpClient->request($url . '/navigate', $agent);
$html = \str_get_html($response->getBody());
$html = \str_get_html($response);
$html = defaultLinkTo($html, self::URI);

$response = $httpClient->request($url . '?view_full_work=true', $agent);
$workhtml = \str_get_html($response->getBody());
$response = getContents($url . '?view_full_work=true', $headers);

$workhtml = \str_get_html($response);
$workhtml = defaultLinkTo($workhtml, self::URI);

$this->title = $html->find('h2 a', 0)->plaintext;
Expand Down
5 changes: 3 additions & 2 deletions bridges/BMDSystemhausBlogBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class BMDSystemhausBlogBridge extends BridgeAbstract
public function collectData()
{
// get website content
$html = getSimpleHTMLDOM($this->getURI()) or returnServerError('No contents received!');
$html = getSimpleHTMLDOM($this->getURI());

// Convert relative links in HTML into absolute links
$html = defaultLinkTo($html, self::URI);
Expand Down Expand Up @@ -207,7 +207,8 @@ public function detectParameters($url)
//-----------------------------------------------------
public function getURI()
{
$lURI = $this->getURIbyCountry($this->getInput('country'));
$country = $this->getInput('country') ?? '';
$lURI = $this->getURIbyCountry($country);
return $lURI != '' ? $lURI : parent::getURI();
}

Expand Down
22 changes: 10 additions & 12 deletions bridges/TwitchBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,21 @@ public function collectData()
// e.g. 01:53:27
private function formatTimestampTime($seconds)
{
return sprintf(
'%02d:%02d:%02d',
floor($seconds / 3600),
($seconds / 60) % 60,
$seconds % 60
);
$floor = floor($seconds / 3600);
$i = intval($seconds / 60) % 60;
$i1 = $seconds % 60;

return sprintf('%02d:%02d:%02d', $floor, $i, $i1);
}

// e.g. 01h53m27s
private function formatQueryTime($seconds)
{
return sprintf(
'%02dh%02dm%02ds',
floor($seconds / 3600),
($seconds / 60) % 60,
$seconds % 60
);
$floor = floor($seconds / 3600);
$i = intval($seconds / 60) % 60;
$i1 = $seconds % 60;

return sprintf('%02dh%02dm%02ds', $floor, $i, $i1);
}

/**
Expand Down
11 changes: 0 additions & 11 deletions docs/01_General/03_Requirements.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@


- PHP 7.4 (or higher)
- [`openssl`](https://secure.php.net/manual/en/book.openssl.php) extension
- [`libxml`](https://secure.php.net/manual/en/book.libxml.php) extension (enabled by default, see [PHP Manual](http://php.net/manual/en/libxml.installation.php))
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) extension
- [`simplexml`](https://secure.php.net/manual/en/book.simplexml.php) extension
- [`curl`](https://secure.php.net/manual/en/book.curl.php) extension
- [`json`](https://secure.php.net/manual/en/book.json.php) extension
- [`filter`](https://secure.php.net/manual/en/book.filter.php) extension
- [`zip`](https://secure.php.net/manual/en/book.zip.php) (for some bridges)
- [`sqlite3`](http://php.net/manual/en/book.sqlite3.php) extension (only when using SQLiteCache)

Enable extensions by un-commenting the corresponding line in your PHP configuration (`php.ini`).
29 changes: 16 additions & 13 deletions docs/01_General/05_FAQ.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
This page provides a collection of frequently asked questions and their answers. Please check this page before opening a new Issue :revolving_hearts:

* [Why doesn't my bridge show new contents?](#why-doesnt-my-bridge-show-new-contents)
* [How can I make a bridge update more frequently?](#how-can-i-make-a-bridge-update-more-frequently)
* [Firefox doesn't show feeds anymore, what can I do?](#firefox-doesnt-show-feeds-anymore-what-can-i-do)

## Why doesn't my bridge show new contents?

RSS-Bridge creates a cached version of your feed in order to reduce traffic and respond faster. The cached version is created on the first request and served for all subsequent requests. On every request RSS-Bridge checks if the cache timeout has elapsed. If the timeout has elapsed, it loads new contents and updates the cached version.
RSS-Bridge creates a cached version of your feed in order to reduce traffic and respond faster.
The cached version is created on the first request and served for all subsequent requests.
On every request RSS-Bridge checks if the cache timeout has elapsed.
If the timeout has elapsed, it loads new contents and updates the cached version.

_Notice_: RSS-Bridge only updates feeds if you actively request it, for example by pressing F5 in your browser or using a feed reader.
_Notice_: RSS-Bridge only updates feeds if you actively request it,
for example by pressing F5 in your browser or using a feed reader.

The cache duration is bridge specific and can last anywhere between five minutes and 24 hours. You can specify a custom cache timeout for each bridge if [this option](#how-can-i-make-a-bridge-update-more-frequently) has been enabled on the server.
The cache duration is bridge specific (usually `1h`)
You can specify a custom cache timeout for each bridge if
[this option](#how-can-i-make-a-bridge-update-more-frequently) has been enabled on the server.

## How can I make a bridge update more frequently?

You can only do that if you are hosting the RSS-Bridge instance:
- Lower the bridge ttl: `CACHE_TIMEOUT` constant
- Enable [`custom_timeout`](../03_For_Hosts/08_Custom_Configuration.md#customtimeout)
- Alternatively, change the default timeout for your bridge by modifying the `CACHE_TIMEOUT` constant in the relevant bridge file (e.g [here](https://github.com/RSS-Bridge/rss-bridge/blob/master/bridges/FilterBridge.php#L7) for the Filter Bridge).

## Firefox doesn't show feeds anymore, what can I do?

As of version 64, Firefox removed support for viewing Atom and RSS feeds in the browser. This results in the browser downloading the pages instead of showing contents.
As of version 64, Firefox removed support for viewing Atom and RSS feeds in the browser.
This results in the browser downloading the pages instead of showing contents.

Further reading:
- https://support.mozilla.org/en-US/kb/feed-reader-replacements-firefox
- https://bugzilla.mozilla.org/show_bug.cgi?id=1477667

To restore the original behavior in Firefox 64 or higher you can use following Add-on which attempts to recreate the original behavior (with some sugar on top):
- https://addons.mozilla.org/en-US/firefox/addon/rsspreview/
To restore the original behavior in Firefox 64 or higher you can use following Add-on
which attempts to recreate the original behavior (with some sugar on top):

- https://addons.mozilla.org/en-US/firefox/addon/rsspreview/
22 changes: 15 additions & 7 deletions docs/02_CLI/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
RSS-Bridge supports calls via CLI. You can use the same parameters as you would normally use via the URI. Example:
RSS-Bridge supports calls via CLI.
You can use the same parameters as you would normally use via the URI. Example:

`php index.php action=display bridge=DansTonChat format=Json`

## Required parameters

RSS-Bridge requires a few parameters that must be specified on every call. Omitting these parameters will result in error messages:
RSS-Bridge requires a few parameters that must be specified on every call.
Omitting these parameters will result in error messages:

### action

Expand All @@ -17,20 +19,26 @@ Value | Description

### bridge

This parameter specifies the name of the bridge RSS-Bridge should return feeds from. The name of the bridge equals the class name of the bridges in the ./bridges/ folder without the 'Bridge' prefix. For example: DansTonChatBridge => DansTonChat.
This parameter specifies the name of the bridge RSS-Bridge should return feeds from.
The name of the bridge equals the class name of the bridges in the ./bridges/ folder without the 'Bridge' prefix.
For example: DansTonChatBridge => DansTonChat.

### format

This parameter specifies the format in which RSS-Bridge returns the contents. RSS-Bridge currently supports five formats: `Atom`, `Html`, `Json`, `Mrss`and `Plaintext`.
This parameter specifies the format in which RSS-Bridge returns the contents.

## Optional parameters

RSS-Bridge supports optional parameters. These parameters are only valid if the options have been enabled in the index.php script.
RSS-Bridge supports optional parameters.
These parameters are only valid if the options have been enabled in the index.php script.

### \_noproxy

This parameter is only available if a proxy server has been specified via `proxy.url` and `proxy.by_bridge` has been enabled. This is a Boolean parameter that can be set to `true` or `false`.
This parameter is only available if a proxy server has been specified via `proxy.url` and `proxy.by_bridge`
has been enabled. This is a Boolean parameter that can be set to `true` or `false`.

## Bridge parameters

Each bridge can specify its own set of parameters. As in the example above, some bridges don't specify any parameters or only optional parameters that can be neglected. For more details read the `PARAMETERS` definition for your bridge.
Each bridge can specify its own set of parameters.
As in the example above, some bridges don't specify any parameters or only optional parameters that can be neglected.
For more details read the `PARAMETERS` definition for your bridge.
11 changes: 1 addition & 10 deletions docs/03_For_Hosts/01_Installation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
In order to install RSS-Bridge on your own web server* do as follows:

* Make sure your web server meets all [requirements](../01_General/03_Requirements.md)
* Download the ZIP file of the [last stable release](https://github.com/RSS-Bridge/rss-bridge/releases)
* Place all files on your web server

For linux hosts:
* Grant read-write-access for `www-data` to the `./cache` directory (`chown -R www-data ./cache`)

You have successfully installed RSS-Bridge.
https://github.com/RSS-Bridge/rss-bridge/blob/master/README.md
38 changes: 0 additions & 38 deletions docs/03_For_Hosts/02_Updating.md
Original file line number Diff line number Diff line change
@@ -1,38 +0,0 @@
Updating an existing installation is very simple, depending on your type of installation.

## Release Build

* Download latest version
* Extract all files
* Replace existing files

This will update all core files to the latest version. Your custom configuration and bridges are left untouched. Keep in mind that changes to any core file of RSS-Bridge will be replaced.

## Heroku

### If you didn't fork the repo before

Fork the repo by clicking the `Fork` button at the top right of this page (must be on desktop site). Then on your Heroku account, go to the application. Click on the `Deploy` tab and connect the repo named `yourusername/rss-bridge`. Do a manual deploy of the `master` branch.

### If you forked the repo before

[Click here to create a new pull request to your fork](https://github.com/RSS-Bridge/rss-bridge/pull/new/master). Select `compare across forks`, make the base repository `yourusername/rss-bridge` and ensure the branch is set to master. Put any title you want and create the pull request. On the page that comes after this, merge the pull request.

You then want to go to your application in Heroku, connect your fork via the `Deploy` tab and deploy the `master` branch.

You can turn on auto-deploy for the master branch if you don't want to go through the process of logging into Heroku and deploying the branch every time changes to the repo are made in the future.

## Git

To get the latest changes from the master branch

```
git pull
```

To use a specific tag

```
git fetch --all
git checkout tags/<tag-name>
```
105 changes: 5 additions & 100 deletions docs/03_For_Hosts/06_Authentication.md
Original file line number Diff line number Diff line change
@@ -1,101 +1,6 @@
Depending on your servers abilities you can choose between two types of authentication:

* [.htaccess](#htaccess)
* [RSS-Bridge Authentication](#rss-bridge-authentication)

**General advice**:

- Make sure to use a strong password, no matter which solution you choose!
- Enable HTTPS on your server to ensure your connection is encrypted and secure!

## .htaccess

.htaccess files are commonly used to restrict access to files on a web server. One of the features of .htaccess files is the ability to password protect specific (or all) directories. If setup correctly, a password is required to access the files.

The usage of .htaccess files requires three basic steps:

1) [Enable .htaccess](#enable-htaccess)
2) [Create a .htpasswd file](#create-a-htpasswd-file)
3) [Create a .htaccess file](#create-a-htaccess-file)

### Enable .htaccess

This process depends on the server you are using. Some providers may require you to change some settings, or place/change some file. Here are some helpful links for your server (please add your own if missing :sparkling_heart:)

- Apache: http://ask.xmodulo.com/enable-htaccess-apache.html

### Create a .htpasswd file

The `.htpasswd` file contains the user name and password used for login to your web server. Please notice that the password is stored in encrypted form, which requires you to encrypt your password before creating the `.htpasswd` file!

Here are three ways of creating your own `.htpasswd` file:

**1) Example file**

Example `.htpasswd` file (user name: "test", password: "test"):

```.htpasswd
test:$apr1$a52u9ILP$XTNG8qMJiEXSm1zD0lQcR0
```

Just copy and paste the contents to your `.htpasswd` file.

**2) Online generator (read warning!)**

You can create your own `.htpasswd` file online using a `.htpasswd` generator like this: https://www.htaccesstools.com/htpasswd-generator/

**WARNING!**
- Never insert real passwords to an online generator!

**3) Generate your own password**

Another way to create your own `.htpasswd` file is to run this script on your server (it'll output the data for you, you just have to paste it int a `.htpasswd` file):

```PHP
<?php
// Password to be encrypted for a .htpasswd file
$clearTextPassword = 'some password';

// Encrypt password
$password = crypt($clearTextPassword, base64_encode($clearTextPassword));

// Print encrypted password
echo $password;
?>
```

>source: https://www.htaccesstools.com/articles/create-password-for-htpasswd-file-using-php/

### Create a .htaccess file

The `.htaccess` file is used to specify which directories are password protected. For that purpose you should place the file in whatever directory you want to restrict access. If you want to restrict access to RSS-Bridge in general, you should place the file in the root directory (where `index.php` is located).

Two parameters must be specified in the `.htaccess` file:

* AuthName
* AuthUserFile

`AuthName` specifies the name of the authentication (i.e. "RSS-Bridge"). `AuthUserFile` defines the **absolute** path to a `.htpasswd` file.

Here are two ways of creating your own `.htaccess` file:

**1) Example file**

```.htaccess
AuthType Basic
AuthName "My Protected Area"
AuthUserFile /path/to/.htpasswd
Require valid-user
```

Notice: You must change the `AuthUserFile` location to fit your own server (i.e. `/var/www/html/rss-bridge/.htpasswd`)

**2) Online generator**

You can use an online generator to create the file for you and copy-paste it to your `.htaccess` file: https://www.htaccesstools.com/htaccess-authentication/

## RSS-Bridge Authentication

RSS-Bridge ships with an authentication module designed for single user environments. You can enable authentication and specify the username & password in the [configuration file](../03_For_Hosts/08_Custom_Configuration.md#authentication).

Please notice that the password is stored in plain text and thus is readable to anyone who can access the file. Make sure to restrict access to the file, so that it cannot be read remotely!
* http basic auth
* token
* Access control via webserver (see nginx/caddy/apache docs)

https://github.com/RSS-Bridge/rss-bridge/blob/master/README.md
Loading
Loading