Mercurial Hosting > disearch
view src/servers.html.luan @ 16:552d6f944acb
add bump
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 01 Nov 2023 17:34:15 -0600 |
parents | 80105b716a62 |
children |
line wrap: on
line source
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 url_encode = Html.url_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 base_url = Shared.base_url or error() local Server = require "site:/lib/Server.luan" local Config = require "site:/lib/Config.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "servers.html" return function() local servers = Server.get_user_servers() Io.stdout = Http.response.text_writer() %> <!doctype html> <html> <head> <% head() %> <title>Disearch</title> </head> <body> <% 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 local config = Config.get() local redirect_uri = base_url().."/add_server.html" local url = "https://discord.com/oauth2/authorize?client_id="..config.discord.client_id.."&scope=bot&response_type=code&redirect_uri="..url_encode(redirect_uri) %> <p><a href="<%=url%>">add server</a></p> <% footer() %> </body> </html> <% end