diff --git a/docs/docs/configuration/server.rst b/docs/docs/configuration/server.rst index b856003..888f9c6 100644 --- a/docs/docs/configuration/server.rst +++ b/docs/docs/configuration/server.rst @@ -156,6 +156,12 @@ listen Does not apply for `uWSGI`. +public-endpoint + public URL that Isso is accessed from by end users. Should always be + a http:// or https:// absolute address. If left blank, automatic + detection is attempted. Normally only needs to be specified if + different than the `listen` setting. + reload reload application, when the source code has changed. Useful for development. Only works with the internal webserver. diff --git a/isso/ext/notifications.py b/isso/ext/notifications.py index 00f0a02..78516bb 100644 --- a/isso/ext/notifications.py +++ b/isso/ext/notifications.py @@ -75,12 +75,7 @@ class SMTP(object): self.isso = isso self.conf = isso.conf.section("smtp") - gh = isso.conf.get("general", "host") - if type(gh) == str: - self.general_host = gh - #if gh is not a string then gh is a list - else: - self.general_host = gh[0] + self.public_endpoint = isso.conf.get("server", "public-endpoint") or local("host") # test SMTP connectivity try: @@ -129,7 +124,7 @@ class SMTP(object): rv.write("---\n") if admin: - uri = self.general_host + "/id/%i" % comment["id"] + uri = self.public_endpoint + "/id/%i" % comment["id"] key = self.isso.sign(comment["id"]) rv.write("Delete comment: %s\n" % (uri + "/delete/" + key)) @@ -138,7 +133,7 @@ class SMTP(object): rv.write("Activate comment: %s\n" % (uri + "/activate/" + key)) else: - uri = self.general_host + "/id/%i" % parent_comment["id"] + uri = self.public_endpoint + "/id/%i" % parent_comment["id"] key = self.isso.sign(('unsubscribe', recipient)) rv.write("Unsubscribe from this conversation: %s\n" % (uri + "/unsubscribe/" + quote(recipient) + "/" + key)) diff --git a/share/isso.conf b/share/isso.conf index 57a1155..16afce1 100644 --- a/share/isso.conf +++ b/share/isso.conf @@ -78,6 +78,11 @@ purge-after = 30d # for details). Does not apply for uWSGI. listen = http://localhost:8080 +# public URL that Isso is accessed from by end users. Should always be a +# http:// or https:// absolute address. If left blank, automatic detection is +# attempted. +public-endpoint = + # reload application, when the source code has changed. Useful for development. # Only works with the internal webserver. reload = off