feat: add configurable site name via SITE_NAME env var
- Introduce `SITE_NAME` environment variable with fallback to 'Bri-Tunes' - Propagate `siteName` to templates via `res.locals` - Replace hardcoded 'Bri-Tunes' references in layout, header, home title, and boot sequence - Update `.env.example` with new variable
This commit is contained in:
parent
5394e0cef4
commit
a24f2fe75d
|
|
@ -4,6 +4,7 @@ SESSION_SECRET=change-me-to-a-long-random-string
|
||||||
ADMIN_BOOTSTRAP_EMAIL=admin@example.com
|
ADMIN_BOOTSTRAP_EMAIL=admin@example.com
|
||||||
DB_PATH=./tunes.db
|
DB_PATH=./tunes.db
|
||||||
MEDIA_DIR=./media
|
MEDIA_DIR=./media
|
||||||
|
SITE_NAME=Bri-Tunes
|
||||||
|
|
||||||
# ── Email verification ──────────────────────────────────────────────────────
|
# ── Email verification ──────────────────────────────────────────────────────
|
||||||
# Full URL of this app — used to build the /verify-email link in emails.
|
# Full URL of this app — used to build the /verify-email link in emails.
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ if (overlay && textEl) {
|
||||||
overlay.classList.add('hidden', 'gone');
|
overlay.classList.add('hidden', 'gone');
|
||||||
overlay.setAttribute('aria-hidden', 'true');
|
overlay.setAttribute('aria-hidden', 'true');
|
||||||
} else {
|
} else {
|
||||||
|
const siteName = (overlay.dataset.siteName || 'BRI-TUNES').toUpperCase();
|
||||||
const lines = [
|
const lines = [
|
||||||
'BRI-TUNES OS v1.0',
|
`${siteName} OS v1.0`,
|
||||||
'',
|
'',
|
||||||
'> boot loader ........................ OK',
|
'> boot loader ........................ OK',
|
||||||
'> initializing audio subsystem ....... OK',
|
'> initializing audio subsystem ....... OK',
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ const { csrfSynchronisedProtection, generateToken } = csrfSync({
|
||||||
|
|
||||||
// Attach helpers for templates.
|
// Attach helpers for templates.
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
|
res.locals.siteName = process.env.SITE_NAME || 'Bri-Tunes';
|
||||||
res.locals.user = req.session.user || null;
|
res.locals.user = req.session.user || null;
|
||||||
res.locals.flash = req.session.flash || null;
|
res.locals.flash = req.session.flash || null;
|
||||||
delete req.session.flash;
|
delete req.session.flash;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function denyAccess(req, res, next, visibility) {
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
const loggedIn = !!req.session.user;
|
const loggedIn = !!req.session.user;
|
||||||
res.render('public/home', {
|
res.render('public/home', {
|
||||||
title: 'Tunes',
|
title: res.locals.siteName,
|
||||||
featured: playlists.featured(5, loggedIn),
|
featured: playlists.featured(5, loggedIn),
|
||||||
recent: songs.recent(8, loggedIn),
|
recent: songs.recent(8, loggedIn),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ function toView(row) {
|
||||||
function trackView(row) {
|
function trackView(row) {
|
||||||
return {
|
return {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
|
slug: row.slug,
|
||||||
title: row.title,
|
title: row.title,
|
||||||
artist: row.artist,
|
artist: row.artist,
|
||||||
album: row.album,
|
album: row.album,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<title><%= typeof title !== 'undefined' ? title : 'Bri-Tunes' %></title>
|
<title><%= typeof title !== 'undefined' ? title : siteName %></title>
|
||||||
<link rel="preload" href="/static/vendor/fonts/Orbitron.woff2" as="font" type="font/woff2" crossorigin>
|
<link rel="preload" href="/static/vendor/fonts/Orbitron.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
<link rel="preload" href="/static/vendor/fonts/Inter.woff2" as="font" type="font/woff2" crossorigin>
|
<link rel="preload" href="/static/vendor/fonts/Inter.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
<link rel="icon" href="/static/favicon.ico" sizes="any">
|
<link rel="icon" href="/static/favicon.ico" sizes="any">
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<body>
|
<body>
|
||||||
<canvas id="bg-canvas" aria-hidden="true"></canvas>
|
<canvas id="bg-canvas" aria-hidden="true"></canvas>
|
||||||
|
|
||||||
<div id="boot-overlay" aria-hidden="true">
|
<div id="boot-overlay" aria-hidden="true" data-site-name="<%= siteName %>">
|
||||||
<div class="boot-inner" id="boot-text"></div>
|
<div class="boot-inner" id="boot-text"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
<div class="container header-inner">
|
<div class="container header-inner">
|
||||||
<a class="brand" href="/">🎵 Bri-Tunes</a>
|
<a class="brand" href="/">🎵 <%= siteName %></a>
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<a href="/songs" class="<%= currentPath && currentPath.startsWith('/songs') ? 'active' : '' %>">Songs</a>
|
<a href="/songs" class="<%= currentPath && currentPath.startsWith('/songs') ? 'active' : '' %>">Songs</a>
|
||||||
<a href="/playlists" class="<%= currentPath && currentPath.startsWith('/playlists') ? 'active' : '' %>">Playlists</a>
|
<a href="/playlists" class="<%= currentPath && currentPath.startsWith('/playlists') ? 'active' : '' %>">Playlists</a>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue