Mercurial Hosting > disearch
diff src/servers.html.luan @ 14:80105b716a62
start bot
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 31 Oct 2023 23:56:48 -0600 |
parents | af2b95854072 |
children |
line wrap: on
line diff
--- a/src/servers.html.luan Mon Oct 30 21:32:42 2023 -0600 +++ b/src/servers.html.luan Tue Oct 31 23:56:48 2023 -0600 @@ -3,13 +3,18 @@ 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() @@ -36,9 +41,13 @@ <a href="javascript:ajax('/delete_server.js?server=<%=server.id%>')">delete</a> </p> <% - end + 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="choose_server.html">add server</a></p> + <p><a href="<%=url%>">add server</a></p> <% footer() %> </body>