api: add ssidclient to display list of all AP SSIDs used

Based on a request, the URL /api/ssidclient will provide a plain-text,
new-line-separated list of all used AP SSIDs.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2020-03-10 18:10:30 +01:00
parent bbb3218db0
commit 5084da09ba
1 changed files with 17 additions and 0 deletions

View File

@ -385,6 +385,23 @@ def wifianalhelper(router_data, headline):
return Response(s,mimetype='text/plain')
@api.route('/ssidclient')
def ssidclient():
mysql = FreifunkMySQL()
ssid_data = mysql.fetchall("""
SELECT wlan_ssid
FROM router_netif
WHERE wlan_ssid IS NOT NULL
GROUP BY wlan_ssid
""",())
mysql.close()
s = ""
for entry in ssid_data:
s += entry["wlan_ssid"] + "\n"
return Response(s,mimetype='text/plain')
@api.route('/dnslist')
def dnslist():
mysql = FreifunkMySQL()