Tangled notifications browser extension

fix: tolerate whitespaces & newlines

moshyfawn.dev fce67f0f ffa9bfd0

verified
+2 -2
+1 -1
package.json
··· 2 2 "name": "tug", 3 3 "description": "A tug for every notification", 4 4 "private": true, 5 - "version": "0.1.1", 5 + "version": "0.1.2", 6 6 "type": "module", 7 7 "scripts": { 8 8 "dev": "wxt",
+1 -1
utils/api.ts
··· 12 12 // FIX: requires backend to return 401 when not logged in (currently returns 200 even if not logged in) 13 13 if (!response.ok) throw new Error(`HTTP ${response.status}`); 14 14 const html = await response.text(); 15 - const match = html.match(/>(\d+\+?)</); 15 + const match = html.match(/>\s*(\d+\+?)\s*</); 16 16 return match ? parseInt(match[1], 10) : 0; 17 17 };