Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ devAssets
*.tfbackend
!*.tfbackend.example
crash.log
build.sh

# the following line was added with the "git ignore" tool by itsrye.dev, version 0.1.0
.lh
2 changes: 1 addition & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"ignoreDependencies": [
"buffer",
"@element-hq/element-call-embedded",
"@sableclient/sable-call-embedded",
"@matrix-org/matrix-sdk-crypto-wasm"
],
"ignoreBinaries": ["knope"],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
"devDependencies": {
"@cloudflare/vite-plugin": "^1.26.0",
"@element-hq/element-call-embedded": "0.16.3",
"@sableclient/sable-call-embedded": "0.16.3-sable.1",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@eslint/compat": "2.0.2",
"@eslint/js": "9.39.3",
Expand Down Expand Up @@ -123,4 +123,4 @@
"vite-plugin-top-level-await": "^1.6.0",
"wrangler": "^4.70.0"
}
}
}
2 changes: 2 additions & 0 deletions src/app/plugins/call/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export function getCallCapabilities(
capabilities.add(MatrixCapabilities.MSC3846TurnServers);
capabilities.add(MatrixCapabilities.MSC4157SendDelayedEvent);
capabilities.add(MatrixCapabilities.MSC4157UpdateDelayedEvent);
capabilities.add('moe.sable.thumbnails');
capabilities.add('moe.sable.media_proxy');
capabilities.add(`org.matrix.msc2762.timeline:${roomId}`);
capabilities.add(`org.matrix.msc2762.state:${roomId}`);

Expand Down
14 changes: 14 additions & 0 deletions src/sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ self.addEventListener('fetch', (event: FetchEvent) => {
return;
}

// Since widgets like element call have their own client ids,
// we need this logic. We just go through the sessions list and get a session
// with the right base url. Media requests to a homeserver simply are fine with any account
// on the homeserver authenticating it, so this is fine. But it can be technically wrong.
// If you have two tabs for different users on the same homeserver, it might authenticate
// as the wrong one.
// Thus any logic in the future which cares about which user is authenticating the request
// might break this. Also, again, it is technically wrong.
const byBaseUrl = [...sessions.values()].find((s) => validMediaRequest(url, s.baseUrl));
if (byBaseUrl) {
event.respondWith(fetch(url, { ...fetchConfig(byBaseUrl.accessToken), redirect }));
return;
}

event.respondWith(
requestSessionWithTimeout(clientId).then((s) => {
if (s && validMediaRequest(url, s.baseUrl)) {
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const isReleaseTag = (() => {
const copyFiles = {
targets: [
{
src: 'node_modules/@element-hq/element-call-embedded/dist/*',
src: 'node_modules/@sableclient/sable-call-embedded/dist/*',
dest: 'public/element-call',
},
{
Expand Down
Loading