diff --git a/package.json b/package.json index 4d86080..bf1b139 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "evolution-manager", - "version": "0.3.8", + "version": "0.3.9", "main": "dist", "engines": { "node": ">=16.0.0" diff --git a/src/components/modal/Settings.vue b/src/components/modal/Settings.vue index 9b9813f..ad3fa9d 100644 --- a/src/components/modal/Settings.vue +++ b/src/components/modal/Settings.vue @@ -32,9 +32,7 @@
- - Sobre esse Manager - + Sobre
mdi-logout - Cancel + --> + + mdi-share-variant + diff --git a/src/layouts/default/AppBar.vue b/src/layouts/default/AppBar.vue index d855b7d..089fede 100644 --- a/src/layouts/default/AppBar.vue +++ b/src/layouts/default/AppBar.vue @@ -53,6 +53,23 @@ export default { openSettings() { this.$refs.settings.open(); }, + async loadConnectionFromUrl() { + try { + const { connection } = this.$route.query; + if (!connection) return null; + this.$router.replace({ query: {} }); + + const json = atob(connection); + const data = JSON.parse(json); + if (!data.host || !data.globalApiKey) return null; + + await this.AppStore.setConnection(data); + return data; + } catch (e) { + console.error(e); + return null; + } + }, }, computed: { dark() { @@ -60,7 +77,8 @@ export default { }, }, async mounted() { - await this.AppStore.loadConnection(); + const urlConnection = await this.loadConnectionFromUrl(); + if (!urlConnection) await this.AppStore.loadConnection(); if (!this.AppStore.validConnection) this.openSettings(); }, };