implement basic web server for dashboard,
use templates to do basic SSR on head and header
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { getSyncSettings, requestAPI } from "./utils.js";
|
||||
import { API } from "../vars.js";
|
||||
|
||||
export async function setupClientSync (callback) {
|
||||
const { scheme, rate } = getSyncSettings();
|
||||
@@ -22,7 +21,7 @@ export async function setupClientSync (callback) {
|
||||
}
|
||||
else if (scheme === "interrupt") {
|
||||
callback();
|
||||
const socket = new WebSocket(`wss://${API.replace("https://", "")}/sync/interrupt`);
|
||||
const socket = new WebSocket(`wss://${window.API.replace("https://", "")}/sync/interrupt`);
|
||||
socket.addEventListener("open", (event) => {
|
||||
socket.send(`rate ${rate}`);
|
||||
});
|
||||
|
@@ -2,7 +2,6 @@ import { requestPVE, requestAPI, goToPage, setAppearance, getSearchSettings, goT
|
||||
import { alert, dialog } from "./dialog.js";
|
||||
import { setupClientSync } from "./clientsync.js";
|
||||
import wfaInit from "../modules/wfa.js";
|
||||
import { PVE } from "../vars.js";
|
||||
|
||||
class InstanceCard extends HTMLElement {
|
||||
constructor () {
|
||||
@@ -220,7 +219,7 @@ class InstanceCard extends HTMLElement {
|
||||
if (!this.actionLock && this.status === "running") {
|
||||
const data = { console: `${this.type === "qemu" ? "kvm" : "lxc"}`, vmid: this.vmid, vmname: this.name, node: this.node.name, resize: "off", cmd: "" };
|
||||
data[`${this.type === "qemu" ? "novnc" : "xtermjs"}`] = 1;
|
||||
goToURL(PVE, data, true);
|
||||
goToURL(window.PVE, data, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import { API } from "../vars.js";
|
||||
|
||||
export const resourcesConfig = {
|
||||
cpu: {
|
||||
name: "CPU Type",
|
||||
@@ -224,7 +222,7 @@ export async function requestPVE (path, method, body = null) {
|
||||
content.headers.CSRFPreventionToken = getCookie("CSRFPreventionToken");
|
||||
}
|
||||
|
||||
const response = await request(`${API}/proxmox${path}`, content);
|
||||
const response = await request(`${window.API}/proxmox${path}`, content);
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -245,7 +243,7 @@ export async function requestAPI (path, method, body = null) {
|
||||
content.body = prms.toString();
|
||||
}
|
||||
|
||||
const response = await request(`${API}${path}`, content);
|
||||
const response = await request(`${window.API}${path}`, content);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user