diff --git a/db.py b/db.py index 0d3b8fb..0d3d2ca 100644 --- a/db.py +++ b/db.py @@ -168,4 +168,12 @@ def delete_link(url,domain): cursor.execute("DELETE FROM links WHERE url=%s AND owner=%s", (url,domain)) connection.commit() cursor.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() \ No newline at end of file diff --git a/main.py b/main.py index c8af825..3079837 100644 --- a/main.py +++ b/main.py @@ -145,8 +145,10 @@ def delete(path): resp = make_response(redirect('/')) resp.set_cookie('linkr', '', expires=0) return resp - - db.delete_link(path,domain) + if domain.lower() != ADMIN_DOMAIN: + db.delete_link(path,domain) + else: + db.delete_link_admin(path,domain) return redirect('/dash')