1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-28 01:15:43 +02:00

Upgrade banner

This commit is contained in:
binwiederhier 2023-01-04 22:47:12 -05:00
parent a91da7cf2c
commit 3280c2c440
22 changed files with 114 additions and 118 deletions

View file

@ -107,8 +107,8 @@ type Config struct {
EnableSignup bool
EnableLogin bool
EnableEmailConfirm bool
EnableResetPassword bool
EnableAccountUpgrades bool
EnablePasswordReset bool
EnablePayments bool
Version string // injected by App
}

View file

@ -452,7 +452,7 @@ func (s *Server) handleWebConfig(w http.ResponseWriter, _ *http.Request, _ *visi
AppRoot: appRoot,
EnableLogin: s.config.EnableLogin,
EnableSignup: s.config.EnableSignup,
EnableResetPassword: s.config.EnableResetPassword,
EnablePasswordReset: s.config.EnablePasswordReset,
DisallowedTopics: disallowedTopics,
}
b, err := json.Marshal(response)

View file

@ -80,18 +80,18 @@ func (s *Server) handleAccountGet(w http.ResponseWriter, _ *http.Request, v *vis
}
if v.user.Plan != nil {
response.Plan = &apiAccountPlan{
Code: v.user.Plan.Code,
Upgradable: v.user.Plan.Upgradable,
Code: v.user.Plan.Code,
Upgradeable: v.user.Plan.Upgradeable,
}
} else if v.user.Role == user.RoleAdmin {
response.Plan = &apiAccountPlan{
Code: string(user.PlanUnlimited),
Upgradable: false,
Code: string(user.PlanUnlimited),
Upgradeable: false,
}
} else {
response.Plan = &apiAccountPlan{
Code: string(user.PlanDefault),
Upgradable: true,
Code: string(user.PlanDefault),
Upgradeable: true,
}
}
reservations, err := s.userManager.Reservations(v.user.Name)
@ -111,8 +111,8 @@ func (s *Server) handleAccountGet(w http.ResponseWriter, _ *http.Request, v *vis
response.Username = user.Everyone
response.Role = string(user.RoleAnonymous)
response.Plan = &apiAccountPlan{
Code: string(user.PlanNone),
Upgradable: true,
Code: string(user.PlanNone),
Upgradeable: true,
}
}
w.Header().Set("Content-Type", "application/json")

View file

@ -235,8 +235,8 @@ type apiAccountTokenResponse struct {
}
type apiAccountPlan struct {
Code string `json:"code"`
Upgradable bool `json:"upgradable"`
Code string `json:"code"`
Upgradeable bool `json:"upgradeable"`
}
type apiAccountLimits struct {
@ -286,6 +286,7 @@ type apiConfigResponse struct {
AppRoot string `json:"app_root"`
EnableLogin bool `json:"enable_login"`
EnableSignup bool `json:"enable_signup"`
EnableResetPassword bool `json:"enable_reset_password"`
EnablePasswordReset bool `json:"enable_password_reset"`
EnablePayments bool `json:"enable_payments"`
DisallowedTopics []string `json:"disallowed_topics"`
}