fix: Overriding avatar didn't update DNS record
All checks were successful
Build Docker / Build Main Image (push) Successful in 19s
Build Docker / Build SLDs Image (push) Successful in 20s

This commit is contained in:
Nathan Woodburn 2023-11-18 12:10:32 +11:00
parent 268721555c
commit 4a21cf9a5a
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 2 additions and 6 deletions

View File

@ -26,7 +26,7 @@ def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
def save_avatar(file,owner): 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()

View File

@ -125,7 +125,6 @@ def get_zone():
"content": "" "content": ""
} }
r = requests.post(url, headers=headers, json=data) r = requests.post(url, headers=headers, json=data)
print(r.text)
r = r.json() r = r.json()
for record in r['data']: for record in r['data']:
TLSA = record['content'] TLSA = record['content']
@ -160,7 +159,6 @@ def update_avatar(avatar,domain):
print("Avatar already set", flush=True) print("Avatar already set", flush=True)
return "Avatar already set" return "Avatar already set"
record_id = record['uuid'] record_id = record['uuid']
if record_id == "": if record_id == "":
data = { data = {
"action": "addRecord", "action": "addRecord",
@ -173,7 +171,7 @@ def update_avatar(avatar,domain):
data = { data = {
"action": "updateRecord", "action": "updateRecord",
"zone": zone, "zone": zone,
"record": record, "record": record_id,
"column": "content", "column": "content",
"value": "profile avatar=" + avatar "value": "profile avatar=" + avatar
} }
@ -185,7 +183,6 @@ def update_avatar(avatar,domain):
"zone": zone, "zone": zone,
"record": record_id "record": record_id
} }
r = requests.post(url, headers=headers, json=data) r = requests.post(url, headers=headers, json=data)
return r.text return r.text
@ -226,5 +223,4 @@ def verify_ALIAS(domain):
"content": TLSA, "content": TLSA,
} }
r = requests.post(url, headers=headers, json=data) r = requests.post(url, headers=headers, json=data)
print(r.text)
return r.text return r.text