mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-11-23 06:38:21 -05:00
feat(panel): log stream stop funtion
This commit is contained in:
parent
1313f608ba
commit
cc5adcffa3
@ -96,6 +96,7 @@ else
|
|||||||
HttpClient httpClient = new HttpClient();
|
HttpClient httpClient = new HttpClient();
|
||||||
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(Environment.GetEnvironmentVariable("ADMIN_KEY"));
|
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 httpClient.PutAsync($"http://localhost:8080/api/admin/servers/{wId}/close", new StringContent(""));
|
||||||
await GetServer();
|
await GetServer();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
window.serverLogsStream = {
|
window.serverLogsStream = {
|
||||||
|
logs: "x",
|
||||||
|
|
||||||
start: (dotNetObject, serverId) => {
|
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 => {
|
logs.onmessage = event => {
|
||||||
dotNetObject.invokeMethodAsync("ReceiveLog", event.data);
|
dotNetObject.invokeMethodAsync("ReceiveLog", event.data);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
stop: () => logs.close()
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user