1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-01-16 21:58:21 +01:00

feat: add vendor http header to cached responses (#4040)

This commit is contained in:
Dag 2024-03-31 21:02:55 +02:00 committed by GitHub
parent 8ca1b90840
commit 73289324bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 5 deletions

View File

@ -32,7 +32,7 @@ class DisplayAction implements ActionInterface
return new Response('', 304, ['last-modified' => $modificationTimeGMT . 'GMT']); return new Response('', 304, ['last-modified' => $modificationTimeGMT . 'GMT']);
} }
} }
return $cachedResponse; return $cachedResponse->withHeader('rss-bridge', 'This is a cached response');
} }
if (!$bridgeName) { if (!$bridgeName) {

View File

@ -35,7 +35,12 @@ class MediapartBlogsBridge extends BridgeAbstract
$item['title'] = $item_title->innertext; $item['title'] = $item_title->innertext;
$item['uri'] = self::BASE_URI . trim($item_title->href); $item['uri'] = self::BASE_URI . trim($item_title->href);
$item['author'] = $element->find('.author .subscriber', 0)->innertext;
$author = $element->find('.author .subscriber', 0);
if ($author) {
$item['author'] = $author->innertext;
}
$item['content'] = $item_divs[count($item_divs) - 2] . $item_divs[count($item_divs) - 1]; $item['content'] = $item_divs[count($item_divs) - 2] . $item_divs[count($item_divs) - 1];
$item['timestamp'] = strtotime($element->find('.author time', 0)->datetime); $item['timestamp'] = strtotime($element->find('.author time', 0)->datetime);

View File

@ -178,7 +178,6 @@ class FeedItem
} else { } else {
$this->author = $author; $this->author = $author;
} }
return $this;
} }
public function getContent(): ?string public function getContent(): ?string
@ -284,7 +283,6 @@ class FeedItem
} else { } else {
$this->misc[$name] = $value; $this->misc[$name] = $value;
} }
return $this;
} }
public function toArray(): array public function toArray(): array

View File

@ -331,7 +331,14 @@ final class Response
return array_pop($header); return array_pop($header);
} }
public function withBody(string $body): Response public function withHeader(string $name, string $value): self
{
$clone = clone $this;
$clone->headers[$name] = [$value];
return $clone;
}
public function withBody(string $body): self
{ {
$clone = clone $this; $clone = clone $this;
$clone->body = $body; $clone->body = $body;