From 08a3fb8a2b0281c3c329b33215ec7f8866add606 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Mon, 14 Jul 2025 01:24:40 +0100 Subject: Add authentication and ability to change host --- web/command/html/host.go | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 web/command/html/host.go (limited to 'web/command/html/host.go') diff --git a/web/command/html/host.go b/web/command/html/host.go new file mode 100644 index 0000000..36f0e6b --- /dev/null +++ b/web/command/html/host.go @@ -0,0 +1,52 @@ +package html + +import ( + "fmt" + + . "maragu.dev/gomponents" + . "maragu.dev/gomponents/html" +) + +func HostPage(success, err, siteName, hostValue string) Node { + return page("Change host for "+siteName, + H1(Text("Change host for "+siteName)), + + If(success != "", Group{ + alertSuccess(success), + Div( + Class("control-group group-right"), + navButton("OK", fmt.Sprintf("/site/%s/", siteName)), + ), + }), + + If(success == "", Group{ + If(err != "", alertError(err)), + + Form( + Method("post"), + + FieldSet( + Legend(Text("Host")), + Input( + ID("host"), + Name("host"), + Value(hostValue), + ), + Span( + Class("form-help"), + Text("The fully qualified domain name for which this site is to be served on. If this site is not to be served by scrapbook, leave blank."), + ), + ), + + Div( + Class("control-group group-right"), + navButton("Go back", fmt.Sprintf("/site/%s/", siteName)), + Input( + Type("submit"), + Value("Submit"), + ), + ), + ), + }), + ) +} -- cgit v1.2.3-70-g09d2