Mercurial Hosting > disearch
diff src/servers.html.luan @ 13:af2b95854072
add server records
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 30 Oct 2023 21:32:42 -0600 |
parents | 62dd23f0b549 |
children | 80105b716a62 |
line wrap: on
line diff
--- a/src/servers.html.luan Mon Oct 30 14:59:45 2023 -0600 +++ b/src/servers.html.luan Mon Oct 30 21:32:42 2023 -0600 @@ -1,14 +1,19 @@ local Luan = require "luan:Luan.luan" local error = Luan.error +local ipairs = Luan.ipairs or error() +local Html = require "luan:Html.luan" +local html_encode = Html.encode or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() local header = Shared.header or error() local footer = Shared.footer or error() +local Server = require "site:/lib/Server.luan" return function() + local servers = Server.get_user_servers() Io.stdout = Http.response.text_writer() %> <!doctype html> @@ -21,7 +26,18 @@ <% header() %> <h1>Your servers</h1> - +<% + for _, server in ipairs(servers) do +%> + <p> + <%=html_encode(server.name)%> + <% server.write_img_html() %> + <a href="<%=server.invite_url()%>">invite</a> + <a href="javascript:ajax('/delete_server.js?server=<%=server.id%>')">delete</a> + </p> +<% + end +%> <p><a href="choose_server.html">add server</a></p> <% footer() %>