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
|
|
@ -21,11 +21,28 @@ and PUTs with ordinary CSRF protection — no endpoint in this app is exempt.
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>arthur</title>
|
||||
<link rel="stylesheet" href="{% static 'arthur/app.css' %}?v={{ css_version }}">
|
||||
<link rel="manifest" href="{% static 'arthur/manifest.webmanifest' %}">
|
||||
<meta name="theme-color" content="#e4e4e1">
|
||||
<link rel="icon" type="image/png" href="{% static 'arthur/icons/icon-192.png' %}">
|
||||
<link rel="apple-touch-icon" href="{% static 'arthur/icons/icon-180.png' %}">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-title" content="arthur">
|
||||
</head>
|
||||
<body>
|
||||
{% csrf_token %}
|
||||
<div id="app"></div>
|
||||
<script src="{% static 'mediapipe/vision_bundle.js' %}"></script>
|
||||
<script src="{% static 'arthur/js/main.js' %}?v={{ js_version }}"></script>
|
||||
<script>
|
||||
// An installable app that opens offline, and keeps what projects load —
|
||||
// see `static/arthur/sw.js`.
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/sw.js');
|
||||
navigator.serviceWorker.ready.then(reg => reg.active.postMessage({
|
||||
keep: [...document.querySelectorAll('link[rel=stylesheet], script[src]')]
|
||||
.map(el => el.href || el.src)
|
||||
}));
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue