From 4a21cf9a5a21abfdcb0a6d472fc077ff5a99a88c Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sat, 18 Nov 2023 12:10:32 +1100 Subject: [PATCH] fix: Overriding avatar didn't update DNS record --- avatar.py | 2 +- varo.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/avatar.py b/avatar.py index 29f1d8c..22b65fa 100644 --- a/avatar.py +++ b/avatar.py @@ -26,7 +26,7 @@ def allowed_file(filename): return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS def save_avatar(file,owner): - filename = re.sub(r'[^a-zA-Z0-9]', '', file.filename).lower() + filename = re.sub(r'[^a-zA-Z0-9.]', '', file.filename).lower() diff --git a/varo.py b/varo.py index d07d6b9..957605e 100644 --- a/varo.py +++ b/varo.py @@ -125,7 +125,6 @@ def get_zone(): "content": "" } r = requests.post(url, headers=headers, json=data) - print(r.text) r = r.json() for record in r['data']: TLSA = record['content'] @@ -160,7 +159,6 @@ def update_avatar(avatar,domain): print("Avatar already set", flush=True) return "Avatar already set" record_id = record['uuid'] - if record_id == "": data = { "action": "addRecord", @@ -173,7 +171,7 @@ def update_avatar(avatar,domain): data = { "action": "updateRecord", "zone": zone, - "record": record, + "record": record_id, "column": "content", "value": "profile avatar=" + avatar } @@ -185,7 +183,6 @@ def update_avatar(avatar,domain): "zone": zone, "record": record_id } - r = requests.post(url, headers=headers, json=data) return r.text @@ -226,5 +223,4 @@ def verify_ALIAS(domain): "content": TLSA, } r = requests.post(url, headers=headers, json=data) - print(r.text) return r.text \ No newline at end of file