arthur installs as an app, and keeps what projects load
A manifest and icons make it installable. A service worker at /sw.js, so its scope is every page, keeps by kind of URL: content-addressed blobs and blocks for good, as projects load them; the versioned bundle and styles until the next build; and the last copy of the page, the API reads and other statics, for when there is no network. A project opened once opens again offline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FLuCjp9kNH6ovwJVXSbq9
This commit is contained in:
parent
bbe20b3abf
commit
f0af8d392a
9 changed files with 172 additions and 1 deletions
|
|
@ -760,6 +760,17 @@ class PageTests(TestCase):
|
|||
# save path reads to write the X-CSRFToken header.
|
||||
self.assertIn("csrfmiddlewaretoken", body)
|
||||
|
||||
def test_the_service_worker_is_served_from_the_root(self):
|
||||
# At the root so its scope is every page — a project is /p/<id> — and
|
||||
# never cached, or a browser would keep an old worker for good.
|
||||
response = self.client.get("/sw.js")
|
||||
self.assertEqual(200, response.status_code)
|
||||
self.assertEqual("application/javascript", response["Content-Type"])
|
||||
self.assertEqual("no-cache", response["Cache-Control"])
|
||||
body = self.client.get("/").content.decode()
|
||||
self.assertIn("manifest.webmanifest", body)
|
||||
self.assertIn("serviceWorker.register('/sw.js')", body)
|
||||
|
||||
def test_the_detector_reports_a_version_derived_from_the_model(self):
|
||||
# The version is the package version plus the model asset's own hash,
|
||||
# because a version string in the client is one somebody has to remember to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue