feat: Allow admin to delete any link
All checks were successful
Build Docker / Build Main Image (push) Successful in 21s
All checks were successful
Build Docker / Build Main Image (push) Successful in 21s
This commit is contained in:
parent
3111bf9204
commit
afbae819c9
8
db.py
8
db.py
@ -169,3 +169,11 @@ def delete_link(url,domain):
|
|||||||
connection.commit()
|
connection.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
def delete_link_admin(url):
|
||||||
|
connection = mysql.connector.connect(**dbargs)
|
||||||
|
cursor = connection.cursor()
|
||||||
|
cursor.execute("DELETE FROM links WHERE url=%s", (url,))
|
||||||
|
connection.commit()
|
||||||
|
cursor.close()
|
||||||
|
connection.close()
|
4
main.py
4
main.py
@ -145,8 +145,10 @@ def delete(path):
|
|||||||
resp = make_response(redirect('/'))
|
resp = make_response(redirect('/'))
|
||||||
resp.set_cookie('linkr', '', expires=0)
|
resp.set_cookie('linkr', '', expires=0)
|
||||||
return resp
|
return resp
|
||||||
|
if domain.lower() != ADMIN_DOMAIN:
|
||||||
db.delete_link(path,domain)
|
db.delete_link(path,domain)
|
||||||
|
else:
|
||||||
|
db.delete_link_admin(path,domain)
|
||||||
return redirect('/dash')
|
return redirect('/dash')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user