diff --git a/groove/cli.py b/groove/cli.py index 1907a1e..1c87406 100644 --- a/groove/cli.py +++ b/groove/cli.py @@ -51,6 +51,9 @@ DEFAULT_THEME=blue_train HOST=127.0.0.1 PORT=2323 +# The URL to use when constructing links. Defaults to http://HOST:PORT. +#BASE_URL=http://127.0.0.1:2323 + # Set this to a suitably random string. SECRET_KEY= diff --git a/groove/playlist.py b/groove/playlist.py index 99207b0..4609497 100644 --- a/groove/playlist.py +++ b/groove/playlist.py @@ -73,7 +73,8 @@ class Playlist: @property def url(self) -> str: - return f"http://{os.environ['HOST']}:{os.environ['PORT']}/playlist/{self.slug}" + base = os.environ.get('BASE_URL', f"http://{os.environ['HOST']}:{os.environ['PORT']}") + return f"{base}/playlist/{self.slug}" @property def slug(self) -> str: @@ -127,7 +128,8 @@ class Playlist: playlist = { 'name': self.name, 'slug': self.slug, - 'description': self.description + 'description': self.description, + 'url': self.url } if self.record: playlist.update(dict(self.record)) diff --git a/groove/static/themes/blue_train/templates/playlist.tpl b/groove/static/themes/blue_train/templates/playlist.tpl index c6ea51b..da9ed87 100644 --- a/groove/static/themes/blue_train/templates/playlist.tpl +++ b/groove/static/themes/blue_train/templates/playlist.tpl @@ -1,9 +1,17 @@
+