Download the whole app build behind a loading page
In production, a page request without the running build's cookie gets a small loading page instead of the app. It downloads every file in .bunext/public (listed at /build-info.json) into that build's cache, checks they are all there, hands over to a new service worker waiting behind an older one, sets the cookie and reloads. The service worker then serves the app's code from the cache, so later visits load it from the device. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -6,6 +6,25 @@ export const AppData = {
|
||||
* Shared with twui's `ColorSchemeSelector`, so it must stay `theme`.
|
||||
*/
|
||||
ThemeStorageKey: "theme",
|
||||
/**
|
||||
* How many of a build's files the loading page downloads at once.
|
||||
*/
|
||||
PrecacheConcurrency: 6,
|
||||
/**
|
||||
* How many more times the loading page downloads files it finds
|
||||
* missing from the cache after a pass, before it gives up on them.
|
||||
*/
|
||||
PrecacheVerifyPasses: 2,
|
||||
/**
|
||||
* How long the loading page waits for a new service worker to take
|
||||
* over before it reloads into the app anyway.
|
||||
*/
|
||||
PrecacheWorkerWaitMs: 10_000,
|
||||
/**
|
||||
* The loading page gives up and lets the app run from the network
|
||||
* when no new file lands for this long.
|
||||
*/
|
||||
PrecacheStallMs: 30_000,
|
||||
/**
|
||||
* Prefix of the composer's unsent drafts in `localStorage`, one per
|
||||
* bot and workspace.
|
||||
@@ -38,6 +57,13 @@ export const AppData = {
|
||||
TlsCaProfileFilename: `${SiteData["SiteSlug"]}-ca.mobileconfig`,
|
||||
AuthKeyCookieName: `${SiteData["SiteSlug"]}_auth_key`,
|
||||
AuthCSRFCookieName: `${SiteData["SiteSlug"]}_auth_csrf`,
|
||||
/**
|
||||
* The build this browser has been through the loading page for
|
||||
* (`handlePrecacheGate`). Set by the page itself, so not `HttpOnly`;
|
||||
* it holds nothing private.
|
||||
*/
|
||||
BuildCookieName: `${SiteData["SiteSlug"]}_build`,
|
||||
BuildCookieMaxAgeSeconds: 365 * 24 * 60 * 60,
|
||||
AuthExpiryDays: 60,
|
||||
APICrudBasePath: "/api/admin/crud",
|
||||
ForcePrivateHeaderKey: `x-${SiteData["SiteSlug"]}-force-private`,
|
||||
|
||||
Reference in New Issue
Block a user