M cfg/main.go => cfg/main.go +8 -0
@@ 112,6 112,14 @@ func MergeConfigs(dst, conf, parsed *Config) *Config {
return dst
}
+func (c *Config) HavePlaylists() bool {
+ files, err := os.ReadDir(c.PlaylistDir)
+ if err != nil {
+ return false
+ }
+ return len(files) > 0
+}
+
// ListenAddress is a helper to asseble a string for the server process' listen address.
func (c *Config) ListenAddress() string {
return strings.Join([]string{c.Host, c.Port}, ":")
M http/router/html/base.html => http/router/html/base.html +30 -1
@@ 15,14 15,43 @@
</head>
<body>
<header>
- <h2 class="center"><a href="/" title="The site name, and a link to the main index page.">Mousikofidi IN GO!</a></h2>
+ <h2 class="center"><a href="/" title="The site name, and a link to the main index page.">{{.SiteName}}</a></h2>
</header>
<nav>
<ul>
<li>
<a href="/browse">Browse</a>
</li>
+ {{if .HavePlaylists}}
+ <li id="playlists-nav">
+ <a href="/playlists/" title="A link to the playlists page.">
+ {{if .Icons}}
+ <i class="fas fa-list"></i>
+ {{end}}Playlists
+ </a>
+ </li>
+ {{end}}
+ <li>
+ <a href="/queue/" title="A link to the queue page.">
+ {{if .Icons}}
+ <i class="fas fa-list"></i>
+ {{end}}Queue
+ </a>
+ </li>
+ <li>
+ <a href="/settings/" title="A link to the settings page.">
+ {{if .Icons}}
+ <i class="fas fa-user-cog"></i>
+ {{end}}Settings
+ </a>
+ </li>
+ <li id="logo">
+ <a id="logo">
+ <img alt="The MousikóFídi logo" src="{{.LogoPath}}" title="The MousikóFídi logo">
+ </a>
+ </li>
</ul>
+ <div class="bold center" id="queue-msg"></div>
</nav>
{{block "content" .}}{{end}}
{{template "footer" .}}