library: proxy URL overrides, restore Quick Add header links
- OPAC_URL / STAFF_URL let Quick Add build correct links behind a reverse proxy - restore the Catalogue/Staff header links (lost when the init block was rewritten) and verify them in the browser test Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wi3ZSot4XbUViwRFgLpRf
This commit is contained in:
@@ -64,6 +64,8 @@ services:
|
|||||||
KOHA_LIBRARY: ${LIBRARY_CODE:-HOME}
|
KOHA_LIBRARY: ${LIBRARY_CODE:-HOME}
|
||||||
OPAC_PORT: ${OPAC_PORT:-8080}
|
OPAC_PORT: ${OPAC_PORT:-8080}
|
||||||
STAFF_PORT: ${STAFF_PORT:-8081}
|
STAFF_PORT: ${STAFF_PORT:-8081}
|
||||||
|
OPAC_URL: ${OPAC_URL:-}
|
||||||
|
STAFF_URL: ${STAFF_URL:-}
|
||||||
QUICKADD_SOURCES: ${QUICKADD_SOURCES:-z3950:lx2.loc.gov:210/LCDB,openlibrary}
|
QUICKADD_SOURCES: ${QUICKADD_SOURCES:-z3950:lx2.loc.gov:210/LCDB,openlibrary}
|
||||||
ports:
|
ports:
|
||||||
- "${BIND_ADDR:-0.0.0.0}:${QUICKADD_PORT:-8082}:8082"
|
- "${BIND_ADDR:-0.0.0.0}:${QUICKADD_PORT:-8082}:8082"
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ PASSWORD = os.environ.get("ADMIN_PASSWORD", "")
|
|||||||
LIBRARY = os.environ.get("KOHA_LIBRARY", "HOME")
|
LIBRARY = os.environ.get("KOHA_LIBRARY", "HOME")
|
||||||
STAFF_PORT = os.environ.get("STAFF_PORT", "8081")
|
STAFF_PORT = os.environ.get("STAFF_PORT", "8081")
|
||||||
OPAC_PORT = os.environ.get("OPAC_PORT", "8080")
|
OPAC_PORT = os.environ.get("OPAC_PORT", "8080")
|
||||||
|
# Set these when the site is behind a reverse proxy (different hostnames than host:port).
|
||||||
|
OPAC_URL = os.environ.get("OPAC_URL", "").rstrip("/")
|
||||||
|
STAFF_URL = os.environ.get("STAFF_URL", "").rstrip("/")
|
||||||
DATA_DIR = os.environ.get("DATA_DIR", "/data")
|
DATA_DIR = os.environ.get("DATA_DIR", "/data")
|
||||||
PORT = int(os.environ.get("PORT", "8082"))
|
PORT = int(os.environ.get("PORT", "8082"))
|
||||||
SOURCES = [s.strip() for s in os.environ.get(
|
SOURCES = [s.strip() for s in os.environ.get(
|
||||||
@@ -742,7 +745,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
return self._send(200, INDEX, "text/html; charset=utf-8")
|
return self._send(200, INDEX, "text/html; charset=utf-8")
|
||||||
if path == "/api/state":
|
if path == "/api/state":
|
||||||
return self._send(200, {"recent": load_recent()[:100], "types": get_item_types(),
|
return self._send(200, {"recent": load_recent()[:100], "types": get_item_types(),
|
||||||
"library": LIBRARY, "locations": get_locations(), "settings": load_settings(), "staff_port": STAFF_PORT, "opac_port": OPAC_PORT,
|
"library": LIBRARY, "locations": get_locations(), "settings": load_settings(), "staff_port": STAFF_PORT, "staff_url": STAFF_URL, "opac_url": OPAC_URL, "opac_port": OPAC_PORT,
|
||||||
"sources": [s.split(":", 1)[0] if s.startswith("z3950") else s for s in SOURCES]})
|
"sources": [s.split(":", 1)[0] if s.startswith("z3950") else s for s in SOURCES]})
|
||||||
if path == "/api/settings":
|
if path == "/api/settings":
|
||||||
return self._send(200, settings_view())
|
return self._send(200, settings_view())
|
||||||
|
|||||||
@@ -294,7 +294,9 @@
|
|||||||
input.focus();
|
input.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const printLink = (from, to) => 'http://' + location.hostname + ':' + staffPort +
|
let staffBase = '';
|
||||||
|
const staffRoot = () => staffBase || ('http://' + location.hostname + ':' + staffPort);
|
||||||
|
const printLink = (from, to) => staffRoot() +
|
||||||
'/cgi-bin/koha/labels/label-print.pl?from=' + encodeURIComponent(from) + '&to=' + encodeURIComponent(to);
|
'/cgi-bin/koha/labels/label-print.pl?from=' + encodeURIComponent(from) + '&to=' + encodeURIComponent(to);
|
||||||
|
|
||||||
function rangeNote(text, from, to) {
|
function rangeNote(text, from, to) {
|
||||||
@@ -370,6 +372,10 @@
|
|||||||
const s = await api('/api/state');
|
const s = await api('/api/state');
|
||||||
types = s.types; if (!types[type]) type = 'BOOK'; typeButtons();
|
types = s.types; if (!types[type]) type = 'BOOK'; typeButtons();
|
||||||
staffPort = s.staff_port; settings = s.settings || {}; shelf = settings.location || '';
|
staffPort = s.staff_port; settings = s.settings || {}; shelf = settings.location || '';
|
||||||
|
staffBase = s.staff_url || '';
|
||||||
|
$('lnk-opac').href = s.opac_url ? s.opac_url + '/' : 'http://' + location.hostname + ':' + s.opac_port + '/';
|
||||||
|
$('lnk-staff').href = staffRoot() + '/';
|
||||||
|
$('lnk-labels').href = staffRoot() + '/cgi-bin/koha/labels/label-edit-range.pl';
|
||||||
if (s.locations && s.locations.length) {
|
if (s.locations && s.locations.length) {
|
||||||
const sel = $('shelf');
|
const sel = $('shelf');
|
||||||
sel.replaceChildren(el('option', { value: '' }, '(not set / all in one place)'),
|
sel.replaceChildren(el('option', { value: '' }, '(not set / all in one place)'),
|
||||||
|
|||||||
Reference in New Issue
Block a user