rename feed.rss to feed.rss.xml

This commit is contained in:
manetta 2022-02-18 16:19:30 +01:00
parent ac459224a8
commit 2d0391c5e5
3 changed files with 9 additions and 7 deletions

View File

@ -107,13 +107,13 @@ class Logbot(Bot):
folder_name = self.db[message.room]["folder"]
if "@" in folder_name: # hacky
folder_name = self._parse_room_name(folder_name)
feed_path = os.path.join(self.output, folder_name, "feed.rss")
feed_path = os.path.join(self.output, folder_name, "feed.rss.xml")
date = datetime.now()
template = jinja2.Template(open("template.rss").read()) # self.feedtemplate would be useful to have in the conf
with open(feed_path, "w") as out:
feed = template.render(
log_path=os.path.join("https://vvvvvvaria.org/logs/", folder_name, "index.html"), # hardcoding the url now, self.baseurl would be helpful to have in the conf
feed_path=os.path.join("https://vvvvvvaria.org/logs/", folder_name, "feed.rss"), # hardcoding the url again
feed_path=os.path.join("https://vvvvvvaria.org/logs/", folder_name, "feed.rss.xml"), # hardcoding the url again
title=self.db[message.room]["title"],
db=self.db[message.room],
date=date.strftime("%a, %d %b %Y %H:%M:%S +0100") # timezone is hardcoded now
@ -132,17 +132,17 @@ class Logbot(Bot):
new_key = str(int(keys[-1]) + 1)
if media_post:
self.db[message.room]["messages"][new_key] = {}
self.db[message.room]["messages"][new_key]['post'] = media_post
self.db[message.room]["messages"][new_key]['post'] = bleach.clean(media_post)
self.db[message.room]["messages"][new_key]['date'] = date
self.db[message.room]["messages"][new_key]['media'] = {}
self.db[message.room]["messages"][new_key]['media']['type'] = media_type
self.db[message.room]["messages"][new_key]['media']['url'] = os.path.join("https://vvvvvvaria.org/logs/", media_url)
self.db[message.room]["messages"][new_key]['media']['size'] = media_size
self.db[message.room]["messages"][new_key]['date'] = date
else:
post = message.content.replace("@add ", "")
post = self._href_wrap(post)
self.db[message.room]["messages"][new_key] = {}
self.db[message.room]["messages"][new_key]['post'] = post
self.db[message.room]["messages"][new_key]['post'] = bleach.clean(post)
self.db[message.room]["messages"][new_key]['date'] = date
self.db._dumps()

View File

@ -8,7 +8,7 @@
</head>
<body>
<h1>{{ title }}</h1>
(Follow this log: <a href="./feed.rss">RSS</a>)
(Follow this log: <a href="./feed.rss.xml">RSS</a>)
<div id="container">
{% for num in sorted_numbering | reverse %}
<div id="{{ num }}" class="post">

View File

@ -11,7 +11,9 @@
<title>{{ title }} #{{ x }}</title>
<link>{{ log_path }}#{{ x }}</link>
<guid>{{ log_path }}#{{ x }}</guid>
<description><![CDATA[{{ post.post }}]]></description>
<description><![CDATA[
{{ post.post }}
]]></description>
{% if 'media' in post %}<enclosure url="{{ post.media.url }}" length="{{ post.media.size }}" type="{{ post.media.type }}" />{% endif %}
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">LogBot</dc:creator>
<pubDate>{{ post.date }}</pubDate>