Skip to content

Commit

Permalink
Finished of cloud backup and restore feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed May 24, 2021
1 parent 0e43e91 commit 5b729cf
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 22 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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;"]
38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -38,25 +39,29 @@
---

## Running the App 🏃‍♂️

### Deploying 🚀
- Get Code: `git clone [email protected]:Lissy93/dashy.git` and `cd dashy`
- Configuration: Fill in you're settings in `./public/conf.yml`
- Install dependencies: `yarn`
- Build: `yarn build`
- Run: `yarn start`

### Deploying with Docker 🐳
### Deploying with Docker from Source 🛳️
- Get Code: `git clone [email protected]: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 [email protected]: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 🔧
Expand Down Expand Up @@ -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 📜

```
Expand All @@ -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.
```
---
<a href="https://www.producthunt.com/posts/dashy" target="_blank" align="center"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=294872&theme=dark" alt="Dashy - A feature-rich dashboard for your homelab 🚀 | Product Hunt" width="250" height="54" /></a>
10 changes: 3 additions & 7 deletions src/components/Configuration/CloudBackupRestore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
<div class="section intro">
<h2>Cloud Backup & Restore</h2>
<p class="intro">
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.
<br><br>
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.
</p>
</div>
<div class="section backup-section">
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Configuration/EditSiteMeta.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/utils/CloudBackup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand Down
1 change: 1 addition & 0 deletions src/utils/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ module.exports = {
className: 'toast-message',
iconPack: 'fontawesome',
},
backupEndpoint: 'https://dashy-sync-service.as93.net',
};

0 comments on commit 5b729cf

Please sign in to comment.