Add host setup functions and client components

This commit is contained in:
2026-09-13 10:52:30 +01:00
parent 76679aabe7
commit 86eb3a0b05
53 changed files with 1284 additions and 1325 deletions
@@ -25,7 +25,6 @@ const {
type Params = {
client: BUN_SQLITE_WGUI_CLIENTS;
host?: BUN_SQLITE_WGUI_HOSTS;
variables?: BUN_SQLITE_WGUI_VARIABLES[];
};
/**
@@ -38,10 +37,18 @@ type Params = {
export default async function setupWireguardClient({
client,
host,
variables,
}: Params): Promise<APIResponseObject> {
const host_id = host?.id || AppData["WireguardHostID"];
const variables_res = await BunSQLite.select<
BUN_SQLITE_WGUI_VARIABLES,
TableType
>({
table: "variables",
});
const variables = variables_res.payload;
const CLIENT_WG_IP = client?.wg_ip_address;
if (!CLIENT_WG_IP) {
@@ -161,7 +168,7 @@ EOF
encoding: "utf-8",
});
const host_setup_res = await setupWireguardHost({ host, variables });
const host_setup_res = await setupWireguardHost({ host });
if (!host_setup_res.success) {
return {