Bläddra i källkod

Improved sitename config usage

Owen Diffey 3 år sedan
förälder
incheckning
cbf628a226

+ 4 - 4
frontend/dist/index.tpl.html

@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <html lang='en'>
 <head>
-	<title>Musare</title>
+	<title><%= htmlWebpackPlugin.options.title %></title>
 
 	<meta charset='UTF-8'>
 	<meta http-equiv='X-UA-Compatible' content='IE=edge'>
 	<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'>
-	<meta name='keywords' content='music, musare, listen, station, station, radio, edm, chill, community, official, rooms, room, party, good, mus, pop'>
-	<meta name='description' content='On Musare you can listen to lots of different songs, playing 24/7 in our official stations and in user-made community stations!'>
-	<meta name='copyright' content='© Copyright Musare 2015-2021 All Right Reserved'>
+	<meta name='keywords' content='music, <%= htmlWebpackPlugin.options.title %>, listen, station, station, radio, edm, chill, community, official, rooms, room, party, good, mus, pop'>
+	<meta name='description' content='On <%= htmlWebpackPlugin.options.title %> you can listen to lots of different songs, playing 24/7 in our official stations and in user-made community stations!'>
+	<meta name='copyright' content='© Copyright <%= htmlWebpackPlugin.options.title %> 2015-2021 All Right Reserved'>
 
 	<link rel='apple-touch-icon' sizes='57x57' href='/assets/favicon/apple-touch-icon-57x57.png?v=06042016'>
 	<link rel='apple-touch-icon' sizes='60x60' href='/assets/favicon/apple-touch-icon-60x60.png?v=06042016'>

+ 33 - 10
frontend/src/components/layout/MainFooter.vue

@@ -3,13 +3,21 @@
 		<div class="container">
 			<div class="footer-content has-text-centered">
 				<div id="footer-copyright">
-					<p>© Copyright Musare 2015 - 2021</p>
+					<p>© Copyright {{ siteSettings.sitename }} 2015 - 2021</p>
 				</div>
-				<a id="footer-logo" href="/"
-					><img src="/assets/blue_wordmark.png" alt="Musare"
-				/></a>
+				<a id="footer-logo" href="/">
+					<img
+						v-if="siteSettings.sitename === 'Musare'"
+						:src="siteSettings.logo_blue"
+						:alt="siteSettings.sitename || `Musare`"
+					/>
+					<span v-else>{{ siteSettings.sitename }}</span>
+				</a>
 				<div id="footer-links">
-					<a :href="github" target="_blank" title="GitHub Repository"
+					<a
+						:href="siteSettings.github"
+						target="_blank"
+						title="GitHub Repository"
 						>GitHub</a
 					>
 					<router-link title="About Musare" to="/about"
@@ -29,11 +37,15 @@
 export default {
 	data() {
 		return {
-			github: "#"
+			siteSettings: {
+				logo: "",
+				sitename: "Musare",
+				github: "#"
+			}
 		};
 	},
 	async mounted() {
-		this.github = await lofig.get("siteSettings.github");
+		this.siteSettings = await lofig.get("siteSettings");
 	}
 };
 </script>
@@ -86,6 +98,17 @@ export default {
 		width: 160px;
 		order: 1;
 		user-select: none;
+		font-size: 2.5rem !important;
+		line-height: 50px !important;
+		font-family: Pacifico, cursive;
+		color: var(--primary-color);
+		white-space: nowrap;
+
+		img {
+			max-height: 38px;
+			color: var(--primary-color);
+			user-select: none;
+		}
 	}
 
 	#footer-links {
@@ -96,15 +119,15 @@ export default {
 		}
 
 		a {
-			padding: 0 7px 0 4px;
+			padding: 0 5px;
 			color: var(--primary-color);
 
 			&:first-of-type {
-				padding: 0 7px 0 0;
+				padding: 0 5px 0 0;
 			}
 
 			&:last-of-type {
-				padding: 0 0 0 7px;
+				padding: 0 0 0 5px;
 			}
 
 			&:hover {

+ 3 - 1
frontend/src/components/layout/MainHeader.vue

@@ -3,9 +3,11 @@
 		<div class="nav-left">
 			<router-link v-if="!hideLogo" class="nav-item is-brand" to="/">
 				<img
+					v-if="siteSettings.sitename === 'Musare'"
 					:src="siteSettings.logo_white"
 					:alt="siteSettings.sitename || `Musare`"
 				/>
+				<span v-else>{{ siteSettings.sitename }}</span>
 			</router-link>
 		</div>
 
@@ -88,7 +90,7 @@ export default {
 			isMobile: false,
 			frontendDomain: "",
 			siteSettings: {
-				logo: "",
+				logo_white: "",
 				sitename: ""
 			}
 		};

+ 0 - 7
frontend/src/main.js

@@ -11,10 +11,6 @@ import AppComponent from "./App.vue";
 
 const REQUIRED_CONFIG_VERSION = 6;
 
-const handleMetadata = attrs => {
-	document.title = `Musare | ${attrs.title}`;
-};
-
 const app = createApp(AppComponent);
 
 app.use(store);
@@ -39,9 +35,6 @@ app.component("PageMetadata", {
 	watch: {
 		$attrs: {
 			// eslint-disable-next-line vue/no-arrow-functions-in-watch
-			handler: attrs => {
-				handleMetadata(attrs);
-			},
 			deep: true,
 			immediate: true
 		}

+ 14 - 6
frontend/src/pages/Home.vue

@@ -13,10 +13,14 @@
 				<div class="content-container">
 					<div class="content">
 						<img
+							v-if="siteSettings.sitename === 'Musare'"
+							:src="siteSettings.logo_white"
+							:alt="siteSettings.sitename || `Musare`"
 							class="logo"
-							src="/assets/white_wordmark.png"
-							:alt="`${this.sitename}` || `Musare`"
 						/>
+						<span v-else class="logo">{{
+							siteSettings.sitename
+						}}</span>
 						<div v-if="!loggedIn" class="buttons">
 							<button
 								class="button login"
@@ -468,7 +472,10 @@ export default {
 			stations: [],
 			favoriteStations: [],
 			searchQuery: "",
-			sitename: "Musare",
+			siteSettings: {
+				logo_white: "",
+				sitename: ""
+			},
 			orderOfFavoriteStations: []
 		};
 	},
@@ -520,7 +527,7 @@ export default {
 		}
 	},
 	async mounted() {
-		this.sitename = await lofig.get("siteSettings.sitename");
+		this.siteSettings = await lofig.get("siteSettings");
 
 		if (this.socket.readyState === 1) this.init();
 		ws.onConnect(() => this.init());
@@ -887,12 +894,13 @@ html {
 			right: 0;
 			transform: translateY(-50%);
 			background-color: transparent !important;
-			img.logo {
+			.logo {
 				max-height: 90px;
-				font-size: 40px;
+				font-size: 50px;
 				color: var(--white);
 				font-family: Pacifico, cursive;
 				user-select: none;
+				white-space: nowrap;
 			}
 			.buttons {
 				display: flex;

+ 4 - 0
frontend/webpack.common.js

@@ -1,3 +1,6 @@
+process.env.NODE_CONFIG_DIR = `${__dirname}/dist/config/`;
+const config = require("config");
+
 const path = require("path");
 const { VueLoaderPlugin } = require("vue-loader");
 const HtmlWebpackPlugin = require("html-webpack-plugin");
@@ -18,6 +21,7 @@ module.exports = {
 	plugins: [
 		new VueLoaderPlugin(),
 		new HtmlWebpackPlugin({
+			title: config.get("siteSettings.sitename"),
 			hash: true,
 			template: "dist/index.tpl.html",
 			inject: "body",