Say that the subpath belongs in site_base_url, because it does
Some checks failed
CI / backend (push) Failing after 7m10s
CI / naming (push) Failing after 7m18s
CI / frontend (push) Failing after 7m14s
CI / migrations-mysql (push) Has been cancelled

Answering "did I set it wrong": no. The setting was right and the description
was misleading, which is what sent the last two commits chasing the wrong fix.

It said "Public base URL of this site (scheme + host), e.g.
https://shopdb.example.net". That is true only of a site mounted at the root.
Both existing consumers append the in-app route to this value and add nothing
themselves:

    `${await getSiteBaseUrl()}${config.detailPath(detailId)}`   asset labels
    `${baseUrl}${defaultPath}`                                  QR codes

so a site served at /shopdb must carry that here or every QR code it prints
404s. The email copy of the same setting has always documented it correctly, as
https://host/ops.

The description now says so, and the comment above the defaults records why -
including that a subpath left out produces links that fail rather than anything
that looks like a configuration error.

Existing rows keep the old text until a site reseeds; the value is unaffected.
This commit is contained in:
cproudlock
2026-08-21 15:26:32 -04:00
parent e8920b2cf3
commit fc46bab72d

View File

@@ -478,6 +478,13 @@ def build_default_settings():
# QR codes and any absolute link the app emits - and facility name shown on
# the shopfloor dashboard. Blank site_base_url falls back to the browsing
# origin so nothing breaks before a site configures it.
#
# THE SUBPATH BELONGS IN THE VALUE. Consumers append the in-app route and
# add nothing themselves (resolveCodeText in print/assetLabel.js, buildQrUrl
# in utils/qrTarget.js), so a site served at /shopdb must carry that here or
# every generated link 404s. This said "scheme + host" for a while, which is
# true only of a site mounted at the root - and the email copy of the same
# setting has always said https://host/ops.
sitedefaults = [
{
'key': 'setup_complete',
@@ -512,7 +519,7 @@ def build_default_settings():
'value': '',
'valuetype': 'string',
'category': 'site',
'description': 'Public base URL of this site (scheme + host), e.g. https://shopdb.example.net. Used for QR codes and absolute links. Blank = use the browsing origin.'
'description': 'Public base URL of this site INCLUDING any subpath it is served under, e.g. https://shopdb.example.net or https://host/shopdb. Consumers append the in-app route to this and add nothing themselves, so a subpath left off here produces links that 404. Blank = use the browsing origin.'
},
{
'key': 'facility_name',