Add host setup functions and client components
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user