From: Roland Häder Date: Sat, 24 Jun 2023 11:33:15 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=34ad7a718cfd8370f978b5a085087f140f1b0a70;p=fba.git Continued: - moved rss.xml, robots.txt to views/ directory as these are actual views --- diff --git a/api.py b/api.py index f473936..5ba8937 100644 --- 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 index 6fdd266..0000000 --- a/templates/robots.txt +++ /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 index 477e562..0000000 --- a/templates/rss.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - fedi-block-api{% if domain %} {{domain}}{% endif %} - Feed of latest blocks{% if domain %} for {{domain}}{% endif %} from fedi-block-api - {{timestamp}} - 1800 - {% for block in blocks %} - - {{block['blocker']}} has applied '{{block['block_level']}}' restriction to {{block['blocked']}} - {{block['reason']}} - https://{{hostname}}/top?mode=reverse&value={{block['blocker']}} - {{block['first_seen']}} - - {% endfor %} - - diff --git a/templates/views/robots.txt b/templates/views/robots.txt new file mode 100644 index 0000000..6fdd266 --- /dev/null +++ b/templates/views/robots.txt @@ -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 index 0000000..477e562 --- /dev/null +++ b/templates/views/rss.xml @@ -0,0 +1,17 @@ + + + + fedi-block-api{% if domain %} {{domain}}{% endif %} + Feed of latest blocks{% if domain %} for {{domain}}{% endif %} from fedi-block-api + {{timestamp}} + 1800 + {% for block in blocks %} + + {{block['blocker']}} has applied '{{block['block_level']}}' restriction to {{block['blocked']}} + {{block['reason']}} + https://{{hostname}}/top?mode=reverse&value={{block['blocker']}} + {{block['first_seen']}} + + {% endfor %} + +