mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
feat: show service banner in SSH/TTY sessions (#8186)
* Allow workspace agents to get appearance * Poll for service banner every two minutes * Show service banner before MOTD if not quiet
This commit is contained in:
@ -87,6 +87,12 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
|
||||
OAuth2Configs: oauthConfigs,
|
||||
RedirectToLogin: false,
|
||||
})
|
||||
apiKeyMiddlewareOptional := httpmw.ExtractAPIKeyMW(httpmw.ExtractAPIKeyConfig{
|
||||
DB: options.Database,
|
||||
OAuth2Configs: oauthConfigs,
|
||||
RedirectToLogin: false,
|
||||
Optional: true,
|
||||
})
|
||||
|
||||
deploymentID, err := options.Database.GetDeploymentID(ctx)
|
||||
if err != nil {
|
||||
@ -201,11 +207,23 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
|
||||
})
|
||||
})
|
||||
r.Route("/appearance", func(r chi.Router) {
|
||||
r.Use(
|
||||
apiKeyMiddleware,
|
||||
)
|
||||
r.Get("/", api.appearance)
|
||||
r.Put("/", api.putAppearance)
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(
|
||||
apiKeyMiddlewareOptional,
|
||||
httpmw.ExtractWorkspaceAgent(httpmw.ExtractWorkspaceAgentConfig{
|
||||
DB: options.Database,
|
||||
Optional: true,
|
||||
}),
|
||||
httpmw.RequireAPIKeyOrWorkspaceAgent(),
|
||||
)
|
||||
r.Get("/", api.appearance)
|
||||
})
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(
|
||||
apiKeyMiddleware,
|
||||
)
|
||||
r.Put("/", api.putAppearance)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user