mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-02-27 20:59:18 +03:00
feat(Reddit): add parameter for web UI frontend
This commit is contained in:
parent
cfef482366
commit
ae2eb2f1d1
1 changed files with 18 additions and 0 deletions
|
@ -38,6 +38,16 @@ class RedditBridge extends BridgeAbstract
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'exampleValue' => 'cats, dogs',
|
'exampleValue' => 'cats, dogs',
|
||||||
'title' => 'Keyword search, separated by commas'
|
'title' => 'Keyword search, separated by commas'
|
||||||
|
],
|
||||||
|
'frontend' => [
|
||||||
|
'type' => 'list',
|
||||||
|
'name' => 'frontend',
|
||||||
|
'title' => 'choose frontend for reddit',
|
||||||
|
'values' => [
|
||||||
|
'old.reddit.com' => 'https://old.reddit.com',
|
||||||
|
'reddit.com' => 'https://reddit.com',
|
||||||
|
'libreddit.kavin.rocks' => 'https://libreddit.kavin.rocks',
|
||||||
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'single' => [
|
'single' => [
|
||||||
|
@ -109,6 +119,10 @@ class RedditBridge extends BridgeAbstract
|
||||||
{
|
{
|
||||||
$user = false;
|
$user = false;
|
||||||
$comments = false;
|
$comments = false;
|
||||||
|
$frontend = $this->getInput('frontend');
|
||||||
|
if ($frontend == '') {
|
||||||
|
$frontend = 'https://old.reddit.com';
|
||||||
|
}
|
||||||
$section = $this->getInput('d');
|
$section = $this->getInput('d');
|
||||||
|
|
||||||
switch ($this->queriedContext) {
|
switch ($this->queriedContext) {
|
||||||
|
@ -175,6 +189,10 @@ class RedditBridge extends BridgeAbstract
|
||||||
$item['timestamp'] = $data->created_utc;
|
$item['timestamp'] = $data->created_utc;
|
||||||
$item['uri'] = $this->urlEncodePathParts($data->permalink);
|
$item['uri'] = $this->urlEncodePathParts($data->permalink);
|
||||||
|
|
||||||
|
if ($frontend != 'https://old.reddit.com') {
|
||||||
|
$item['uri'] = preg_replace('#^https://old\.reddit\.com#', $frontend, $item['uri']);
|
||||||
|
}
|
||||||
|
|
||||||
$item['categories'] = [];
|
$item['categories'] = [];
|
||||||
|
|
||||||
if ($post->kind == 't1') {
|
if ($post->kind == 't1') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue