Fix "no such file" error creating clients on non-default servers

SuggestIPAllocation always looked up the legacy "wg0" server regardless
of which server the request was for, so any setup without a migrated
wg0 (i.e. every fresh multi-server install) failed with
"open db/servers/wg0.json: no such file or directory" when adding a
new client.

Now accepts an optional server_id query param (falling back to wg0 for
the legacy bare routes), and the per-server clients page passes its
own server ID.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-07-12 23:39:26 +02:00
co-authored by Claude Sonnet 5
parent 8a92958a84
commit 067d0af323
3 changed files with 39 additions and 2 deletions
+1 -1
View File
@@ -322,7 +322,7 @@ Wireguard Clients
$.ajax({
cache: false,
method: 'GET',
url: `{{.basePath}}/api/suggest-client-ips?sr=${subnetRange}`,
url: `{{.basePath}}/api/suggest-client-ips?sr=${subnetRange}&server_id={{.serverID}}`,
dataType: 'json',
contentType: "application/json",
success: function(data) {