Added logout API function for a single account

This commit is contained in:
Bofh 2021-02-08 15:49:42 +01:00
parent 2fc703e866
commit 646ea83410
2 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,10 @@ def update_allaccounts():
print()
print('I| done updating all accounts')
def logout_account(acc_id):
accdata = db_get('accounts', acc_id)
del accdata['cookie']
db_set('accounts', acc_id, accdata)
def pixelfed_islogged(acc_id, accdata=None):
if accdata is None:

View File

@ -26,6 +26,8 @@ class MyServer(BaseHTTPRequestHandler):
igmirror.add_igaccount(accname)
elif parts[1].lower() == 'update':
igmirror.update_igaccount_async(accname)
elif parts[1].lower() == 'logout':
igmirror.logout_account(accname)
self.wfile.write(bytes('{"status": "ok"}', "utf-8"))
else:
self.wfile.write(bytes('{"status": "parameters are not correct"}', "utf-8"))