π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
π Vue 3 compatibility fixes
Alicia Sykesd4f1d7ff84da
diff --git a/.dockerignore b/.dockerignoreindex 56625883..083b416d 100644--- a/.dockerignore+++ b/.dockerignore@@ -1,7 +1,7 @@# Files specified here are not required for Docker# so ignoring them helps to reduce the container size# The Docker container MUST have the following files:-# package.json yarn.lock server.js vue.config.js src/ services/+# package.json yarn.lock server.js vite.config.mjs src/ services/node_modulesdocsdiff --git a/.github/pr-auto-comments.yml b/.github/pr-auto-comments.ymlindex 41d8eb51..b4a62ab1 100644--- a/.github/pr-auto-comments.yml+++ b/.github/pr-auto-comments.yml@@ -15,11 +15,11 @@ comment:- Your spelling and grammar is correct- Any markdown formatting is valid- - id: vue-config+ - id: vite-configfiles:- - vue.config.js+ - vite.config.mjsbody: >- You're making changes to the main Vue app config. Please test the app thoroughly,+ You're making changes to the main Vite build config. Please test the app thoroughly,as any misconfigurations here may cause the app to stop functioning.- id: server-entrydiff --git a/.github/workflows/update-docs-site.yml b/.github/workflows/update-docs-site.ymlindex 7964bf38..b839a334 100644--- a/.github/workflows/update-docs-site.yml+++ b/.github/workflows/update-docs-site.yml@@ -54,8 +54,6 @@ jobs:- name: Run script to update documentation πͺworking-directory: website-docs- env:- NODE_OPTIONS: '--openssl-legacy-provider'run: |cp -r ../master-docs/docs ./python ./do-doc-updaty-magic.pydiff --git a/.vscode/launch.json b/.vscode/launch.jsonindex 516d39f7..177df740 100644--- a/.vscode/launch.json+++ b/.vscode/launch.json@@ -1,7 +1,4 @@{- // Use IntelliSense to learn about possible attributes.- // Hover to view descriptions of existing attributes.- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{@@ -9,18 +6,7 @@"request": "launch","name": "dashy: edge","url": "http://localhost:8080",- "webRoot": "${workspaceFolder}",- "breakOnLoad": true,- "pathMapping": {- "/_karma_webpack_": "${workspaceFolder}"- },- "sourceMapPathOverrides": {- "webpack:/*": "${webRoot}/*",- "/./*": "${webRoot}/*",- "/src/*": "${webRoot}/*",- "/*": "*",- "/./~/*": "${webRoot}/node_modules/*"- },+ "webRoot": "${workspaceFolder}/src","preLaunchTask": "dashy start"},{@@ -28,18 +14,7 @@"request": "launch","name": "dashy: chrome","url": "http://localhost:8080",- "webRoot": "${workspaceFolder}",- "breakOnLoad": true,- "pathMapping": {- "/_karma_webpack_": "${workspaceFolder}"- },- "sourceMapPathOverrides": {- "webpack:/*": "${webRoot}/*",- "/./*": "${webRoot}/*",- "/src/*": "${webRoot}/*",- "/*": "*",- "/./~/*": "${webRoot}/node_modules/*"- },+ "webRoot": "${workspaceFolder}/src","preLaunchTask": "dashy start"},{@@ -47,19 +22,8 @@"request": "launch","name": "dashy: firefox","url": "http://localhost:8080",- "webRoot": "${workspaceFolder}",- "breakOnLoad": true,- "pathMapping": {- "/_karma_webpack_": "${workspaceFolder}"- },- "sourceMapPathOverrides": {- "webpack:/*": "${webRoot}/*",- "/./*": "${webRoot}/*",- "/src/*": "${webRoot}/*",- "/*": "*",- "/./~/*": "${webRoot}/node_modules/*"- },+ "webRoot": "${workspaceFolder}/src","preLaunchTask": "dashy start"}]-}\ No newline at end of file+}diff --git a/services/rebuild-app.js b/services/rebuild-app.jsindex 2b748c2d..8a335f70 100644--- a/services/rebuild-app.js+++ b/services/rebuild-app.js@@ -5,7 +5,7 @@const { exec } = require('child_process');module.exports = () => new Promise((resolve, reject) => {- const buildProcess = exec('NODE_OPTIONS="--max-old-space-size=512" npm run build'); // Trigger the build command+ const buildProcess = exec('yarn build'); // Trigger the build commandlet output = ''; // Will store console output@@ -17,11 +17,7 @@ module.exports = () => new Promise((resolve, reject) => {// Handle errors, by sending the rejectbuildProcess.on('error', (error) => {- reject(Error({- success: false,- error,- output,- }));+ reject({ success: false, error, output });});// When finished, check success, make message and resolve responsediff --git a/src/components/LinkItems/Collapsable.vue b/src/components/LinkItems/Collapsable.vueindex 91131ba4..c97dfe1e 100644--- a/src/components/LinkItems/Collapsable.vue+++ b/src/components/LinkItems/Collapsable.vue@@ -137,13 +137,15 @@ export default {},/* Returns local storage collapse state data, and if not yet set then initialized is */locallyStoredCollapseStates() {- // If not yet set, then call initializeif (!localStorage[localStorageKeys.COLLAPSE_STATE]) {localStorage.setItem(localStorageKeys.COLLAPSE_STATE, JSON.stringify({}));return {};}- // Otherwise, return value of local storage- return JSON.parse(localStorage[localStorageKeys.COLLAPSE_STATE]);+ try {+ return JSON.parse(localStorage[localStorageKeys.COLLAPSE_STATE]);+ } catch (e) {+ return {};+ }},openEditModal() {this.$emit('openEditSection');diff --git a/src/components/LinkItems/Section.vue b/src/components/LinkItems/Section.vueindex 5bdbbe04..4e0af75b 100644--- a/src/components/LinkItems/Section.vue+++ b/src/components/LinkItems/Section.vue@@ -285,7 +285,8 @@ export default {this.contextMenuOpen = true; // Open context menu// If mouse position not set, use section coordinatesconst sectionOuterId = `section-outer-${this.groupId}`;- const sectionPosition = document.getElementById(sectionOuterId).getBoundingClientRect();+ const sectionEl = document.getElementById(sectionOuterId);+ const sectionPosition = sectionEl ? sectionEl.getBoundingClientRect() : { right: 0, top: 0 };this.contextPos = {posX: (e.clientX || sectionPosition.right - 10) + window.pageXOffset,posY: (e.clientY || sectionPosition.top + 30) + window.pageYOffset,diff --git a/src/components/PageStrcture/Footer.vue b/src/components/PageStrcture/Footer.vueindex d213f1bb..03e61a7e 100644--- a/src/components/PageStrcture/Footer.vue+++ b/src/components/PageStrcture/Footer.vue@@ -1,7 +1,7 @@<template><footer v-if="visible"><!-- User-defined footer -->- <span v-if="text" v-html="text"></span>+ <span v-if="text" v-html="sanitizedText"></span><!-- Default footer --><span v-else><a :href="defaultInfo.projectUrl">Dashy</a> is free & open source@@ -15,6 +15,7 @@<script>import { shouldBeVisible } from '@/utils/SectionHelpers';+import { sanitizeHtml } from '@/utils/Sanitizer';export default {name: 'Footer',@@ -39,6 +40,9 @@ export default {visible() {return shouldBeVisible(this.$route.name);},+ sanitizedText() {+ return this.text ? sanitizeHtml(this.text) : '';+ },},};</script>diff --git a/src/components/PageStrcture/LoadingScreen.vue b/src/components/PageStrcture/LoadingScreen.vueindex 81e2c9de..fa87a5e6 100644--- a/src/components/PageStrcture/LoadingScreen.vue+++ b/src/components/PageStrcture/LoadingScreen.vue@@ -107,7 +107,7 @@ div#loading {.slide-fade-leave-active {transition: all .2s cubic-bezier(1, 0.9, 0.7, 0.4);}-.slide-fade-enter, .slide-fade-leave-to {+.slide-fade-enter-from, .slide-fade-leave-to {transform: translateY(-200px);opacity: 0;}diff --git a/src/components/Settings/CustomThemeMaker.vue b/src/components/Settings/CustomThemeMaker.vueindex 37828b4a..02622a8a 100644--- a/src/components/Settings/CustomThemeMaker.vue+++ b/src/components/Settings/CustomThemeMaker.vue@@ -84,7 +84,9 @@ export default {},/* Updates browser storage, and srore with new color settings, and shows success msg */saveChanges() {- const priorSettings = JSON.parse(localStorage[localStorageKeys.CUSTOM_COLORS] || '{}');+ let priorSettings = {};+ try { priorSettings = JSON.parse(localStorage[localStorageKeys.CUSTOM_COLORS] || '{}'); }+ catch (e) { /* ignore corrupt data */ }priorSettings[this.themeToEdit] = this.customColors;localStorage.setItem(localStorageKeys.CUSTOM_COLORS, JSON.stringify(priorSettings));this.$store.commit(StoreKeys.SET_CUSTOM_COLORS, priorSettings);@@ -102,7 +104,9 @@ export default {},/* Resets styles, and removes data for current theme from local storage */resetAndSave() {- const priorSettings = JSON.parse(localStorage[localStorageKeys.CUSTOM_COLORS] || '{}');+ let priorSettings = {};+ try { priorSettings = JSON.parse(localStorage[localStorageKeys.CUSTOM_COLORS] || '{}'); }+ catch (e) { /* ignore corrupt data */ }delete priorSettings[this.themeToEdit];localStorage.setItem(localStorageKeys.CUSTOM_COLORS, JSON.stringify(priorSettings));this.resetUnsavedColors();diff --git a/src/components/Settings/LocalConfigWarning.vue b/src/components/Settings/LocalConfigWarning.vueindex 999740e6..9c265df7 100644--- a/src/components/Settings/LocalConfigWarning.vue+++ b/src/components/Settings/LocalConfigWarning.vue@@ -169,7 +169,7 @@ export default {.slide-fade-leave-active {transition: all .8s cubic-bezier(.93,.01,.89,.5);}-.slide-fade-enter, .slide-fade-leave-to {+.slide-fade-enter-from, .slide-fade-leave-to {transform: translateY(35em);opacity: 0;}diff --git a/src/components/Widgets/CveVulnerabilities.vue b/src/components/Widgets/CveVulnerabilities.vueindex 94df6c64..14578e11 100644--- a/src/components/Widgets/CveVulnerabilities.vue+++ b/src/components/Widgets/CveVulnerabilities.vue@@ -25,7 +25,7 @@<script>import WidgetMixin from '@/mixins/WidgetMixin';import { timestampToDate, truncateStr } from '@/utils/MiscHelpers';-import { widgetApiEndpoints, serviceEndpoints } from '@/utils/defaults';+import { widgetApiEndpoints } from '@/utils/defaults';export default {mixins: [WidgetMixin],@@ -64,10 +64,6 @@ export default {return apiUrl;},- proxyReqEndpoint() {- const baseUrl = import.meta.env.VITE_APP_DOMAIN || window.location.origin;- return `${baseUrl}${serviceEndpoints.corsProxy}`;- },},methods: {formatDate(date) {diff --git a/src/components/Widgets/EmbedWidget.vue b/src/components/Widgets/EmbedWidget.vueindex 564a3d47..332f4b96 100644--- a/src/components/Widgets/EmbedWidget.vue+++ b/src/components/Widgets/EmbedWidget.vue@@ -42,7 +42,7 @@ export default {injectHtml() {if (this.html) {const element = document.getElementById(this.elementId);- element.innerHTML = this.html;+ if (element) element.innerHTML = this.html;}if (this.css) {const styleElem = document.createElement('style');diff --git a/src/components/Widgets/HackernewsTrending.vue b/src/components/Widgets/HackernewsTrending.vueindex 09680f2d..553972a9 100644--- a/src/components/Widgets/HackernewsTrending.vue+++ b/src/components/Widgets/HackernewsTrending.vue@@ -18,7 +18,6 @@</template><script>-// import axios from 'axios';import WidgetMixin from '@/mixins/WidgetMixin';import { widgetApiEndpoints } from '@/utils/defaults';diff --git a/src/components/Widgets/RssFeed.vue b/src/components/Widgets/RssFeed.vueindex 04ccf7e6..2f0baf13 100644--- a/src/components/Widgets/RssFeed.vue+++ b/src/components/Widgets/RssFeed.vue@@ -231,27 +231,27 @@ export default {color: var(--widget-text-color);max-height: 400px;overflow: hidden;- ::v-deep p {+ :deep(p) {margin: 0.5rem 0;}- ::v-deep img {+ :deep(img) {max-width: 80%;display: flex;margin: 0 auto;border-radius: var(--curve-factor);}- ::v-deep a {+ :deep(a) {color: var(--widget-text-color);}- ::v-deep svg path {+ :deep(svg path) {fill: var(--widget-text-color);}- ::v-deep blockquote {+ :deep(blockquote) {margin-left: 0.5rem;padding-left: 0.5rem;border-left: 4px solid var(--widget-text-color);}- ::v-deep .avatar.avatar-user { display: none; }+ :deep(.avatar.avatar-user) { display: none; }}a.continue-reading-btn {width: 100%;diff --git a/src/components/Widgets/StatPing.vue b/src/components/Widgets/StatPing.vueindex fbdf1c4a..f507e8c1 100644--- a/src/components/Widgets/StatPing.vue+++ b/src/components/Widgets/StatPing.vue@@ -50,7 +50,6 @@</template><script>-import { serviceEndpoints } from '@/utils/defaults';import { showNumAsThousand, getTimeAgo } from '@/utils/MiscHelpers';import WidgetMixin from '@/mixins/WidgetMixin';@@ -70,10 +69,6 @@ export default {limit() {return this.options.limit;},- proxyReqEndpoint() {- const baseUrl = import.meta.env.VITE_APP_DOMAIN || window.location.origin;- return `${baseUrl}${serviceEndpoints.corsProxy}`;- },endpoint() {return `${this.hostname}/api/services`;},diff --git a/src/components/Widgets/SynologyDownload.vue b/src/components/Widgets/SynologyDownload.vueindex 9c560fd8..cb9de59c 100644--- a/src/components/Widgets/SynologyDownload.vue+++ b/src/components/Widgets/SynologyDownload.vue@@ -29,7 +29,6 @@ import axios from 'axios';import WidgetMixin from '@/mixins/WidgetMixin';import PercentageChart from '@/components/Charts/PercentageChart';import { getValueFromCss, convertBytes } from '@/utils/MiscHelpers';-import { serviceEndpoints } from '@/utils/defaults';export default {mixins: [WidgetMixin],@@ -64,10 +63,6 @@ export default {endpointLogout() {return `${this.hostname}/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=logout&session=DownloadStation&_sid=${this.sid}`;},- proxyReqEndpoint() {- const baseUrl = import.meta.env.VITE_APP_DOMAIN || window.location.origin;- return `${baseUrl}${serviceEndpoints.corsProxy}`;- },},methods: {formatSize(byteValue) {diff --git a/src/components/Widgets/TacticalRMM.vue b/src/components/Widgets/TacticalRMM.vueindex dcbb28ce..0f970d70 100644--- a/src/components/Widgets/TacticalRMM.vue+++ b/src/components/Widgets/TacticalRMM.vue@@ -63,7 +63,6 @@<script>import axios from 'axios';import WidgetMixin from '@/mixins/WidgetMixin';-import { serviceEndpoints } from '@/utils/defaults';export default {mixins: [WidgetMixin],@@ -98,10 +97,6 @@ export default {'Content-Type': 'application/json',};},- proxyReqEndpoint() {- const baseUrl = import.meta.env.VITE_APP_DOMAIN || window.location.origin;- return `${baseUrl}${serviceEndpoints.corsProxy}`;- },},methods: {update() {diff --git a/src/components/Workspace/MultiTaskingWebComtent.vue b/src/components/Workspace/MultiTaskingWebComtent.vueindex 6849ed6c..1ce40f20 100644--- a/src/components/Workspace/MultiTaskingWebComtent.vue+++ b/src/components/Workspace/MultiTaskingWebComtent.vue@@ -48,7 +48,8 @@ export default {Array.from(document.getElementsByClassName('web-content')).forEach((frame) => {frame.classList.add('hide');});- document.getElementById(btoa(this.url)).classList.remove('hide');+ const el = document.getElementById(btoa(this.url));+ if (el) el.classList.remove('hide');},},};diff --git a/src/components/Workspace/SideBar.vue b/src/components/Workspace/SideBar.vueindex 2c85a167..5db31c03 100644--- a/src/components/Workspace/SideBar.vue+++ b/src/components/Workspace/SideBar.vue@@ -125,7 +125,7 @@ nav.side-bar {.slide-enter-active {transition: all 0.1s ease-in-out;}-.slide-enter {+.slide-enter-from {transform: translate(0, -80%);}.slide-leave-to {diff --git a/src/main.js b/src/main.jsindex 4c745ff2..38b405bd 100644--- a/src/main.js+++ b/src/main.js@@ -67,11 +67,17 @@ app.config.globalProperties.$toasted = {};/* eslint-enable object-property-newline */-// When running in dev mode, enable Vue performance tools+app.config.errorHandler = (err, instance, info) => {+ ErrorHandler(`Vue error in ${info}`, err);+};++window.addEventListener('unhandledrejection', (event) => {+ ErrorHandler('Unhandled promise rejection', event.reason);+});+const isDevMode = import.meta.env.DEV;app.config.performance = isDevMode;-// Checks if service worker not disable, and if so will registers itserviceWorker();// Checks if user enabled error reporting, and if so will initialize itdiff --git a/src/mixins/ConfigSaving.js b/src/mixins/ConfigSaving.jsindex b3b9f8ea..1a095773 100644--- a/src/mixins/ConfigSaving.js+++ b/src/mixins/ConfigSaving.js@@ -60,7 +60,7 @@ export default {this.progress.end();this.$store.commit(StoreKeys.SET_EDIT_MODE, false);})- .catch((error) => { // fucking hell+ .catch((error) => {this.saveSuccess = false;this.responseText = error;this.showToast(error, false);diff --git a/src/mixins/HomeMixin.js b/src/mixins/HomeMixin.jsindex 6f163f88..71e0f13e 100644--- a/src/mixins/HomeMixin.js+++ b/src/mixins/HomeMixin.js@@ -58,7 +58,7 @@ const HomeMixin = {},/* Based on the current route, get which config to display, null will use default */determineConfigFile() {- const pagePath = this.$router.currentRoute.path;+ const pagePath = this.$route.path;const isSubPage = new RegExp((/(home|workspace|minimal)\/[a-zA-Z0-9-]+/g)).test(pagePath);const subPageName = isSubPage ? pagePath.split('/').pop() : null;return subPageName;@@ -78,7 +78,7 @@ const HomeMixin = {// ApplyCustomVariables(theme);},updateModalVisibility(modalState) {- this.$store.commit('SET_MODAL_OPEN', modalState);+ this.$store.commit(Keys.SET_MODAL_OPEN, modalState);},/* Updates local data with search value, triggered from filter comp */searching(searchValue) {diff --git a/src/mixins/ItemMixin.js b/src/mixins/ItemMixin.jsindex dc57b9d1..f9fafaee 100644--- a/src/mixins/ItemMixin.js+++ b/src/mixins/ItemMixin.js@@ -214,17 +214,18 @@ export default {},/* Used for smart-sort when sorting items by most used apps */incrementMostUsedCount(itemId) {- const mostUsed = JSON.parse(localStorage.getItem(localStorageKeys.MOST_USED) || '{}');- let counter = mostUsed[itemId] || 0;- counter += 1;- mostUsed[itemId] = counter;- localStorage.setItem(localStorageKeys.MOST_USED, JSON.stringify(mostUsed));+ try {+ const mostUsed = JSON.parse(localStorage.getItem(localStorageKeys.MOST_USED) || '{}');+ mostUsed[itemId] = (mostUsed[itemId] || 0) + 1;+ localStorage.setItem(localStorageKeys.MOST_USED, JSON.stringify(mostUsed));+ } catch (e) { /* ignore corrupt localStorage */ }},- /* Used for smart-sort when sorting by last used apps */incrementLastUsedCount(itemId) {- const lastUsed = JSON.parse(localStorage.getItem(localStorageKeys.LAST_USED) || '{}');- lastUsed[itemId] = new Date().getTime();- localStorage.setItem(localStorageKeys.LAST_USED, JSON.stringify(lastUsed));+ try {+ const lastUsed = JSON.parse(localStorage.getItem(localStorageKeys.LAST_USED) || '{}');+ lastUsed[itemId] = new Date().getTime();+ localStorage.setItem(localStorageKeys.LAST_USED, JSON.stringify(lastUsed));+ } catch (e) { /* ignore corrupt localStorage */ }},},};diff --git a/src/mixins/NextcloudMixin.js b/src/mixins/NextcloudMixin.jsindex 19d23f2a..daad6b27 100644--- a/src/mixins/NextcloudMixin.js+++ b/src/mixins/NextcloudMixin.js@@ -1,4 +1,3 @@-import { serviceEndpoints } from '@/utils/defaults';import {convertBytes, formatNumber, getTimeAgo, timestampToDateTime,} from '@/utils/MiscHelpers';@@ -70,10 +69,6 @@ export default {capabilitiesTtl() {return (parseInt(this.options.capabilitiesTtl, 10) || 3600) * 1000;},- proxyReqEndpoint() {- const baseUrl = import.meta.env.VITE_APP_DOMAIN || window.location.origin;- return `${baseUrl}${serviceEndpoints.corsProxy}`;- },},methods: {/* Nextcloud API endpoints */diff --git a/src/router.js b/src/router.jsindex a059f749..768aac06 100644--- a/src/router.js+++ b/src/router.js@@ -140,8 +140,12 @@ const router = createRouter({* */router.beforeEach(async (to, from, next) => {progress.start();- if (to.name !== 'login' && !isAuthenticated()) next({ name: 'login' });- else next();+ try {+ if (to.name !== 'login' && !isAuthenticated()) next({ name: 'login' });+ else next();+ } catch (e) {+ next();+ }});/* If title is missing, then apply default page title */diff --git a/src/store.js b/src/store.jsindex 87ed2526..d4fa5a3f 100644--- a/src/store.js+++ b/src/store.js@@ -8,7 +8,7 @@ import { applyItemId } from '@/utils/SectionHelpers';import filterUserSections from '@/utils/CheckSectionVisibility';import ErrorHandler, { InfoHandler, InfoKeys } from '@/utils/ErrorHandler';import { isUserAdmin, makeBasicAuthHeaders, isLoggedInAsGuest } from '@/utils/Auth';-import { localStorageKeys, theme as defaultTheme } from './utils/defaults';+import { localStorageKeys, theme as defaultTheme } from '@/utils/defaults';const {INITIALIZE_CONFIG,@@ -423,9 +423,15 @@ const store = createStore({commit(CRITICAL_ERROR_MSG, `Unable to find config for '${subConfigId}'`);return { ...emptyConfig };}- axios.get(subConfigPath, makeBasicAuthHeaders()).then((response) => {- // Parse the YAML- const configContent = yaml.load(response.data) || {};+ try {+ const response = await axios.get(subConfigPath, makeBasicAuthHeaders());+ let configContent;+ try {+ configContent = yaml.load(response.data) || {};+ } catch (parseError) {+ commit(CRITICAL_ERROR_MSG, `Failed to parse sub-config YAML: ${parseError.message}`);+ return { ...emptyConfig };+ }// Certain values must be inherited from root configconst theme = configContent?.appConfig?.theme || rootConfig.appConfig?.theme || 'default';configContent.appConfig = rootConfig.appConfig;@@ -448,11 +454,13 @@ const store = createStore({// Set the configcommit(SET_CONFIG, configContent);commit(SET_CURRENT_CONFIG_INFO, { confPath: subConfigPath, confId: subConfigId });- }).catch((err) => {- commit(CRITICAL_ERROR_MSG, `Unable to load config from '${subConfigPath}'`, err);- });+ return configContent;+ } catch (err) {+ commit(CRITICAL_ERROR_MSG, `Unable to load config from '${subConfigPath}'`);+ ErrorHandler(`Sub-config load failed: ${subConfigPath}`, err);+ return { ...emptyConfig };+ }}- return { ...emptyConfig };},},modules: {},diff --git a/src/utils/CloudBackup.js b/src/utils/CloudBackup.jsindex 66a8e8b5..2591d170 100644--- a/src/utils/CloudBackup.js+++ b/src/utils/CloudBackup.js@@ -46,6 +46,6 @@ export const restore = (backupId, password) => {const decryptedData = decryptData(response.data.userData.userData, password);try { resolve(JSON.parse(decryptedData)); } catch (e) { reject(e); }}- });+ }).catch(reject);});};diff --git a/src/utils/ConfigAccumalator.js b/src/utils/ConfigAccumalator.jsindex f6317b07..502be23d 100644--- a/src/utils/ConfigAccumalator.js+++ b/src/utils/ConfigAccumalator.js@@ -35,7 +35,8 @@ export default class ConfigAccumulator {// Fill in defaults if anything missinglet usersAppConfig = defaultAppConfig;if (localStorage[localStorageKeys.APP_CONFIG]) {- usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]);+ try { usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]); }+ catch (e) { ErrorHandler('Malformed app config in local storage'); }} else if (Object.keys(appConfigFile).length > 0) {usersAppConfig = appConfigFile;}diff --git a/src/utils/ConfigSchema.json b/src/utils/ConfigSchema.jsonindex 4346d9b3..ab2eb0f1 100644--- a/src/utils/ConfigSchema.json+++ b/src/utils/ConfigSchema.json@@ -525,8 +525,8 @@"password": {"title": "Password","type": "string",- "description": "The environmental variable pointing to a plaintext password for that user. Must start with VUE_APP_",- "pattern": "^VUE_APP_.*"+ "description": "The environmental variable pointing to a plaintext password for that user. Must start with VITE_APP_",+ "pattern": "^VITE_APP_.*"},"type": {"title": "Privileges",diff --git a/src/utils/HeaderAuth.js b/src/utils/HeaderAuth.jsindex 1a9f5db4..6ed850d6 100644--- a/src/utils/HeaderAuth.js+++ b/src/utils/HeaderAuth.js@@ -27,13 +27,13 @@ class HeaderAuth {const baseUrl = import.meta.env.VITE_APP_DOMAIN || window.location.origin;axios.get(`${baseUrl}${serviceEndpoints.getUser}`).then((response) => {if (!response.data) {- reject(Error('Error, expected data nout returned'));+ reject(Error('Error, expected data not returned'));} else if (response.data.errorMsg) {reject(response.data.errorMsg);} else {try {this.users.forEach((user) => {- if (user.user.toLowerCase() === response.data.user.toLowerCase()) { // User found+ if (user.user.toLowerCase() === response.data.user.toLowerCase()) {const strAndUpper = (input) => input.toString().toUpperCase();const sha = strAndUpper(sha256(strAndUpper(user.user) + strAndUpper(user.hash)));document.cookie = `${cookieKeys.AUTH_TOKEN}=${sha};`;@@ -47,7 +47,7 @@ class HeaderAuth {reject(e);}}- });+ }).catch(reject);});}diff --git a/src/utils/InitServiceWorker.js b/src/utils/InitServiceWorker.jsindex 3dff6961..cc8c1c8c 100644--- a/src/utils/InitServiceWorker.js+++ b/src/utils/InitServiceWorker.js@@ -33,11 +33,17 @@ const setSwStatus = (swStateToSet) => {* Or disable if user specified to disable*/const shouldEnableServiceWorker = async () => {- const conf = yaml.load((await axios.get('/conf.yml')).data);- if (conf && conf.appConfig && conf.appConfig.enableServiceWorker) {- setSwStatus({ disabledByUser: false });- return true;- } else if (import.meta.env.DEV) {+ try {+ const response = await axios.get('/conf.yml');+ const conf = yaml.load(response.data);+ if (conf && conf.appConfig && conf.appConfig.enableServiceWorker) {+ setSwStatus({ disabledByUser: false });+ return true;+ }+ } catch (e) {+ statusErrorMsg('Service Worker Status', 'Failed to load config for SW check', e);+ }+ if (import.meta.env.DEV) {setSwStatus({ devMode: true });return false;}diff --git a/src/utils/IsVisibleToUser.js b/src/utils/IsVisibleToUser.jsindex 9b80bcba..21f5ac86 100644--- a/src/utils/IsVisibleToUser.js+++ b/src/utils/IsVisibleToUser.js@@ -44,10 +44,14 @@ export const isVisibleToUser = (displayData, currentUser) => {if (showForUsers.length < 1) return true;return determineVisibility(showForUsers, cUsername);};+ const getKeycloakInfo = () => {+ try { return JSON.parse(localStorage.getItem(localStorageKeys.KEYCLOAK_INFO) || '{}'); }+ catch (e) { return {}; }+ };const checkKeycloakVisibility = () => {if (!displayData.hideForKeycloakUsers) return true;- const { groups, roles } = JSON.parse(localStorage.getItem(localStorageKeys.KEYCLOAK_INFO) || '{}');+ const { groups, roles } = getKeycloakInfo();const hideForGroups = displayData.hideForKeycloakUsers.groups || [];const hideForRoles = displayData.hideForKeycloakUsers.roles || [];@@ -57,7 +61,7 @@ export const isVisibleToUser = (displayData, currentUser) => {const checkKeycloakHiddenability = () => {if (!displayData.showForKeycloakUsers) return true;- const { groups, roles } = JSON.parse(localStorage.getItem(localStorageKeys.KEYCLOAK_INFO) || '{}');+ const { groups, roles } = getKeycloakInfo();const showForGroups = displayData.showForKeycloakUsers.groups || [];const showForRoles = displayData.showForKeycloakUsers.roles || [];diff --git a/tsconfig.json b/tsconfig.jsonindex f5bf64d1..291c55fe 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -14,8 +14,7 @@"sourceMap": true,"baseUrl": ".","types": [- "webpack-env",- "jest",+ "vite/client","node"],"paths": {