diff --git a/js/components/src/streamplace-store/branding.tsx b/js/components/src/streamplace-store/branding.tsx index 5e4778192..19fcbe75e 100644 --- a/js/components/src/streamplace-store/branding.tsx +++ b/js/components/src/streamplace-store/branding.tsx @@ -173,12 +173,6 @@ export function useAccentColor(): string { return asset?.data || "#8b5cf6"; } -// convenience hook for default stream key -export function useDefaultStreamKey(): string | undefined { - const asset = useBrandingAsset("defaultStreamKey"); - return asset?.data || undefined; -} - // convenience hook for default streamer export function useDefaultStreamer(): string | undefined { const asset = useBrandingAsset("defaultStreamer"); diff --git a/pkg/api/api_internal.go b/pkg/api/api_internal.go index f126fed69..ef33d5809 100644 --- a/pkg/api/api_internal.go +++ b/pkg/api/api_internal.go @@ -449,44 +449,6 @@ func (a *StreamplaceAPI) InternalHandler(ctx context.Context) (http.Handler, err } }) - router.GET("/branding-admin", func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { - http.ServeFile(w, r, "pkg/api/branding-admin.html") - }) - - router.GET("/xrpc/place.stream.branding.getBranding", func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { - // call XRPC handler directly instead of proxying - broadcasterDID := r.URL.Query().Get("broadcaster") - output, err := a.XRPCServer.HandlePlaceStreamBrandingGetBrandingDirect(ctx, broadcasterDID) - if err != nil { - errors.WriteHTTPInternalServerError(w, "failed to fetch branding", err) - return - } - - w.Header().Set("Content-Type", "application/json") - bs, err := json.Marshal(output) - if err != nil { - errors.WriteHTTPInternalServerError(w, "unable to marshal json", err) - return - } - if _, err := w.Write(bs); err != nil { - log.Error(ctx, "error writing response", "error", err) - } - }) - - router.GET("/xrpc/place.stream.branding.getBlob", func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { - // call XRPC handler directly instead of proxying - key := r.URL.Query().Get("key") - broadcasterDID := r.URL.Query().Get("broadcaster") - reader, err := a.XRPCServer.HandlePlaceStreamBrandingGetBlobDirect(ctx, broadcasterDID, key) - if err != nil { - errors.WriteHTTPInternalServerError(w, "failed to fetch blob", err) - return - } - if _, err := io.Copy(w, reader); err != nil { - log.Error(ctx, "error writing response", "error", err) - } - }) - router.POST("/notification-blast", func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { var payload notificationpkg.NotificationBlast if err := json.NewDecoder(r.Body).Decode(&payload); err != nil { diff --git a/pkg/api/branding-admin.html b/pkg/api/branding-admin.html deleted file mode 100644 index 2cad4aace..000000000 --- a/pkg/api/branding-admin.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - - - Branding Admin - - - -
-

Branding Administration

-

Customize your Streamplace instance

- - -
-
Broadcaster DID
-
Leave empty to use server default
-
- -
-
- - -
-
Site Title
-
- Current: Loading... -
-
- - -
-
- - -
-
Site Description
-
- Current: Loading... -
-
- - -
-
- - -
-
Primary Color
-
- Current: Loading... -
-
- - -
-
- - -
-
Accent Color
-
- Current: Loading... -
-
- - -
-
- - -
-
Default Streamer
-
- Current: None -
-
- - -
-
- -
-
- - -
-
Main Logo
-
SVG, PNG, or JPEG (max 500KB)
-
-
- - -
-
- -
-
- - -
-
Favicon
-
SVG, PNG, or ICO (max 100KB)
-
-
- - -
-
- -
-
- -
Loading branding information...
-
- - - - diff --git a/pkg/spxrpc/place_stream_branding.go b/pkg/spxrpc/place_stream_branding.go index 9af77ddc1..25bad564e 100644 --- a/pkg/spxrpc/place_stream_branding.go +++ b/pkg/spxrpc/place_stream_branding.go @@ -23,12 +23,11 @@ var defaultBrandingAssets = map[string]struct { }{ // "mainLogo": {data: defaultLogoSVG, mime: "image/svg+xml"}, // "favicon": {data: defaultFaviconSVG, mime: "image/svg+xml"}, - "siteTitle": {data: []byte("Streamplace"), mime: "text/plain"}, - "siteDescription": {data: []byte("Live streaming platform"), mime: "text/plain"}, - "primaryColor": {data: []byte("#6366f1"), mime: "text/plain"}, - "accentColor": {data: []byte("#8b5cf6"), mime: "text/plain"}, - "defaultStreamKey": {data: []byte(""), mime: "text/plain"}, - "defaultStreamer": {data: []byte(""), mime: "text/plain"}, + "siteTitle": {data: []byte("Streamplace"), mime: "text/plain"}, + "siteDescription": {data: []byte("Live streaming platform"), mime: "text/plain"}, + "primaryColor": {data: []byte("#6366f1"), mime: "text/plain"}, + "accentColor": {data: []byte("#8b5cf6"), mime: "text/plain"}, + "defaultStreamer": {data: []byte(""), mime: "text/plain"}, } func (s *Server) getBroadcasterID(ctx context.Context, broadcasterDID string) string { @@ -170,7 +169,7 @@ func (s *Server) handlePlaceStreamBrandingUpdateBlob(ctx context.Context, input maxSize := 500 * 1024 // 500KB default for logos if input.Key == "favicon" { maxSize = 100 * 1024 // 100KB for favicons - } else if input.Key == "siteTitle" || input.Key == "siteDescription" || input.Key == "primaryColor" || input.Key == "accentColor" || input.Key == "defaultStreamKey" || input.Key == "defaultStreamer" { + } else if input.Key == "siteTitle" || input.Key == "siteDescription" || input.Key == "primaryColor" || input.Key == "accentColor" || input.Key == "defaultStreamer" { maxSize = 1024 // 1KB for text values } // sidebarBackgroundImage uses default 500KB limit @@ -195,10 +194,6 @@ func (s *Server) handlePlaceStreamBrandingUpdateBlob(ctx context.Context, input return nil, echo.NewHTTPError(http.StatusInternalServerError, "unable to store branding blob") } - // invalidate cache - cacheKey := fmt.Sprintf("%s:%s", broadcasterID, input.Key) - s.BrandingCache.Delete(cacheKey) - return &placestreamtypes.BrandingUpdateBlob_Output{ Success: true, }, nil @@ -232,10 +227,6 @@ func (s *Server) handlePlaceStreamBrandingDeleteBlob(ctx context.Context, input return nil, echo.NewHTTPError(http.StatusInternalServerError, "unable to delete branding blob") } - // invalidate cache - cacheKey := fmt.Sprintf("%s:%s", broadcasterID, input.Key) - s.BrandingCache.Delete(cacheKey) - return &placestreamtypes.BrandingDeleteBlob_Output{ Success: true, }, nil diff --git a/pkg/spxrpc/spxrpc.go b/pkg/spxrpc/spxrpc.go index 8a9a6707b..717f00b1b 100644 --- a/pkg/spxrpc/spxrpc.go +++ b/pkg/spxrpc/spxrpc.go @@ -24,27 +24,25 @@ import ( ) type Server struct { - e *echo.Echo - cli *config.CLI - model model.Model - OGImageCache *cache.Cache - BrandingCache *cache.Cache - ATSync *atproto.ATProtoSynchronizer - statefulDB *statedb.StatefulDB - bus *bus.Bus + e *echo.Echo + cli *config.CLI + model model.Model + OGImageCache *cache.Cache + ATSync *atproto.ATProtoSynchronizer + statefulDB *statedb.StatefulDB + bus *bus.Bus } func NewServer(ctx context.Context, cli *config.CLI, model model.Model, statefulDB *statedb.StatefulDB, op *oatproxy.OATProxy, mdlw middleware.Middleware, atsync *atproto.ATProtoSynchronizer, bus *bus.Bus) (*Server, error) { e := echo.New() s := &Server{ - e: e, - cli: cli, - model: model, - OGImageCache: cache.New(5*time.Minute, 10*time.Minute), // 5min TTL, 10min cleanup - BrandingCache: cache.New(1*time.Hour, 15*time.Minute), // 1hr TTL, 15min cleanup - ATSync: atsync, - statefulDB: statefulDB, - bus: bus, + e: e, + cli: cli, + model: model, + OGImageCache: cache.New(5*time.Minute, 10*time.Minute), // 5min TTL, 10min cleanup + ATSync: atsync, + statefulDB: statefulDB, + bus: bus, } e.Use(s.ErrorHandlingMiddleware()) e.Use(s.ContextPreservingMiddleware()) @@ -65,7 +63,6 @@ func NewServer(ctx context.Context, cli *config.CLI, model model.Model, stateful e.GET("/xrpc/_health", func(c echo.Context) error { return c.JSON(http.StatusOK, map[string]string{"version": cli.Build.Version}) }) - e.GET("/favicon.ico", s.HandleFaviconICO) e.GET("/xrpc/com.atproto.sync.subscribeRepos", s.handleComAtprotoSyncSubscribeRepos) e.GET("/xrpc/place.stream.live.subscribeSegments", s.handlePlaceStreamLiveSubscribeSegments) e.GET("/xrpc/*", s.HandleWildcard)