]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 24 Jun 2023 11:33:15 +0000 (13:33 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 24 Jun 2023 11:33:15 +0000 (13:33 +0200)
- moved rss.xml, robots.txt to views/ directory as these are actual views

api.py
templates/robots.txt [deleted file]
templates/rss.xml [deleted file]
templates/views/robots.txt [new file with mode: 0644]
templates/views/rss.xml [new file with mode: 0644]

diff --git a/api.py b/api.py
index f473936e98180d559ff2c9b05f42886b11061041..5ba8937f4e990092c67cc6ada82caa0231dba4f6 100644 (file)
--- a/api.py
+++ b/api.py
@@ -334,7 +334,7 @@ def rss(request: Request, domain: str = None):
             "last_seen"  : format_datetime(datetime.fromtimestamp(row[5])),
         })
 
-    return templates.TemplateResponse("rss.xml", {
+    return templates.TemplateResponse("views/rss.xml", {
         "request"  : request,
         "timestamp": format_datetime(datetime.now()),
         "domain"   : domain,
@@ -346,7 +346,7 @@ def rss(request: Request, domain: str = None):
 
 @router.get(config.get("base_url") + "/robots.txt", response_class=PlainTextResponse)
 def robots(request: Request):
-    return templates.TemplateResponse("robots.txt", {
+    return templates.TemplateResponse("views/robots.txt", {
         "request" : request,
         "base_url": config.get("base_url")
     })
diff --git a/templates/robots.txt b/templates/robots.txt
deleted file mode 100644 (file)
index 6fdd266..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-User-Agent: *
-Disallow {{base_url}}/api/
diff --git a/templates/rss.xml b/templates/rss.xml
deleted file mode 100644 (file)
index 477e562..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<rss version="2.0">
-<channel>
- <title>fedi-block-api{% if domain %} {{domain}}{% endif %}</title>
- <description>Feed of latest blocks{% if domain %} for {{domain}}{% endif %} from fedi-block-api</description>
- <pubDate>{{timestamp}}</pubDate>
- <ttl>1800</ttl>
- {% for block in blocks %}
- <item>
-  <title>{{block['blocker']}} has applied '{{block['block_level']}}' restriction to {{block['blocked']}}</title>
-  <description>{{block['reason']}}</description>
-  <link>https://{{hostname}}/top?mode=reverse&amp;value={{block['blocker']}}</link>
-  <pubDate>{{block['first_seen']}}</pubDate>
- </item>
- {% endfor %}
-</channel>
-</rss>
diff --git a/templates/views/robots.txt b/templates/views/robots.txt
new file mode 100644 (file)
index 0000000..6fdd266
--- /dev/null
@@ -0,0 +1,2 @@
+User-Agent: *
+Disallow {{base_url}}/api/
diff --git a/templates/views/rss.xml b/templates/views/rss.xml
new file mode 100644 (file)
index 0000000..477e562
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<rss version="2.0">
+<channel>
+ <title>fedi-block-api{% if domain %} {{domain}}{% endif %}</title>
+ <description>Feed of latest blocks{% if domain %} for {{domain}}{% endif %} from fedi-block-api</description>
+ <pubDate>{{timestamp}}</pubDate>
+ <ttl>1800</ttl>
+ {% for block in blocks %}
+ <item>
+  <title>{{block['blocker']}} has applied '{{block['block_level']}}' restriction to {{block['blocked']}}</title>
+  <description>{{block['reason']}}</description>
+  <link>https://{{hostname}}/top?mode=reverse&amp;value={{block['blocker']}}</link>
+  <pubDate>{{block['first_seen']}}</pubDate>
+ </item>
+ {% endfor %}
+</channel>
+</rss>