From 1c7dd7e44d1f6f659a63100f3981df2cca8ef258 Mon Sep 17 00:00:00 2001 From: rune Date: Thu, 9 Nov 2023 12:02:11 +0100 Subject: [PATCH] Refind check for existing alias on server and in db --- malias.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/malias.py b/malias.py index 22c04d5..711a3f4 100755 --- a/malias.py +++ b/malias.py @@ -29,7 +29,7 @@ database = filepath.joinpath('malias.db') logfile = filepath.joinpath('malias.log') Path(filepath).mkdir(parents=True, exist_ok=True) logging.basicConfig(filename=logfile,level=logging.INFO,format='%(message)s') -app_version = '0.3.1' +app_version = '0.3.2' def get_latest_release(): @@ -116,7 +116,6 @@ def get_settings(kind): def get_api(): - latest_release = get_latest_release() cursor = conn.cursor() cursor.execute('SELECT api FROM apikey') apikey = cursor.fetchone()[0] @@ -299,11 +298,11 @@ def checklist(alias): remoteData = json.loads(remote) i = 0 for search in remoteData: - if alias in remoteData[i]['address'] or alias in remoteData[i]['goto']: + if alias == remoteData[i]['address'] or alias == remoteData[i]['goto']: alias_exist = True i=i+1 cursor = conn.cursor() - cursor.execute('SELECT count(*) FROM aliases where alias like ? or goto like ?', (alias,alias,)) + cursor.execute('SELECT count(*) FROM aliases where alias == ? or goto == ?', (alias,alias,)) count = cursor.fetchone()[0] if count >= 1 : alias_exist = True