The browser attempts to update the service worker by fetching the script url. This url will be the original url of the script at the time of registration.
The fetch request will not be handled by the service worker:
This means that unless the browser can directly access the script via the original URL, no update will happen.
Solution
Create a bootloader service worker that gets updated rarely. It fetches the full worker script and loads and executes it.
Design Criteria
Should work over relays if necessary
Come up with fallback for no libp2p connection (i.e. do relative url)
Make sure both install and update flows are accounted for
Come up with some sort of caching solution
Maybe stale while revalidate, 24 hour limit
Methods for eval:
eval() probably won't work with such a large bundle
Can explore Function constructor
Explore creating a Web Worker thread
Some of the work in the planned status update concerning worker versions should be implemented as a part of this solution (assuming this gets done before the status update).
How to (Currently) Update the Service Worker
The steps for updating the service worker are more or less the same as the steps for installing the client.
These steps will likely still apply assuming we go with the above solution. They will also have to be done in order to migrate over to the above solution.
Chrome/Brave on Desktop
The worker should automatically update following normal worker update rules.
Chrome/Brave on Android
For Android versions less than 12
Ensure your box is connected via ethernet (required).
Restart your box by powering it off and on again.
Connect your device to your box's WiFi network:
i. In your device's list of available WiFi networks, select the network named "SamizdApp".
ii. Enter the security key: samizdapp.
If you unset the #unsafely-treat-insecure-origin-as-secure flag, you'll need to set it again.
Problem
The browser attempts to update the service worker by fetching the script url. This url will be the original url of the script at the time of registration.
The fetch request will not be handled by the service worker:
https://w3c.github.io/ServiceWorker/#update-algorithm
This means that unless the browser can directly access the script via the original URL, no update will happen.
Solution
Create a bootloader service worker that gets updated rarely. It fetches the full worker script and loads and executes it.
Design Criteria
eval()
probably won't work with such a large bundleFunction
constructorSome of the work in the planned status update concerning worker versions should be implemented as a part of this solution (assuming this gets done before the status update).
How to (Currently) Update the Service Worker
The steps for updating the service worker are more or less the same as the steps for installing the client.
These steps will likely still apply assuming we go with the above solution. They will also have to be done in order to migrate over to the above solution.
Chrome/Brave on Desktop
The worker should automatically update following normal worker update rules.
Chrome/Brave on Android
For Android versions less than 12
#unsafely-treat-insecure-origin-as-secure
flag, you'll need to set it again.For all other Android versions
The worker should automatically update following normal worker update rules.
Safari on iOS
Use the Shortcut again?