wireweave 0.3.8 → 0.3.9

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": "wireweave",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "nostr + webrtc voice + data SDK. networking layer for 247420 projects.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/media.js CHANGED
@@ -94,8 +94,8 @@ export class Media {
94
94
 
95
95
  isMedia(url) {
96
96
  if (typeof url !== 'string') return null;
97
- if (/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(url)) return 'image';
98
- if (/\.(mp4|webm|mov|ogg)(\?|$)/i.test(url)) return 'video';
97
+ if (/\.(png|jpe?g|gif|webp|svg|avif|heic|heif|tiff?|bmp)(\?|$)/i.test(url)) return 'image';
98
+ if (/\.(mp4|webm|mov|ogg|ogv|mkv|m4v|avi)(\?|$)/i.test(url)) return 'video';
99
99
  return null;
100
100
  }
101
101
 
package/src/relay-pool.js CHANGED
@@ -36,7 +36,12 @@ export class RelayPool extends EventTarget {
36
36
 
37
37
  disconnect() {
38
38
  for (const [, r] of this.relays) {
39
- if (r.ws) { r.ws.onclose = null; r.ws.onerror = null; try { r.ws.close(); } catch {} }
39
+ if (r.ws) {
40
+ r.ws.onclose = null; r.ws.onerror = null; r.ws.onopen = null; r.ws.onmessage = null;
41
+ if (typeof r.ws.removeAllListeners === 'function') r.ws.removeAllListeners();
42
+ if (typeof r.ws.on === 'function') r.ws.on('error', () => {});
43
+ try { r.ws.close(); } catch {}
44
+ }
40
45
  }
41
46
  this.relays.clear();
42
47
  }
package/src/wireweave.js CHANGED
@@ -24,6 +24,7 @@ export const createWireweave = ({
24
24
  } = {}) => {
25
25
  if (!nostrTools) throw new Error('wireweave: nostrTools required');
26
26
  if (!xstate) throw new Error('wireweave: xstate required');
27
+ if (!storage) throw new Error('wireweave: storage required (no localStorage in this env — pass a {getItem,setItem,removeItem} adapter)');
27
28
 
28
29
  const fsm = createFSM(xstate);
29
30
  const pool = createRelayPool({ relays, verifyEvent: nostrTools.verifyEvent, WebSocketImpl });