- 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)
else:
fba.cursor.execute("SELECT blocker, blocked, block_level, reason, first_seen, last_seen FROM blocks ORDER BY first_seen DESC LIMIT 50")
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 + "'"
first_seen = utils.format_datetime(datetime.fromtimestamp(first_seen))
if reason == None or reason == '':
reason = "No reason provided."
else:
reason = "Provided reason: '" + reason + "'"
"blocker" : blocker,
"blocked" : blocked,
"block_level": block_level,
"blocker" : blocker,
"blocked" : blocked,
"block_level": block_level,
"first_seen" : first_seen
})
"first_seen" : first_seen
})
- timestamp = utils.format_datetime(datetime.now())
-
return templates.TemplateResponse("rss.xml", {
"request" : request,
return templates.TemplateResponse("rss.xml", {
"request" : request,
- "timestamp": timestamp,
+ "timestamp": utils.format_datetime(datetime.now()),
+ "hostname" : config.get("hostname"),
+ "blocks" : blocks
}, headers={
"Content-Type": "routerlication/rss+xml"
})
}, headers={
"Content-Type": "routerlication/rss+xml"
})
"useragent" : "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/113.0",
"connection_timeout": 30,
"read_timeout" : 5,
"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,
"nodeinfo_connection_timeout": 3,
"nodeinfo_read_timeout" : 2,
"bot_enabled" : false,
<item>
<title>{{block['blocker']}} has applied '{{block['block_level']}}' restriction to {{block['blocked']}}</title>
<description>{{block['reason']}}</description>
<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 %}
<pubDate>{{block['first_seen']}}</pubDate>
</item>
{% endfor %}