Add public IP field and Network interface to host form

This commit is contained in:
2026-09-20 12:22:54 +01:00
parent 957f2de13c
commit 8b40a876a1
17 changed files with 327 additions and 21 deletions
+2
View File
@@ -41,6 +41,8 @@ export const handler: BunextAPIRouteHandler<APIResponseObject> = async (
return await createWireguardHost({
wg_ip_address: body?.wg_ip_address,
public_ip_address: body?.public_ip_address,
interface: body?.interface,
user,
});
} catch (error: any) {
+20
View File
@@ -0,0 +1,20 @@
import grabHostNetworkInterfaces from "@/src/functions/backend/setup/grab-host-network-interfaces";
import type { ApiReqParams } from "@/src/types";
import type {
APIResponseObject,
BunextAPIRouteHandler,
} from "@moduletrace/bunext/types";
export const handler: BunextAPIRouteHandler<APIResponseObject> = async (
params,
) => {
if (params.req.method !== "GET") {
return { success: false };
}
try {
const interfaces = await grabHostNetworkInterfaces();
return { success: true, stringRes: JSON.stringify(interfaces) };
} catch (error: any) {
return { success: false, msg: error.message };
}
};
+20
View File
@@ -0,0 +1,20 @@
import grabHostPublicIPAddress from "@/src/functions/backend/setup/grab-host-public-ip-address";
import type { ApiReqParams } from "@/src/types";
import type {
APIResponseObject,
BunextAPIRouteHandler,
} from "@moduletrace/bunext/types";
export const handler: BunextAPIRouteHandler<APIResponseObject> = async (
params,
) => {
if (params.req.method !== "GET") {
return { success: false };
}
try {
const public_ip = await grabHostPublicIPAddress();
return { success: true, stringRes: public_ip };
} catch (error: any) {
return { success: false, msg: error.message };
}
};