view src/add_server.html.luan @ 13:af2b95854072

add server records
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 30 Oct 2023 21:32:42 -0600
parents 3e2cb946d511
children 80105b716a62
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.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()


return function()
	local parameters = Http.request.parameters
	local id = parameters.id or error()
	local name = parameters.name or error()
	name = html_encode(name)
	local icon = parameters.icon or error()
	Io.stdout = Http.response.text_writer()
%>
<!doctype html>
<html>
	<head>
<%		head() %>
		<title>Disearch</title>
		<style>
			input[type="url"] {
				width: 100%;
			}
		</style>
	</head>
	<body>
<%		header() %>

		<h1>Add server</h1>

		<form page onsubmit="ajaxForm('/add_server.js',this); return false">
			<input type=hidden name=id value="<%=id%>">
			<input type=hidden name=name value="<%=name%>">
			<input type=hidden name=icon value="<%=icon%>">
			<p><%=name%></p>
			<p><img icon src="https://cdn.discordapp.com/icons/<%=id%>/<%=icon%>.png"></p>
			<p>
				Invite URL:<br>
				<input type=url required name=invite>
				<span error=invite></span>
			</p>
			<p><input type=submit></p>
		</form>

<%		footer() %>
	</body>
</html>
<%
end