From: Roland Häder Date: Mon, 29 May 2023 18:40:12 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7c0c4efe8247fd3965b788741ff9226dea29c38f;p=fba.git Continued: - move templates to own folder --- diff --git a/api.py b/api.py index 1c6a98d..fdf5b07 100644 --- a/api.py +++ b/api.py @@ -26,7 +26,7 @@ import re import fba app = fastapi.FastAPI(docs_url=fba.config["base_url"] + "/docs", redoc_url=fba.config["base_url"] + "/redoc") -templates = Jinja2Templates(directory=".") +templates = Jinja2Templates(directory="templates") @app.get(fba.config["base_url"] + "/api/info") def info(): @@ -132,7 +132,7 @@ def index(request: Request, blockers: int = None, blocked: int = None, reference elif not res.ok: raise HTTPException(status_code=res.status_code, detail=res.text) - return templates.TemplateResponse("index.html", { + return templates.TemplateResponse("scoreboard.html", { "base_url" : fba.config["base_url"], "request" : request, "scoreboard": True, diff --git a/index.html b/index.html deleted file mode 100644 index f25d00f..0000000 --- a/index.html +++ /dev/null @@ -1,185 +0,0 @@ - - - fedi-block-api{% if domain %} {{domain}}{% endif %} - - {% if domain %} - - {% elif reverse %} - - {% endif %} - - - - {% if scoreboard %} - {% if blockers %} -

Top {{blockers}} defederating instances

- {% elif blocked %} -

Top {{blocked}} defederated instances

- {% elif reference %} -

Top {{reference}} referencing instances

- {% elif software %} -

Top {{software}} used software

- {% endif %} -
- - - - - {% for entry in scores %} - - - - - - {% endfor %} -
№{% if software %}Software{% else %}Instance{% endif %}{% if reference %}References{% elif software %}Total{% else %}Blocks{% endif %}
{{loop.index}} - {% if software %} - {{entry['domain']}} - {% else %} - {{entry['domain']}}  - ↗ - {% endif %} - {{entry['highscore']}}
-
- {% elif reason or domain or reverse %} - {% if reason %} -

Instances that use "{{reason}}" in their reason

- {% elif reverse %} -

Instances that are blocked by {{reverse}}

- {% elif domain %} -

Instances that block {{domain}}

- {% endif %} - {% for block_level in blocks %} -
-

{{block_level}} ({{blocks[block_level]|length}})

- - - - - - - {% for block in blocks[block_level] %} - - - - - - - - {% endfor %} -
Blocker{% if block_level == 'accept' %}Accepted{% else %}Blocked{% endif %}ReasonFirst addedLast seen
- {{block['blocker']}} - {% if reason or domain %}↘{% endif %} - - {{block['blocked']}} - {% if reason or reverse %}↘{% endif %} - {{block['reason']}}{{block['first_seen']}}{{block['last_seen']}}
-
- {% endfor %} - {% else %} -

Enter a Domain

-
- - -
-

Enter a Reason

-
- - -
-

Reverse search

-
- - -
-

- top 50 defederating / - defederated instances / - referencing instances / - used software -

-
- known instances: {{info.known_instances}}
- indexed instances: {{info.indexed_instances}}
- blocks recorded: {{info.blocks_recorded}}
- errorous instances: {{info.errorous_instances}}
- source code: git.mxchange.org

- {{info.slogan}} -
- {% endif %} - - diff --git a/rss.xml b/rss.xml deleted file mode 100644 index 5d63df9..0000000 --- a/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://fba.ryona.agency/?reverse={{block['blocker']}} - {{block['first_seen']}} - - {% endfor %} - - diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..f25d00f --- /dev/null +++ b/templates/index.html @@ -0,0 +1,185 @@ + + + fedi-block-api{% if domain %} {{domain}}{% endif %} + + {% if domain %} + + {% elif reverse %} + + {% endif %} + + + + {% if scoreboard %} + {% if blockers %} +

Top {{blockers}} defederating instances

+ {% elif blocked %} +

Top {{blocked}} defederated instances

+ {% elif reference %} +

Top {{reference}} referencing instances

+ {% elif software %} +

Top {{software}} used software

+ {% endif %} +
+ + + + + {% for entry in scores %} + + + + + + {% endfor %} +
№{% if software %}Software{% else %}Instance{% endif %}{% if reference %}References{% elif software %}Total{% else %}Blocks{% endif %}
{{loop.index}} + {% if software %} + {{entry['domain']}} + {% else %} + {{entry['domain']}}  + ↗ + {% endif %} + {{entry['highscore']}}
+
+ {% elif reason or domain or reverse %} + {% if reason %} +

Instances that use "{{reason}}" in their reason

+ {% elif reverse %} +

Instances that are blocked by {{reverse}}

+ {% elif domain %} +

Instances that block {{domain}}

+ {% endif %} + {% for block_level in blocks %} +
+

{{block_level}} ({{blocks[block_level]|length}})

+ + + + + + + {% for block in blocks[block_level] %} + + + + + + + + {% endfor %} +
Blocker{% if block_level == 'accept' %}Accepted{% else %}Blocked{% endif %}ReasonFirst addedLast seen
+ {{block['blocker']}} + {% if reason or domain %}↘{% endif %} + + {{block['blocked']}} + {% if reason or reverse %}↘{% endif %} + {{block['reason']}}{{block['first_seen']}}{{block['last_seen']}}
+
+ {% endfor %} + {% else %} +

Enter a Domain

+
+ + +
+

Enter a Reason

+
+ + +
+

Reverse search

+
+ + +
+

+ top 50 defederating / + defederated instances / + referencing instances / + used software +

+
+ known instances: {{info.known_instances}}
+ indexed instances: {{info.indexed_instances}}
+ blocks recorded: {{info.blocks_recorded}}
+ errorous instances: {{info.errorous_instances}}
+ source code: git.mxchange.org

+ {{info.slogan}} +
+ {% endif %} + + diff --git a/templates/rss.xml b/templates/rss.xml new file mode 100644 index 0000000..5d63df9 --- /dev/null +++ b/templates/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://fba.ryona.agency/?reverse={{block['blocker']}} + {{block['first_seen']}} + + {% endfor %} + +