aboutsummaryrefslogtreecommitdiff
path: root/reluax.luax
diff options
context:
space:
mode:
authorStanisław Zagórowski <hasohasacz@gmail.com>2024-01-29 17:08:34 +0100
committerStanisław Zagórowski <hasohasacz@gmail.com>2024-01-29 17:08:34 +0100
commit35d76e1b92692398ed61caef819b678477204989 (patch)
tree740cb5036e1596101a3a8922cebfef10e464a585 /reluax.luax
parent76e5a86c7ba514a1d5af97a69946a7272d844593 (diff)
site: add redirects, remove annoying CSS
Diffstat (limited to 'reluax.luax')
-rw-r--r--reluax.luax31
1 files changed, 28 insertions, 3 deletions
diff --git a/reluax.luax b/reluax.luax
index cb45ae6..034d408 100644
--- a/reluax.luax
+++ b/reluax.luax
@@ -15,7 +15,12 @@ local blogposts = require("blog.posts")
math.randomseed(os.time())
-local function wrap_component(component)
+local redirects = {
+ { slug = "mrfinalboss", url = "https://jellingfish-games.itch.io/mr-final-boss" },
+ { slug = "bumblingbuilders", url = "https://oroshibu.itch.io/bumbling-builders" }
+}
+
+local wrap_component = function(component)
return
<Common>
<Navbar />
@@ -28,8 +33,28 @@ local function wrap_component(component)
</Common>
end
-local function route(path)
- if path == '/' then
+local route = function(path, method, headers, body)
+ if method ~= 'GET' then
+ return 405, "Method not allowed"
+ end
+
+ if reluax.url_matches('/r/{slug}', path) then
+ local slug = reluax.url_extract('/r/{slug}', path).slug
+ local redirect = nil
+ for _, r in ipairs(redirects) do
+ if r.slug == slug then
+ redirect = r
+ break
+ end
+ end
+ if redirect then
+ local headers = {
+ ["Location"] = redirect.url
+ }
+ local body = <a>You are being redirected...</a>
+ return 301, reluax.headers(body, headers)
+ end
+ elseif path == '/' then
return 200, wrap_component(<Home />)
elseif path == '/projects' then
return 200, wrap_component(<Projects />)