Add policy version to create-account & mediaapi

This commit is contained in:
Till Faelligen 2022-02-15 14:15:18 +01:00
parent 535d388ec0
commit 5a0ec6e443
2 changed files with 8 additions and 3 deletions

View file

@ -81,7 +81,12 @@ func main() {
logrus.Fatalln("Failed to connect to the database:", err.Error())
}
_, err = accountDB.CreateAccount(context.Background(), *username, pass, "")
policyVersion := ""
if cfg.Global.UserConsentOptions.Enabled() {
policyVersion = cfg.Global.UserConsentOptions.Version
}
_, err = accountDB.CreateAccount(context.Background(), *username, pass, "", policyVersion)
if err != nil {
logrus.Fatalln("Failed to create the account:", err.Error())
}

View file

@ -60,14 +60,14 @@ func Setup(
PathToResult: map[string]*types.ThumbnailGenerationResult{},
}
uploadHandler := httputil.MakeAuthAPI("upload", userAPI, cfg.Matrix.UserConsentOptions, func(req *http.Request, dev *userapi.Device) util.JSONResponse {
uploadHandler := httputil.MakeAuthAPI("upload", userAPI, cfg.Matrix.UserConsentOptions, false, func(req *http.Request, dev *userapi.Device) util.JSONResponse {
if r := rateLimits.Limit(req); r != nil {
return *r
}
return Upload(req, cfg, dev, db, activeThumbnailGeneration)
})
configHandler := httputil.MakeAuthAPI("config", userAPI, cfg.Matrix.UserConsentOptions, func(req *http.Request, device *userapi.Device) util.JSONResponse {
configHandler := httputil.MakeAuthAPI("config", userAPI, cfg.Matrix.UserConsentOptions, false, func(req *http.Request, device *userapi.Device) util.JSONResponse {
if r := rateLimits.Limit(req); r != nil {
return *r
}