Major updates

This commit is contained in:
2026-09-14 07:56:13 +01:00
parent 42224c94d3
commit e0d105beb9
17 changed files with 405 additions and 277 deletions
@@ -16,11 +16,7 @@ type Params = {
clients?: BUN_SQLITE_WGUI_CLIENTS[];
};
export default function deriveHostConfig({
host,
variables,
clients,
}: Params) {
export default function deriveHostConfig({ host, variables, clients }: Params) {
const host_id = host?.id || AppData["WireguardHostID"];
const wg_ip_address =
@@ -33,16 +29,14 @@ export default function deriveHostConfig({
host_id,
interface_name,
config_path: `${HOSTS_CONFIG_DIR}/${interface_name}.conf`,
systemd_unit_name: `wg-quick@${interface_name}.service`,
address: wg_ip_address ? `${wg_ip_address}/24` : undefined,
listen_port: LISTEN_PORT,
post_up: `${IP_TABLES_DIR}/${host_id}-up.sh`,
post_down: `${IP_TABLES_DIR}/${host_id}-down.sh`,
private_key: host?.private_key,
public_key: host?.public_key,
client_count: clients?.filter(
(client) => (client.host_id || 0) == host_id,
).length || 0,
client_count:
clients?.filter((client) => (client.host_id || 0) == host_id)
.length || 0,
};
}
}