diff --git a/dendrite-config.yaml b/dendrite-config.yaml index e2e29a982..66dc5e049 100644 --- a/dendrite-config.yaml +++ b/dendrite-config.yaml @@ -84,6 +84,8 @@ global: user_consent: # If the user consent tracking is enabled or not enabled: false + # The base URL this homeserver will serve clients on, e.g. https://matrix.org + base_url: http://localhost # Randomly generated string to be used to calculate the HMAC form_secret: "superSecretRandomlyGeneratedSecret" # Require consent when user registers for the first time diff --git a/docs/templates/privacy/1.0.gohtml b/docs/templates/privacy/1.0.gohtml index 54438c4e0..8704ff2e2 100644 --- a/docs/templates/privacy/1.0.gohtml +++ b/docs/templates/privacy/1.0.gohtml @@ -1,16 +1,16 @@
-- Your base already belong to us. + You have already given your consent.
{{ else }}- All your base are belong to us. + Please give your consent to keep using this homeserver.
{{ if not .PublicVersion }} diff --git a/setup/config/config.go b/setup/config/config.go index 8a15240aa..8559af23b 100644 --- a/setup/config/config.go +++ b/setup/config/config.go @@ -289,7 +289,7 @@ func (config *Dendrite) Derive() error { // TODO: Add MSISDN auth type if config.Global.UserConsentOptions.Enabled && config.Global.UserConsentOptions.RequireAtRegistration { - uri := config.Global.BaseURL + "/_matrix/consent?v=" + config.Global.UserConsentOptions.Version + uri := config.Global.UserConsentOptions.BaseURL + "/_matrix/consent?v=" + config.Global.UserConsentOptions.Version config.Derived.Registration.Params[authtypes.LoginTypeTerms] = Terms{ Policies: Policies{ PrivacyPolicy: PrivacyPolicy{ diff --git a/setup/config/config_global.go b/setup/config/config_global.go index 22be162a4..19eec8be4 100644 --- a/setup/config/config_global.go +++ b/setup/config/config_global.go @@ -16,9 +16,6 @@ type Global struct { // The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'. ServerName gomatrixserverlib.ServerName `yaml:"server_name"` - // The base URL this homeserver will server clients on, e.g. https://matrix.org - BaseURL string `yaml:"base_url"` - // Path to the private key which will be used to sign requests and events. PrivateKeyPath Path `yaml:"private_key"` @@ -75,7 +72,6 @@ type Global struct { func (c *Global) Defaults(generate bool) { if generate { c.ServerName = "localhost" - c.BaseURL = "http://localhost" c.PrivateKeyPath = "matrix_key.pem" _, c.PrivateKey, _ = ed25519.GenerateKey(rand.New(rand.NewSource(0))) c.KeyID = "ed25519:auto" @@ -86,7 +82,7 @@ func (c *Global) Defaults(generate bool) { c.Metrics.Defaults(generate) c.DNSCache.Defaults() c.Sentry.Defaults() - c.UserConsentOptions.Defaults(c.BaseURL) + c.UserConsentOptions.Defaults() c.ServerNotices.Defaults(generate) } @@ -268,18 +264,18 @@ type UserConsentOptions struct { // All loaded templates Templates *template.Template `yaml:"-"` TextTemplates *textTemplate.Template `yaml:"-"` - // The BaseURL, used for building the consent URL - BaseURL string `yaml:"-"` + // The base URL this homeserver will serve clients on, e.g. https://matrix.org + BaseURL string `yaml:"base_url"` } -func (c *UserConsentOptions) Defaults(baseURL string) { +func (c *UserConsentOptions) Defaults() { c.Enabled = false c.RequireAtRegistration = false c.SendServerNoticeToGuest = false c.PolicyName = "Privacy Policy" c.Version = "1.0" c.TemplateDir = "./templates/privacy" - c.BaseURL = baseURL + c.BaseURL = "http://localhost" } func (c *UserConsentOptions) Verify(configErrors *ConfigErrors, isMonolith bool) { diff --git a/setup/flags.go b/setup/flags.go index 2f0634619..09db51bc5 100644 --- a/setup/flags.go +++ b/setup/flags.go @@ -43,8 +43,6 @@ func ParseFlags(monolith bool) *config.Dendrite { } cfg, err := config.Load(*configPath, monolith) - // TODO: just for testing - cfg.Global.UserConsentOptions.BaseURL = cfg.Global.BaseURL if err != nil { logrus.Fatalf("Invalid config file: %s", err) }