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()
print('I| done updating all accounts') 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): def pixelfed_islogged(acc_id, accdata=None):
if accdata is None: if accdata is None:

View File

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