mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-11 16:07:15 +02:00
This commit fixes two critical issues preventing live message delivery in self-chat and other NIP-17 conversations: **Issue 1: applesauce-actions relay hint bug (PATCHED IN NODE_MODULES)** - Root cause: Action used gift wrap's random ephemeral pubkey to look up inbox relays, but the map was keyed by real recipient pubkeys - Result: inboxRelays.get(giftWrap.pubkey) returned undefined - publishEvent received no relay hints and failed with "No relays found" - Messages never published **Issue 2: Relay URL normalization mismatch** - Root cause: Inbox relays from kind 10050 not normalized (kept raw format) - Result: URLs with/without trailing slashes treated as different relays Example: wss://relay.com/ vs wss://relay.com - Published to: wss://frens.nostr1.com/ (with slash) - Subscribed to: wss://frens.nostr1.com (without slash) - Messages sent but subscription never received them (different relay!) - User had to click "Sync" to manually fetch from all relay variations **Changes:** 1. src/services/gift-wrap.ts: * Added normalizeRelayURL import * Normalize all inbox relay URLs when loading from kind 10050 event * Ensures consistent URL format for subscription matching 2. src/services/hub.ts: * Added normalizeRelayURL import * Normalize relay hints before publishing * Ensures sent messages go to same normalized relay as subscription 3. node_modules/applesauce-actions/dist/actions/wrapped-messages.js: * PATCHED: Track recipient pubkey alongside gift wrap * Use recipientPubkey (real user) instead of giftWrap.pubkey (ephemeral) * Ensures correct inbox relay lookup * NOTE: This is a temporary patch until fix is merged upstream * TODO: Remove patch after applesauce-actions >5.0.2 is released **Expected Behavior After Fix:** 1. User sends self-chat message 2. Action looks up inbox relays using recipient pubkey (FIXED) 3. publishEvent receives relay hints: ['wss://relay.com/'] (WORKING) 4. Relay hints normalized: ['wss://relay.com/'] (NEW) 5. Gift wrap published to normalized relays (WORKING) 6. Subscription listening on normalized relays receives message (FIXED) 7. Message appears live in UI without manual sync (~200-500ms latency) **Testing:** Self-chat test: - Send message to self - Console should show: * [Publish] Using provided relay hints * [Publish] Persisted encrypted content for gift wrap * Match: true (relay alignment) - Message should appear within 500ms - Reload page - message persists - Send another message - both visible, no duplicates **Note on node_modules patch:** The applesauce-actions patch will be lost on npm install. Options: 1. Use patch-package to persist the patch 2. Wait for upstream fix and update to applesauce-actions >5.0.2 3. Create local fork until upstream merge For now, if you run npm install, you'll need to reapply the patch. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
117 lines
3.6 KiB
JSON
117 lines
3.6 KiB
JSON
{
|
|
"name": "grimoire",
|
|
"private": true,
|
|
"version": "0.1.0",
|
|
"type": "module",
|
|
"license": "MIT",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "tsc -b && vite build",
|
|
"lint": "eslint .",
|
|
"lint:fix": "eslint . --fix",
|
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
|
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
|
|
"preview": "vite preview",
|
|
"test": "vitest",
|
|
"test:ui": "vitest --ui",
|
|
"test:run": "vitest run"
|
|
},
|
|
"dependencies": {
|
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
"@radix-ui/react-context-menu": "^2.2.16",
|
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
"@radix-ui/react-hover-card": "^1.1.15",
|
|
"@radix-ui/react-popover": "^1.1.15",
|
|
"@radix-ui/react-progress": "^1.1.8",
|
|
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
"@radix-ui/react-slider": "^1.3.6",
|
|
"@radix-ui/react-slot": "^1.2.4",
|
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
"@tiptap/core": "^3.15.3",
|
|
"@tiptap/extension-mention": "^3.15.3",
|
|
"@tiptap/extension-placeholder": "^3.15.3",
|
|
"@tiptap/pm": "^3.15.3",
|
|
"@tiptap/react": "^3.15.3",
|
|
"@tiptap/starter-kit": "^3.15.3",
|
|
"@tiptap/suggestion": "^3.15.3",
|
|
"@types/qrcode": "^1.5.6",
|
|
"applesauce-accounts": "^5.0.0",
|
|
"applesauce-actions": "^5.0.2",
|
|
"applesauce-common": "^5.0.0",
|
|
"applesauce-content": "^5.0.0",
|
|
"applesauce-core": "^5.0.0",
|
|
"applesauce-loaders": "^5.0.0",
|
|
"applesauce-react": "^5.0.1",
|
|
"applesauce-relay": "^5.0.0",
|
|
"applesauce-signers": "^5.0.0",
|
|
"blossom-client-sdk": "^4.1.0",
|
|
"class-variance-authority": "^0.7.1",
|
|
"clsx": "^2.1.1",
|
|
"cmdk": "^1.1.1",
|
|
"date-fns": "^4.1.0",
|
|
"dexie": "^4.2.1",
|
|
"dexie-react-hooks": "^4.2.0",
|
|
"flexsearch": "^0.8.212",
|
|
"framer-motion": "^12.23.26",
|
|
"hls-video-element": "^1.5.10",
|
|
"hls.js": "^1.6.15",
|
|
"jotai": "^2.15.2",
|
|
"js-yaml": "^4.1.1",
|
|
"lucide-react": "latest",
|
|
"media-chrome": "^4.17.2",
|
|
"prismjs": "^1.30.0",
|
|
"qrcode": "^1.5.4",
|
|
"react": "^19.2.1",
|
|
"react-dom": "^19.2.1",
|
|
"react-markdown": "^10.1.0",
|
|
"react-medium-image-zoom": "^5.4.0",
|
|
"react-mosaic-component": "^6.1.1",
|
|
"react-router": "^7.1.0",
|
|
"react-virtuoso": "^4.17.0",
|
|
"remark-gfm": "^4.0.1",
|
|
"rxjs": "^7.8.1",
|
|
"shell-quote": "^1.8.3",
|
|
"sonner": "^2.0.7",
|
|
"tailwind-merge": "^2.5.5",
|
|
"tippy.js": "^6.3.7"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^9.17.0",
|
|
"@react-router/dev": "^7.1.0",
|
|
"@testing-library/dom": "^10.4.1",
|
|
"@testing-library/react": "^16.3.1",
|
|
"@types/js-yaml": "^4.0.9",
|
|
"@types/node": "^24.10.1",
|
|
"@types/prismjs": "^1.26.5",
|
|
"@types/react": "^19.2.7",
|
|
"@types/react-dom": "^19.2.3",
|
|
"@types/shell-quote": "^1.7.5",
|
|
"@types/uuid": "^10.0.0",
|
|
"@types/ws": "^8.18.1",
|
|
"@vitejs/plugin-react": "^4.3.4",
|
|
"@vitest/ui": "^4.0.15",
|
|
"autoprefixer": "^10.4.20",
|
|
"eslint": "^9.17.0",
|
|
"eslint-config-prettier": "^10.1.8",
|
|
"eslint-plugin-prettier": "^5.5.4",
|
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
"eslint-plugin-react-refresh": "^0.4.16",
|
|
"fake-indexeddb": "^6.2.5",
|
|
"globals": "^15.14.0",
|
|
"happy-dom": "^20.0.11",
|
|
"jsdom": "^27.4.0",
|
|
"postcss": "^8.4.49",
|
|
"prettier": "^3.7.4",
|
|
"tailwindcss": "^3.4.17",
|
|
"typescript": "~5.6.2",
|
|
"typescript-eslint": "^8.18.2",
|
|
"vite": "^6.0.5",
|
|
"vitest": "^4.0.15"
|
|
}
|
|
}
|