Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33075298
D7068.1768447382.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D7068.1768447382.diff
View Options
diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -63,7 +63,12 @@
}
}
-type AssetInfo = { jsURL: string, fontsURL: string, cssInclude: string };
+type AssetInfo = {
+ +jsURL: string,
+ +fontsURL: string,
+ +cssInclude: string,
+ +olmFilename: string,
+};
let assetInfo: ?AssetInfo = null;
async function getAssetInfo() {
if (assetInfo) {
@@ -75,6 +80,7 @@
jsURL: 'http://localhost:8080/dev.build.js',
fontsURL,
cssInclude: '',
+ olmFilename: '',
};
return assetInfo;
}
@@ -91,6 +97,7 @@
href="compiled/${assets.browser.css}"
/>
`,
+ olmFilename: assets[''].wasm,
};
return assetInfo;
} catch {
@@ -316,7 +323,7 @@
return pushConfig.publicKey;
})();
- const { jsURL, fontsURL, cssInclude } = await assetInfoPromise;
+ const { jsURL, fontsURL, cssInclude, olmFilename } = await assetInfoPromise;
// prettier-ignore
res.write(html`
@@ -413,6 +420,7 @@
res.end(html`
;
var baseURL = "${baseURL}";
+ var olmFilename = "${olmFilename}";
</script>
<script src="${jsURL}"></script>
</body>
diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js
--- a/web/account/log-in-form.react.js
+++ b/web/account/log-in-form.react.js
@@ -12,6 +12,7 @@
import SIWELoginForm from './siwe-login-form.react.js';
import TraditionalLoginForm from './traditional-login-form.react.js';
import OrBreak from '../components/or-break.react.js';
+import { initOlm } from '../olm/olm-utils.js';
import {
setPrimaryIdentityKeys,
setNotificationIdentityKeys,
@@ -42,7 +43,7 @@
) {
return;
}
- await olm.init();
+ await initOlm();
const identityAccount = new olm.Account();
identityAccount.create();
diff --git a/web/olm/olm-utils.js b/web/olm/olm-utils.js
new file mode 100644
--- /dev/null
+++ b/web/olm/olm-utils.js
@@ -0,0 +1,16 @@
+// @flow
+
+import olm from '@matrix-org/olm';
+
+declare var olmFilename: string;
+
+async function initOlm(): Promise<void> {
+ if (!olmFilename) {
+ return await olm.init();
+ }
+ const locateFile = (wasmFilename: string, httpAssetsHost: string) =>
+ httpAssetsHost + olmFilename;
+ return await olm.init({ locateFile });
+}
+
+export { initOlm };
diff --git a/web/webpack.config.cjs b/web/webpack.config.cjs
--- a/web/webpack.config.cjs
+++ b/web/webpack.config.cjs
@@ -12,16 +12,6 @@
const babelConfig = require('./babel.config.cjs');
const baseBrowserConfig = {
- plugins: [
- new CopyPlugin({
- patterns: [
- {
- from: 'node_modules/@matrix-org/olm/olm.wasm',
- to: path.join(__dirname, 'dist'),
- },
- ],
- }),
- ],
entry: {
browser: ['./script.js'],
},
@@ -58,12 +48,29 @@
directory: path.join(__dirname, 'dist'),
},
},
+ plugins: [
+ new CopyPlugin({
+ patterns: [
+ {
+ from: 'node_modules/@matrix-org/olm/olm.wasm',
+ to: path.join(__dirname, 'dist'),
+ },
+ ],
+ }),
+ ],
};
const baseProdBrowserConfig = {
...baseBrowserConfig,
plugins: [
- ...baseBrowserConfig.plugins,
+ new CopyPlugin({
+ patterns: [
+ {
+ from: 'node_modules/@matrix-org/olm/olm.wasm',
+ to: path.join(__dirname, 'dist', 'olm.[contenthash:12].wasm'),
+ },
+ ],
+ }),
new AssetsPlugin({
filename: 'assets.json',
path: path.join(__dirname, 'dist'),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 3:23 AM (2 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5935663
Default Alt Text
D7068.1768447382.diff (3 KB)
Attached To
Mode
D7068: [keyserver][web] Use unique filename for each prod olm.wasm asset
Attached
Detach File
Event Timeline
Log In to Comment