Files
ComfyUI_frontend/src
Christian Byrne 648190bf65 [backport rh-test] add service worker on cloud distribution to attach auth header to browser native /view requests (#6139) (#6259)
## Summary

Backport of #6139 to `rh-test` branch.

Added Service Worker to inject Firebase auth headers into browser-native
`/api/view` requests (img, video, audio tags) for cloud distribution.

## Changes

- **What**: Implemented [Service
Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)
to intercept and authenticate media requests that cannot natively send
custom headers
- **Dependencies**: None (uses native Service Worker API)

## Implementation Details

**Tree-shaking**: Uses compile-time `isCloud` constant - completely
removed from localhost/desktop builds (verified via bundle analysis).

**Caching**: 50-minute auth header cache with automatic invalidation on
login/logout to prevent redundant token fetches.

## Backport Notes

- Resolved merge conflict in `src/main.ts` where remote config loading
logic was added on `rh-test`
- Preserved the CRITICAL comment about loading remote config first
- All files from original commit included
- Typecheck passed successfully

Original commit: 26f587c956

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6259-backport-rh-test-add-service-worker-on-cloud-distribution-to-attach-auth-header-to-brow-2966d73d365081b39cdac969b6c24d0d)
by [Unito](https://www.unito.io)
2025-10-24 14:19:02 -07:00
..
2025-09-28 15:33:29 -07:00
2024-09-25 16:01:50 +09:00
2025-08-13 11:46:03 -07:00