Files
Sebastian Gabrielsson 1625e4ec8f Migration to FastAPI is complete. Also added observability functionality to integrate with opentelemetry.
Migration includes:
* A move away from being a SPA to have actual endpoints
* Every page is generated via Jinja2Template
* Added observability class to export metrics and logs to opentelemetry to integrate with observability stack
* Let's database cache what the current status of all VMs are instead of using a dict to allow more multiple workers reading from a single source
* The vm status API check to proxmox not caches authentication header for an hour instead of requesting a new header everytime it makes a request every thirty seconds.
* Updated front end to be more WCAG compatible but it's still WIP
2026-05-21 15:44:03 +02:00

30 lines
885 B
JavaScript

import RFB from '/static/novnc/core/rfb.js'
async function startVNC(){
const consoleContainer = document.querySelector('#console-container');
const hostname = getHostname();
try {
const response = await fetch(`/api/${hostname}/vnc`)
if(!response.ok){
console.error('Failed to set up vnc proxy');
return;
}
const data = await response.json()
const ticket = data.ticket
const servername = data.servername
const wsurl = `wss://${servername}.dsv.su.se/ws/${hostname}/vnc?ticket=${encodeURIComponent(ticket)}`
const rfb = new RFB(consoleContainer, wsurl, {
credentials: {password: ticket}
})
rfb.viewOnly = false;
rfb.scaleViewport = true;
rfb.backgroubd = '#000';
} catch (e) {
console.error('VNC error', e);
}
}
startVNC();