From 3619facd751f5950bbc9bf1045455bb77e18c7f8 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 24 Sep 2021 00:12:27 +0100 Subject: [PATCH 1/7] :wrench: Adds route name for 404 page --- src/utils/defaults.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/defaults.js b/src/utils/defaults.js index 35695eea23..49fa263c19 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -35,6 +35,7 @@ module.exports = { about: '/about', login: '/login', download: '/download', + notFound: '/404', }, /* Server Endpoints */ serviceEndpoints: { @@ -84,6 +85,7 @@ module.exports = { 'login', 'download', 'landing-page-minimal', + // '404', ], /* Key names for local storage identifiers */ localStorageKeys: { From 728e39a83de201bfb1c5086a4a207e6e4c8c707a Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 24 Sep 2021 00:12:59 +0100 Subject: [PATCH 2/7] :sparkles: Builds a 404 not-found page --- src/views/404.vue | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/views/404.vue diff --git a/src/views/404.vue b/src/views/404.vue new file mode 100644 index 0000000000..7024fc3dc3 --- /dev/null +++ b/src/views/404.vue @@ -0,0 +1,90 @@ + + + + + From 0e31e9ab4fc1e89300a23a4f5da57b2c7a483112 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 24 Sep 2021 00:13:25 +0100 Subject: [PATCH 3/7] :sparkles: Redirects not-found pages to the 404 route --- src/router.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/router.js b/src/router.js index a1bdd95b93..e76efe4252 100644 --- a/src/router.js +++ b/src/router.js @@ -9,17 +9,17 @@ import Vue from 'vue'; import Router from 'vue-router'; import ProgressBar from 'rsup-progress'; -// Import views +// Import views, that are not lazy-loaded import Home from '@/views/Home.vue'; import Login from '@/views/Login.vue'; import Workspace from '@/views/Workspace.vue'; import Minimal from '@/views/Minimal.vue'; -import DownloadConfig from '@/views/DownloadConfig.vue'; // Import helper functions, config data and defaults import { isAuthEnabled, isLoggedIn, isGuestAccessEnabled } from '@/utils/Auth'; import { config } from '@/utils/ConfigHelpers'; import { metaTagData, startingView, routePaths } from '@/utils/defaults'; +import ErrorHandler from '@/utils/ErrorHandler'; Vue.use(Router); const progress = new ProgressBar({ color: 'var(--progress-bar)' }); @@ -102,16 +102,32 @@ const router = new Router({ { // The about app page path: routePaths.about, name: 'about', // We lazy load the About page so as to not slow down the app - component: () => import(/* webpackChunkName: "about" */ './views/About.vue'), + component: () => import('./views/About.vue'), meta: makeMetaTags('About Dashy'), }, { // The export config page path: routePaths.download, name: 'download', - component: DownloadConfig, + component: () => import('./views/DownloadConfig.vue'), props: config, meta: makeMetaTags('Download Config'), }, + { // Page not found, any non-defined routes will land here + path: routePaths.notFound, + name: '404', + component: () => import('./views/404.vue'), + meta: makeMetaTags('404 Not Found'), + beforeEnter: (to, from, next) => { + if (to.redirectedFrom) { // Log error, if redirected here from another route + ErrorHandler(`Route not found: '${to.redirectedFrom}'`); + } + next(); + }, + }, + { // Redirect any not-found routed to the 404 view + path: '*', + redirect: '/404', + }, ], }); From 3104cf605deaed96677e08a587eb9a1df81366b5 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 24 Sep 2021 00:13:55 +0100 Subject: [PATCH 4/7] :fire: Removes non-essential code from AppInfo modal --- src/components/Configuration/AppInfoModal.vue | 133 +++--------------- 1 file changed, 19 insertions(+), 114 deletions(-) diff --git a/src/components/Configuration/AppInfoModal.vue b/src/components/Configuration/AppInfoModal.vue index 8ba9dbc64d..d8c4c98f99 100644 --- a/src/components/Configuration/AppInfoModal.vue +++ b/src/components/Configuration/AppInfoModal.vue @@ -1,46 +1,32 @@ @@ -58,71 +44,13 @@ export default { return { modalName: modalNames.ABOUT_APP, appVersion: process.env.VUE_APP_VERSION, - systemInfo: this.getSystemInfo(), errorLog: this.getErrorLog(), - serviceWorkerInfo: 'Checking...', - showInfo: false, }; }, - mounted() { - setTimeout(() => { - this.serviceWorkerInfo = this.getSwStatus(); - }, 100); - }, methods: { getErrorLog() { return sessionStorage.getItem(sessionStorageKeys.ERROR_LOG) || ''; }, - getIsConfigValidStatus() { - const isValidVar = process.env.VUE_APP_CONFIG_VALID; - if (isValidVar === undefined) return 'Config validation status is missing'; - return `Config is ${isValidVar ? 'Valid' : 'Invalid'}`; - }, - getSwStatus() { - const sessionData = sessionStorage[sessionStorageKeys.SW_STATUS]; - const swInfo = sessionData ? JSON.parse(sessionData) : {}; - let swStatus = ''; - if (swInfo.registered) swStatus += 'Service worker registered\n'; - if (swInfo.ready) swStatus += 'Dashy is being served from service worker\n'; - if (swInfo.cached) swStatus += 'Content has been cached for offline use\n'; - if (swInfo.updateFound) swStatus += 'New content is downloading\n'; - if (swInfo.updated) swStatus += 'New content is available; please refresh\n'; - if (swInfo.offline) swStatus += 'No internet connection found. App is running in offline mode\n'; - if (swInfo.error) swStatus += 'Error during service worker registration\n'; - if (swInfo.devMode) swStatus += 'App running in dev mode, no need for service worker\n'; - if (swStatus.length === 0) swStatus += 'No service worker info available'; - return swStatus; - }, - getSystemInfo() { - const { userAgent } = navigator; - - // Find Operating System - let os = 'Unknown'; - if (userAgent.indexOf('Win') !== -1) os = 'Windows'; - else if (userAgent.indexOf('Mac') !== -1) os = 'MacOS'; - else if (userAgent.indexOf('Android') !== -1) os = 'Android'; - else if (userAgent.indexOf('iPhone') !== -1) os = 'iOS'; - else if (userAgent.indexOf('Linux') !== -1) os = 'Linux'; - else if (userAgent.indexOf('X11') !== -1) os = 'UNIX'; - - // Find Browser - let browser = 'Unknown'; - if (userAgent.indexOf('Opera') !== -1) browser = 'Opera'; - else if (userAgent.indexOf('Chrome') !== -1) browser = 'Chrome'; - else if (userAgent.indexOf('Safari') !== -1) browser = 'Safari'; - else if (userAgent.indexOf('Firefox') !== -1) browser = 'Firefox'; - else if (userAgent.indexOf('MSIE') !== -1) browser = 'IE'; - else browser = 'Unknown'; - - const isMobile = !!navigator.userAgent.match(/iphone|android|blackberry/ig) || false; - - return { - os, - browser, - userAgent, - isMobile, - }; - }, }, }; @@ -152,40 +80,17 @@ div.about-modal { } } h3 { - font-size: 1.3rem; - margin: 1rem 0 0.2rem 0; + font-size: 1rem; + margin: 0.5rem 0 0.2rem 0; color: var(--about-page-accent); } - p.small-note { - margin: 0.2rem 0; - } - p.about-text { - margin: 0.2rem 0; - } a { color: var(--about-page-accent); } - ul { - margin-top: 0.2rem; - } a.info { text-decoration: underline; margin-left: 0.2rem; } - .system-info { - font-size: 0.8rem; - background: var(--black); - color: var(--white); - border-radius: var(--curve-factor-small); - padding: 0.5rem; - border: 1px solid var(--white); - width: fit-content; - h4 { - font-size: 0.8rem; - margin: 0 0 0.2rem 0; - text-decoration: underline; - } - } .app-version { text-align: left; } From 7623ea575ea4932c8df1463619f9e5f704600795 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 28 Sep 2021 20:56:39 +0100 Subject: [PATCH 5/7] :bookmark: Bumps to V 1.8.4 and updates changelog --- .github/CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index a8514e7610..b1f4fb38e1 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## ✨ 1.8.4 - Custom Error Pages [PR #257](https://github.com/Lissy93/dashy/pull/257) +- Creates a 404 Not Found page +- Routes any missing views to the 404 page + ## ⚡️ 1.8.3 - Improved UX for Initial Load [PR #238](https://github.com/Lissy93/dashy/pull/238) - Removes the old splash screen - Adds placeholder in the HTML index, which will usually be visible on initial load diff --git a/package.json b/package.json index 023a0a46e7..7629a0cbd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Dashy", - "version": "1.8.3", + "version": "1.8.4", "license": "MIT", "main": "server", "scripts": { From 52fef039ca5db1fee50dd4387686298aa205c6ea Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 28 Sep 2021 20:59:22 +0100 Subject: [PATCH 6/7] :green_heart: Removed duplicate css property --- src/views/404.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/404.vue b/src/views/404.vue index 7024fc3dc3..8e067286b5 100644 --- a/src/views/404.vue +++ b/src/views/404.vue @@ -81,8 +81,8 @@ main.not-found-page { color: #0c0c0c; margin: 2rem 0 0; text-decoration: none; + background: #db78fc; box-shadow: 0 4px #b83ddd; - background: #db78fc; box-shadow: 0 4px #b83ddd; &:hover { box-shadow: 0 2px #b83ddd; } } ::selection { background-color: #db78fc; color: #121212; } From e84f09bb0aca2051fbcfd749fef4584029ba6d97 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 28 Sep 2021 21:07:35 +0100 Subject: [PATCH 7/7] :memo: Updates the Support docs and link --- .github/SUPPORT.md | 10 +++++++--- src/views/404.vue | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 28b824258c..8ed0e88d47 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -1,5 +1,9 @@ -# SUPPORT +# Support -For help with getting Dashy up and running, please see the [Discussion](https://github.com/Lissy93/dashy/discussions). +To raise a bug, please **[Open a new Issue](https://github.com/Lissy93/dashy/issues/new/choose)**. -If you'd like to help support Dashy's future development, see [Contributing](/docs/contributing.md) \ No newline at end of file +To report a potential vulnerability, please see **[Security](https://github.com/Lissy93/dashy/blob/master/.github/SECURITY.md#reporting-a-security-issue)**. + +For help with getting Dashy up and running, please see the **[Discussions](https://github.com/Lissy93/dashy/discussions)**. + +If you'd like to help support Dashy's future development, see **[Contributing](https://github.com/Lissy93/dashy/blob/master/docs/contributing.md)**. \ No newline at end of file diff --git a/src/views/404.vue b/src/views/404.vue index 8e067286b5..ef2c11f73a 100644 --- a/src/views/404.vue +++ b/src/views/404.vue @@ -5,7 +5,7 @@

Page Not Found

Facing Issues? - Get Support. + Get Support.

Back Home