Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

Fixes pageInfo not being read in router (#645)

Alicia Sykes9b33a6e277fa
diff --git a/src/router.js b/src/router.js
index e034b0e0..bf520682 100644
--- a/src/router.js
+++ b/src/router.js
@@ -11,7 +11,6 @@ import { Progress } from 'rsup-progress';
// Import views, that are not lazy-loaded
import Home from '@/views/Home.vue';
-import ConfigAccumulator from '@/utils/ConfigAccumalator';
// Import helper functions, config data and defaults
import { isAuthEnabled, isLoggedIn, isGuestAccessEnabled } from '@/utils/Auth';
@@ -19,7 +18,8 @@ import { makePageSlug, makePageName } from '@/utils/ConfigHelpers';
import { metaTagData, startingView, routePaths } from '@/utils/defaults';
import ErrorHandler from '@/utils/ErrorHandler';
-import { pages } from '../public/conf.yml';
+// Import data from users conf file. Note that rebuild is required for this to update.
+import { pages, pageInfo, appConfig } from '../public/conf.yml';
Vue.use(Router);
const progress = new Progress({ color: 'var(--progress-bar)' });
@@ -32,17 +32,6 @@ const isAuthenticated = () => {
return (!authEnabled || userLoggedIn || guestEnabled);
};
-const getConfig = () => {
- const Accumulator = new ConfigAccumulator();
- return {
- appConfig: Accumulator.appConfig(),
- pageInfo: Accumulator.pageInfo(),
- pages: Accumulator.pages(),
- };
-};
-
-const { appConfig, pageInfo } = getConfig();
-
/* Get the users chosen starting view from app config, or return default */
const getStartingView = () => appConfig.startingView || startingView;
@@ -61,7 +50,7 @@ const getStartingComponent = () => {
/* Returns the meta tags for each route */
const makeMetaTags = (defaultTitle) => ({
- title: pageInfo.title || defaultTitle,
+ title: pageInfo?.title || defaultTitle,
metaTags: metaTagData,
});
@@ -73,10 +62,12 @@ const makeSubConfigPath = (rawPath) => {
/* For each additional config file, create routes for home, minimal and workspace views */
const makeMultiPageRoutes = (userPages) => {
- if (!userPages) return [];
+ // If no multi pages specified, or is not array, then return nothing
+ if (!userPages || !Array.isArray(userPages)) return [];
const multiPageRoutes = [];
+ // For each user page, create an additional route
userPages.forEach((page) => {
- if (!page.name || !page.path) {
+ if (!page.name || !page.path) { // Sumin not right, show warning
ErrorHandler('Additional pages must have both a `name` and `path`');
}
// Props to be passed to home mixin