@@ -232,6 +232,9 @@ type htmlState struct {
232
232
CSRF csrfState
233
233
234
234
// Below are HTML escaped JSON strings of the respective structs.
235
+ ApplicationName string
236
+ LogoURL string
237
+
235
238
BuildInfo string
236
239
User string
237
240
Entitlements string
@@ -313,6 +316,14 @@ func (h *Handler) renderHTMLWithState(r *http.Request, filePath string, state ht
313
316
SessionTokenFunc : nil ,
314
317
})
315
318
if ! ok || apiKey == nil || actor == nil {
319
+ var cfg codersdk.AppearanceConfig
320
+ if h .AppearanceFetcher != nil {
321
+ // nolint:gocritic // User is not expected to be signed in.
322
+ ctx := dbauthz .AsSystemRestricted (r .Context ())
323
+ cfg , _ = h .AppearanceFetcher (ctx )
324
+ }
325
+ state .ApplicationName = applicationNameOrDefault (cfg )
326
+ state .LogoURL = cfg .LogoURL
316
327
return execTmpl (tmpl , state )
317
328
}
318
329
@@ -368,6 +379,8 @@ func (h *Handler) renderHTMLWithState(r *http.Request, filePath string, state ht
368
379
appearance , err := json .Marshal (cfg )
369
380
if err == nil {
370
381
state .Appearance = html .EscapeString (string (appearance ))
382
+ state .ApplicationName = applicationNameOrDefault (cfg )
383
+ state .LogoURL = cfg .LogoURL
371
384
}
372
385
}
373
386
}()
@@ -841,3 +854,10 @@ func (b *binHashCache) getHash(name string) (string, error) {
841
854
//nolint:forcetypeassert
842
855
return strings .ToLower (v .(string )), nil
843
856
}
857
+
858
+ func applicationNameOrDefault (cfg codersdk.AppearanceConfig ) string {
859
+ if cfg .ApplicationName != "" {
860
+ return cfg .ApplicationName
861
+ }
862
+ return "Coder"
863
+ }
0 commit comments