From c3c38cd2b33d37dfe980c4e21c9b369c138f20c5 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 6 Jan 2019 10:42:45 +0100 Subject: mod_http_errors: Normalize CSS --- plugins/mod_http_errors.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'plugins/mod_http_errors.lua') diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index 13473219..2bb13298 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -26,21 +26,24 @@ local html = [[ {title} -- cgit v1.2.3 From dfa2bdffc083faa597509d7f35125c41f6ffbc9d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 17 Nov 2019 16:16:53 +0100 Subject: mod_http_errors: Show a friendly page instead of 404 on top level --- plugins/mod_http_errors.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins/mod_http_errors.lua') diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index 2bb13298..2158b403 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -75,3 +75,15 @@ module:hook_object_event(server, "http-error", function (event) end return get_page(event.code, (show_private and event.private_message) or event.message); end); + +module:hook_object_event(server, "http-error", function (event) + local request, response = event.request, event.response; + if request and response and request.path == "/" and response.status_code == 404 then + response.headers.content_type = "text/html; charset=utf-8"; + return render(html, { + title = "Prosody is running!"; + message = "Welcome to the XMPP world!"; + }); + end +end, 1); + -- cgit v1.2.3 From 30f7e379d4b316c197c837dce2c47b73b8b77d1f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 29 Dec 2019 22:20:51 +0100 Subject: mod_http_errors: Use text from util.errror object if included This makes util.error objects useful for more than just an error code container. --- plugins/mod_http_errors.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/mod_http_errors.lua') diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index 2158b403..e151a68e 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -73,7 +73,7 @@ module:hook_object_event(server, "http-error", function (event) if event.response then event.response.headers.content_type = "text/html; charset=utf-8"; end - return get_page(event.code, (show_private and event.private_message) or event.message); + return get_page(event.code, (show_private and event.private_message) or event.message or (event.error and event.error.text)); end); module:hook_object_event(server, "http-error", function (event) -- cgit v1.2.3 From 09e8795afb2f3d218be88fbe51819c01d3f7ed13 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 12 Oct 2020 18:13:20 +0200 Subject: mod_http_errors: Use a class on extra data section This CSS selector makes it awkward to add more items. --- plugins/mod_http_errors.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/mod_http_errors.lua') diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index e151a68e..1abdc57e 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -41,7 +41,7 @@ p { font-size : x-large } -p+p { +p.extra { font-size : large; font-family : courier } @@ -50,7 +50,7 @@ p+p {

{title}

{message}

-

{extra?}

+

{extra?}

]]; -- cgit v1.2.3 From 6518e5f41b9ebf9a4be4e9e8a4872fad7ff88f3f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 12 Oct 2020 18:16:18 +0200 Subject: mod_http_errors: Dark theme! --- plugins/mod_http_errors.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugins/mod_http_errors.lua') diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index 1abdc57e..727b2516 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -45,6 +45,13 @@ p.extra { font-size : large; font-family : courier } + +@media(prefers-color-scheme: dark) { + body { + background-color: #161616; + color: #eee + } +} -- cgit v1.2.3 From b4af560c9711221a4da3da41c8cef1d302b63beb Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 12 Oct 2020 18:27:42 +0200 Subject: mod_http_errors: Remove 'extra' element when empty --- plugins/mod_http_errors.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/mod_http_errors.lua') diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua index 727b2516..a2138d88 100644 --- a/plugins/mod_http_errors.lua +++ b/plugins/mod_http_errors.lua @@ -57,7 +57,7 @@ p.extra {

{title}

{message}

-

{extra?}

+{extra&

{extra?}

} ]]; -- cgit v1.2.3