Skip to content

Conversation

@Maphikza
Copy link
Member

@Maphikza Maphikza commented Jul 6, 2025

Summary

This PR implements dual icon upload functionality and eliminates hardcoded URLs for true deployment portability.

Key Features

Icon Upload System

  • Dual upload options: Direct URL input or file upload
  • Blossom server integration with NIP-98 authentication
  • Drag-and-drop interface with real-time preview
  • Automatic form synchronization for existing icons

Dynamic URL Detection

  • Runtime URL detection using window.location.origin
  • One build works everywhere - no environment-specific rebuilds needed
  • Automatic adaptation to any domain (localhost, production, ngrok tunnels)
  • Simplified deployment with minimal environment configuration

Technical Implementation

  • Added IconUpload component with tabbed interface (URL/Upload)
  • Implemented complete Blossom protocol flow (Kind 117 → NIP-98 → file upload)
  • Replaced hardcoded environment variables with dynamic detection functions
  • Updated type definitions for relay_icon field in both frontend and backend interfaces
  • Made software/version fields read-only as per PM requirements

Deployment Benefits

  • No more REACT_APP_BASE_URL needed in production
  • Panel automatically detects API endpoints from current domain
  • Works instantly on any hosting provider or tunnel service
  • Eliminates environment-specific builds

Files Changed

  • New: src/components/common/IconUpload.tsx - Dual upload component
  • New: src/utils/blossomUpload.ts - Blossom integration utilities
  • Updated: src/config/config.ts - Dynamic URL detection
  • Updated: Type definitions and form handling for icon field
  • Updated: README with launch-ready deployment guide

Maphikza added 7 commits July 4, 2025 13:56
- Fix backend API communication for blacklist mode
- In blacklist mode: selected items are blocked, backend receives inverse (allowed items)
- In whitelist mode: selected items are allowed, backend receives them directly
- Fix mode switching to preserve blocked items when loading from backend
- Add helper functions to calculate inverse kinds for blacklist mode
- Ensure core kinds are never blockable in blacklist mode
- Add AddKindForm component for dynamic kind addition
- Add 10-minute caching to subscriber profile fetching to prevent backend spam
- Implement LRU cache with automatic cleanup for thousands of users
- Fix blacklist mode reconciliation to properly show blocked items on page refresh
- Use Set-based logic for more reliable blacklist calculations
- Remove App Buckets functionality from relay settings
- Clean up excessive console logging
- Properly include dynamic kinds in backend whitelist calculation
- Separate predefined vs dynamic kinds in reconciliation logic
- Fix kind formatting in AddKindForm
- Improve UI labels for better UX
- Show dynamic kinds in both whitelist and blacklist modes
- Implement dual icon upload: URL input or file upload with Blossom server integration
- Add IconUpload component with drag-and-drop and URL validation
- Integrate NIP-98 HTTP authentication for Blossom uploads
- Add Kind 117 file metadata event publishing before upload
- Update RelayInfoSettings to use new IconUpload component
- Add relay_icon field to both frontend and backend type definitions
- Make software and version fields read-only as per requirements
- Fix form value synchronization for dynamic icon loading

Icon uploads now support both direct URL entry and file uploads via Blossom server with proper Nostr authentication.
Replace hardcoded environment variables with runtime URL detection using window.location.origin.
This eliminates the need for environment-specific builds and makes the panel deployable anywhere.

Key improvements:
- Panel API URLs auto-detected from current domain in production
- Wallet service URLs auto-detected from current domain in production
- Relay WebSocket URLs auto-detected from current domain in production
- One build now works on ANY domain (localhost, custom domains, ngrok tunnels)
- No more REACT_APP_BASE_URL or REACT_APP_WALLET_BASE_URL needed in production
- Simplified deployment process with minimal environment configuration
- Updated README with comprehensive deployment guidance and launch-ready improvements

Production URLs now resolve to:
- Panel API: ${window.location.origin}/panel
- Wallet API: ${window.location.origin}/wallet
- Relay WebSocket: wss://${window.location.host}

Development mode still uses localhost URLs for easy local development.
Kind 117 events are required for Blossom file uploads to work properly.
Without this kind in the relay's whitelist, users cannot upload files
such as relay icons, as the Kind 117 metadata events would be rejected.

Changes:
- Added kind117 to CORE_KINDS array (cannot be removed by users)
- Added Kind 117 to noteOptions with description 'Blossom File Metadata'
- Ensures file upload functionality works out of the box
@f7f376a1fcd0d0e11a10ed1b6577c9 f7f376a1fcd0d0e11a10ed1b6577c9 merged commit d668abf into main Jul 7, 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