Add public IP field and Network interface to host form
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
};
|
||||
@@ -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 };
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user