Skip to content

Conversation

@Maphikza
Copy link
Member

Summary

This PR makes wallet configuration optional and adds support for new event kinds, improving deployment flexibility and expanding relay
functionality.

Key Changes

Optional Wallet Configuration

  • Made REACT_APP_WALLET_BASE_URL optional in environment configuration
  • Added isWalletEnabled flag to detect wallet availability at build time
  • Updated wallet-related components to gracefully handle missing wallet configuration
  • Send/Receive buttons now show helpful messages when wallet is not configured

New Event Kind Support

  • Added kind 1060 (Double Ratchet DM - NIP-117)
  • Added kind 1063 (File Metadata - NIP-94)
  • Added kind 30078 (Application-specific Data - NIP-78)
  • All new kinds are selectable in relay settings under "Basic Nostr Features"

Simplified Icon Upload

  • Replaced complex client-side Blossom upload with simple backend API call
  • Uses POST /api/relay/icon with JWT authentication
  • Backend now handles Kind 117 event creation, Blossom storage, and config updates
  • Auto-detects panel URL for proper Blossom server integration

Benefits

Improved Deployment Flexibility

  • Panel can be deployed without wallet service
  • Clear user guidance when wallet features are disabled
  • No more build failures from missing wallet URLs
  • Graceful degradation of wallet functionality

Enhanced User Experience

  • Helpful error messages instead of crashes
  • Clear instructions for enabling wallet features
  • Simplified icon upload process
  • Support for additional Nostr event types

Technical Details

Configuration Changes

  • Before: REACT_APP_WALLET_BASE_URL was required, would throw error if missing
  • After: REACT_APP_WALLET_BASE_URL is optional, returns null when empty
  • Relay URL: Still required for profile fetching functionality

Component Updates

  • SendButton: Shows warning message when wallet not available
  • TopUpBalanceButton: Shows warning message when wallet not available
  • IconUpload: Uses new simplified API instead of direct Blossom upload

Environment File Updates

  • .env.production: Set REACT_APP_WALLET_BASE_URL= (empty by default)
  • Documentation updated to reflect optional wallet configuration

Testing Checklist

  • Panel builds successfully with empty wallet URL
  • Send/Receive buttons show appropriate messages when wallet disabled
  • Panel builds and works with wallet URL configured
  • New event kinds appear in relay settings
  • Icon upload works with new API
  • Profile fetching still works with relay URL

Migration Guide

For users without wallet service:

REACT_APP_WALLET_BASE_URL=
REACT_APP_OWN_RELAY_URL=ws://localhost:9001

For users with wallet service:

REACT_APP_WALLET_BASE_URL=http://localhost:9003
REACT_APP_OWN_RELAY_URL=ws://localhost:9001

Related Issues

- Improves deployment flexibility for users who don't need wallet functionality
- Adds support for modern Nostr NIPs (78, 94, 117)
- Simplifies icon upload process based on backend API improvements

Maphikza added 20 commits July 7, 2025 17:23
Fix deprecated CodeQL Action versions:
- github/codeql-action/init@v2 → @V3
- github/codeql-action/autobuild@v2 → @V3
- github/codeql-action/analyze@v2 → @V3

This resolves GitHub's deprecation warnings for CodeQL Action v1/v2.
## New Features
- **NIP-07 Extension Detection**: Intelligent background detection that only shows helper UI when no extension is found
- **Production Build Environment Override**: Support localhost testing with production builds
- **Smart Extension Checking**: Auto-detects extensions on load, graceful fallback for missing extensions

## UI Improvements
- **Extension Helper Component**: Mobile-responsive guide with direct links to Chrome/Firefox stores
- **Background Detection**: Login form shows immediately for users with extensions
- **Improved UX**: Only users without extensions see the setup guide

## Technical Improvements
- **Config Updates**: Production builds now support environment variable overrides for localhost testing
- **Service Worker Management**: Disable caching on localhost to prevent build conflicts
- **Better Error Handling**: Proper timeout and cleanup for extension detection

## Documentation Updates
- **Production Testing Guide**: Instructions for localhost production build testing
- **Environment Examples**: Clear .env.production examples for different scenarios
- **Deployment Instructions**: Updated with proper serve commands

## Files Changed
- Add: NostrExtensionCheck component with mobile-responsive design
- Update: LoginForm with intelligent extension detection
- Update: config.ts with environment override support
- Update: README.md with production testing instructions
- Update: Service worker disabled for localhost testing
…ctions

- Add complete .env.development example with all required variables
- Emphasize using start-app.sh script for Node.js compatibility
- Include proper Nostr relay URLs and asset bucket configuration
- Replace hardcoded relay URLs with generic examples
- Show proper comma-separated pattern without bias
- Maintain neutrality in relay recommendations
## Major Architecture Change
- Panel now integrates directly into relay server (port 9002)
- No separate nginx proxy needed for basic deployment
- Single origin serves both React app and API endpoints

## Configuration Updates
- Simplified dynamic URL detection (same origin for panel + API)
- Removed /front and /panel path requirements
- Auto-detect WebSocket URL from current domain
- Streamlined environment configuration

## Documentation Updates
- Updated architecture diagrams for integrated deployment
- Simplified environment configuration examples
- Clarified development vs production setup
- Removed complex reverse proxy requirements

## Benefits
- ✅ Simplified deployment (single server)
- ✅ No CORS issues (same origin)
- ✅ Unified SSL certificate
- ✅ Same build works everywhere
- Remove outdated /front/ location block
- Keep wallet service proxying at /wallet/
- Maintain relay WebSocket as default location (/)
- Panel runs integrated in relay server (port 9002) - no nginx needed
- Add /panel/ location block to proxy to relay server (port 9002)
- Handle React Router SPA routing with fallback
- Update production .env.production to use /panel basename
- Now accessible at https://example.com/panel/ in production

Production URLs:
- Panel: /panel/ → port 9002 (React app + API)
- Relay: / → port 9001 (WebSocket)
- Wallet: /wallet/ → port 9003 (API)
- Remove URI path from proxy_pass in named locations (nginx requirement)
- Simplify panel routing - Go server handles React Router internally
- Update README to match working configuration
- Remove complex fallback handling that caused proxy_pass syntax error

The panel location now uses simple proxy_pass without URI conflicts.
Development (.env.development):
- Direct service connections (ports 9001, 9002, 9003)
- No base path - panel runs from root in dev mode
- Remove specific relay defaults to maintain neutrality

Production (.env.production):
- Base path /panel to match nginx routing
- Auto-detection for API URLs (same origin through nginx)
- Clean configuration for deployment
- Commented examples without favoring specific relays
- Remove hardcoded API URLs (now auto-detected)
- Set /panel base path for nginx routing
- Remove specific relay defaults to maintain neutrality
- Align with current .env.production configuration
- Clear comments about auto-detection features
Critical fixes based on backend dev feedback:
1. Add trailing slash to proxy_pass to strip /panel/ prefix properly
2. Add required proxy headers for proper request forwarding

Before: /panel/login → http://127.0.0.1:9002/panel/login (broken)
After:  /panel/login → http://127.0.0.1:9002/login (correct)

This fixes panel accessibility at https://domain.com/panel/
- Replace specific *.serveo.net with universal server_name _
- Now works with localhost, ngrok, serveo, custom domains, and any tunneling service
- Remove service-specific limitations from configuration
- Update both fixed config and README documentation
- Back to proven rewrite + break pattern that was working
- Keep the added proxy headers for proper forwarding
- Remove the trailing slash approach that broke functionality

Working pattern:
- rewrite ^/panel/(.*)$ / break strips /panel/ prefix
- proxy_pass http://127.0.0.1:9002 (no trailing slash)
- Restores https://afrihornet.ngrok.io/panel/ functionality
- Remove auto-detection fallback that was causing incorrect URL usage
- Always require REACT_APP_WALLET_BASE_URL to be explicitly set
- Prevent panel from incorrectly trying localhost:9002/wallet instead of localhost:9003
- Add clear error message when wallet URL environment variable is missing
- Include production environment configuration in repository
- Ensures wallet URL is properly configured during build process
- Required for automated deployment scripts that clone and build
- Remove auto-detection fallback for relay WebSocket URL
- Always require REACT_APP_OWN_RELAY_URL to be explicitly set
- Prevent panel from incorrectly connecting to ws://localhost:9002 instead of ws://localhost:9001
- Add clear error message when relay URL environment variable is missing
- Update .env.production with correct relay URL: ws://localhost:9001
- Document direct access deployment method that actually works
- Remove non-working reverse proxy configurations to prevent confusion
- Clarify that service URLs (wallet/relay) require explicit configuration
- Note that panel routing can be auto-detected but service URLs cannot
- Add note that reverse proxy setup still needs proper configuration example

TODO: Create working nginx configuration example for reverse proxy deployment
  - Replace complex client-side Blossom upload with simple API call
  - Use POST /api/relay/icon endpoint with JWT authentication
  - Send panel_url (auto-detected from window.location.origin) and image file
  - Backend now handles Kind 117 event creation, Blossom storage, and config updates
  - Remove dependency on direct Blossom upload utilities
  - Improve error handling and user feedback
  - Add kind 1060 (Double Ratchet DM - NIP-117) to selectable kinds
  - Add kind 1063 (File Metadata - NIP-94) to selectable kinds
  - Add kind 30078 (Application-specific Data - NIP-78) to selectable kinds
  - Update kindMapping.ts with kind 1060 description
  - All new kinds categorized under Basic Nostr Features
  - Users can now enable/disable these kinds in relay settings
  - Make REACT_APP_WALLET_BASE_URL optional in config.ts
  - Add isWalletEnabled flag to detect wallet availability
  - Update SendButton and TopUpBalanceButton to show helpful messages when wallet not configured
  - Add support for kind 1060 (Double Ratchet DM - NIP-117), kind 1063 (File Metadata - NIP-94), and kind 30078 (Application-specific Data
  - NIP-78)
  - Simplify icon upload to use new backend API instead of client-side Blossom upload
  - Update .env.production to show wallet URL as optional (empty by default)
  - Update README documentation to reflect optional wallet configuration
  - Users can now deploy panel without wallet service and get clear guidance on enabling wallet features
@f7f376a1fcd0d0e11a10ed1b6577c9 f7f376a1fcd0d0e11a10ed1b6577c9 merged commit 1fa88c6 into main Jul 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants