javascript-solid-server 0.0.113 → 0.0.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/webrtc/index.js +5 -1
package/package.json
CHANGED
package/src/webrtc/index.js
CHANGED
|
@@ -220,7 +220,11 @@ export async function webrtcPlugin(fastify, options = {}) {
|
|
|
220
220
|
fastify.get(path, { websocket: true }, async (connection, request) => {
|
|
221
221
|
const socket = connection.socket;
|
|
222
222
|
|
|
223
|
-
// Authenticate the connection
|
|
223
|
+
// Authenticate the connection (support query param for browser WebSocket which can't set headers)
|
|
224
|
+
const queryToken = request.query?.token;
|
|
225
|
+
if (queryToken && !request.headers.authorization) {
|
|
226
|
+
request.headers.authorization = `Bearer ${queryToken}`;
|
|
227
|
+
}
|
|
224
228
|
const { webId } = await getWebIdFromRequestAsync(request);
|
|
225
229
|
if (!webId) {
|
|
226
230
|
socket.send(JSON.stringify({ type: 'error', message: 'Authentication required' }));
|