mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-07-28 16:32:37 -04:00
connect to correct backend url
This commit is contained in:
@@ -63,7 +63,7 @@ go mod tidy
|
||||
go run main.go serve
|
||||
```
|
||||
|
||||
Log in to [http://127.0.0.1:8090/\_/](http://127.0.0.1:8090/_/), create an admin user and add some devices.
|
||||
Log in to [http://localhost:8090/\_/](http://localhost:8090/_/), create an admin user and add some devices.
|
||||
|
||||
2. Start frontend
|
||||
|
||||
|
||||
5237
frontend/pnpm-lock.yaml
generated
5237
frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -15,11 +15,11 @@
|
||||
export let now;
|
||||
|
||||
function shutdown() {
|
||||
fetch(`${dev ? 'http://127.0.0.1:8090' : ''}/api/upsnap/shutdown/${device.id}`);
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/shutdown/${device.id}`);
|
||||
}
|
||||
|
||||
function wake() {
|
||||
fetch(`${dev ? 'http://127.0.0.1:8090' : ''}/api/upsnap/wake/${device.id}`);
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/wake/${device.id}`);
|
||||
}
|
||||
|
||||
function sortPorts(a, b) {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
buttons.scan.state = 'waiting';
|
||||
await pb.collection('settings').update(settings.id, settings);
|
||||
|
||||
fetch(`${dev ? 'http://127.0.0.1:8090' : ''}/api/upsnap/scan`)
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/scan`)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
if (data.message) {
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const pb = new PocketBase('http://127.0.0.1:8090');
|
||||
let backend_url;
|
||||
let isDevMode = import.meta.env.DEV;
|
||||
if (isDevMode) {
|
||||
backend_url = 'http://localhost:8090';
|
||||
} else {
|
||||
backend_url = '/';
|
||||
}
|
||||
const pb = new PocketBase(backend_url);
|
||||
pb.autoCancellation(false);
|
||||
|
||||
export const pocketbase = writable(pb);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
const config = {
|
||||
plugins: [sveltekit()]
|
||||
};
|
||||
|
||||
export default config;
|
||||
export default defineConfig({
|
||||
plugins: [sveltekit()],
|
||||
envPrefix: 'UPSNAP'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user