129 lines
4.4 KiB
Plaintext
129 lines
4.4 KiB
Plaintext
package web
|
||
|
||
import "net/http"
|
||
import "strconv"
|
||
|
||
import "github.com/invopop/ctxi18n/i18n"
|
||
|
||
import "dwelling-radio/internal/radio"
|
||
import "dwelling-radio/pkg/utils"
|
||
|
||
templ Index(prgVer string, curSong *radio.Song, sl []radio.Song, slLen int64, lstnrs *radio.ListenerCounter, r *http.Request) {
|
||
<!DOCTYPE html>
|
||
<html lang={ i18n.GetLocale(ctx).Code().String() }>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<meta name="theme-color" content="#cd2682" />
|
||
<meta name="color-scheme" content="light dark" />
|
||
|
||
<title>Arav's dwelling / { i18n.T(ctx, "title") }</title>
|
||
|
||
<meta name="author" content={ "Alexander \"Arav\" Andreev" } />
|
||
<meta name="description" content={ i18n.T(ctx, "description") } />
|
||
<meta name="keywords" content={ i18n.T(ctx, "keywords") } />
|
||
|
||
<link rel="canonical" href={ utils.Site(r.Host) } />
|
||
|
||
<link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml" />
|
||
<link rel="stylesheet" href="/assets/css/main.css" />
|
||
|
||
<script src="/assets/js/main.js" defer />
|
||
</head>
|
||
<body>
|
||
<header>
|
||
<svg width="360" viewBox="0 -36 360 66">
|
||
<text y="7" textLength="360" lengthAdjust="spacingAndGlyphs">Arav's dwelling</text>
|
||
<text y="25" textLength="360" lengthAdjust="spacingAndGlyphs">Welcome to my sacred place, wanderer</text>
|
||
</svg>
|
||
<nav>
|
||
<a href={ templ.SafeURL(utils.MainSite(r.Host)) }>{ i18n.T(ctx, "back-home") }</a>
|
||
<h1>{ i18n.T(ctx, "title") }</h1>
|
||
</nav>
|
||
</header>
|
||
<section id="banner">
|
||
<video playsinline autoplay loop muted>
|
||
<source src="/assets/img/stopit.mp4" type="video/mp4" />
|
||
</video>
|
||
</section>
|
||
<section>
|
||
<div class="small player-links">
|
||
<a href="/filelist">{ i18n.T(ctx, "link.filelist") }</a>
|
||
<a href="/playlist">{ i18n.T(ctx, "link.playlist") }</a>
|
||
<a href="/live/stream.ogg">{ i18n.T(ctx, "link.direct-link") }</a>
|
||
(<a href="http://radio.arav.su:8000/stream.ogg">http</a>
|
||
<a href="http://wsmkgnmhmzqm7kyzv7jnzzafvgm7xlmlfvzhgorpapd5or2arnhuktqd.onion/live/stream.ogg">Tor</a>
|
||
<a href="http://radio.arav.i2p/live/stream.ogg">I2P</a>
|
||
<a href="http://[300:a98d:d6d0:8a08::e]/live/stream.ogg">Ygg</a>)
|
||
<a href="https://dir.xiph.org/search?q=arav's+dwelling">Xiph</a>
|
||
| OGG 128 Kb/s
|
||
</div>
|
||
<div id="player">
|
||
<div>
|
||
<button id="radio-play" />
|
||
<input id="radio-volume" type="range" min="0" max="100" orient="vertical" />
|
||
</div>
|
||
<audio preload="none" controls playsinline>
|
||
<source src="/live/stream.ogg" type="audio/ogg" />
|
||
{ i18n.T(ctx, "no-audio-tag") } <a href="/playlist">{ i18n.T(ctx, "link.playlist") }</a>.
|
||
</audio>
|
||
<div>
|
||
<p>
|
||
<img src="/assets/img/headphones.svg" alt="Listeners" title="Listeners" />
|
||
<span id="radio-listeners">{ strconv.FormatInt(lstnrs.Current(), 10) }</span>
|
||
<img src="/assets/img/duration.svg" alt="Duration" title="Duration" />
|
||
<span id="radio-duration-estimate"></span>
|
||
<span id="radio-duration">
|
||
if curSong != nil && curSong.Artist != "" {
|
||
{ curSong.DurationString() }
|
||
} else {
|
||
0:00
|
||
}
|
||
</span>
|
||
</p>
|
||
<p>
|
||
<img src="/assets/img/note.svg" alt="Song" title="Song" />
|
||
<span id="radio-song">
|
||
if curSong != nil && curSong.Artist != "" {
|
||
{ curSong.Artist } - { curSong.Title }
|
||
}
|
||
</span>
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<section>
|
||
<h2>{ i18n.T(ctx, "last-songs.h", i18n.M{"n": strconv.FormatInt(slLen, 10)}) }</h2>
|
||
<table id="last-songs">
|
||
<thead class="small">
|
||
<tr>
|
||
<td>{ i18n.T(ctx, "last-songs.tab-start") }</td>
|
||
<td><abbr title={ i18n.T(ctx, "last-songs.tab-stat-tip") }>{ i18n.T(ctx, "last-songs.tab-stat") }</abbr></td>
|
||
<td>{ i18n.T(ctx, "last-songs.tab-song") }</td>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
for _, song := range sl {
|
||
<tr>
|
||
<td>{ utils.ToClientTimezone(song.StartAt, r).Format("15:04") }</td>
|
||
<td>
|
||
if song.PeakListeners != 0 {
|
||
{ strconv.FormatInt(song.Listeners, 10) }/{ strconv.FormatInt(song.PeakListeners, 10) }
|
||
}
|
||
</td>
|
||
<td>{ song.Artist } - { song.Title }</td>
|
||
</tr>
|
||
}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
<footer>
|
||
<a href="?lang=ru">рус</a>
|
||
<a href="?lang=en">eng</a>
|
||
<br/>
|
||
v{ prgVer } 2017—2024 { i18n.T(ctx, "footer.author") } <<a href="mailto:me@arav.su">me@arav.su</a>> <a href={ templ.SafeURL(utils.MainSite(r.Host) + "/privacy") }>{ i18n.T(ctx, "footer.privacy") }</a>
|
||
</footer>
|
||
</body>
|
||
</html>
|
||
} |