diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 3f6d4e01..323e0ace 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,12 +1,19 @@ # Changelog -## ♻️ - Refactor [PR #110](https://github.com/Lissy93/dashy/pull/110) +## ✨ 1.4.8 - Optional Crash Reports [PR #120](https://github.com/Lissy93/dashy/pull/112) +- Adds an optional, off by default method of getting crash reports +- This can be enabled in `appConfig.enableErrorReporting`, and will not be used at all unless explicitly activated by user +- This is needed for when a user raises a bug which is hard to fix +- Also improves robustness of config accumulator, don't throw error when config is missing +- Adds Privacy & Security docs + +## ♻️ 1.4.7 - Refactor [PR #110](https://github.com/Lissy93/dashy/pull/110) - Moves cloud sync dialog into the config menu, and removes icon on homepage - Fixes typo in Default theme name, Re #106 - Spell checks readme - Updates the contributor CI action, that generates list of contributors + sponsors -## 📝 - Documentation Updates [PR #108](https://github.com/Lissy93/dashy/pull/108) +## 📝 1.4.6 - Documentation Updates [PR #108](https://github.com/Lissy93/dashy/pull/108) - Breaks many of the longer files into several more digestible articles - Writes repo pages including, Security, Code of Conduct, Legal, Updates license - Makes an automatically generated Credits page diff --git a/README.md b/README.md index 685da86a..a9b795ce 100644 --- a/README.md +++ b/README.md @@ -512,6 +512,13 @@ If you're new to web development, I've put together a short [list of resources]( - 🌐 [Language Switching](/docs/multi-language-support.md) - How to change language, add a language, or update text - 🎨 [Theming](/docs/theming.md) - Complete guide to applying, writing and modifying themes and styles +#### Misc +- [🔐 Privacy & Security](/docs/privacy.md) - List of requests, potential issues, and security resources +- [📄 License](/LICENSE) - Copy of the MIT License +- [⚖️ Legal](/.github/LEGAL.md) - Licenses of direct dependencies +- [📏 Code of Conduct](/.github/CODE_OF_CONDUCT.md) - Contributor Covenant Code of Conduct +- [🌳 Changelog](/.github/CHANGELOG.md) - Details of recent changes, and historical versions + **[⬆️ Back to Top](#dashy)** --- diff --git a/docs/configuring.md b/docs/configuring.md index a024031f..8879b082 100644 --- a/docs/configuring.md +++ b/docs/configuring.md @@ -73,6 +73,7 @@ To disallow any changes from being written to disk via the UI config editor, set **`customCss`** | `string` | _Optional_ | Raw CSS that will be applied to the page. This can also be set from the UI. Please minify it first. **`hideComponents`** | `object` | _Optional_ | A list of key page components (header, footer, search, settings, etc) that are present by default, but can be removed using this option. See [`appConfig.hideComponents`](#appconfighideComponents-optional) **`allowConfigEdit`** | `boolean` | _Optional_ | Should prevent / allow the user to write configuration changes to the conf.yml from the UI. When set to `false`, the user can only apply changes locally using the config editor within the app, whereas if set to `true` then changes can be written to disk directly through the UI. Defaults to `true`. Note that if authentication is enabled, the user must be of type `admin` in order to apply changes globally. +**`enableErrorReporting`** | `boolean` | _Optional_ | Enable reporting of unexpected errors and crashes. This is off by default, and **no data will ever be captured unless you explicitly enable it**. Turning on error reporting helps previously unknown bugs get discovered and fixed. Dashy uses [Sentry](https://github.com/getsentry/sentry) for error reporting. Defaults to `false`. **`disableUpdateChecks`** | `boolean` | _Optional_ | If set to true, Dashy will not check for updates. Defaults to `false`. **`disableServiceWorker`** | `boolean` | _Optional_ | Service workers cache web applications to improve load times and offer basic offline functionality, and are enabled by default in Dashy. The service worker can sometimes cause older content to be cached, requiring the app to be hard-refreshed. If you do not want SW functionality, or are having issues with caching, set this property to `true` to disable all service workers. **`disableContextMenu`** | `boolean` | _Optional_ | If set to `true`, the custom right-click context menu will be disabled. Defaults to `false`. diff --git a/docs/contributing.md b/docs/contributing.md index ee3c2e61..9d6a4972 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -22,19 +22,22 @@ Dashy now has a [Showcase](https://github.com/Lissy93/dashy/blob/master/docs/sho ## Spread the word Dashy is still a relatively young project, and as such not many people know of it. It would be great to see more users, and so it would be awesome if you could consider sharing on social platforms. -[![Share Dashy on Mastodon](https://img.shields.io/badge/Share-Mastodon-%232b90d9?style=flat-square&logo=mastodon)](https://mastodon.social/?text=Check%20out%20Dashy%2C%20the%20privacy-friendly%2C%20self-hosted%20startpage%20for%20organizing%20your%20life%3A%20https%3A%2F%2Fgithub.com%2FLissy93%2Fdashy%20-%20By%20%40lissy93%40mastodon.social) -[![Share Dashy on Reddit](https://img.shields.io/badge/Share-Reddit-%23FF5700?style=flat-square&logo=reddit)](http://www.reddit.com/submit?url=https://github.com/Lissy93/dashy&title=Dashy%20-%20The%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) -[![Share Dashy on Twitter](https://img.shields.io/badge/Share-Twitter-%231DA1F2?style=flat-square&logo=twitter)](https://twitter.com/intent/tweet?url=https://github.com/lissy93/dashy&text=Check%20out%20Dashy%20by%20@Lissy_Sykes,%20the%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) -[![Share Dashy on Facebook](https://img.shields.io/badge/Share-Facebook-%234267B2?style=flat-square&logo=facebook)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/lissy93/dashy) -[![Share Dashy on LinkedIn](https://img.shields.io/badge/Share-LinkedIn-%230077b5?style=flat-square&logo=linkedin)](https://www.linkedin.com/shareArticle?mini=true&url=https://github.com/lissy93/dashy) -[![Share Dashy on Pinterest](https://img.shields.io/badge/Share-Pinterest-%23E60023?style=flat-square&logo=pinterest)](https://pinterest.com/pin/create/button/?url=https://github.com/lissy93/dashy&media=https://raw.githubusercontent.com/Lissy93/dashy/master/docs/showcase/1-home-lab-material.png&description=Check%20out%20Dashy,%20the%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) -[![Share Dashy via Email](https://img.shields.io/badge/Share-Email-%238A90C7?style=flat-square&logo=protonmail)](mailto:info@example.com?&subject=Check%20out%20Dashy%20-%20The%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80&cc=&bcc=&body=https://github.com/lissy93/dashy) +[![Share Dashy on Mastodon](https://img.shields.io/badge/Share-Mastodon-%232b90d9?style=for-the-badge&logo=mastodon)](https://mastodon.social/?text=Check%20out%20Dashy%2C%20the%20privacy-friendly%2C%20self-hosted%20startpage%20for%20organizing%20your%20life%3A%20https%3A%2F%2Fgithub.com%2FLissy93%2Fdashy%20-%20By%20%40lissy93%40mastodon.social) +[![Share Dashy on Reddit](https://img.shields.io/badge/Share-Reddit-%23FF5700?style=for-the-badge&logo=reddit)](http://www.reddit.com/submit?url=https://github.com/Lissy93/dashy&title=Dashy%20-%20The%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) +[![Share Dashy on Twitter](https://img.shields.io/badge/Share-Twitter-%231DA1F2?style=for-the-badge&logo=twitter)](https://twitter.com/intent/tweet?url=https://github.com/lissy93/dashy&text=Check%20out%20Dashy%20by%20@Lissy_Sykes,%20the%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) +[![Share Dashy on Facebook](https://img.shields.io/badge/Share-Facebook-%234267B2?style=for-the-badge&logo=facebook)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/lissy93/dashy) +[![Share Dashy on LinkedIn](https://img.shields.io/badge/Share-LinkedIn-%230077b5?style=for-the-badge&logo=linkedin)](https://www.linkedin.com/shareArticle?mini=true&url=https://github.com/lissy93/dashy) +[![Share Dashy on Pinterest](https://img.shields.io/badge/Share-Pinterest-%23E60023?style=for-the-badge&logo=pinterest)](https://pinterest.com/pin/create/button/?url=https://github.com/lissy93/dashy&media=https://raw.githubusercontent.com/Lissy93/dashy/master/docs/showcase/1-home-lab-material.png&description=Check%20out%20Dashy,%20the%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) +[![Share Dashy on VK](https://img.shields.io/badge/Share-VK-%234C75A3?style=for-the-badge&logo=vk)](https://vk.com/share.php?url=https%3A%2F%2Fgithub.com%2Flissy93%2Fdashy%2F&title=Check%20out%20Dashy%20-%20The%20Self-Hosted%20Dashboard%20for%20your%20Homelab%20%F0%9F%9A%80) +[![Share Dashy via Viber](https://img.shields.io/badge/Share-Viber-%238176d6?style=for-the-badge&logo=viber)](viber://forward?text=https%3A%2F%2Fgithub.com%2Flissy93%2Fdashy%0ACheck%20out%20Dashy%2C%20the%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) +[![Share Dashy via Telegram](https://img.shields.io/badge/Share-Telegram-%230088cc?style=for-the-badge&logo=telegram)](https://t.me/share/url?url=https%3A%2F%2Fgithub.com%2Flissy93%2Fdashy&text=Check%20out%20Dashy%2C%20the%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80) +[![Share Dashy via Email](https://img.shields.io/badge/Share-Email-%238A90C7?style=for-the-badge&logo=protonmail)](mailto:info@example.com?&subject=Check%20out%20Dashy%20-%20The%20self-hosted%20dashboard%20for%20your%20homelab%20%F0%9F%9A%80&cc=&bcc=&body=https://github.com/lissy93/dashy) ## Leave a review Dashy is on the following platforms, and if you could spare a few seconds to give it an upvote or review, this will also help new users find it. -[![ProductHunt](https://img.shields.io/badge/Review-ProductHunt-%23b74424?style=flat-square&logo=producthunt)](https://www.producthunt.com/posts/dashy) -[![AlternativeTo](https://img.shields.io/badge/Review-AlternativeTo-%235581a6?style=flat-square&logo=abletonlive)](https://alternativeto.net/software/dashy/about/) +[![ProductHunt](https://img.shields.io/badge/Review-ProductHunt-%23b74424?style=for-the-badge&logo=producthunt)](https://www.producthunt.com/posts/dashy) +[![AlternativeTo](https://img.shields.io/badge/Review-AlternativeTo-%235581a6?style=for-the-badge&logo=abletonlive)](https://alternativeto.net/software/dashy/about/) ## Make a small donation @@ -47,13 +50,24 @@ Sponsoring will give you several perks, from $1 / £0.70 per month, as well as a You can also send one-off small contriutions using crypto: - **BTC**: `3853bSxupMjvxEYfwGDGAaLZhTKxB2vEVC` - **ETH**: `0x0fc98cBf8bea932B4470C46C0FbE1ed1f6765017` / `aliciasykes.eth` -- **XMR**: `471KZdxb6N63aABR4WYwMRjTVkc1p1x7wGsUTEF7AMYzL8L94A5pCuYWkosgJQ5Ze8Y2PscVCGZFJa3hDPg6MaDq47GUm8r` +- **XMR**: `471KZdxb6N63aABR4WYwMRjTVkc1p1x7wGsUTEF7AMYzL8L94A5pCuYWkosgJQ5Ze8Y2PscVCGZFJa3hDPg6MaDq47GUm8r`# ## Request a feature via BountySource BountySource is a platform for sponsoring the development of certain features on open source projects. If there is a feature you'd like implemented into Dashy, but either isn't high enough priority or is deemed to be more work than it's worth, then you can instead contribute a bounty towards it's development. You won't pay a penny until your proposal is fully built, and you are satisfied with the result. This helps support the developers, and makes Dashy better for everyone. For more info, see [Dashy on Bounty Source](https://www.bountysource.com/teams/dashy) +## Enable Anonymous Bug Reports +[Sentry](https://github.com/getsentry/sentry) is an open source error tracking and performance monitoring tool, which enables the identification any errors which occur in the production app (only if you enable it). It helps me to discover bugs I was unaware of, and then fix them, in order to make Dashy more reliable long term. This is a simple, yet really helpful step you can take to help improve Dashy. + +To enable error reporting: +```yaml +appConfig: + enableErrorReporting: true +``` + +All reporting is **disabled** by default, and no data will ever be sent to any external endpoint without your explicit consent. In fact, the error tracking package will not even be imported unless you have actively enabled it. All statistics are anonomized and stored securely. For more about privacy and security, see the [Sentry Docs](https://sentry.io/security/). + --- ### Contributors diff --git a/docs/privacy.md b/docs/privacy.md new file mode 100644 index 00000000..39259c73 --- /dev/null +++ b/docs/privacy.md @@ -0,0 +1,78 @@ +# Privacy & Security +Dashy was built with privacy in mind. Self-hosting your own apps and services is a great way to protect yourself from the mass data collection employed by big tech companies, and Dashy was designed to keep your local services organized and accessible from a single place. + +It's fully open source, and I've tried to keep to code as clear and thoroughly documented as possible, which will make it easy for you to understand exactly how it works, and what goes on behind the scenes. + +For privacy and security tips, check out another project of mine: **[Personal Security Checklist](https://github.com/Lissy93/personal-security-checklist)**. + +--- + +## External Requests +By default, Dashy will not make any external requests, unless you configure it to. Some features (which are all off by default) do require internat access, and this section outlines those features, the services used, and links to their privacy policies. + +### Font Awesome +If either sections or items are using font-awesome icons, then these will be fetched directly from font-awesome on page load. + +### Favicon Fetching +If an item's icon is set to `favicon`, then it will be auto-fetched from the corresponding URL. Since not all websites have their icon located at `/favicon.ico`, and if they do, it's often very low resolution (like `16 x 16 px`). Therefore, the default behavior is for Dashy to check if the URL is public, and if so will use an API to fetch the favicon. For self-hosted services, the favion will be fetched from the default path, and no external requests will be made. + +The default favicon API is [Favicon Kit](https://faviconkit.com/), but this can be changed by setting `appConfig.faviconApi` to an alternate source (`google`, `clearbit`, `webmasterapi` and `allesedv` are supported). If you do not want to use any API, then you can set this property to `local`, and the favicon will be fetched from the default path. For hosted services, this will still incur an external request. + +### Other Icons +Section icons, item icons and app icons are able to accept a URL to a raw image, if the image is hosted online then an external request will be made. To avoid the need to make external requests for icon assets, you can either use a self-hosted CDN, or store your images within `./public/item-icons` (which can be mounted as a volume if you're using Docker). + +### Web Assets +By default, all assets required by Dashy come bundled within the source, and so no external requests are made. If you add an additional font, which is imported from a CDN, then that will incur an external request. The same applies for other web assets, like external images, scripts or styles. + +### Status Checking +The status check util will ping your services directly, and does not rely on any third party. If you are checking the uptime status of a public/ hosted application, then please refer to that services privacy policy. For all self-hosted services, requests happen locally within your network, and are not external. + +### Update Checks +When the application loads, it checks for updates. The results of which are displayed in the config menu of the UI. This was implemented because using a very outdated version of Dashy may have unfixed issues. Your version is fetched from the source (local request), but the latest version is fetched from GitHub, which is an external request. This can be disabled by setting `appConfig.disableUpdateChecks: true` + +### Anonymous Error Reporting +Error reporting is disabled by default, and no data will ever be sent without your explicit consent. In fact, the error tracking method will not even be imported unless you have actively enabled it. [Sentry](https://github.com/getsentry/sentry) is used for this, it's an open source error tracking and performance monitoring tool, which is used to identify any errors which occur in the production app (if you enable it). + +The crash report includes the file or line of code that triggered the error, and a 2-layer deep stack trace. Reoccurring errors will also include the following user information: OS type (Mac, Windows, Linux, Android or iOS) and browser type (Firefox, Chrome, IE, Safari). Data scrubbing is enabled. IP address will not be stored. If any potentially identifiable data ever finds its way into a crash report, it will be automatically and permanently erased. All statistics collected are anonomized and stored securely, and ae automatically deleted after 14 days. For more about privacy and security, see the [Sentry Docs](https://sentry.io/security/). + +Enabling anonymous error reporting helps me to discover bugs I was unaware of, and then fix them, in order to make Dashy more reliable long term. Error reporting is activated by setting `appConfig.enableErrorReporting: true`. + +--- + +## Dependencies +As with most web projects, Dashy relies on several [dependencies](https://github.com/Lissy93/dashy/blob/master/docs/credits.md#dependencies-). For links to each, and a breakdown of their licenses, please see [Legal](https://github.com/Lissy93/dashy/blob/master/.github/LEGAL.md). + +Dependencies can introduce security vulnerabilities, but since all these packages are open source any issues are usually very quickly spotted. Dashy is using Snyk for dependency security monitoring, and you can see [the latest report here](https://snyk.io/test/github/lissy93/dashy). + +--- + +## Securing your Environment +Running your self-hosted applications in individual, containerized environments (such as containers or VMs) helps keep them isolated, and prevent an exploit in one service effecting another. + +There is very little complexity involved with Dashy, and therefore the attack surface is reasonably small, but it is still important to follow best practices and employ monitoring for all your self-hosted apps. A couple of things that you should look at include: +- Use SSL for securing traffic in transit +- Configure [authentication](/docs/authentication.md#alternative-authentication-methods) to prevent unauthorized access +- Keep your system, software and Dashy up-to-date +- Ensure your server is appropriately secured +- Manage users and SSH correctly +- Enable and configure firewall rules +- Implement security, malware and traffic scanning +- Setup malicious traffic detection + +This is covered in more detail in [App Management](/docs/management.md). + +--- + +## Reporting a Security Issue +If you think you've found a critical issue with Dashy, please send an email to `security@mail.alicia.omg.lol`. You can encrypt it, using [`0688 F8D3 4587 D954 E9E5 1FB8 FEDB 68F5 5C02 83A7`](https://keybase.io/aliciasykes/pgp_keys.asc?fingerprint=0688f8d34587d954e9e51fb8fedb68f55c0283a7). You should receive a response within 48 hours. + +All non-critical issues can be raised as a ticket. + +Please include the following information: +- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) +- Full paths of source file(s) related to the manifestation of the issue +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- Step-by-step instructions to reproduce the issue +- Proof-of-concept or exploit code (if possible) +- Impact of the issue, including how an attacker might exploit the issue diff --git a/docs/readme.md b/docs/readme.md index 4fd72f6e..b6a2d859 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -20,3 +20,10 @@ - [Language Switching](/docs/multi-language-support.md) - [Status Indicators](/docs/status-indicators.md) - Using Dashy to monitor uptime and status of your apps - [Theming](/docs/theming.md) - Complete guide to applying, writing and modifying themes and styles + +#### Misc +- [Privacy & Security](/docs/privacy.md) - List of requests, potential issues, and security resources +- [License](/LICENSE) - Copy of the MIT License +- [Legal](/.github/LEGAL.md) - Licenses of direct dependencies +- [Code of Conduct](/.github/CODE_OF_CONDUCT.md) - Contributor Covenant Code of Conduct +- [Changelog](/.github/CHANGELOG.md) - Details of recent changes, and historical versions diff --git a/package.json b/package.json index d5e9843a..34fba720 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Dashy", - "version": "1.4.7", + "version": "1.4.8", "license": "MIT", "main": "server", "scripts": { @@ -15,6 +15,8 @@ "health-check": "node services/healthcheck" }, "dependencies": { + "@sentry/tracing": "^6.10.0", + "@sentry/vue": "^6.10.0", "ajv": "^8.5.0", "axios": "^0.21.1", "body-parser": "^1.19.0", diff --git a/src/main.js b/src/main.js index 7af5b0aa..44fff3e8 100644 --- a/src/main.js +++ b/src/main.js @@ -1,22 +1,25 @@ +/* eslint-disable no-multi-spaces */ // Import core framework and essential utils import Vue from 'vue'; import VueI18n from 'vue-i18n'; // i18n for localization // Import component Vue plugins, used throughout the app -import VTooltip from 'v-tooltip'; // A Vue directive for Popper.js, tooltip component -import VModal from 'vue-js-modal'; // Modal component -import VSelect from 'vue-select'; // Select dropdown component -import VTabs from 'vue-material-tabs'; // Tab view component, used on the config page -import Toasted from 'vue-toasted'; // Toast component, used to show confirmation notifications +import VTooltip from 'v-tooltip'; // A Vue directive for Popper.js, tooltip component +import VModal from 'vue-js-modal'; // Modal component +import VSelect from 'vue-select'; // Select dropdown component +import VTabs from 'vue-material-tabs'; // Tab view component, used on the config page +import Toasted from 'vue-toasted'; // Toast component, used to show confirmation notifications // Import base Dashy components and utils -import Dashy from '@/App.vue'; -import router from '@/router'; -import registerServiceWorker from '@/registerServiceWorker'; -import clickOutside from '@/utils/ClickOutside'; -import { toastedOptions, language as defaultLanguage } from '@/utils/defaults'; -import { messages } from '@/utils/languages'; +import Dashy from '@/App.vue'; // Main Dashy Vue app +import router from '@/router'; // Router, for navigation +import serviceWorker from '@/utils/InitServiceWorker'; // Service worker initialization +import clickOutside from '@/utils/ClickOutside'; // Directive for closing popups, modals, etc +import { messages } from '@/utils/languages'; // Language texts +import ErrorReporting from '@/utils/ErrorReporting'; // Error reporting initializer (off) +import { toastedOptions, language as defaultLanguage } from '@/utils/defaults'; // Defaults +// Initialize global Vue components Vue.use(VueI18n); Vue.use(VTooltip); Vue.use(VModal); @@ -25,7 +28,7 @@ Vue.use(Toasted, toastedOptions); Vue.component('v-select', VSelect); Vue.directive('clickOutside', clickOutside); -Vue.config.productionTip = false; +Vue.config.productionTip = false; // Disable annoying console message // Setup i18n translations const i18n = new VueI18n({ @@ -34,8 +37,11 @@ const i18n = new VueI18n({ messages, }); -// Register Service Worker -registerServiceWorker(); +// Checks if service worker not disable, and if so will registers it +serviceWorker(); + +// Checks if user enabled error reporting, and if so will initialize it +ErrorReporting(Vue, router); // Render function const render = (awesome) => awesome(Dashy); diff --git a/src/utils/ConfigAccumalator.js b/src/utils/ConfigAccumalator.js index b1426eef..b92ee569 100644 --- a/src/utils/ConfigAccumalator.js +++ b/src/utils/ConfigAccumalator.js @@ -23,7 +23,10 @@ export default class ConfigAccumulator { /* App Config */ appConfig() { - const appConfigFile = this.conf.appConfig || {}; + let appConfigFile = {}; + if (this.conf) { + appConfigFile = this.conf.appConfig || {}; + } let usersAppConfig = defaultAppConfig; if (localStorage[localStorageKeys.APP_CONFIG]) { usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]); @@ -48,8 +51,11 @@ export default class ConfigAccumulator { } catch (e) { localPageInfo = {}; } - const filePageInfo = this.conf.pageInfo || {}; - const pi = this.conf.pageInfo || defaults; // The page info object to return + let filePageInfo = {}; + if (this.conf) { + filePageInfo = this.conf.pageInfo || {}; + } + const pi = filePageInfo || defaults; // The page info object to return pi.title = localPageInfo.title || filePageInfo.title || defaults.title; pi.logo = localPageInfo.logo || filePageInfo.logo || defaults.logo; pi.description = localPageInfo.description || filePageInfo.description || defaults.description; @@ -71,7 +77,9 @@ export default class ConfigAccumulator { } } // If the function hasn't yet returned, then return the config file sections - return this.conf.sections; + let sectionsFile = []; + if (this.conf) sectionsFile = this.conf.sections || []; + return sectionsFile; } /* Complete config */ diff --git a/src/utils/ConfigSchema.json b/src/utils/ConfigSchema.json index 874fd18b..62d0e8c3 100644 --- a/src/utils/ConfigSchema.json +++ b/src/utils/ConfigSchema.json @@ -258,6 +258,11 @@ "type": "boolean", "default": false, "description": "Prevents Dashy from checking for updates" + }, + "enableErrorReporting": { + "type": "boolean", + "default": false, + "description": "Enable anonymous crash reports. This helps bugs be found and fixed, in order to make Dashy more stable. Reporting is off by default, and no data will EVER be collected without your explicit and active concent." } }, "additionalProperties": false diff --git a/src/utils/ErrorReporting.js b/src/utils/ErrorReporting.js new file mode 100644 index 00000000..9b0a2a97 --- /dev/null +++ b/src/utils/ErrorReporting.js @@ -0,0 +1,39 @@ +/** + * NOTE: No data is EVER sent to any external service without your explicit consent. + * In the case of error reporting, Sentry will not even be initialized unless + * you have purposely set appConfig.enableErrorReporting: true. + * It is false by default. + * You may want to enable error reporting if you have encountered a bug, + * as access to the console errors enable it to be triaged an fixed effectively + */ + +/* eslint-disable global-require */ + +import ConfigAccumulator from '@/utils/ConfigAccumalator'; + +const ErrorTracking = (Vue, router) => { + // Fetch users config + const appConfig = new ConfigAccumulator().appConfig() || {}; + // Check if error reporting is enabled. Only proceed if user has turned it on. + if (appConfig.enableErrorReporting) { + // Import Sentry + const Sentry = require('@sentry/vue'); + const { Integrations } = require('@sentry/tracing'); + const dsn = 'https://3138ea85f15a4fa883a5b27a4dc8ee28@o937511.ingest.sentry.io/5887934'; + // Initialize Sentry + Sentry.init({ + Vue, + dsn, + integrations: [ + new Integrations.BrowserTracing({ + routingInstrumentation: Sentry.vueRouterInstrumentation(router), + }), + ], + tracesSampleRate: 1.0, + }); + } else { + // Error reporting not enabled. Do Nothing. + } +}; + +export default ErrorTracking; diff --git a/src/registerServiceWorker.js b/src/utils/InitServiceWorker.js similarity index 96% rename from src/registerServiceWorker.js rename to src/utils/InitServiceWorker.js index 5db4a8f3..03f3b7e0 100644 --- a/src/registerServiceWorker.js +++ b/src/utils/InitServiceWorker.js @@ -1,8 +1,8 @@ /* eslint-disable no-console */ import { register } from 'register-service-worker'; -import { sessionStorageKeys } from './utils/defaults'; -import conf from '../public/conf.yml'; +import { sessionStorageKeys } from '@/utils/defaults'; +import conf from '../../public/conf.yml'; /* Sets a local storage item with the state from the SW lifecycle */ const setSwStatus = (swStateToSet) => { diff --git a/yarn.lock b/yarn.lock index a84a1628..a5408341 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1091,6 +1091,81 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== +"@sentry/browser@6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.10.0.tgz#92e72edca584d940fba80cf6477d4a54c6dea573" + integrity sha512-H0Blgp8f8bomebkkGWIgxHVjabtQAlsKJDiFXBg7gIc75YcarRxwH0R3hMog1/h8mmv4CGGUsy5ljYW6jsNnvA== + dependencies: + "@sentry/core" "6.10.0" + "@sentry/types" "6.10.0" + "@sentry/utils" "6.10.0" + tslib "^1.9.3" + +"@sentry/core@6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.10.0.tgz#70af9dc72bb6a5b59062a31b7de023f7f1878357" + integrity sha512-5KlxHJlbD7AMo+b9pMGkjxUOfMILtsqCtGgI7DMvZNfEkdohO8QgUY+hPqr540kmwArFS91ipQYWhqzGaOhM3Q== + dependencies: + "@sentry/hub" "6.10.0" + "@sentry/minimal" "6.10.0" + "@sentry/types" "6.10.0" + "@sentry/utils" "6.10.0" + tslib "^1.9.3" + +"@sentry/hub@6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.10.0.tgz#d59be18016426fd3a5e8d38712c2080466aafe3c" + integrity sha512-MV8wjhWiFAXZAhmj7Ef5QdBr2IF93u8xXiIo2J+dRZ7eVa4/ZszoUiDbhUcl/TPxczaw4oW2a6tINBNFLzXiig== + dependencies: + "@sentry/types" "6.10.0" + "@sentry/utils" "6.10.0" + tslib "^1.9.3" + +"@sentry/minimal@6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.10.0.tgz#9404b93fae649b6c48e1da8f0991b87cf9999561" + integrity sha512-yarm046UgUFIBoxqnBan2+BEgaO9KZCrLzsIsmALiQvpfW92K1lHurSawl5W6SR7wCYBnNn7CPvPE/BHFdy4YA== + dependencies: + "@sentry/hub" "6.10.0" + "@sentry/types" "6.10.0" + tslib "^1.9.3" + +"@sentry/tracing@^6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.10.0.tgz#8dcdc28cccfad976540a3c801acb6914b9c0802e" + integrity sha512-jZj6Aaf8kU5wgyNXbAJHosHn8OOFdK14lgwYPb/AIDsY35g9a9ncTOqIOBp8X3KkmSR8lcBzAEyiUzCxAis2jA== + dependencies: + "@sentry/hub" "6.10.0" + "@sentry/minimal" "6.10.0" + "@sentry/types" "6.10.0" + "@sentry/utils" "6.10.0" + tslib "^1.9.3" + +"@sentry/types@6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.10.0.tgz#6b1f44e5ed4dbc2710bead24d1b32fb08daf04e1" + integrity sha512-M7s0JFgG7/6/yNVYoPUbxzaXDhnzyIQYRRJJKRaTD77YO4MHvi4Ke8alBWqD5fer0cPIfcSkBqa9BLdqRqcMWw== + +"@sentry/utils@6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.10.0.tgz#839a099fa0a1f0ca0893c7ce8c55ba0608c1d80f" + integrity sha512-F9OczOcZMFtazYVZ6LfRIe65/eOfQbiAedIKS0li4npuMz0jKYRbxrjd/U7oLiNQkPAp4/BujU4m1ZIwq6a+tg== + dependencies: + "@sentry/types" "6.10.0" + tslib "^1.9.3" + +"@sentry/vue@^6.10.0": + version "6.10.0" + resolved "https://registry.yarnpkg.com/@sentry/vue/-/vue-6.10.0.tgz#f969e90140e78376ecfa3c235842632b71de5e2e" + integrity sha512-pCmycL9EglfywdUKU6KJ6QqUfCKZmyZkZma6b2mpWjAgeMnuRFcc1arz/HvjtIY6hDKVsIFzgIBeVfcKcdCrnQ== + dependencies: + "@sentry/browser" "6.10.0" + "@sentry/core" "6.10.0" + "@sentry/minimal" "6.10.0" + "@sentry/types" "6.10.0" + "@sentry/utils" "6.10.0" + tslib "^1.9.3" + "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" @@ -9256,7 +9331,7 @@ tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@^1.9.0: +tslib@^1.9.0, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==