Mercurial Hosting > disearch
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:af2b95854072 | 14:80105b716a62 |
---|---|
1 local Luan = require "luan:Luan.luan" | 1 local Luan = require "luan:Luan.luan" |
2 local error = Luan.error | 2 local error = Luan.error |
3 local ipairs = Luan.ipairs or error() | 3 local ipairs = Luan.ipairs or error() |
4 local Html = require "luan:Html.luan" | 4 local Html = require "luan:Html.luan" |
5 local html_encode = Html.encode or error() | 5 local html_encode = Html.encode or error() |
6 local url_encode = Html.url_encode or error() | |
6 local Io = require "luan:Io.luan" | 7 local Io = require "luan:Io.luan" |
7 local Http = require "luan:http/Http.luan" | 8 local Http = require "luan:http/Http.luan" |
8 local Shared = require "site:/lib/Shared.luan" | 9 local Shared = require "site:/lib/Shared.luan" |
9 local head = Shared.head or error() | 10 local head = Shared.head or error() |
10 local header = Shared.header or error() | 11 local header = Shared.header or error() |
11 local footer = Shared.footer or error() | 12 local footer = Shared.footer or error() |
13 local base_url = Shared.base_url or error() | |
12 local Server = require "site:/lib/Server.luan" | 14 local Server = require "site:/lib/Server.luan" |
15 local Config = require "site:/lib/Config.luan" | |
16 local Logging = require "luan:logging/Logging.luan" | |
17 local logger = Logging.logger "servers.html" | |
13 | 18 |
14 | 19 |
15 return function() | 20 return function() |
16 local servers = Server.get_user_servers() | 21 local servers = Server.get_user_servers() |
17 Io.stdout = Http.response.text_writer() | 22 Io.stdout = Http.response.text_writer() |
34 <% server.write_img_html() %> | 39 <% server.write_img_html() %> |
35 <a href="<%=server.invite_url()%>">invite</a> | 40 <a href="<%=server.invite_url()%>">invite</a> |
36 <a href="javascript:ajax('/delete_server.js?server=<%=server.id%>')">delete</a> | 41 <a href="javascript:ajax('/delete_server.js?server=<%=server.id%>')">delete</a> |
37 </p> | 42 </p> |
38 <% | 43 <% |
39 end | 44 end |
45 local config = Config.get() | |
46 local redirect_uri = base_url().."/add_server.html" | |
47 local url = "https://discord.com/oauth2/authorize?client_id="..config.discord.client_id.."&scope=bot&response_type=code&redirect_uri="..url_encode(redirect_uri) | |
48 | |
40 %> | 49 %> |
41 <p><a href="choose_server.html">add server</a></p> | 50 <p><a href="<%=url%>">add server</a></p> |
42 | 51 |
43 <% footer() %> | 52 <% footer() %> |
44 </body> | 53 </body> |
45 </html> | 54 </html> |
46 <% | 55 <% |