feat: Show link owner on admin dash
All checks were successful
Build Docker / Build Main Image (push) Successful in 21s

This commit is contained in:
Nathan Woodburn 2023-11-17 11:17:00 +11:00
parent 73ef222feb
commit f1e0d1b5dc
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 6 additions and 3 deletions

View File

@ -81,16 +81,17 @@ def edit():
avatar=account.get_avatar(domain)
host = request.host
admin=False
if domain.lower() == ADMIN_DOMAIN:
links = db.get_all_links()
admin=True
else:
links = db.get_users_links(domain)
link_count = len(links)
if links == False:
links = "<h1>No links created yet</h1>"
else:
links = render.links(links,host)
links = render.links(links,host,admin)
return render_template('dash.html',domain=domain,avatar=avatar,host=host,links=links,link_count=link_count)
@app.route('/dash', methods=['POST'])

View File

@ -1,9 +1,11 @@
def links(links,host=""):
def links(links,host="",show_domain=False):
host = "https://"+host+"/"
html = ""
for link in links:
html += "<div class='link'><a href='"+link[3]+"' target='_blank' class='no_display'>"+host+link[2] +" -> " + link[3]+"</a>"
if show_domain:
html += "<div class='link-domain'>"+link[1]+"</div>"
html += "<div class='link-delete'><a class='no_display' href='/delete/"+link[2]+"'>Delete</a></div>"
html += "</div>\n"
return html