From 5b729cfbddf2d2b7833729ca9c0c17d7df635af3 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 24 May 2021 20:46:58 +0100 Subject: [PATCH] Finished of cloud backup and restore feature --- Dockerfile | 6 ++- README.md | 38 +++++++++++++------ .../Configuration/CloudBackupRestore.vue | 10 ++--- src/components/Configuration/EditSiteMeta.vue | 4 +- src/utils/CloudBackup.js | 4 +- src/utils/defaults.js | 1 + 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 125ad12d..e249559e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,10 +15,12 @@ COPY . . RUN yarn build # Production Stage +ENV PORT 80 + FROM nginx:1.15.7-alpine as production-stage COPY --from=build-stage /app/dist /usr/share/nginx/html -EXPOSE 80 - +EXPOSE ${PORT} +VOLUME /usr/share/nginx/html/item-icons CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index 779de909..3ed0e9a9 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,11 @@ - Quickly preview a website, by holding down the Alt key while clicking, to open it in a resizable pop-up modal - Many options for icons, including full Font-Awesome support and the ability to auto-fetch icon from URLs favicon - Additional info for each item visible on hover (including opening method icon and description as a tooltip) -- Option for full-screen background image, custom nav-bar links, and custom footer -- Preferences stored in local storage and applied on load -- Easy YAML-based configuration -- Small bundle size and a fully responsive UI makes the app easy to use on any device +- Option for full-screen background image, custom nav-bar links, and custom footer text +- User settings stored in local storage and applied on load +- Encrypted cloud backup and restore feature available +- Easy single-file YAML-based configuration +- Small bundle size, fully responsive UI and PWA makes the app easy to use on any device - Plus lots more... **Live Demos**: [Demo 1](https://dashy-demo-1.as93.net) ┆ [Demo 2](https://dashy-demo-2.as93.net) ┆ [Demo 3](https://dashy-demo-3.as93.net) @@ -38,7 +39,6 @@ --- ## Running the App 🏃‍♂️ - ### Deploying 🚀 - Get Code: `git clone git@github.com:Lissy93/dashy.git` and `cd dashy` - Configuration: Fill in you're settings in `./public/conf.yml` @@ -46,17 +46,22 @@ - Build: `yarn build` - Run: `yarn start` -### Deploying with Docker 🐳 +### Deploying with Docker from Source 🛳️ - Get Code: `git clone git@github.com:Lissy93/dashy.git` and `cd dashy` - Configuration: Fill in you're settings in `./public/conf.yml` - Build: `docker build -t lissy93/dashy .` -- Start: `docker run -it -p 8080:80 --rm --name my-dashboard lissy93/dashy` +- Start: `docker run -p 8080:80 --name my-dashboard lissy93/dashy` +### Deploying from Docker Hub 🐳 +- Get the Image: `docker pull lissy93/dashy` +- Start the Container: `docker run -d -p 8080:80 --name my-dashboard lissy93/dashy` ### Developing 🧱 - Get Code: `git clone git@github.com:Lissy93/dashy.git` and `cd dashy` - Install dependencies: `yarn` - Start dev server: `yarn dev` +Note that although recommended, it is not required to use the conf.yml file- all settings can be specified through the UI, and backed up on the cloud. + --- ## Configuring 🔧 @@ -162,17 +167,24 @@ There are a few self-hosted web apps, that serve a similar purpose to Dashy. Inc ### Credits 🏆 -And the app itself is built with [Vue.js](https://github.com/vuejs/vue) ![vue-logo](https://i.ibb.co/xqKW6h5/vue-logo.png) - -And wouldn't have been quite possible, without the following components, kudos to their respective authors +This wouldn't have been quite so possible without the following components, kudos to their respective authors - [`vue-select`](https://github.com/sagalbot/vue-select) - Dropdown component by @sagalbot `MIT` - [`vue-js-modal`](https://github.com/euvl/vue-js-modal) - Modal component by @euvl `MIT` - [`v-tooltip`](https://github.com/Akryum/v-tooltip) - Tooltip component by @Akryum `MIT` - [`vue-material-tabs`](https://github.com/jairoblatt/vue-material-tabs) - Tab view component by @jairoblatt `MIT` - [`VJsoneditor`](https://github.com/yansenlei/VJsoneditor) - Interactive JSON editor component by @yansenlei `MIT` - - Forked from [JsonEditor](https://github.com/josdejong/jsoneditor) by @josdejong `Apache-2.0 License` + - Forked from [`JsonEditor`](https://github.com/josdejong/jsoneditor) by @josdejong `Apache-2.0 License` + - And using [`ajv`](https://github.com/ajv-validator/ajv) `MIT` JSON schema Validator [`ace`](https://github.com/ajaxorg/ace) `BSD` code editor - [`vue-toasted`](https://github.com/shakee93/vue-toasted) - Toast notification component by @shakee93 `MIT` +Utils: +- [`crypto-js`](https://github.com/brix/crypto-js) - Encryption implementations by @evanvosberg and community `MIT` +- [`axios`](https://github.com/axios/axios) - Promise based HTTP client by @mzabriskie and community `MIT` + +And the app itself is built with [Vue.js](https://github.com/vuejs/vue) ![vue-logo](https://i.ibb.co/xqKW6h5/vue-logo.png) + +Although the app is purely frontend, there is an optional cloud backup and restore feature. This is built as a serverless function on [Cloudflare workers](https://workers.cloudflare.com/) using [KV](https://developers.cloudflare.com/workers/runtime-apis/kv) and [web crypto](https://developers.cloudflare.com/workers/runtime-apis/web-crypto) + ### License 📜 ``` @@ -194,3 +206,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRA TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAREOR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` + +--- + +Dashy - A feature-rich dashboard for your homelab 🚀 | Product Hunt diff --git a/src/components/Configuration/CloudBackupRestore.vue b/src/components/Configuration/CloudBackupRestore.vue index 7fdfac75..8fb4dda0 100644 --- a/src/components/Configuration/CloudBackupRestore.vue +++ b/src/components/Configuration/CloudBackupRestore.vue @@ -3,14 +3,10 @@

Cloud Backup & Restore

- The cloud backup and restore feature, allows you to upload your config to the internet, - and then restore it on any other device or instance of Dashy. This provides an alternative - method of configuring, without the need to write YAML, and also means you don't necessarily - need to host your own instance of the application. + Cloud backup and restore is an optional feature, that enabled you to upload your + config to the internet, and then restore it on any other device or instance of Dashy.

All data is fully end-to-end encrypted with AES, using your password as the key. - Both encryption and decryption happens on your device so your data cannot be - accessed by anyone other than you.

@@ -102,7 +98,7 @@ export default { } else if (savedHash === this.makeHash(this.backupPassword)) { this.makeUpdate(); } else { - this.showErrorMsg('Incorrect password. Please enter the password you used last time.'); + this.showErrorMsg('Incorrect password. Please enter your current password.'); } }, makeBackup() { diff --git a/src/components/Configuration/EditSiteMeta.vue b/src/components/Configuration/EditSiteMeta.vue index 6d629439..abbf9d7b 100644 --- a/src/components/Configuration/EditSiteMeta.vue +++ b/src/components/Configuration/EditSiteMeta.vue @@ -60,7 +60,9 @@ export default { pageInfo.title = this.formElements.title; pageInfo.description = this.formElements.description; pageInfo.footerText = this.formElements.footerText; - pageInfo.navLinks = this.formElements.navLinks.filter(link => (link.title !== '')); + if (this.formElements.navLinks) { + pageInfo.navLinks = this.formElements.navLinks.filter(link => (link.title !== '')); + } localStorage.setItem(localStorageKeys.PAGE_INFO, JSON.stringify(pageInfo)); this.$toasted.show('Changes saved succesfully'); setTimeout(() => { location.reload(); }, 1500); // eslint-disable-line no-restricted-globals diff --git a/src/utils/CloudBackup.js b/src/utils/CloudBackup.js index 59d6a845..e49e0519 100644 --- a/src/utils/CloudBackup.js +++ b/src/utils/CloudBackup.js @@ -2,8 +2,9 @@ import sha256 from 'crypto-js/sha256'; import aes from 'crypto-js/aes'; import Utf8 from 'crypto-js/enc-utf8'; import axios from 'axios'; +import { backupEndpoint } from '@/utils/defaults'; -const ENDPOINT = 'https://dashy-sync-service.as93.net'; +const ENDPOINT = backupEndpoint; // 'https://dashy-sync-service.as93.net'; /* Stringify, encrypt and encode data for transmission */ const encryptData = (data, password) => { @@ -36,6 +37,7 @@ const encodeGetParams = p => Object.entries(p).map(kv => kv.map(encodeURICompone /* Restores the backup */ export const restore = (backupId, password) => { const params = encodeGetParams({ backupId, subHash: makeSubHash(password) }); + console.log(makeSubHash(password)); const url = `${ENDPOINT}/?${params}`; return new Promise((resolve, reject) => { axios.get(url).then((response) => { diff --git a/src/utils/defaults.js b/src/utils/defaults.js index f79904d8..0c3bac44 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -62,4 +62,5 @@ module.exports = { className: 'toast-message', iconPack: 'fontawesome', }, + backupEndpoint: 'https://dashy-sync-service.as93.net', };