WIP: Device components, services and stores updated.

This commit is contained in:
Jesse Malotaux 2025-03-23 22:01:50 +01:00
parent 2f96c787a2
commit 03181cf6a4
8 changed files with 137 additions and 62 deletions

View file

@ -1,3 +1,5 @@
import CryptoJS from 'crypto-js'
export const appUrl = () => {
return window.location.port !== 6970 ? `http://${window.location.hostname}:6970` : ''
}
@ -5,3 +7,13 @@ export const appUrl = () => {
export const isLocal = () => {
return window.location.hostname === '127.0.0.1' || window.location.hostname === 'localhost'
}
export const encrypt = (data, key = false) => {
const pk = !key ? localStorage.getItem('Macrame__pk') : key
if (pk) {
return CryptoJS.RSA.encrypt(JSON.stringify(data), pk).toString()
} else {
return false
}
}