return scores
-@router.get(config.get("base_url") + "/api/index.json", response_class=JSONResponse)
+@router.get(config.get("base_url") + "/api/top.json", response_class=JSONResponse)
def api_index(request: Request, mode: str, value: str, amount: int):
if mode is None or value is None or amount is None:
raise HTTPException(status_code=500, detail="No filter specified")
if mode == "domain":
database.cursor.execute("SELECT blocker, blocked, block_level, reason, first_seen, last_seen \
FROM blocks \
-WHERE blocked = ? OR blocked = ? OR blocked = ? OR blocked = ? OR blocked = ? OR blocked = ? ORDER BY first_seen ASC LIMIT ?",
+WHERE blocked = ? OR blocked = ? OR blocked = ? OR blocked = ? OR blocked = ? OR blocked = ? \
+ORDER BY block_level ASC, first_seen ASC \
+LIMIT ?",
[
domain,
"*." + domain,
elif mode in ["domain", "reverse"] and not utils.is_domain_wanted(value):
raise HTTPException(status_code=500, detail="Invalid or blocked domain specified")
- response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/index.json?mode={mode}&value={value}&amount={amount}")
+ response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode={mode}&value={value}&amount={amount}")
if response is not None:
blocklist = response.json()
domains = database.cursor.fetchall()
logger.info("Checking %d domain(s) ...", len(domains))
+ cnt = 0
for row in domains:
logger.debug("row[]='%s'", type(row))
try:
- logger.info("Checking nodeinfo for row[domain]='%s',row[software]='%s' ...", row["domain"], row["software"])
+ logger.info("Checking nodeinfo for row[domain]='%s',row[software]='%s' (%s%%) ...", row["domain"], row["software"], "{:5.1f}".format(cnt / len(domains) * 100))
software = federation.determine_software(row["domain"])
logger.debug("Determined software='%s'", software)
instances.set_last_nodeinfo(row["domain"])
instances.update_data(row["domain"])
+ cnt = cnt + 1
logger.debug("Success! - EXIT!")
return 0