fix: disable Olm on web — /keys/upload 400 crashed client init
The web session generates new Olm keys for an existing device ID. Synapse rejects the upload (400 — keys mismatch) which crashes the entire client init. Result: no sync, no room history, no calls. Proper E2EE requires persistent Olm account storage (IndexedDB) so the same device ID always sends the same keys. Deferred to Phase 3. Without Olm loaded, the Matrix SDK gracefully skips encryption init. Unencrypted rooms work fully. E2EE rooms show 'Encrypted message'. Also unregisters stale service workers that served cached old JS (caused calls to use the old GET URL instead of POST /sfu/get). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,22 +39,22 @@
|
||||
Strategy: load olm.js synchronously, await Olm.init(), THEN inject
|
||||
flutter_bootstrap.js dynamically so Flutter never starts before Olm.
|
||||
-->
|
||||
<script src="olm.js"></script>
|
||||
<script>
|
||||
Olm.init({ locateFile: function() { return 'olm.wasm'; } })
|
||||
.then(function() {
|
||||
var s = document.createElement('script');
|
||||
s.src = 'flutter_bootstrap.js';
|
||||
document.body.appendChild(s);
|
||||
})
|
||||
.catch(function(e) {
|
||||
// Olm failed — start Flutter anyway so user sees an error screen
|
||||
// rather than a blank page.
|
||||
console.warn('[M8Chat] Olm init failed:', e);
|
||||
var s = document.createElement('script');
|
||||
s.src = 'flutter_bootstrap.js';
|
||||
document.body.appendChild(s);
|
||||
// Unregister any stale service worker from previous builds — cached old JS
|
||||
// causes calls and features to use outdated code silently.
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations) {
|
||||
for (var r of registrations) { r.unregister(); }
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<!--
|
||||
Olm (E2EE) disabled for Phase 1 web builds. The Matrix SDK gracefully
|
||||
skips encryption when Olm is not loaded — unencrypted rooms work fine.
|
||||
E2EE requires persistent Olm account storage (IndexedDB) to avoid
|
||||
device key conflicts on /keys/upload (400). Deferred to Phase 3.
|
||||
The olm.js and olm.wasm files remain deployed for future use.
|
||||
-->
|
||||
<script src="flutter_bootstrap.js" async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user