Remove BaseURL from Global
Update template
This commit is contained in:
parent
e2b0ff675b
commit
185cb7a582
|
@ -84,6 +84,8 @@ global:
|
||||||
user_consent:
|
user_consent:
|
||||||
# If the user consent tracking is enabled or not
|
# If the user consent tracking is enabled or not
|
||||||
enabled: false
|
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
|
# Randomly generated string to be used to calculate the HMAC
|
||||||
form_secret: "superSecretRandomlyGeneratedSecret"
|
form_secret: "superSecretRandomlyGeneratedSecret"
|
||||||
# Require consent when user registers for the first time
|
# Require consent when user registers for the first time
|
||||||
|
|
6
docs/templates/privacy/1.0.gohtml
vendored
6
docs/templates/privacy/1.0.gohtml
vendored
|
@ -1,16 +1,16 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Matrix.org Privacy policy</title>
|
<title>Privacy policy</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{ if .HasConsented }}
|
{{ if .HasConsented }}
|
||||||
<p>
|
<p>
|
||||||
Your base already belong to us.
|
You have already given your consent.
|
||||||
</p>
|
</p>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>
|
<p>
|
||||||
All your base are belong to us.
|
Please give your consent to keep using this homeserver.
|
||||||
</p>
|
</p>
|
||||||
{{ if not .PublicVersion }}
|
{{ if not .PublicVersion }}
|
||||||
<!-- The variables used here are only provided when the 'u' param is given to the homeserver -->
|
<!-- The variables used here are only provided when the 'u' param is given to the homeserver -->
|
||||||
|
|
|
@ -289,7 +289,7 @@ func (config *Dendrite) Derive() error {
|
||||||
// TODO: Add MSISDN auth type
|
// TODO: Add MSISDN auth type
|
||||||
|
|
||||||
if config.Global.UserConsentOptions.Enabled && config.Global.UserConsentOptions.RequireAtRegistration {
|
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{
|
config.Derived.Registration.Params[authtypes.LoginTypeTerms] = Terms{
|
||||||
Policies: Policies{
|
Policies: Policies{
|
||||||
PrivacyPolicy: PrivacyPolicy{
|
PrivacyPolicy: PrivacyPolicy{
|
||||||
|
|
|
@ -16,9 +16,6 @@ type Global struct {
|
||||||
// The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'.
|
// The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'.
|
||||||
ServerName gomatrixserverlib.ServerName `yaml:"server_name"`
|
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.
|
// Path to the private key which will be used to sign requests and events.
|
||||||
PrivateKeyPath Path `yaml:"private_key"`
|
PrivateKeyPath Path `yaml:"private_key"`
|
||||||
|
|
||||||
|
@ -75,7 +72,6 @@ type Global struct {
|
||||||
func (c *Global) Defaults(generate bool) {
|
func (c *Global) Defaults(generate bool) {
|
||||||
if generate {
|
if generate {
|
||||||
c.ServerName = "localhost"
|
c.ServerName = "localhost"
|
||||||
c.BaseURL = "http://localhost"
|
|
||||||
c.PrivateKeyPath = "matrix_key.pem"
|
c.PrivateKeyPath = "matrix_key.pem"
|
||||||
_, c.PrivateKey, _ = ed25519.GenerateKey(rand.New(rand.NewSource(0)))
|
_, c.PrivateKey, _ = ed25519.GenerateKey(rand.New(rand.NewSource(0)))
|
||||||
c.KeyID = "ed25519:auto"
|
c.KeyID = "ed25519:auto"
|
||||||
|
@ -86,7 +82,7 @@ func (c *Global) Defaults(generate bool) {
|
||||||
c.Metrics.Defaults(generate)
|
c.Metrics.Defaults(generate)
|
||||||
c.DNSCache.Defaults()
|
c.DNSCache.Defaults()
|
||||||
c.Sentry.Defaults()
|
c.Sentry.Defaults()
|
||||||
c.UserConsentOptions.Defaults(c.BaseURL)
|
c.UserConsentOptions.Defaults()
|
||||||
c.ServerNotices.Defaults(generate)
|
c.ServerNotices.Defaults(generate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,18 +264,18 @@ type UserConsentOptions struct {
|
||||||
// All loaded templates
|
// All loaded templates
|
||||||
Templates *template.Template `yaml:"-"`
|
Templates *template.Template `yaml:"-"`
|
||||||
TextTemplates *textTemplate.Template `yaml:"-"`
|
TextTemplates *textTemplate.Template `yaml:"-"`
|
||||||
// The BaseURL, used for building the consent URL
|
// The base URL this homeserver will serve clients on, e.g. https://matrix.org
|
||||||
BaseURL string `yaml:"-"`
|
BaseURL string `yaml:"base_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *UserConsentOptions) Defaults(baseURL string) {
|
func (c *UserConsentOptions) Defaults() {
|
||||||
c.Enabled = false
|
c.Enabled = false
|
||||||
c.RequireAtRegistration = false
|
c.RequireAtRegistration = false
|
||||||
c.SendServerNoticeToGuest = false
|
c.SendServerNoticeToGuest = false
|
||||||
c.PolicyName = "Privacy Policy"
|
c.PolicyName = "Privacy Policy"
|
||||||
c.Version = "1.0"
|
c.Version = "1.0"
|
||||||
c.TemplateDir = "./templates/privacy"
|
c.TemplateDir = "./templates/privacy"
|
||||||
c.BaseURL = baseURL
|
c.BaseURL = "http://localhost"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *UserConsentOptions) Verify(configErrors *ConfigErrors, isMonolith bool) {
|
func (c *UserConsentOptions) Verify(configErrors *ConfigErrors, isMonolith bool) {
|
||||||
|
|
|
@ -43,8 +43,6 @@ func ParseFlags(monolith bool) *config.Dendrite {
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg, err := config.Load(*configPath, monolith)
|
cfg, err := config.Load(*configPath, monolith)
|
||||||
// TODO: just for testing
|
|
||||||
cfg.Global.UserConsentOptions.BaseURL = cfg.Global.BaseURL
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatalf("Invalid config file: %s", err)
|
logrus.Fatalf("Invalid config file: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue