forked from KNEMC/KLALB
refactor(web)!: remove obsolete interfaces endpoint
This commit is contained in:
@@ -68,10 +68,9 @@ public class KLALBWebServer {
|
||||
server.createContext("/api/links", this::handleLinks);
|
||||
server.createContext("/api/links/action", this::handleLinkAction);
|
||||
server.createContext("/api/links/reconnect", this::handleReconnectAll);
|
||||
server.createContext("/api/routes", this::handleRoutes);
|
||||
server.createContext("/api/routing-table", this::handleRoutingTable);
|
||||
server.createContext("/api/nodes", this::handleNodes);
|
||||
server.createContext("/api/node-info", this::handleNodeInfo);
|
||||
server.createContext("/api/interfaces", this::handleInterfaces);
|
||||
server.createContext("/api/config", this::handleConfig);
|
||||
|
||||
// Static Files / SPA Fallback Handler
|
||||
@@ -429,7 +428,7 @@ public class KLALBWebServer {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRoutes(HttpExchange exchange) throws IOException {
|
||||
private void handleRoutingTable(HttpExchange exchange) throws IOException {
|
||||
if (handleCorsPreflight(exchange)) return;
|
||||
if (!"GET".equalsIgnoreCase(exchange.getRequestMethod())) {
|
||||
sendError(exchange, 405, "Method not allowed");
|
||||
@@ -633,33 +632,6 @@ public class KLALBWebServer {
|
||||
sendJsonResponse(exchange, 200, result);
|
||||
}
|
||||
|
||||
private void handleInterfaces(HttpExchange exchange) throws IOException {
|
||||
if (handleCorsPreflight(exchange)) return;
|
||||
if (!"GET".equalsIgnoreCase(exchange.getRequestMethod())) {
|
||||
sendError(exchange, 405, "Method not allowed");
|
||||
return;
|
||||
}
|
||||
|
||||
KLALBController kc = proxySystem.getKlalbController();
|
||||
JsonArray ifacesArray = new JsonArray();
|
||||
if (kc != null && kc.getNetworkInterfaceManager() != null) {
|
||||
List<NetworkInterface> ifaces = kc.getNetworkInterfaceManager().getAllAvaliableNetworkInterface();
|
||||
for (NetworkInterface nif : ifaces) {
|
||||
JsonObject obj = new JsonObject();
|
||||
obj.addProperty("name", nif.getName());
|
||||
obj.addProperty("displayName", nif.getDisplayName());
|
||||
JsonArray ips = new JsonArray();
|
||||
List<InetAddress> addrs = kc.getNetworkInterfaceManager().getNetworkInterfaceAddress(nif);
|
||||
for (InetAddress a : addrs) {
|
||||
ips.add(new JsonPrimitive(a.getHostAddress()));
|
||||
}
|
||||
obj.add("addresses", ips);
|
||||
ifacesArray.add(obj);
|
||||
}
|
||||
}
|
||||
sendJsonResponse(exchange, 200, ifacesArray);
|
||||
}
|
||||
|
||||
private void handleConfig(HttpExchange exchange) throws IOException {
|
||||
if (handleCorsPreflight(exchange)) return;
|
||||
String method = exchange.getRequestMethod();
|
||||
|
||||
Reference in New Issue
Block a user