Frontend update Alpha version

This commit is contained in:
Jesse Malotaux 2025-04-17 11:23:20 +02:00
parent e1b13b3930
commit 84b038b5ee
4 changed files with 8 additions and 4 deletions

View file

@ -7,7 +7,7 @@ export const appUrl = () => {
return `http://${window.location.hostname}:${port}`
}
export const isLocal = () => {
export const isLocal = () => {
return window.location.hostname === '127.0.0.1' || window.location.hostname === 'localhost'
}

View file

@ -24,9 +24,11 @@ export const decryptAES = (key, str) => {
return encrypted.toString(enc.Utf8)
}
export const AuthCall = (data) => {
export const AuthCall = (data = false) => {
if (isLocal()) return data
if (!data) data = {empty: true}
const device = useDeviceStore()
return {

View file

@ -39,7 +39,9 @@ export const usePanelStore = defineStore('panel', () => {
const getList = async () => {
if (list.value.length > 0) return list.value
const resp = await axios.post(appUrl() + '/panel/list')
const data = AuthCall()
const resp = await axios.post(appUrl() + '/panel/list', data)
list.value = resp.data
return list.value

View file

@ -5,7 +5,7 @@
<div class="panel__content">
<div class="grid gap-1 opacity-50 h-fit">
<em v-if="isLocal()">This is the server dashboard.</em>
<em v-else>This is the server dashboard.</em>
<em v-else>This is the remote dashboard.</em>
</div>
<div v-if="isLocal()">
<h4>Start: Authenticate a device</h4>