Replace CPU-intensive headless Chrome + WebRTC pipeline with a lightweight Go reverse proxy that strips anti-framing headers (X-Frame-Options, CSP) and embeds streaming sites in iframes. - New internal/proxy package with URL rewriting for HTML/CSS - JS shim injection to intercept fetch/XHR/WebSocket/createElement - Referer reconstruction for correct cross-origin auth (HLS streams) - Inline iframe viewer preserving site navigation (not fullscreen overlay)
20 lines
372 B
Go
20 lines
372 B
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
|
|
"f1-stream/internal/models"
|
|
)
|
|
|
|
type contextKey string
|
|
|
|
const userKey contextKey = "user"
|
|
|
|
func ContextWithUser(ctx context.Context, user *models.User) context.Context {
|
|
return context.WithValue(ctx, userKey, user)
|
|
}
|
|
|
|
func UserFromContext(ctx context.Context) *models.User {
|
|
user, _ := ctx.Value(userKey).(*models.User)
|
|
return user
|
|
}
|