fix: API-Endpoint in Setup aus Browser-URL statt DOL_MAIN_URL_ROOT [deploy]
All checks were successful
Deploy Eplan / deploy (push) Successful in 9s
All checks were successful
Deploy Eplan / deploy (push) Successful in 9s
DOL_MAIN_URL_ROOT ist in Docker-Setups oft die interne Container-URL (z.B. 192.168.155.1:8090), die externe Clients nicht erreichen. Stattdessen Scheme + Host aus dem aktuellen Request verwenden — genau die URL die der User gerade im Browser hat, die garantiert auch von außen erreichbar ist. Zusätzlich Hinweistext unter dem Endpoint wie die URL in der PWA einzutragen ist (ohne den /custom/…-Suffix). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
593c93f377
commit
cf0b78893c
3 changed files with 10 additions and 1 deletions
|
|
@ -106,8 +106,15 @@ print '<input type="text" id="eplan-token-field" readonly value="'.dol_escape_ht
|
||||||
print 'style="width: 100%; max-width: 600px; font-family: monospace; font-size: 12px;" class="flat" onclick="this.select()">';
|
print 'style="width: 100%; max-width: 600px; font-family: monospace; font-size: 12px;" class="flat" onclick="this.select()">';
|
||||||
print '<br><span class="opacitymedium small">'.$langs->trans("EplanApiTokenHint").'</span>';
|
print '<br><span class="opacitymedium small">'.$langs->trans("EplanApiTokenHint").'</span>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
// Endpoint aus der aktuellen Browser-URL ableiten — DOL_MAIN_URL_ROOT
|
||||||
|
// zeigt in Docker-Setups die interne Container-URL (z.B. 192.168…:8090),
|
||||||
|
// die externe Clients nicht erreichen.
|
||||||
|
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||||
|
$host = $_SERVER['HTTP_HOST'] ?? '';
|
||||||
|
$api_endpoint = $scheme.'://'.$host.'/custom/eplan/ajax/pwa_api.php';
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EplanApiEndpoint").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EplanApiEndpoint").'</td><td>';
|
||||||
print '<code>'.dol_escape_htmltag(DOL_MAIN_URL_ROOT.'/custom/eplan/ajax/pwa_api.php').'</code>';
|
print '<code>'.dol_escape_htmltag($api_endpoint).'</code>';
|
||||||
|
print '<br><span class="opacitymedium small">'.$langs->trans("EplanApiEndpointHint").'</span>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<div class="center" style="margin-top: 12px;">';
|
print '<div class="center" style="margin-top: 12px;">';
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ EplanApiTokenDesc = Der Token authentifiziert die ElektroPlan-PWA gegen diesen D
|
||||||
EplanApiTokenValue = Token
|
EplanApiTokenValue = Token
|
||||||
EplanApiTokenHint = Einmal anklicken zum Markieren, dann Strg+C zum Kopieren.
|
EplanApiTokenHint = Einmal anklicken zum Markieren, dann Strg+C zum Kopieren.
|
||||||
EplanApiEndpoint = API-Endpoint
|
EplanApiEndpoint = API-Endpoint
|
||||||
|
EplanApiEndpointHint = Diese URL trägst Du zusammen mit dem Token in der PWA ⚙-Einstellungen als Dolibarr-URL ein (ohne "/custom/eplan/ajax/pwa_api.php").
|
||||||
EplanTokenRotieren = Neuen Token erzeugen
|
EplanTokenRotieren = Neuen Token erzeugen
|
||||||
EplanTokenRotierenConfirm = Neuen Token erzeugen? Der alte wird sofort ungültig und die PWA muss neu konfiguriert werden.
|
EplanTokenRotierenConfirm = Neuen Token erzeugen? Der alte wird sofort ungültig und die PWA muss neu konfiguriert werden.
|
||||||
EplanTokenRotiert = Neuer Token erzeugt. PWA mit dem neuen Token aktualisieren.
|
EplanTokenRotiert = Neuer Token erzeugt. PWA mit dem neuen Token aktualisieren.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ EplanApiTokenDesc = The token authenticates the ElektroPlan PWA against this Dol
|
||||||
EplanApiTokenValue = Token
|
EplanApiTokenValue = Token
|
||||||
EplanApiTokenHint = Click once to select, then Ctrl+C to copy.
|
EplanApiTokenHint = Click once to select, then Ctrl+C to copy.
|
||||||
EplanApiEndpoint = API endpoint
|
EplanApiEndpoint = API endpoint
|
||||||
|
EplanApiEndpointHint = Enter this URL together with the token in the PWA gear settings as Dolibarr URL (without "/custom/eplan/ajax/pwa_api.php").
|
||||||
EplanTokenRotieren = Generate new token
|
EplanTokenRotieren = Generate new token
|
||||||
EplanTokenRotierenConfirm = Generate new token? The old one is immediately invalid and the PWA must be reconfigured.
|
EplanTokenRotierenConfirm = Generate new token? The old one is immediately invalid and the PWA must be reconfigured.
|
||||||
EplanTokenRotiert = New token generated. Update the PWA with the new token.
|
EplanTokenRotiert = New token generated. Update the PWA with the new token.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue