"useragent" : "Mozilla/5.0 (Windows NT 10.0; rv:113.0) Gecko/20100101 Firefox/113.0",
"connection_timeout" : 30,
"read_timeout" : 5,
+ "scheme" : "https",
"hostname" : "example.org",
"timestamp_format" : "%Y-%m-%d %H:%M",
"nodeinfo_connection_timeout": 3,
@router.get(config.get("base_url") + "/.well-known/nodeinfo", response_class=JSONResponse)
def wellknown_nodeinfo(request: Request):
- components = urlparse(str(request.url))
-
return JSONResponse(status_code=200, content={
"links": ({
"rel" : "http://nodeinfo.diaspora.software/ns/schema/1.0",
- "href": f"{components.scheme}://{config.get('hostname')}{config.get('base_url')}/nodeinfo/1.0"
+ "href": f"{config.get('scheme')}://{config.get('hostname')}{config.get('base_url')}/nodeinfo/1.0"
})
})
raise HTTPException(status_code=response.status_code, detail=response.text)
return templates.TemplateResponse("views/scoreboard.html", {
- "base_url" : config.get("base_url"),
+ "base_url" : utils.base_url(),
"slogan" : config.get("slogan"),
"theme" : config.get("theme"),
"request" : request,
"request" : request,
"timestamp": format_datetime(datetime.now()),
"domain" : domain,
+ "scheme" : config.get("scheme"),
"hostname" : config.get("hostname"),
"blocks" : blocklist
}, headers={
})
if __name__ == "__main__":
- uvicorn.run("daemon:router", host=config.get("host"), port=config.get("port"), log_level=config.get("log_level"))
+ uvicorn.run("daemon:router", host=config.get("host"), port=config.get("port"), log_level=config.get("log_level"), proxy_headers=True)
elif url == "":
raise ValueError("Parameter 'url' is empty")
- components = urlparse(url)
punycode = domain.encode("idna").decode("utf-8")
+ components = urlparse(url)
logger.debug("components[]='%s',punycode='%s'", type(components), punycode)
+
is_found = (punycode in [components.netloc, components.hostname])
logger.debug("is_found='%s' - EXIT!", is_found)
import validators
from fba.helpers import blacklist
+from fba.helpers import config
from fba.helpers import domain as domain_helper
from fba.helpers import tidyup
logger.debug("domain='%s' - EXIT!", domain)
return domain
+
+def base_url() -> str:
+ return f"{config.get('scheme')}://{config.get('hostname')}{config.get('base_url')}"
<link rel="alternate" type="application/rss+xml" title="RSS Feed for latest blocked instances" href="rss" />
{% block rss %}{% endblock %}
- <link rel="stylesheet" type="text/css" href="{{ url_for('static', path='css/' + theme + '.css') }}?v=0.0.2" media="all" />
+ <link rel="stylesheet" type="text/css" href="static/css/{{theme}}.css?v=0.0.2" media="all" />
</head>
<body>
{% block content %}
<table class="index-table">
<thead>
- <th colspan="2">
- <h3>Choose an option</h3>
- </th>
+ <tr>
+ <th colspan="2">
+ <h3>Choose an option</h3>
+ </th>
+ </tr>
</thead>
<tbody>
<item>
<title>{{block['blocker']}} has applied '{{block['block_level']}}' restriction to {{block['blocked']}}</title>
<description>{{block['reason']}}</description>
- <link>https://{{hostname}}/top?mode=reverse&value={{block['blocker']}}</link>
+ <link>{{scheme}}://{{hostname}}/top?mode=reverse&value={{block['blocker']}}</link>
<pubDate>{{block['first_seen']}}</pubDate>
</item>
{% endfor %}