allow customization of <title>

This commit is contained in:
Alex Dunn 2020-06-03 12:15:30 -07:00
parent de117eb5a9
commit 677a9fd9cb
5 changed files with 7 additions and 4 deletions

View File

@ -328,7 +328,7 @@ func handleIndexTemplate(w http.ResponseWriter, r *http.Request) {
Video: true,
Chat: true,
MessageHistoryCount: settings.MaxMessageCount,
Title: "Movie Night!",
Title: settings.PageTitle,
}
path := strings.Split(strings.TrimLeft(r.URL.Path, "/"), "/")

View File

@ -26,6 +26,7 @@ type Settings struct {
StreamStats bool
MaxMessageCount int
TitleLength int // maximum length of the title that can be set with the /playing
PageTitle string // primary value for the page <title> element
AdminPassword string
RegenAdminPass bool // regenerate admin password on start?
StreamKey string

View File

@ -1,5 +1,6 @@
{
"MaxMessageCount": 300,
"PageTitle": "Movie Night",
"TitleLength": 50,
"AdminPassword": "",
"RegenAdminPass": true,

View File

@ -23,10 +23,10 @@ function deleteCookie(cname) {
function setPlaying(title, link) {
if (title !== "") {
$('#playing').text(title);
document.title = "Movie Night | " + title;
document.title = pageTitle + " | " + title;
} else {
$('#playing').text("");
document.title = "Movie Night";
document.title = pageTitle;
}
$('#playing').removeAttr('href');

View File

@ -1,4 +1,5 @@
{{define "header"}}
<script>pageTitle = {{ .Title }}</script>
{{if .Chat}}
<script type="application/javascript" src="/static/js/wasm_exec.js"></script>
<script type="application/javascript" src="/static/js/chat.js"></script>
@ -124,4 +125,4 @@
</div>
</div>
{{end}}
{{end}}
{{end}}