Use new network interface API

This commit is contained in:
Yuri Iozzelli
2025-09-04 16:26:50 +02:00
parent 0581968726
commit e27ec00f17
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -6,7 +6,7 @@
import '$lib/global.css';
import '@xterm/xterm/css/xterm.css'
import '@fortawesome/fontawesome-free/css/all.min.css'
import { networkInterface, startLogin } from '$lib/network.js'
import { networkInterfaceConfig, startLogin } from '$lib/network.js'
import { cpuActivity, diskActivity, cpuPercentage, diskLatency } from '$lib/activities.js'
import { introMessage, errorMessage, unexpectedErrorMessage } from '$lib/messages.js'
import { displayConfig, handleToolImpl } from '$lib/anthropic.js'
@@ -21,6 +21,7 @@
var term = null;
var cx = null;
var networkInterface = null;
var fitAddon = null;
var cxReadFunc = null;
var blockCache = null;
@@ -305,6 +306,7 @@
];
try
{
networkInterface = await CheerpX.TailscaleNetwork(networkInterfaceConfig);
cx = await CheerpX.Linux.create({mounts: mountPoints, networkInterface: networkInterface});
}
catch(e)
@@ -335,7 +337,7 @@
async function handleConnect()
{
const w = window.open("login.html", "_blank");
await cx.networkLogin();
await networkInterface.up();
w.location.href = await startLogin();
}
async function handleReset()
+1 -1
View File
@@ -148,6 +148,6 @@ export function updateButtonData(state, handleConnect) {
}
}
export const networkInterface = { authKey: authKey, controlUrl: controlUrl, loginUrlCb: loginUrlCb, stateUpdateCb: stateUpdateCb, netmapUpdateCb: netmapUpdateCb };
export const networkInterfaceConfig = { authKey: authKey, controlUrl: controlUrl, loginUrlCb: loginUrlCb, stateUpdateCb: stateUpdateCb, netmapUpdateCb: netmapUpdateCb };
export const networkData = { currentIp: null, connectionState: connectionState, exitNode: exitNode, loginUrl: null, dashboardUrl: dashboardUrl }