app = FastAPI(docs_url=fba.config["base_url"] + "/docs", redoc_url=fba.config["base_url"] + "/redoc")
templates = Jinja2Templates(directory=".")
-@app.get(fba.config["base_url"] + "/info")
+@app.get(fba.config["base_url"] + "/api/info")
def info():
fba.cursor.execute("SELECT (SELECT COUNT(domain) FROM instances), (SELECT COUNT(domain) FROM instances WHERE software IN ('pleroma', 'mastodon', 'misskey', 'gotosocial', 'friendica', 'bookwyrm', 'takahe')), (SELECT COUNT(blocker) FROM blocks), (SELECT COUNT(domain) FROM instances WHERE last_status_code IS NOT NULL)")
known, indexed, blocks, errorous = fba.cursor.fetchone()
"slogan" : fba.config["slogan"]
}
-@app.get(fba.config["base_url"] + "/top")
+@app.get(fba.config["base_url"] + "/api/top")
def top(blocked: int = None, blockers: int = None, reference: int = None, software: int = None):
if blocked != None:
if blocked > 500:
scores = None
if blockers != None and blockers > 0:
- res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/top?blockers={blockers}")
+ res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/api/top?blockers={blockers}")
elif blocked != None and blocked > 0:
- res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/top?blocked={blocked}")
+ res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/api/top?blocked={blocked}")
elif reference != None and reference > 0:
- res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/top?reference={reference}")
+ res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/api/top?reference={reference}")
elif software != None and software > 0:
- res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/top?software={software}")
+ res = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/api/top?software={software}")
else:
raise HTTPException(status_code=400, detail="No filter specified")
blocks = None
if domain == None and reason == None and reverse == None:
- info = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/info")
+ info = requests.get(f"http://127.0.0.1:{fba.config['port']}{fba.config['base_url']}/api/info")
if not info.ok:
raise HTTPException(status_code=info.status_code, detail=info.text)
<td>{{loop.index}}</td>
<td>
{% if software %}
- {{entry['domain']}}
+ {{entry['domain']}}
{% else %}
- <b><a href="../?{% if blockers %}reverse{% elif blocked %}domain{% endif %}={{entry['domain']}}" rel="nofollow noopener noreferrer">{{entry['domain']}}</a></b>
+ <b><a href="{{base_url}}/?{% if blockers %}reverse{% elif blocked or reference %}domain{% endif %}={{entry['domain']}}" rel="nofollow noopener noreferrer">{{entry['domain']}}</a></b>
<a class="listlink" href="https://{{entry['domain']}}" rel="external" target="_blank">↗</a>
{% endif %}
</td>
<tr>
<td>
<b><a href="https://{{block['blocker']}}" rel="nofollow noopener noreferrer">{{block['blocker']}}</a></b>
- {% if reason or domain %}<a class="listlink" href="./?reverse={{block['blocker']}}">↘</a>{% endif %}
+ {% if reason or domain %}<a class="listlink" href="{{base_url}}/?reverse={{block['blocker']}}">↘</a>{% endif %}
</td>
<td>
<b><a href="https://{{domain or block['blocked']}}" rel="nofollow noopener noreferrer">{{block['blocked']}}</a></b>
- {% if reason or reverse %}<a class="listlink" href="./?domain={{domain or block['blocked']}}">↘</a>{% endif %}
+ {% if reason or reverse %}<a class="listlink" href="{{base_url}}/?domain={{domain or block['blocked']}}">↘</a>{% endif %}
</td>
<td>{{block['reason']}}</td>
<td>{{block['first_added']}}</td>
<input type="submit" value="Submit" />
</form>
<p>
- <a href="./scoreboard?blockers=50">top 50 defederating</a> /
- <a href="./scoreboard?blocked=50">defederated instances</a> /
- <a href="./scoreboard?reference=50">referencing instances</a> /
- <a href="./scoreboard?software=50">used software</a>
+ <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?reference=50">referencing instances</a> /
+ <a href="{{base_url}}/scoreboard?software=50">used software</a>
</p>
<div class="info">
known instances: {{info.known_instances}}<br/>