linkr/render.py

11 lines
636 B
Python
Raw Normal View History

2023-11-17 11:17:00 +11:00
def links(links,host="",show_domain=False):
2023-11-17 00:06:02 +11:00
host = "https://"+host+"/"
html = ""
for link in links:
2023-12-21 16:14:53 +11:00
html += "<div class='link'><a href='"+link[3]+"' target='_blank' data-umami-event='Visited link from dashboard' data-umami-event-id='"+link[2] + "' class='no_display'>"+host+link[2] +" -> " + link[3]+"</a>"
2023-11-17 11:17:00 +11:00
if show_domain:
html += "<div class='link-domain'>"+link[1]+"</div>"
2023-12-21 16:14:53 +11:00
html += "<div class='link-delete'><a class='no_display' data-umami-event='Deleted link' data-umami-event-id='"+link[2] + "' href='/delete/"+link[2]+"'>Delete</a></div>"
2023-11-17 00:06:02 +11:00
html += "</div>\n"
return html