From 646ea834105e1321c3cb4bc949fb78ba2dd3e70c Mon Sep 17 00:00:00 2001 From: Bofh Date: Mon, 8 Feb 2021 15:49:42 +0100 Subject: [PATCH] Added logout API function for a single account --- igmirror.py | 4 ++++ server.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/igmirror.py b/igmirror.py index c39903b..3c3daa6 100644 --- a/igmirror.py +++ b/igmirror.py @@ -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: diff --git a/server.py b/server.py index 477daca..32fac39 100644 --- a/server.py +++ b/server.py @@ -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"))