Add public IP field and Network interface to host form
This commit is contained in:
@@ -100,7 +100,7 @@ export default async function setupWireguardHost({
|
||||
rules_by_client_id.set(rule.client_id, existing_rules);
|
||||
}
|
||||
|
||||
const TARGET_INTERFACE = await grabHostNetworkInterface();
|
||||
const TARGET_INTERFACE = host?.interface || await grabHostNetworkInterface();
|
||||
const HOST_WG_IP =
|
||||
host?.wg_ip_address ||
|
||||
variables?.find((v) => v.key == "main_host_wg_ip_address")?.value ||
|
||||
@@ -158,21 +158,29 @@ export default async function setupWireguardHost({
|
||||
}).trim();
|
||||
|
||||
if (HOST_ID == 0 && !is_update_after_client_setup) {
|
||||
const variables_data: Array<{ key: string; value: string }> = [
|
||||
{
|
||||
key: "main_host_wg_ip_address",
|
||||
value: HOST_WG_IP,
|
||||
},
|
||||
{
|
||||
key: "main_host_wg_public_key",
|
||||
value: HOST_PUBLIC_KEY,
|
||||
},
|
||||
];
|
||||
if (host?.interface) {
|
||||
variables_data.push({
|
||||
key: "main_host_public_interface",
|
||||
value: host.interface,
|
||||
});
|
||||
}
|
||||
|
||||
const update_variables = await BunSQLite.insert<
|
||||
BUN_SQLITE_WGUI_VARIABLES,
|
||||
TableType
|
||||
>({
|
||||
table: "variables",
|
||||
data: [
|
||||
{
|
||||
key: "main_host_wg_ip_address",
|
||||
value: HOST_WG_IP,
|
||||
},
|
||||
{
|
||||
key: "main_host_wg_public_key",
|
||||
value: HOST_PUBLIC_KEY,
|
||||
},
|
||||
],
|
||||
data: variables_data as BUN_SQLITE_WGUI_VARIABLES[],
|
||||
update_on_duplicate: true,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user