feat(http): ff and uxt are disabled by default

This commit is contained in:
Alexander 2024-09-03 11:41:24 +02:00
parent 7634db34db
commit bbf1dbcc23
7 changed files with 40 additions and 27 deletions

View file

@ -106,7 +106,9 @@ ENV TZ=UTC \
RECORD_CANVAS=true \
JWT_SECRET="SECRET" \
JWT_SPOT_SECRET="SECRET" \
BUCKET_NAME="spots"
BUCKET_NAME="spots" \
IS_FEATURE_FLAG_ENABLED=false \
IS_USABILITY_TEST_ENABLED=false
RUN if [ "$SERVICE_NAME" = "http" ]; then \

View file

@ -37,6 +37,8 @@ type Config struct {
CanvasFps int `env:"CANVAS_FPS,default=1"`
MobileQuality string `env:"MOBILE_QUALITY,default=low"` // (low, standard, high)
MobileFps int `env:"MOBILE_FPS,default=1"`
IsFeatureFlagEnabled bool `env:"IS_FEATURE_FLAG_ENABLED,default=false"`
IsUsabilityTestEnabled bool `env:"IS_USABILITY_TEST_ENABLED,default=false"`
WorkerID uint16
}

View file

@ -164,6 +164,7 @@ func (e *Router) startMobileSessionHandler(w http.ResponseWriter, r *http.Reques
ImageQuality: e.cfg.MobileQuality,
FrameRate: e.cfg.MobileFps,
ProjectID: strconv.FormatUint(uint64(p.ProjectID), 10),
Features: e.features,
}, startTime, r.URL.Path, 0)
}

View file

@ -281,6 +281,7 @@ func (e *Router) startSessionHandlerWeb(w http.ResponseWriter, r *http.Request)
CanvasEnabled: e.cfg.RecordCanvas,
CanvasImageQuality: e.cfg.CanvasQuality,
CanvasFrameRate: e.cfg.CanvasFps,
Features: e.features,
}
modifyResponse(req, startResponse)

View file

@ -26,12 +26,13 @@ type StartMobileSessionRequest struct {
}
type StartMobileSessionResponse struct {
Token string `json:"token"`
ImagesHashList []string `json:"imagesHashList"`
UserUUID string `json:"userUUID"`
BeaconSizeLimit int64 `json:"beaconSizeLimit"`
SessionID string `json:"sessionID"`
ImageQuality string `json:"quality"`
FrameRate int `json:"fps"`
ProjectID string `json:"projectID"`
Token string `json:"token"`
ImagesHashList []string `json:"imagesHashList"`
UserUUID string `json:"userUUID"`
BeaconSizeLimit int64 `json:"beaconSizeLimit"`
SessionID string `json:"sessionID"`
ImageQuality string `json:"quality"`
FrameRate int `json:"fps"`
ProjectID string `json:"projectID"`
Features map[string]bool `json:"features"`
}

View file

@ -30,6 +30,7 @@ type Router struct {
services *http2.ServicesBuilder
beaconSizeCache map[uint64]*BeaconSize // Cache for session's beaconSize
compressionThreshold int64
features map[string]bool
}
func NewRouter(cfg *http3.Config, log logger.Logger, services *http2.ServicesBuilder) (*Router, error) {
@ -48,6 +49,10 @@ func NewRouter(cfg *http3.Config, log logger.Logger, services *http2.ServicesBui
services: services,
beaconSizeCache: make(map[uint64]*BeaconSize),
compressionThreshold: cfg.CompressionThreshold,
features: map[string]bool{
"feature-flags": cfg.IsFeatureFlagEnabled,
"usability-test": cfg.IsUsabilityTestEnabled,
},
}
e.init()
go e.clearBeaconSizes()

View file

@ -22,24 +22,25 @@ type StartSessionRequest struct {
}
type StartSessionResponse struct {
Timestamp int64 `json:"timestamp"`
StartTimestamp int64 `json:"startTimestamp"`
Delay int64 `json:"delay"`
Token string `json:"token"`
UserUUID string `json:"userUUID"`
UserOS string `json:"userOS"`
UserDevice string `json:"userDevice"`
UserBrowser string `json:"userBrowser"`
UserCountry string `json:"userCountry"`
UserState string `json:"userState"`
UserCity string `json:"userCity"`
SessionID string `json:"sessionID"`
ProjectID string `json:"projectID"`
BeaconSizeLimit int64 `json:"beaconSizeLimit"`
CompressionThreshold int64 `json:"compressionThreshold"`
CanvasEnabled bool `json:"canvasEnabled"` // false default
CanvasImageQuality string `json:"canvasQuality"` // low | medium | high
CanvasFrameRate int `json:"canvasFPS"` // 2 default
Timestamp int64 `json:"timestamp"`
StartTimestamp int64 `json:"startTimestamp"`
Delay int64 `json:"delay"`
Token string `json:"token"`
UserUUID string `json:"userUUID"`
UserOS string `json:"userOS"`
UserDevice string `json:"userDevice"`
UserBrowser string `json:"userBrowser"`
UserCountry string `json:"userCountry"`
UserState string `json:"userState"`
UserCity string `json:"userCity"`
SessionID string `json:"sessionID"`
ProjectID string `json:"projectID"`
BeaconSizeLimit int64 `json:"beaconSizeLimit"`
CompressionThreshold int64 `json:"compressionThreshold"`
CanvasEnabled bool `json:"canvasEnabled"` // false default
CanvasImageQuality string `json:"canvasQuality"` // low | medium | high
CanvasFrameRate int `json:"canvasFPS"` // 2 default
Features map[string]bool `json:"features"`
}
func recordSession(req *StartSessionRequest) bool {