fixed bug when domain is empty
This commit is contained in:
parent
b28453a083
commit
80b9cba5f3
4
api.py
4
api.py
@ -1,4 +1,4 @@
|
|||||||
from fastapi import FastAPI, Request, HTTPException
|
from fastapi import FastAPI, Request, HTTPException, responses
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
@ -55,6 +55,8 @@ def blocked(domain: str = None):
|
|||||||
|
|
||||||
@app.get(base_url+"/")
|
@app.get(base_url+"/")
|
||||||
def index(request: Request, domain: str = None):
|
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}")
|
blocks = get(f"http://127.0.0.1:8069{base_url}/api?domain={domain}")
|
||||||
info = None
|
info = None
|
||||||
if domain == None:
|
if domain == None:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<title>fedi-block-api {{domain}}</title>
|
<title>fedi-block-api{% if domain %} {{domain}}{% endif %}</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #000022;
|
background-color: #000022;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user