use proxmox builtin consoles
This commit is contained in:
parent
d8d36bee96
commit
87e50051c7
@ -1,4 +1,4 @@
|
||||
import {requestPVE, goToPage, instances, getCookie} from "./utils.js";
|
||||
import {requestPVE, goToPage, goToURL, instances} from "./utils.js";
|
||||
|
||||
export class Instance extends HTMLElement {
|
||||
constructor () {
|
||||
@ -131,7 +131,9 @@ export class Instance extends HTMLElement {
|
||||
|
||||
handleConsoleButton () {
|
||||
if (this.status === "running") {
|
||||
//goToPage("pve-xtermjs/index.html", {type: this.type, vmid: this.vmid, name: this.name, node: this.node.name, user: getCookie("username"), url: "pve.tronnet.net/api2/json"}, true);
|
||||
let 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("https://pve.tronnet.net", data, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,21 @@ async function request (url, content) {
|
||||
}
|
||||
|
||||
export function goToPage (page, data={}, newwindow = false) {
|
||||
let url = new URL(`https://client.tronnet.net/${page}`);
|
||||
let url = new URL(`https://${window.location.host}/${page}`);
|
||||
for(let k in data) {
|
||||
url.searchParams.append(k, data[k]);
|
||||
}
|
||||
|
||||
if (newwindow) {
|
||||
window.open(url, "tronnet - client", "height=480,width=848");
|
||||
}
|
||||
else {
|
||||
window.location.assign(url.toString());
|
||||
}
|
||||
}
|
||||
|
||||
export function goToURL (href, data={}, newwindow = false) {
|
||||
let url = new URL(href);
|
||||
for(let k in data) {
|
||||
url.searchParams.append(k, data[k]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user