"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Johannes Thyssen Tishman <johannes@thyssentishman.com>
Subject:
gotwebd: use stylesheet in redirection page
To:
gameoftrees@openbsd.org
Date:
Sat, 20 Jun 2026 13:42:54 +0000

Download raw body.

Thread
Here's a diff to use a stylesheet for the redirection page. The added
code is all taken from the 'gotweb_render_page' function.

M  gotwebd/pages.tmpl  |  29+  1-

1 file changed, 29 insertions(+), 1 deletion(-)

commit - b31d139f2dba212026fb5f7403fe53218d105093
commit + f2f6d077e86c12260720200d57901a172ad212b2
blob - 46d63f952fe699261e1b986996d1a61cb516e1f5
blob + ab1b6288020128df255679667f47261e6eed76a0
--- gotwebd/pages.tmpl
+++ gotwebd/pages.tmpl
@@ -1471,13 +1471,41 @@ date: {{ datebuf }} {{ " UTC" }} {{ "\n" }}
 
 {{ define gotweb_render_fake_redirect(struct template *tp) }}
 {!
-	struct gotweb_url url;
+	struct request		*c = tp->tp_arg;
+	struct server		*srv = c->srv;
+	char			 prefix[MAX_DOCUMENT_URI * 2];
+	const char		*css = srv->custom_css;
+	const char		*url_root, *url_path;
+	struct gotweb_url	url;
+
+	strlcpy(prefix, "/", sizeof(prefix));
+
+	url_root = srv->gotweb_url_root;
+	while (url_root[0] == '/')
+		url_root++;
+	if (url_root[0] != '\0')
+		strlcat(prefix, url_root, sizeof(prefix));
+
+	url_path = srv->repos_url_path;
+	while (url_path[0] == '/')
+		url_path++;
+	if (url_path[0] != '\0') {
+		if (url_root[0] != '\0') {
+			got_path_strip_trailing_slashes(prefix);
+			strlcat(prefix, "/", sizeof(prefix));
+		}
+		strlcat(prefix, url_path, sizeof(prefix));
+	}
+
+	got_path_strip_trailing_slashes(prefix);
+
 	memset(&url, 0, sizeof(url));
 	url.action = INDEX;
 !}
 <html>
 <head>
   <meta http-equiv="refresh" content="0;url={{ render gotweb_render_url(tp->tp_arg, &url) }}">
+  <link rel="stylesheet" type="text/css" href="{{ prefix }}/{{ css }}" />
 </head>
 <body>
 <p>