diff options
| author | Ethan Lee <ethanalee@google.com> | 2025-12-17 21:10:20 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-12-20 07:17:10 -0800 |
| commit | 1f39ab54702217a4b686a5902aeec7e5cad36929 (patch) | |
| tree | f7a9f9c117e88f76b2ffd8d2dbd2e34b8391a4a2 /internal/frontend/server.go | |
| parent | 4bec540fa60466fef335f277510938f6043d16dc (diff) | |
| download | go-x-pkgsite-1f39ab54702217a4b686a5902aeec7e5cad36929.tar.xz | |
internal/frontend: add CodeWiki link support to pkgsite
- If a module's source repo exists in CodeWiki, display a link to
codewiki.google/repo.
- Disable the CodeWiki link from being displayed for screentests by
adding it to the hidden elements.
Change-Id: Ia5feb913280b8066806e56524bf9d32ce51f0614
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/730880
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Diffstat (limited to 'internal/frontend/server.go')
| -rw-r--r-- | internal/frontend/server.go | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/internal/frontend/server.go b/internal/frontend/server.go index 5f621fdf..e15f9298 100644 --- a/internal/frontend/server.go +++ b/internal/frontend/server.go @@ -60,7 +60,7 @@ type Server struct { vulnClient *vuln.Client versionID string instanceID string - depsDevHTTPClient *http.Client + HTTPClient *http.Client mu sync.Mutex // Protects all fields below templates map[string]*template.Template @@ -84,18 +84,18 @@ type ServerConfig struct { FetchServer FetchServerInterface // DataSourceGetter should return a DataSource on each call. // It should be goroutine-safe. - DataSourceGetter func(context.Context) internal.DataSource - Queue queue.Queue - TemplateFS template.TrustedFS // for loading templates safely - StaticFS fs.FS // for static/ directory - ThirdPartyFS fs.FS // for third_party/ directory - DevMode bool - LocalMode bool - GoDocMode bool - LocalModules []LocalModule - Reporter derrors.Reporter - VulndbClient *vuln.Client - DepsDevHTTPClient *http.Client + DataSourceGetter func(context.Context) internal.DataSource + Queue queue.Queue + TemplateFS template.TrustedFS // for loading templates safely + StaticFS fs.FS // for static/ directory + ThirdPartyFS fs.FS // for third_party/ directory + DevMode bool + LocalMode bool + GoDocMode bool + LocalModules []LocalModule + Reporter derrors.Reporter + VulndbClient *vuln.Client + HTTPClient *http.Client } // NewServer creates a new Server for the given database and template directory. @@ -107,24 +107,24 @@ func NewServer(scfg ServerConfig) (_ *Server, err error) { } dochtml.LoadTemplates(scfg.TemplateFS) s := &Server{ - fetchServer: scfg.FetchServer, - getDataSource: scfg.DataSourceGetter, - queue: scfg.Queue, - templateFS: scfg.TemplateFS, - staticFS: scfg.StaticFS, - thirdPartyFS: scfg.ThirdPartyFS, - devMode: scfg.DevMode, - localMode: scfg.LocalMode, - goDocMode: scfg.GoDocMode, - localModules: scfg.LocalModules, - templates: ts, - reporter: scfg.Reporter, - fileMux: http.NewServeMux(), - vulnClient: scfg.VulndbClient, - depsDevHTTPClient: scfg.DepsDevHTTPClient, + fetchServer: scfg.FetchServer, + getDataSource: scfg.DataSourceGetter, + queue: scfg.Queue, + templateFS: scfg.TemplateFS, + staticFS: scfg.StaticFS, + thirdPartyFS: scfg.ThirdPartyFS, + devMode: scfg.DevMode, + localMode: scfg.LocalMode, + goDocMode: scfg.GoDocMode, + localModules: scfg.LocalModules, + templates: ts, + reporter: scfg.Reporter, + fileMux: http.NewServeMux(), + vulnClient: scfg.VulndbClient, + HTTPClient: scfg.HTTPClient, } - if s.depsDevHTTPClient == nil { - s.depsDevHTTPClient = http.DefaultClient + if s.HTTPClient == nil { + s.HTTPClient = http.DefaultClient } if scfg.Config != nil { s.appVersionLabel = scfg.Config.AppVersionLabel() |
