Add option to enforce strict compatibility

Some plugins check for token length. Since PushBits uses longer tokens by default for better security, these plugins are
incompatible. With this patch, users can decide if they want an application to have a short token, so that said plugins
can talk to PushBits again.
This commit is contained in:
eikendev 2021-02-08 00:34:33 +01:00
parent fb90808288
commit d7721e827b
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694
8 changed files with 106 additions and 30 deletions

View file

@ -11,10 +11,13 @@ type Application struct {
// CreateApplication is used to process queries for creating applications.
type CreateApplication struct {
Name string `form:"name" query:"name" json:"name" binding:"required"`
Name string `form:"name" query:"name" json:"name" binding:"required"`
StrictCompatibility bool `form:"strict_compatibility" query:"strict_compatibility" json:"strict_compatibility"`
}
// UpdateApplication is used to process queries for updating applications.
type UpdateApplication struct {
Name *string `json:"name"`
Name *string `form:"new_name" query:"new_name" json:"new_name"`
RefreshToken *bool `form:"refresh_token" query:"refresh_token" json:"refresh_token"`
StrictCompatibility *bool `form:"strict_compatibility" query:"strict_compatibility" json:"strict_compatibility"`
}

View file

@ -79,8 +79,8 @@ func (u *User) IntoExternalUser() *ExternalUser {
// UpdateUser is used to process queries for updating users.
type UpdateUser struct {
Name *string `json:"name"`
Password *string `json:"password"`
IsAdmin *bool `json:"is_admin"`
MatrixID *string `json:"matrix_id"`
Name *string `form:"name" query:"name" json:"name"`
Password *string `form:"password" query:"password" json:"password"`
IsAdmin *bool `form:"is_admin" query:"is_admin" json:"is_admin"`
MatrixID *string `form:"matrix_id" query:"matrix_id" json:"matrix_id"`
}