Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CoreX-wg-easy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hendrik Garske
CoreX-wg-easy
Commits
abcbbea3
Commit
abcbbea3
authored
Dec 27, 2025
by
Hendrik Garske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Entferne window-Referenz und verbessere Fehlermeldungen
parent
6d6ca448
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
wg-api.ts
lib/wg-api.ts
+16
-2
No files found.
lib/wg-api.ts
View file @
abcbbea3
...
...
@@ -67,12 +67,20 @@ export class WgApiClient {
private
async
request
<
T
>
(
endpoint
:
string
,
options
:
RequestInit
=
{}):
Promise
<
T
>
{
// Liste möglicher Backend-URLs zum Ausprobieren
// Hinweis: Port 51821 ist der Standard-Port für wg-easy Web-UI
// Wenn das Backend auf einem anderen Port läuft, muss WG_API_URL als Environment Variable gesetzt werden
const
possibleUrls
=
[
this
.
baseUrl
,
// Zuerst die konfigurierte URL versuchen
'http://localhost:51821'
,
'http://127.0.0.1:51821'
,
'http://localhost:51820'
,
// Alternative Port
'http://wg-easy:51821'
,
'http://wg-easy:51820'
,
'http://srv-captain--wg-easy:51821'
,
'http://srv-captain--wg-easy:51820'
,
// Versuche auch mögliche CapRover Service-Namen
'http://srv-captain--corex-wg-easy:51821'
,
'http://srv-captain--corex-wg-easy:51820'
,
]
let
lastError
:
Error
|
null
=
null
...
...
@@ -129,8 +137,14 @@ export class WgApiClient {
}
}
// All URLs failed
throw
new
Error
(
`Failed to connect to WG API. Tried:
${
possibleUrls
.
join
(
', '
)}
. Last error:
${
lastError
?.
message
||
'Unknown error'
}
`)
// All URLs failed - provide helpful error message
const
triedUrls
=
possibleUrls
.
filter
((
url
,
index
,
self
)
=>
self
.
indexOf
(
url
)
===
index
)
// Remove duplicates
throw
new
Error
(
`Failed to connect to WG API Backend. `
+
`Tried URLs:
${
triedUrls
.
join
(
', '
)}
. `
+
`Last error:
${
lastError
?.
message
||
'Unknown error'
}.
` +
`
Please
ensure
the
wg
-
easy
backend
is
running
and
set
WG_API_URL
environment
variable
if
it
's on a different URL/port.`
)
}
async getStats(): Promise<WgStats> {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment