add lots of stuff

This commit is contained in:
Sky Johnson 2025-05-21 22:04:43 -05:00
parent f9c3921768
commit 4d02f7d0b7
7 changed files with 37 additions and 18 deletions

Binary file not shown.

11
libs/install.lua Normal file
View File

@ -0,0 +1,11 @@
local m = {}
function m.is_installed()
if fs.exists(".installed") then
return true
else
return false
end
end
return m

BIN
moonshark

Binary file not shown.

View File

@ -0,0 +1,16 @@
local i = require("install")
if i.is_installed() then http.redirect("/") end
return send.html([[
<html>
<head>
<title>Dragon Knight Installation</title>
</head>
<body>
<h1>Dragon Knight Installation</h1>
<p>Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.</p>
<a href="/install/second"><button>Install</button></a>
</body>
</html>
]])

View File

@ -1,14 +1,2 @@
http.set_content_type("text/html") local i = require("install")
return [[ if i.is_installed() then http.redirect("/") else http.redirect("/install/first") end
<html>
<head>
<title>Dragon Knight Installation</title>
</head>
<body>
<h1>Dragon Knight Installation</h1>
<p>Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.</p>
<a href="/install/second"><button>Install</button></a>
</body>
</html>
]]

View File

@ -1,3 +1,6 @@
local i = require("install")
if i.is_installed() then http.redirect("/") end
local start = microtime(true) local start = microtime(true)
local db = sqlite("dk") local db = sqlite("dk")
@ -429,16 +432,15 @@ db:commit()
local time = math.roundto(microtime(true) - start, 4) local time = math.roundto(microtime(true) - start, 4)
http.set_content_type("text/html") return send.html(iparse([[
return [[
<html> <html>
<head> <head>
<title>Dragon Knight Installation</title> <title>Dragon Knight Installation</title>
</head> </head>
<body> <body>
<h1>Dragon Knight Installation</h1> <h1>Dragon Knight Installation</h1>
<p>Database setup complete in ]]..time..[[ seconds.</p> <p>Database setup complete in <!> seconds.</p>
<a href="/install/third"><button>Continue</button></a> <a href="/install/third"><button>Continue</button></a>
</body> </body>
</html> </html>
]] ]], {time}))

View File

@ -0,0 +1,2 @@
local i = require("install")
if i.is_installed() then http.redirect("/") end