feat(panel): log stream stop funtion

This commit is contained in:
CyberL1 2024-05-30 14:42:18 +02:00
parent 1313f608ba
commit cc5adcffa3
2 changed files with 7 additions and 2 deletions

View File

@ -96,6 +96,7 @@ else
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(Environment.GetEnvironmentVariable("ADMIN_KEY"));
await JS.InvokeVoidAsync("serverLogsStream.stop");
await httpClient.PutAsync($"http://localhost:8080/api/admin/servers/{wId}/close", new StringContent(""));
await GetServer();
}

View File

@ -1,9 +1,13 @@
window.serverLogsStream = {
logs: "x",
start: (dotNetObject, serverId) => {
const logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`, { withCredentials: true });
logs = new EventSource(`http://localhost:8080/api/admin/servers/${serverId}/logs`, { withCredentials: true });
logs.onmessage = event => {
dotNetObject.invokeMethodAsync("ReceiveLog", event.data);
}
}
},
stop: () => logs.close()
}