From 5a0ec6e4435f5feda3a512fc565098739ace6b5d Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Tue, 15 Feb 2022 14:15:18 +0100 Subject: [PATCH] Add policy version to create-account & mediaapi --- cmd/create-account/main.go | 7 ++++++- mediaapi/routing/routing.go | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/create-account/main.go b/cmd/create-account/main.go index 3ac077705..9a79c50f2 100644 --- a/cmd/create-account/main.go +++ b/cmd/create-account/main.go @@ -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()) } diff --git a/mediaapi/routing/routing.go b/mediaapi/routing/routing.go index 2476b5b20..6507505fe 100644 --- a/mediaapi/routing/routing.go +++ b/mediaapi/routing/routing.go @@ -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 }