From 2e5c296a7c36be46169a52c67a1f70658ed7a837 Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Tue, 12 Jul 2022 11:16:03 +0100 Subject: [PATCH] Add the ability to include a CSS sheet link. The output page no states Package Set rather than just Package. --- conf/zone.go | 1 + config.example.yml | 1 + web/outputpage.html | 9 +++++++-- web/pagehandler.go | 1 + web/web.go | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/conf/zone.go b/conf/zone.go index 381d759..ace87ea 100644 --- a/conf/zone.go +++ b/conf/zone.go @@ -5,6 +5,7 @@ import "golang.captainalm.com/GOPackageHeaderServer/outputMeta" type ZoneYaml struct { Name string `yaml:"name"` Domains []string `yaml:"domains"` + CssURL string `yaml:"cssURL"` HavePageContents bool `yaml:"havePageContents"` BasePath string `yaml:"basePath"` UsernameProvided bool `yaml:"usernameProvided"` diff --git a/config.example.yml b/config.example.yml index 917d853..4a2909a 100644 --- a/config.example.yml +++ b/config.example.yml @@ -8,6 +8,7 @@ listen: #HTTP server settings zones: #An array of zones - name: test #The name of the package set domains: ["localhost:8080"] #An array of domains this package set use (Each domain can only be registered with one zone) + cssURL: "http://localhost/sheet.css" #A URL to the CSS file to use for outputted pages (If blank or not provided, no CSS is included) havePageContents: true #Output a header and link to the target repo basePath: "localhost" #The base-path, also known as, package name basePrefixURL: "http://localhost" #The base git URL diff --git a/web/outputpage.html b/web/outputpage.html index 715586a..407ac86 100644 --- a/web/outputpage.html +++ b/web/outputpage.html @@ -1,8 +1,13 @@ + {{ if .PageHandler.OutputPage }} {{ if isNotEmpty .PageHandler.Name }} - Go Package: {{ .PageHandler.Name }} + Go Package Set: {{ .PageHandler.Name }} + {{ end }} + {{ if isNotEmpty .PageHandler.CSS }} + + {{ end }} {{ end }} @@ -10,7 +15,7 @@ {{ if .PageHandler.OutputPage }} {{ if isNotEmpty .PageHandler.Name }} -

Go Package: {{ .PageHandler.Name }}

+

Go Package Set: {{ .PageHandler.Name }}

{{ end }} {{ .GetLink }} {{ end }} diff --git a/web/pagehandler.go b/web/pagehandler.go index 36769df..9485389 100644 --- a/web/pagehandler.go +++ b/web/pagehandler.go @@ -10,6 +10,7 @@ import ( type PageHandler struct { Name string + CSS string OutputPage bool MetaOutput *outputMeta.PackageMetaTagOutputter } diff --git a/web/web.go b/web/web.go index 26cecbd..1498fea 100644 --- a/web/web.go +++ b/web/web.go @@ -14,6 +14,7 @@ func New(yaml conf.ConfigYaml) (*http.Server, map[string]*PageHandler) { for _, zc := range yaml.Zones { currentPage := &PageHandler{ Name: zc.Name, + CSS: zc.CssURL, OutputPage: zc.HavePageContents, MetaOutput: zc.GetPackageMetaTagOutputter(), }