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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-solid-server",
3
- "version": "0.0.113",
3
+ "version": "0.0.114",
4
4
  "description": "A minimal, fast Solid server",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -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' }));