mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-23 06:41:56 -06:00
Remove BaseURL from Global
Update template
This commit is contained in:
parent
e2b0ff675b
commit
185cb7a582
|
@ -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
|
||||
|
|
6
docs/templates/privacy/1.0.gohtml
vendored
6
docs/templates/privacy/1.0.gohtml
vendored
|
@ -1,16 +1,16 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Matrix.org Privacy policy</title>
|
||||
<title>Privacy policy</title>
|
||||
</head>
|
||||
<body>
|
||||
{{ if .HasConsented }}
|
||||
<p>
|
||||
Your base already belong to us.
|
||||
You have already given your consent.
|
||||
</p>
|
||||
{{ else }}
|
||||
<p>
|
||||
All your base are belong to us.
|
||||
Please give your consent to keep using this homeserver.
|
||||
</p>
|
||||
{{ if not .PublicVersion }}
|
||||
<!-- 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
|
||||
|
||||
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{
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue