More API improvements

This commit is contained in:
Bofh 2021-02-11 20:16:27 +01:00
parent da564cc43f
commit 4af16f2e52
1 changed files with 3 additions and 2 deletions

View File

@ -25,14 +25,15 @@ class MyServer(BaseHTTPRequestHandler):
accounts = os.listdir('./db/accounts')
for acc in sorted(set(accounts)):
echo(self, acc)
return 0
# lists accounts on a pretty HTML + CSS
# making sure there is no XSS possible on account names
elif action == 'mirrors':
html = igmirror.pixelfed_htmlfill_mirrors( igmirror.template('mirrors') )
echo(self, html)
return echo(self, html)
return
return echo(self, {'status': 'error', 'message': '1st parameter action not defined: {}'.format(action)})
if len(parts) == 2:
response(self, 200, 'json')