mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 15:29:26 +00:00
Update to UIX.
This commit is contained in:
parent
d373237127
commit
c9850dcbf8
10 changed files with 38 additions and 16 deletions
|
|
@ -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}`
|
||||
}
|
||||
|
|
|
|||
12
fe/src/services/ConfigService.js
Normal file
12
fe/src/services/ConfigService.js
Normal 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]
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue