]> git.mxchange.org Git - fba.git/commitdiff
fixed bug when domain is empty
authorEnju Aihara <9839590-EnjuAihara@users.noreply.gitlab.com>
Fri, 22 Apr 2022 18:42:39 +0000 (20:42 +0200)
committerEnju Aihara <9839590-EnjuAihara@users.noreply.gitlab.com>
Fri, 22 Apr 2022 18:42:39 +0000 (20:42 +0200)
api.py
index.html

diff --git a/api.py b/api.py
index 20363b9e2127bd49f4be9b6557cb5599e25f55fb..0090f62d4a26512b26924dd0c44bbeb2ec6f8778 100644 (file)
--- a/api.py
+++ b/api.py
@@ -1,4 +1,4 @@
-from fastapi import FastAPI, Request, HTTPException
+from fastapi import FastAPI, Request, HTTPException, responses
 import sqlite3
 from hashlib import sha256
 from fastapi.templating import Jinja2Templates
@@ -55,6 +55,8 @@ def blocked(domain: str = None):
 
 @app.get(base_url+"/")
 def index(request: Request, domain: str = None):
+    if domain == "":
+        return responses.RedirectResponse("/")
     blocks = get(f"http://127.0.0.1:8069{base_url}/api?domain={domain}")
     info = None
     if domain == None:
index 607ca731313aa4c376ac8daa3507c5afbec40035..05c4091a5d2ac554037c3917633a53fa3660fdf8 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <head>
-    <title>fedi-block-api {{domain}}</title>
+    <title>fedi-block-api{% if domain %} {{domain}}{% endif %}</title>
     <style>
         body {
             background-color: #000022;