mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +00:00
feat: add customizable upgrade message on client/server version mismatch (#11587)
This commit is contained in:
Generated
+7
@@ -8329,6 +8329,10 @@ const docTemplate = `{
|
||||
"description": "ExternalURL references the current Coder version.\nFor production builds, this will link directly to a release. For development builds, this will link to a commit.",
|
||||
"type": "string"
|
||||
},
|
||||
"upgrade_message": {
|
||||
"description": "UpgradeMessage is the message displayed to users when an outdated client\nis detected.",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "Version returns the semantic version of the build.",
|
||||
"type": "string"
|
||||
@@ -9043,6 +9047,9 @@ const docTemplate = `{
|
||||
"cache_directory": {
|
||||
"type": "string"
|
||||
},
|
||||
"cli_upgrade_message": {
|
||||
"type": "string"
|
||||
},
|
||||
"config": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
Generated
+7
@@ -7418,6 +7418,10 @@
|
||||
"description": "ExternalURL references the current Coder version.\nFor production builds, this will link directly to a release. For development builds, this will link to a commit.",
|
||||
"type": "string"
|
||||
},
|
||||
"upgrade_message": {
|
||||
"description": "UpgradeMessage is the message displayed to users when an outdated client\nis detected.",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "Version returns the semantic version of the build.",
|
||||
"type": "string"
|
||||
@@ -8079,6 +8083,9 @@
|
||||
"cache_directory": {
|
||||
"type": "string"
|
||||
},
|
||||
"cli_upgrade_message": {
|
||||
"type": "string"
|
||||
},
|
||||
"config": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+1
-1
@@ -645,7 +645,7 @@ func New(options *Options) *API {
|
||||
// All CSP errors will be logged
|
||||
r.Post("/csp/reports", api.logReportCSPViolations)
|
||||
|
||||
r.Get("/buildinfo", buildInfo(api.AccessURL))
|
||||
r.Get("/buildinfo", buildInfo(api.AccessURL, api.DeploymentValues.CLIUpgradeMessage.String()))
|
||||
// /regions is overridden in the enterprise version
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(apiKeyMiddleware)
|
||||
|
||||
@@ -68,7 +68,7 @@ func (api *API) deploymentStats(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags General
|
||||
// @Success 200 {object} codersdk.BuildInfoResponse
|
||||
// @Router /buildinfo [get]
|
||||
func buildInfo(accessURL *url.URL) http.HandlerFunc {
|
||||
func buildInfo(accessURL *url.URL, upgradeMessage string) http.HandlerFunc {
|
||||
return func(rw http.ResponseWriter, r *http.Request) {
|
||||
httpapi.Write(r.Context(), rw, http.StatusOK, codersdk.BuildInfoResponse{
|
||||
ExternalURL: buildinfo.ExternalURL(),
|
||||
@@ -76,6 +76,7 @@ func buildInfo(accessURL *url.URL) http.HandlerFunc {
|
||||
AgentAPIVersion: AgentAPIVersionREST,
|
||||
DashboardURL: accessURL.String(),
|
||||
WorkspaceProxy: false,
|
||||
UpgradeMessage: upgradeMessage,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user