1
0

Template was rewritten to a form that gets pre-compiled into a Go source file. Must help to increase speed drastically.

This commit is contained in:
Alexander Andreev 2022-06-13 18:37:50 +04:00
parent b5d8b58b81
commit 595d7769ec
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -1,3 +1,7 @@
:go:func Index(mainSite string, status *radio.IcecastStatus, songs *[]radio.Song)
:go:import "dwelling-radio/internal/radio"
doctype html doctype html
html(lang='en') html(lang='en')
head head
@ -16,7 +20,7 @@ html(lang='en')
text.logo Arav's dwelling text.logo Arav's dwelling
text.under(y='11') Welcome to my sacred place, wanderer text.under(y='11') Welcome to my sacred place, wanderer
nav nav
a(href=.MainSite) Back to main website a(href=mainSite) Back to main website
h1 Radio h1 Radio
section section
small.player-links small.player-links
@ -31,27 +35,27 @@ html(lang='en')
audio(preload='none' controls='') audio(preload='none' controls='')
source(src='/live/stream.ogg' type='audio/ogg') source(src='/live/stream.ogg' type='audio/ogg')
| Your browser doesn't support an audio element, it's sad... But you always can take the #[a(href='/playlist') playlist]! | Your browser doesn't support an audio element, it's sad... But you always can take the #[a(href='/playlist') playlist]!
if .Status.ServerStartDate if status.ServerStartDate != ""
p#radio-status On-air since p#radio-status On-air since
time(datetime=.Status.ServerStartISO8601)= .Status.ServerStartDate time(datetime=status.ServerStartISO8601)= status.ServerStartDate
else else
p#radio-status Radio is offline. p#radio-status Radio is offline.
p Now playing: #[span#radio-song #{.Status.SongName}] p Now playing: #[span#radio-song #{status.SongName}]
p Current/peak listeners: #[span#radio-listeners #{.Status.Listeners}] / #[span#radio-listener-peak #{.Status.ListenerPeak}] p Current/peak listeners: #[span#radio-listeners #{status.Listeners}] / #[span#radio-listener-peak #{status.ListenerPeak}]
p p
small Notice: information updates every 45 seconds. But you can #[button(id='btn-update') update] it forcibly. small Notice: information updates every 45 seconds. But you can #[button(id='btn-update') update] it forcibly.
if .Songs if len(*songs) > 0
section section
h2 Last 10 songs h2 Last 10 songs
table#last-played table#last-played
each s in .Songs each song in *songs
tr tr
td= .Time td= song.Time
if ne .Listeners "0" if song.Listeners != "0"
td= .Listeners td= song.Listeners
else else
td td
td= .Song td= song.Song
section section
p The largest number of simultaneous listeners was #[b 7] at #[time(datetime='2022-02-19') 19 February 2022], and the song was "Röyksopp - 49 Percent". p The largest number of simultaneous listeners was #[b 7] at #[time(datetime='2022-02-19') 19 February 2022], and the song was "Röyksopp - 49 Percent".
section section