version 0.4.0 prepare to evolution-api

This commit is contained in:
Gabriel Pastori 2023-12-11 14:58:47 -03:00
parent 6191c8b3f2
commit f77436c5ce
5 changed files with 23 additions and 9 deletions

View File

@ -8,8 +8,6 @@ module.exports = async (argv) => {
const isEvolutionInstalled = verifyEvolutionInstallation(); const isEvolutionInstalled = verifyEvolutionInstallation();
if (!isEvolutionInstalled) return; if (!isEvolutionInstalled) return;
console.log(`🔃 Reverting to Evolution-Api v${v}...`); console.log(`🔃 Reverting to Evolution-Api v${v}...`);
await revertToVersion(v); await revertToVersion(v);
console.log(`🔃 Reverted to Evolution-Api v${v} successfully`); console.log(`🔃 Reverted to Evolution-Api v${v} successfully`);

7
lib/postinstall.js Normal file
View File

@ -0,0 +1,7 @@
const build = require('./utils/build');
async function main() {
await build({ VITE_BASE_URL: '/manager/' });
}
main();

View File

@ -1,7 +1,7 @@
{ {
"name": "evolution-manager", "name": "evolution-manager",
"description": "Evolution Manager is an open-source interface for managing the Evolution API, simplifying the creation and administration of API instances with advanced features and diverse integrations.", "description": "Evolution Manager is an open-source interface for managing the Evolution API, simplifying the creation and administration of API instances with advanced features and diverse integrations.",
"version": "0.3.12", "version": "0.4.0",
"main": "dist", "main": "dist",
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"
@ -10,7 +10,8 @@
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint . --fix --ignore-path .gitignore" "lint": "eslint . --fix --ignore-path .gitignore",
"prepare": "node ./lib/postinstall.js"
}, },
"directories": { "directories": {
"bin": "./bin" "bin": "./bin"

View File

@ -141,6 +141,8 @@
import { useAppStore } from "@/store/app"; import { useAppStore } from "@/store/app";
import AboutModal from "./About.vue"; import AboutModal from "./About.vue";
import ShareConnection from "./ShareConnection.vue"; import ShareConnection from "./ShareConnection.vue";
const BASE_URL = import.meta.env.BASE_URL;
export default { export default {
components: { AboutModal, ShareConnection }, components: { AboutModal, ShareConnection },
name: "SettingsModal", name: "SettingsModal",
@ -149,7 +151,7 @@ export default {
valid: false, valid: false,
revelPassword: false, revelPassword: false,
connection: { connection: {
host: "", host: BASE_URL ? window.location.origin : "",
globalApiKey: "", globalApiKey: "",
}, },
loading: false, loading: false,
@ -161,7 +163,6 @@ export default {
share() { share() {
const connection = Object.assign({}, this.AppStore.connection); const connection = Object.assign({}, this.AppStore.connection);
this.$refs.share.open(connection); this.$refs.share.open(connection);
}, },
logout() { logout() {
this.AppStore.logout(); this.AppStore.logout();
@ -192,6 +193,8 @@ export default {
open() { open() {
this.dialog = true; this.dialog = true;
this.connection = Object.assign({}, this.AppStore.connection); this.connection = Object.assign({}, this.AppStore.connection);
if (!this.connection.host && BASE_URL.startsWith("/manager"))
this.connection.host = window.location.origin;
}, },
}, },
watch: { watch: {

View File

@ -77,9 +77,14 @@ export default {
}, },
}, },
async mounted() { async mounted() {
const urlConnection = await this.loadConnectionFromUrl(); try {
if (!urlConnection) await this.AppStore.loadConnection(); const urlConnection = await this.loadConnectionFromUrl();
if (!this.AppStore.validConnection) this.openSettings(); if (!urlConnection) await this.AppStore.loadConnection();
} catch (e) {
console.error(e);
} finally {
if (!this.AppStore.validConnection) this.openSettings();
}
}, },
}; };
</script> </script>