Root cause of 'the change never appears': pages are statically prerendered,
so Next replied with Cache-Control: s-maxage=31536000. The browser kept the
old HTML for up to a year, which is why editing sw.js and the footer version
changed nothing for an existing visitor.
next.config now adds, for any request whose Accept includes text/html:
Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate
Static assets are untouched (hashed files under _next/static keep their
immutable caching).
Bumped version.json and the SW VERSION to 2026.10.24.2.
Verified with curl (Accept: text/html) that /, /stops, /routes, /about and
/credits all return no-store, while images still return public, max-age=0;
and in the browser an ordinary reload returns the three-tab /stops page with
the v2026.10.24.2 footer badge.
The service worker version had never moved past 1.0.0 and nothing on the page
said which build was loaded, so an old cached shell looked identical to a
fresh one.
- public/version.json: app, version, builtAt, pwa
- sw.js VERSION -> 2026.10.24.1 (new cache name, old caches dropped on activate)
- next.config: sw.js and version.json are served no-cache, no-store, plus
Service-Worker-Allowed: / ; ui-manifest.json must-revalidate
- layout: <html data-app-version> read from version.json at build time
- PwaBoot: paints the version into the footer badge, polls /version.json
(1.5s then every 5 min) and reloads once when it differs; guards against
reload loops
- footer shows v2026.10.24.1 in mono next to the copyright
Verified: sw.js, /version.json and <html data-app-version> all report
2026.10.24.1, the footer badge shows it, and /stops renders the three search
tabs with the near-me panel in its own tab.
The third tab made the Thai labels wrap on 375px. The tab bar now stretches
its children so all three share the same height, uses centred two-line labels
with a 56px minimum, and keeps zero horizontal overflow at 360/375/414px.
sw.js VERSION 1.0.0 -> 1.0.1 so browsers drop the cached shell and pick up
the three-tab markup without a manual cache clear.
Searching now has three peer modes on /stops: by stop code, by place name,
and by device location.
- StopsView: third tab (data-mode=near) plus its own panel holding the
location button, hint and result area; the button no longer sits in the
toolbar with Search/Reset/Back
- stops.search.ts: setMode handles the near mode, disables the other panels,
hides the full stop list while the ranked results are shown, and skips
filtering in that mode
- stops.nearme.ts: applies the security gate - the tab is revealed only when
window.isSecureContext && navigator.geolocation exist, otherwise it is
hidden and any active near mode falls back to stop-code search
- i18n: stops.modeNear / nearCta / nearHint (th + en, both copies)
Distance is computed from each stop's own coordinates (busstop_list.json)
against the device position, sorted nearest first.
Verified: secure context shows all three tabs and returns a ranked map;
a forced insecure context hides the tab and refuses the mode.
The topbar carried five small buttons in a row (3 theme + 2 language).
Replaced with two single buttons that open their own popover menu:
- ThemeSwitch: single icon button showing the active mode, menu with
light/dark/auto as menuitemradio
- LangSwitch: new component showing the active code (ไทย / EN), menu
keeps the existing [data-i18n-switch] mechanism from i18n.ts
- .mu-topbar-tools wrapper, 8px gap (WCAG 2.5.8), 40px buttons / 44px on touch
- popovers close on select, outside click and Escape (focus returns to button)
Also fixed two bugs found on /stops:
- .mu-btn.outline had no CSS rule, so the browser painted a light grey
background that ignored the dark theme
- deleted the unused StopSearch component which still carried the old
number pad and its delete key, plus the now-unused stops.padDelete key
Verified at 375px: no horizontal overflow, buttons 40x40 and 59x40,
8px gap; menus open/close correctly in both themes.
- src/lib/site.ts: single source for site name/url/description (rename via env only)
- src/app/robots.ts: allow all, disallow /api /files, explicit Googlebot/Bingbot/DuckDuckBot/Bravebot/Applebot
- src/app/sitemap.ts: static pages + routes/check/stops from backend, falls back to static when API is down
- src/components/JsonLd.tsx: WebSite + Organization + SearchAction, BreadcrumbList, BusStop, Service
- layout.tsx: metadataBase, canonical, keywords, robots, openGraph, twitter
- generateMetadata for /stops/[code], /routes/[routeId], /check/[routeId]
- canonical + description on /stops /routes /blog /about /credits
- public/og-image.png 1200x630
Android (Samsung S23, One UI 6) refuses 'Install app' / standalone mode
when the origin is not secure or the app has no service worker. The ported
Next.js app shipped neither: only a manifest existed, and no sw.js at all.
- public/sw.js: navigation network-first with an offline fallback,
cache-first for static assets, /api and /files bypassed, versioned
cache with skipWaiting + clients.claim.
- public/offline.html: offline shell.
- src/components/PwaBoot.tsx: registers the worker, wires
beforeinstallprompt into an in-app install button, and shows a
share-sheet hint on iOS/Samsung Internet where the event never fires.
- ui-manifest.json: add id, display_override, prefer_related_applications,
launch_handler, handle_links, a maskable icon for Android 14 and
screenshots for the install preview.
- layout.tsx: viewport-fit=cover, interactive-widget, maximumScale 5
(never user-scalable=no), appleWebApp metadata, format detection off,
and drop manually duplicated meta tags that Next already emits.
Verified: manifest passes 8/8 installability checks, sw.js and offline.html
serve with correct content types, tsc clean, npm run build passes.
Verified each path against every .ts/.tsx/.css under src plus every JSON
under public. Kept all dynamic lookup directories (routes/qrcode/stations/
stops/partners/icons) because the ported modules resolve those per id and
try several extensions at runtime.
Deleted (nothing references them):
- image/extras/boat.jpeg, boat-market2transta.jpg
- image/landmarks/*.{png,jpg} (stations.json has no landmarks[] entries)
- image/icons/minibus-256x256.ico (Next serves app/icon.png instead)
- image/partners/_original/ (local backup of the tcl999 source photo)
public/image: 39.8 MB -> 30.1 MB. npm run build still prerenders all routes.