add nodes to list endpoint
This commit is contained in:
parent
e93278717f
commit
38fab43060
1 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Text.Json.Nodes;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
@ -30,7 +31,12 @@ public class HTTPServer
|
||||||
|
|
||||||
private async Task<IResult> VMListHandler(HttpContext context)
|
private async Task<IResult> VMListHandler(HttpContext context)
|
||||||
{
|
{
|
||||||
return Results.Json(Program.VMs.Where(v => v.cvm.ConnectedToVM).Select(v => v.Config.Name).ToArray());
|
var j = new JsonObject();
|
||||||
|
foreach (var v in Program.VMs.Where(v => v.cvm.ConnectedToVM))
|
||||||
|
{
|
||||||
|
j[v.Config.Name] = v.Config.Node;
|
||||||
|
}
|
||||||
|
return Results.Json(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IResult> UsernameToIPHandler(HttpContext context, string username)
|
private async Task<IResult> UsernameToIPHandler(HttpContext context, string username)
|
||||||
|
|
Loading…
Reference in a new issue