]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 6 Jun 2023 10:16:56 +0000 (12:16 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 6 Jun 2023 10:16:56 +0000 (12:16 +0200)
- renamed result <-> blocks
- added config entry 'hostname' which you should change to where you have
  installed it, e.g. mine is 'fba.mxchange.org' (password-protected)

api.py
config.defaults.json
templates/rss.xml

diff --git a/api.py b/api.py
index 94fdc3895368e7a6ad2bf77b97fa4cec9dfa15ca..ec2e193ba444857e0443f368fdc887fed08bf752 100644 (file)
--- a/api.py
+++ b/api.py
@@ -227,17 +227,17 @@ def rss(request: Request, domain: str = None):
     else:
         fba.cursor.execute("SELECT blocker, blocked, block_level, reason, first_seen, last_seen FROM blocks ORDER BY first_seen DESC LIMIT 50")
 
-    blocks = fba.cursor.fetchall()
+    result = fba.cursor.fetchall()
 
-    result = []
-    for blocker, blocked, block_level, reason, first_seen, last_seen in blocks:
+    blocks = []
+    for blocker, blocked, block_level, reason, first_seen, last_seen in result:
         first_seen = utils.format_datetime(datetime.fromtimestamp(first_seen))
         if reason == None or reason == '':
             reason = "No reason provided."
         else:
             reason = "Provided reason: '" + reason + "'"
 
-        result.append({
+        blocks.append({
             "blocker"    : blocker,
             "blocked"    : blocked,
             "block_level": block_level,
@@ -245,13 +245,12 @@ def rss(request: Request, domain: str = None):
             "first_seen" : first_seen
         })
 
-    timestamp = utils.format_datetime(datetime.now())
-
     return templates.TemplateResponse("rss.xml", {
         "request"  : request,
-        "timestamp": timestamp,
+        "timestamp": utils.format_datetime(datetime.now()),
         "domain"   : domain,
-        "blocks"   : result
+        "hostname" : config.get("hostname"),
+        "blocks"   : blocks
     }, headers={
         "Content-Type": "routerlication/rss+xml"
     })
index 9fba2c198088f1f5fa1f7bf7738e362d87cb20d3..02a7c741b90e0a4339bb498045f130c083128451 100644 (file)
@@ -6,6 +6,7 @@
     "useragent"         : "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/113.0",
     "connection_timeout": 30,
     "read_timeout"      : 5,
+    "hostname"          : "fba.ryona.agency",
     "nodeinfo_connection_timeout": 3,
     "nodeinfo_read_timeout"      : 2,
     "bot_enabled"       : false,
index 5d63df9db2f1c7ce6318c4895b6ca3257e18f071..9fe3962b42951dfddce3245e613ae9b43ab79bd1 100644 (file)
@@ -9,7 +9,7 @@
  <item>
   <title>{{block['blocker']}} has applied '{{block['block_level']}}' restriction to {{block['blocked']}}</title>
   <description>{{block['reason']}}</description>
-  <link>https://fba.ryona.agency/?reverse={{block['blocker']}}</link>
+  <link>https://{{hostname}}/?reverse={{block['blocker']}}</link>
   <pubDate>{{block['first_seen']}}</pubDate>
  </item>
  {% endfor %}