adding mastodon meta card, BASE_URL config option.

This commit is contained in:
evilchili 2022-12-31 15:16:30 -08:00
parent 69ab191227
commit 5822702590
3 changed files with 16 additions and 3 deletions

View File

@ -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=

View File

@ -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))

View File

@ -1,9 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<title>{{playlist['name']}} - Groove On Demand</title>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no">
<title>Groove On Demand</title>
<meta name="title" content="{{playlist['name']}}">
<meta name="description" content="{{playlist['description']}}">
<meta name="url" content="{{playlist['url']}}">
<meta name="type" content="audio">
<meta name="provider_name" content="Groove on Demand">
<meta name="html" "<iframe width=\"480\" height=\"270\" src=\"{{playlist['url']}}\" frameborder=\"0\" allowfullscreen=\"\"></iframe>">
<link rel='stylesheet' href='/static/styles.css' />
<link rel='stylesheet' href="https://fonts.cdnfonts.com/css/clarendon-mt-std" />
<script defer crossorigin src='https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.3/howler.core.min.js'></script>