if domain == "" or reason == "" or reverse == "":
return fastapi.responses.RedirectResponse("/")
- info = None
- blocks = None
+ response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/info.json")
- if domain == None and reason == None and reverse == None:
- info = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/info.json")
+ if not response.ok:
+ raise HTTPException(status_code=response.status_code, detail=response.text)
- if not info.ok:
- raise HTTPException(status_code=info.status_code, detail=info.text)
+ info = response.json()
+ blocks = None
- info = info.json()
- elif domain != None:
+ if domain != None:
blocks = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/index.json?domain={domain}")
elif reason != None:
blocks = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/index.json?reason={reason}")
blocks = blocks.json()
for block_level in blocks:
for block in blocks[block_level]:
- block["first_seen"] = datetime.utcfromtimestamp(block["first_seen"]).strftime('%Y-%m-%d %H:%M')
- block["last_seen"] = datetime.utcfromtimestamp(block["last_seen"]).strftime('%Y-%m-%d %H:%M')
+ block["first_seen"] = datetime.utcfromtimestamp(block["first_seen"]).strftime(config.get("timestamp_format"))
+ block["last_seen"] = datetime.utcfromtimestamp(block["last_seen"]).strftime(config.get("timestamp_format"))
return templates.TemplateResponse("index.html", {
"request": request,
"connection_timeout": 30,
"read_timeout" : 5,
"hostname" : "fba.ryona.agency",
+ "timestamp_format" : "%Y-%m-%d %H:%M",
"nodeinfo_connection_timeout": 3,
"nodeinfo_read_timeout" : 2,
"bot_enabled" : false,
text-decoration: none;
font-size: 0.8em;
}
- .info {
- margin-top: 25px;
- }
input[type="text"], input[type="submit"] {
padding: 5px;
border-radius: 5px;
</table>
</div>
{% endfor %}
+ <h2>Infos:</h2>
+ <p>
+ <a href="{{base_url}}/">Index</a> /
+ source code: <a href="https://git.mxchange.org/?p=fba.git;a=summary" rel="source" target="_blank">git.mxchange.org</a><br /><br />
+ {{info.slogan}}
+ </p>
{% else %}
<h1>Enter a Domain</h1>
<form>
<input type="text" name="domain" placeholder="example.com" required="required" />
<input type="submit" value="Submit" />
</form>
+
<h1>Enter a Reason</h1>
<form>
<input type="text" name="reason" placeholder="free speech" required="required" />
<input type="submit" value="Submit" />
</form>
+
<h1>Reverse search</h1>
<form>
<input type="text" name="reverse" placeholder="example.com" required="required" />
<input type="submit" value="Submit" />
</form>
+
+ <h1>Scoreboards:</h1>
<p>
<a href="{{base_url}}/scoreboard?blockers=50">top 50 defederating</a> /
<a href="{{base_url}}/scoreboard?blocked=50">defederated instances</a> /
<a href="{{base_url}}/scoreboard?software=50">used software</a> /
<a href="{{base_url}}/scoreboard?originator=10">originators</a>
</p>
- <div class="info">
+
+ <h2>Infos:</h2>
+ <p>
known instances: {{info.known_instances}}<br/>
indexed instances: {{info.indexed_instances}}<br/>
blocks recorded: {{info.blocks_recorded}}<br/>
errorous instances: {{info.errorous_instances}}<br/>
source code: <a href="https://git.mxchange.org/?p=fba.git;a=summary" rel="source" target="_blank">git.mxchange.org</a><br /><br />
{{info.slogan}}
- </div>
+ </p>
{% endif %}
</body>
</html>