feat: Show link owner on admin dash
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
73ef222feb
commit
f1e0d1b5dc
5
main.py
5
main.py
@ -81,16 +81,17 @@ def edit():
|
|||||||
|
|
||||||
avatar=account.get_avatar(domain)
|
avatar=account.get_avatar(domain)
|
||||||
host = request.host
|
host = request.host
|
||||||
|
admin=False
|
||||||
if domain.lower() == ADMIN_DOMAIN:
|
if domain.lower() == ADMIN_DOMAIN:
|
||||||
links = db.get_all_links()
|
links = db.get_all_links()
|
||||||
|
admin=True
|
||||||
else:
|
else:
|
||||||
links = db.get_users_links(domain)
|
links = db.get_users_links(domain)
|
||||||
link_count = len(links)
|
link_count = len(links)
|
||||||
if links == False:
|
if links == False:
|
||||||
links = "<h1>No links created yet</h1>"
|
links = "<h1>No links created yet</h1>"
|
||||||
else:
|
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)
|
return render_template('dash.html',domain=domain,avatar=avatar,host=host,links=links,link_count=link_count)
|
||||||
|
|
||||||
@app.route('/dash', methods=['POST'])
|
@app.route('/dash', methods=['POST'])
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
def links(links,host=""):
|
def links(links,host="",show_domain=False):
|
||||||
host = "https://"+host+"/"
|
host = "https://"+host+"/"
|
||||||
|
|
||||||
html = ""
|
html = ""
|
||||||
for link in links:
|
for link in links:
|
||||||
html += "<div class='link'><a href='"+link[3]+"' target='_blank' class='no_display'>"+host+link[2] +" -> " + link[3]+"</a>"
|
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 class='link-delete'><a class='no_display' href='/delete/"+link[2]+"'>Delete</a></div>"
|
||||||
html += "</div>\n"
|
html += "</div>\n"
|
||||||
return html
|
return html
|
Loading…
Reference in New Issue
Block a user