30 Commits

Author SHA1 Message Date
Dorian
8d56fe392d refactor: update environment configuration and documentation
- Modified `.env.example` to reflect new API URL structure and added CDN configuration for external storage.
- Updated `.gitignore` to include deployment secrets and certificate files, ensuring sensitive information is not committed.
- Revised `BACKEND_INTEGRATION.md` to clarify authentication methods, replacing Cognito references with Nostr NIP-98.
- Deleted outdated documentation files (`CONTENT-INTEGRATION-COMPLETE.md`, `CURSOR-MCP-SETUP.md`, `FINAL-STATUS.md`, `FIXES-APPLIED.md`, `INDEEHHUB-INTEGRATION.md`, `PROJECT-COMPLETE.md`, `PROJECT-SUMMARY.md`) to streamline project documentation.

These changes enhance the clarity of the environment setup and improve the overall documentation structure for better developer onboarding.
2026-02-17 05:12:59 +00:00
Dorian
023653eec5 docs: update README and improve zap handling in webhooks and services
- Added a production checklist for Zaps (Lightning) in README.md, detailing necessary steps for historic zap visibility.
- Enhanced comments in webhooks.service.ts to clarify zap handling and webhook requirements for BTCPay Server.
- Improved logging in zaps.service.ts to provide more detailed information on zap payouts and recorded stats.
- Updated error handling in zaps.service.ts to ensure robust logging if zap stats recording fails.
- Refined getZapStats method in indeehub-api.service.ts to clarify mock data usage in development.

These changes improve documentation and enhance the handling of zap-related functionalities across the application.
2026-02-14 16:35:21 +00:00
Dorian
f40b4a1268 refactor: update caching and zap handling in components
- Replaced CacheInterceptor with HttpCacheInterceptor in app.module.ts for improved caching strategy.
- Enhanced ContentDetailModal to dispatch a custom event upon zap completion, improving inter-component communication.
- Refactored ContentRow to streamline zap stats fetching and added a listener for zap completion events, ensuring real-time updates.
- Updated Analytics.vue to improve number formatting functions, handling undefined and null values more robustly.

These changes enhance the application's performance and user experience by optimizing caching and ensuring accurate, real-time data updates across components.
2026-02-14 16:11:30 +00:00
Dorian
66db9376ed feat: enhance zap functionality with stats tracking and pubkey support
- Added a new endpoint in ZapsController to retrieve zap statistics by project IDs, including total counts, amounts, and recent zapper pubkeys.
- Updated ZapsService to record zap statistics, including optional zapper pubkey for tracking who zapped.
- Enhanced CreateZapInvoiceDto to include an optional zapperPubkey field.
- Modified frontend components to display zap stats and integrate with the new backend functionality, improving user engagement and transparency.

These changes improve the overall zap experience by providing detailed insights into zap activities and enhancing the tracking of contributors.
2026-02-14 15:35:59 +00:00
Dorian
edf8be014e feat: integrate ZapsModule and enhance zap payment handling
- Added ZapsModule to the application, integrating it into the main app and webhooks modules.
- Introduced a new method in BTCPayService for processing payments to Lightning addresses, improving zap payout functionality.
- Updated WebhooksService to handle zap payment events, allowing for seamless integration of zap transactions.
- Enhanced UI components to display zap-related information, including zaps count and avatar stacks, improving user engagement.

These changes enhance the overall zap payment experience and ensure better integration of zap functionalities across the application.
2026-02-14 13:21:27 +00:00
Dorian
11d289d793 feat: add comment support for Lightning payments in BTCPay and Strike services
- Enhanced the sendPaymentWithAddress method in BTCPayService and StrikeService to accept an optional comment parameter.
- Updated resolveLightningAddress to include the comment in the callback URL if supported by the LNURL-pay endpoint.
- Modified PaymentService to construct a descriptive comment for Lightning invoices, improving clarity for users.

These changes enhance the payment experience by allowing users to include contextual information with their transactions.
2026-02-14 13:02:42 +00:00
Dorian
2a16802404 feat: add KeysModal for managing private key accounts
- Introduced a new KeysModal component to display and manage nsec/npub for accounts with local private keys.
- Updated AppHeader and Profile views to include a "My Keys" button, conditionally rendered based on the presence of a private key.
- Enhanced the useAccounts composable to determine if the active account holds a local private key, enabling key management functionality.

These changes improve user access to their private key information and enhance the overall account management experience.
2026-02-14 12:18:48 +00:00
Dorian
d1ac281ad9 feat: enhance webhook event handling and improve profile fetching logic
- Updated the WebhooksService to differentiate between 'InvoiceSettled' and 'InvoicePaymentSettled' events, ensuring accurate payment confirmation and logging.
- Enhanced the useAccounts composable to improve display name handling by skipping generic placeholder names and ensuring the most recent profile metadata is fetched from multiple relays.
- Modified the IndeehubApiService to handle JWT token refresh failures gracefully, allowing public endpoints to function without authentication.
- Updated content store logic to fetch all published projects from the public API, ensuring backstage content is visible to all users regardless of their active content source.

These changes improve the reliability of payment processing, enhance user profile representation, and ensure content visibility across the application.
2026-02-14 12:05:32 +00:00
Dorian
674c9f80c5 feat: enhance streaming functionality with format support and fallback mechanism
- Added support for an optional 'format' query parameter in the streaming endpoint to allow raw file retrieval.
- Implemented a fallback mechanism in the VideoPlayer to automatically switch to raw file playback when HLS streaming fails.
- Improved error handling and logging for HLS playback issues, ensuring better user feedback and recovery attempts.
- Updated the Indeehub API service to accommodate the new format parameter in the streaming URL request.
2026-02-14 10:56:37 +00:00
Dorian
38293b1f95 feat: add comprehensive logging to payment cron for debugging
Every 10 minutes, the cron now logs:
- When it triggers and completes
- Satoshi rate fetched (or failure)
- Number of eligible shareholders found
- If 0 found: warns about shareholders with revenue but mismatched criteria
- Per-shareholder: revenue, filmmaker ID, lightning address
- Payment preparation: amount in sats, destination address
- Duplicate detection
- Payment send result (completed or failed with error)
- Revenue deduction confirmation

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 23:07:31 +00:00
Dorian
ae97cbe67b fix: resolve AES-128 key delivery blocking HLS video playback
Root cause: HLS content is AES-128 encrypted, but the key endpoint
required mandatory auth (HybridAuthGuard). HLS.js fetches the key
without auth headers, causing a silent 401 and playback failure.

Backend:
- Changed key.controller.ts to use OptionalHybridAuthGuard
- Free content (price <= 0) now serves keys without authentication
- Paid content still requires auth, returns 401 for anon requests
- Added Content entity injection to look up pricing

Frontend:
- Configured HLS.js xhrSetup to attach Bearer token on /key requests
- Uses nostr_token or auth_token from sessionStorage
- Ensures logged-in users can play paid encrypted content

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 22:54:52 +00:00
Dorian
0917410c9e fix: add stream diagnostics and project-ID fallback for video playback
- Stream endpoint now accepts both content ID and project ID,
  falling back to project lookup when content ID is not found
- Added /contents/:id/stream-debug diagnostic endpoint that checks
  file existence in both private and public MinIO buckets
- Stream endpoint now verifies raw file exists before generating
  presigned URL, returning a clear error if file is missing
- Added comprehensive logging throughout the stream pipeline
- VideoPlayer now logs stream URL, API responses, and playback errors
  to browser console for easier debugging
- Bumped CACHEBUST for frontend (19), API (11), and ffmpeg-worker (13)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 22:36:41 +00:00
Dorian
671afd2915 fix: add GET /subscriptions endpoint to silence 404s
The frontend calls GET /subscriptions but only GET /subscriptions/active
existed. Add a root GET handler that returns the same data.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 21:57:17 +00:00
Dorian
f3a9d3d614 fix: decouple rent payouts from rate API, correct sats terminology
Rent shareholder payouts are denominated in sats and don't need a
USD/sat exchange rate. Skip the getSatoshiRate() call for rent-type
payments so they are never blocked by rate-API 429s or outages.

Also fix a misleading log message that said "USD" instead of "sats".

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 21:34:07 +00:00
Dorian
c84c4e92b7 fix: widen rents.usd_amount column, add webhook alias, silence cron spam
- Migration to ALTER rents.usd_amount from numeric(5,2) to numeric(15,2)
  which was causing "numeric field overflow" 500 errors when saving
  rental prices >= 1000 sats (e.g. 1200 sats)
- Also widen season_rents.usd_amount for consistency
- Add /webhooks/btcpay route alias (BTCPay was posting to /btcpay but
  the endpoint was /btcpay-webhook, causing 404s on payment callbacks)
- Skip ECS autoscaling cron when TRANSCODING_API_URL is not set
  (eliminates "security token invalid" error spam every minute)
- Reduce payment cron from EVERY_MINUTE to EVERY_10_MINUTES to avoid
  429 rate limiting on the BTC price API
- Bump API CACHEBUST to 10

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 21:30:29 +00:00
Dorian
7f78ac9ba6 Fix FFmpeg worker: align job data format with API and update content status
The worker was completely broken because of 4 mismatches with the API:

1. Field names: API sends {correlationId, inputKey, outputKey, inputBucket,
   outputBucket} but worker expected {contentId, sourceKey, outputPrefix}.
   All fields were undefined, so jobs silently failed.

2. No status callback: Worker never updated content status to 'completed',
   so projects never appeared as published (content stuck in 'processing').
   Now updates status directly in PostgreSQL.

3. Wrong bucket: Worker uploaded HLS to private bucket, but the stream
   controller checks the public bucket. Now uploads to outputBucket (public).

4. Wrong manifest name: Worker output index.m3u8 but codebase expects
   file.m3u8. Aligned with helper.ts convention.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 21:07:24 +00:00
Dorian
fc20c625fa Fix Mixed Content on file uploads: presigned URLs now use public domain
The backend was generating presigned S3 URLs pointing to the internal
MinIO endpoint (http://minio:9000), which browsers block on HTTPS pages.

- Add a second S3 client in upload.service.ts configured with FRONTEND_URL
  for generating browser-facing presigned URLs (both upload and download)
- Add nginx proxy location for /indeedhub-private/ and /indeedhub-public/
  paths that forwards to MinIO without rewriting (preserves S3v4 signatures)
- Keep internal S3 client for server-side operations (copy, delete, etc.)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 20:30:49 +00:00
Dorian
abb83fe164 Bump CACHEBUST to v8 for backend and frontend rebuilds; update Nginx and NostrAuthGuard to handle X-Forwarded-Prefix for NIP-98 compliance 2026-02-13 20:20:32 +00:00
Dorian
4f7fdd4413 Fix missing payment_methods table creation + bump CACHEBUST to v6
Migration AddedWithdrawalFrequency1733770884555 referenced payment_methods
table that was never created. Modified to CREATE TABLE IF NOT EXISTS with
all columns, then drop lightning_address from filmmakers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 19:47:46 +00:00
Dorian
34c48d9f6e Fix apostrophe in Children's Animation migration + bump CACHEBUST to v5
Escape single quote in seed-episodic-subgenres migration that caused
"column Children's Animation does not exist" PostgreSQL error.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 19:34:31 +00:00
Dorian
85e9d2f197 Convert all remaining entity-manager migrations to raw SQL
TypeORM's manager.save/delete with string table names still uses
entity metadata internally (triggers SELECT with all entity columns).
Converted SeedSubgenres, RemoveLastGenres, and SeedEpisodicSubgenres
to use queryRunner.query() with raw SQL to avoid column mismatches.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 19:01:24 +00:00
Dorian
82a5c0a5cf Fix entity-based migrations that crash on missing columns
MusicVideosUpdate and AddEpisodicGenres migrations used TypeORM
entity classes which reference columns that don't exist at their
migration timestamp (e.g. trailer_old, later entity fields).
Rewrote both to use raw SQL INSERT/UPDATE statements.

Also bumped CACHEBUST to v3 to force backend image rebuild.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 18:30:37 +00:00
Dorian
bb281b488b Add CACHEBUST build arg to force Docker image rebuilds
Docker's build cache was preventing Portainer from picking up
code changes. Adding a CACHEBUST ARG before COPY invalidates
all subsequent layers when the value changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 18:05:40 +00:00
Dorian
819b20dcb4 Refactor genre seeding and deletion logic for improved database management
- Simplified the genre seeding process by replacing bulk save with individual insert queries, enhancing performance and error handling.
- Removed unnecessary comments and streamlined the deletion process for genres, ensuring clarity in migration scripts.
- Updated the `down` method to accurately restore deleted genres, maintaining data integrity during rollbacks.
2026-02-13 17:36:53 +00:00
Dorian
8c43448306 Refactor database SSL configuration for improved clarity and flexibility
- Updated SSL settings in database.module.ts and ormconfig.ts to use DATABASE_SSL environment variable for better control over SSL usage.
- Clarified comments to indicate that SSL is only necessary for remote PostgreSQL instances, enhancing understanding for local development setups.
2026-02-13 17:28:28 +00:00
Dorian
a8dc82dc59 Update environment variables and enhance Docker configurations for improved deployment
- Modified .env.portainer to include new environment variables for S3 private bucket URL, Nostr JWT secrets, and SendGrid options.
- Updated docker-compose.yml to support the new environment variables, enhancing service configurations.
- Added a seed content script to the backend package.json for initializing the database with sample data.
- Refactored helper functions to construct S3 URLs more robustly, accommodating potential missing configurations.
- Enhanced dev.sh script to seed the database if empty, ensuring content availability during development.
2026-02-13 16:27:51 +00:00
Dorian
3ca43b62e4 Enhance Docker and backend configurations for improved deployment
- Updated docker-compose.yml to include environment variable support for services, enhancing flexibility in configuration.
- Refactored Dockerfile to utilize build arguments for VITE environment variables, allowing for better customization during builds.
- Improved Nginx configuration to handle larger video uploads by increasing client_max_body_size to 5GB.
- Enhanced backend Dockerfile to include wget for health checks and improved startup logging for database migrations.
- Added validation for critical environment variables in the backend to ensure necessary configurations are present before application startup.
- Updated content streaming logic to support direct HLS URL construction, improving streaming reliability and user experience.
- Refactored various components and services to streamline access checks and improve error handling during content playback.
2026-02-13 12:35:03 +00:00
Dorian
7e9a35a963 Add HLS.js support and enhance content streaming logic
- Integrated HLS.js version 1.6.15 into the project for improved video streaming capabilities.
- Updated the ContentsController to check for HLS manifest availability and fall back to presigned URLs for original files if not found.
- Enhanced the VideoPlayer component to handle loading and error states more effectively, improving user experience during streaming.
- Refactored content service methods to return detailed streaming information, including HLS and DASH manifest URLs.
2026-02-13 00:04:53 +00:00
Dorian
0da83f461c Enhance payment processing and rental features
- Updated the BTCPay service to support internal Lightning invoices with private route hints, improving payment routing for users with private channels.
- Added reconciliation methods for pending rents and subscriptions to ensure missed payments are processed on startup.
- Enhanced the rental and subscription services to handle payments in satoshis, aligning with Lightning Network standards.
- Improved the rental modal and content detail components to display rental status and pricing more clearly, including a countdown for rental expiration.
- Refactored various components to streamline user experience and ensure accurate rental access checks.
2026-02-12 23:24:25 +00:00
Dorian
cdd24a5def Implement backend API and database services in Docker setup
- Added a new `api` service for the NestJS backend, including health checks and dependencies on PostgreSQL, Redis, and MinIO.
- Introduced PostgreSQL and Redis services with health checks and configurations for data persistence.
- Added MinIO for S3-compatible object storage and a one-shot service to initialize required buckets.
- Updated the Nginx configuration to proxy requests to the new backend API and MinIO storage.
- Enhanced the Dockerfile to support the new API environment variables and configurations.
- Updated the `package.json` and `package-lock.json` to include new dependencies for QR code generation and other utilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 20:14:39 +00:00