Update to UIX.

This commit is contained in:
Jesse Malotaux 2025-04-12 15:31:32 +02:00
parent d373237127
commit c9850dcbf8
10 changed files with 38 additions and 16 deletions

View file

@ -2,7 +2,7 @@ import { useDeviceStore } from '@/stores/device'
import CryptoJS from 'crypto-js'
export const appUrl = () => {
const port = window.location.port == 5173 ? import.meta.env.VITE_MCRM__PORT : window.location.port
const port = window.location.port == 5173 ? window.__CONFIG__.MCRM__PORT : window.location.port
return `http://${window.location.hostname}:${port}`
}

View file

@ -0,0 +1,12 @@
import axios from 'axios'
import { appUrl } from './ApiService'
export const ConfigGet = async (key) => {
console.log(window.__CONFIG__)
const config = await axios.get(appUrl() + '/config.json')
if (!config.data) return false
return config.data[key]
}

View file

@ -5,7 +5,7 @@ import { isLocal } from './ApiService'
export const encryptAES = (key, str) => {
key = keyPad(key)
let iv = enc.Utf8.parse(import.meta.env.VITE_MCRM__IV)
let iv = enc.Utf8.parse(window.__CONFIG__.MCRM__IV)
let encrypted = AES.encrypt(str, key, {
iv: iv,
padding: pad.Pkcs7,
@ -16,7 +16,7 @@ export const encryptAES = (key, str) => {
export const decryptAES = (key, str) => {
key = keyPad(key)
let iv = enc.Utf8.parse(import.meta.env.VITE_MCRM__IV)
let iv = enc.Utf8.parse(window.__CONFIG__.MCRM__IV)
let encrypted = AES.decrypt(str.toString(), key, {
iv: iv,
padding: pad.Pkcs7,
@ -39,7 +39,7 @@ function keyPad(key) {
let returnKey = key
if (key.length == 4) {
returnKey = key + import.meta.env.VITE_MCRM__SALT
returnKey = key + window.__CONFIG__.MCRM__SALT
}
return enc.Utf8.parse(returnKey)