diff options
author | Alan Pearce | 2024-05-25 02:31:40 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-25 02:31:40 +0200 |
commit | fb07320a12f83ffaf80bf3c0aca94a720f865201 (patch) | |
tree | fb36a9853c19c1549ba63f2b5c2ca7b0c90a76ff /internal/server | |
parent | 4c4b980bff860dda725253438b499245338161df (diff) | |
download | searchix-fb07320a12f83ffaf80bf3c0aca94a720f865201.tar.lz searchix-fb07320a12f83ffaf80bf3c0aca94a720f865201.tar.zst searchix-fb07320a12f83ffaf80bf3c0aca94a720f865201.zip |
build: just use nix version as internal version
Diffstat (limited to 'internal/server')
-rw-r--r-- | internal/server/error.go | 1 | ||||
-rw-r--r-- | internal/server/headers.go | 2 | ||||
-rw-r--r-- | internal/server/mux.go | 14 |
3 files changed, 1 insertions, 16 deletions
diff --git a/internal/server/error.go b/internal/server/error.go index 6994ad7..e700d3b 100644 --- a/internal/server/error.go +++ b/internal/server/error.go @@ -17,7 +17,6 @@ func createErrorHandler( indexData := TemplateData{ ExtraHeadHTML: config.Web.ExtraHeadHTML, Sources: config.Importer.Sources, - Version: *versionInfo, Code: code, Message: message, } diff --git a/internal/server/headers.go b/internal/server/headers.go index 562fccc..7ff9fb9 100644 --- a/internal/server/headers.go +++ b/internal/server/headers.go @@ -11,7 +11,7 @@ func AddHeadersMiddleware(next http.Handler, config *cfg.Config) http.Handler { w.Header().Add(h, v) } w.Header().Add("Content-Security-Policy", config.Web.ContentSecurityPolicy.String()) - w.Header().Add("Server", "searchix/"+cfg.ShortSHA) + w.Header().Add("Server", "searchix/"+cfg.Version) next.ServeHTTP(w, r) }) diff --git a/internal/server/mux.go b/internal/server/mux.go index c2469ad..ea4b70c 100644 --- a/internal/server/mux.go +++ b/internal/server/mux.go @@ -34,11 +34,6 @@ type HTTPError struct { const jsSnippet = template.HTML(livereload.JsSnippet) // #nosec G203 -type VersionInfo struct { - ShortSHA string - CommitSHA string -} - type TemplateData struct { Sources map[string]*config.Source Source config.Source @@ -46,7 +41,6 @@ type TemplateData struct { Results bool SourceResult *bleve.SearchResult ExtraHeadHTML template.HTML - Version VersionInfo Code int Message string } @@ -60,11 +54,6 @@ type ResultData struct { Next string } -var versionInfo = &VersionInfo{ - ShortSHA: config.ShortSHA, - CommitSHA: config.CommitSHA, -} - var templates TemplateCollection func applyDevModeOverrides(cfg *config.Config) { @@ -105,7 +94,6 @@ func NewMux( indexData := TemplateData{ ExtraHeadHTML: cfg.Web.ExtraHeadHTML, Sources: cfg.Importer.Sources, - Version: *versionInfo, } w.Header().Add("Cache-Control", "max-age=86400") err := templates["index"].Execute(w, indexData) @@ -154,7 +142,6 @@ func NewMux( ExtraHeadHTML: cfg.Web.ExtraHeadHTML, Source: *source, Sources: cfg.Importer.Sources, - Version: *versionInfo, }, ResultsPerPage: search.ResultsPerPage, Query: qs, @@ -218,7 +205,6 @@ func NewMux( Sources: cfg.Importer.Sources, Source: *source, SourceResult: sourceResult, - Version: *versionInfo, }) if err != nil { errorHandler(w, r, err.Error(), http.StatusInternalServerError) |