Browse Source

complete rss feature

main
ghost 11 months ago
parent
commit
18554be677
  1. 5
      public/css/default.css
  2. 12
      src/Controller/RoomController.php
  3. 5
      templates/default/module/room.html.twig
  4. 4
      templates/default/room/index.rss.twig

5
public/css/default.css

@ -116,6 +116,11 @@ main ul li > span > svg @@ -116,6 +116,11 @@ main ul li > span > svg
float: right;
}
main > sup > a > svg
{
fill: #ee784e;
}
footer
{
/*backdrop-filter: blur(100px);*/

12
src/Controller/RoomController.php

@ -166,15 +166,23 @@ class RoomController extends AbstractController @@ -166,15 +166,23 @@ class RoomController extends AbstractController
);
// RSS
if ('RSS' === $request->get('feed'))
if ('rss' === $request->get('feed'))
{
$response = new Response();
$response->headers->set(
'Content-Type',
'text/xml'
);
return $this->render(
'default/room/index.rss.twig',
[
'name' => $name,
'feed' => $feed,
'request' => $request
]
],
$response
);
}

5
templates/default/module/room.html.twig

@ -12,6 +12,11 @@ @@ -12,6 +12,11 @@
<a href="{{ path('room_namespace', { namespace : namespace }) }}">{{ name }}</a>
{% endif %}
</h2>
<sup>
<a href="{{ path('room_namespace', { namespace : namespace, feed : 'rss' }) }}" title="{{ 'RSS' | trans }}"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 16 16">
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2m0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2m.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"/>
</svg></a>
</sup>
{% set i = i + 1 %}
{% endfor %}
{% endif %}

4
templates/default/room/index.rss.twig

@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
<link>{{ url('room_namespace', { namespace : request.get('namespace') }) }}</link>
{% for post in feed %}
<item>
<title>{{ post.user }}</title>
<author>#{{ post.user }}</author>
<title>@{{ post.user }}</title>
<author>@{{ post.user }}</author>
<pubDate>{{ post.timestamp | date('D, d M Y h:i:s O') }}</pubDate>
<guid>{{ url('room_namespace', { namespace : request.get('namespace') }) }}#{{ post.id }}</guid>
<link>{{ url('room_namespace', { namespace : request.get('namespace') }) }}#{{ post.id }}</link>

Loading…
Cancel
Save