openreplay/ee/backend/pkg/sessions/api/web/model.go
Alexander 6830c8879f
web module refactoring (#2725)
* feat(server): moved an http server object into a pkg subdir to be reusable for http, spots, and integrations

* feat(web): isolated web module (server, router, middleware, utils) used in spots and new integrations

* feat(web): removed possible panic

* feat(web): split all handlers from http service into different packages for better management.

* feat(web): changed router's method signature

* feat(web): added missing handlers interface

* feat(web): added health middleware to remove unnecessary checks

* feat(web): customizable middleware set for web servers

* feat(web): simplified the handler's structure

* feat(web): created an unified server.Run method for all web services (http, spot, integrations)

* feat(web): fixed a json size limit issue

* feat(web): removed Keys and PG connection from router

* feat(web): simplified integration's main file

* feat(web): simplified spot's main file

* feat(web): simplified http's main file (builder)

* feat(web): refactored audit trail functionality

* feat(web): added ee version of audit trail

* feat(web): added ee version of conditions module

* feat(web): moved ee version of some web session structs

* feat(web): new format of web metrics

* feat(web): added new web metrics to all handlers

* feat(web): added justExpired feature to web ingest handler

* feat(web): added small integrations improvements
2024-11-21 17:48:04 +01:00

62 lines
2.6 KiB
Go

package web
type NotStartedRequest struct {
ProjectKey *string `json:"projectKey"`
TrackerVersion string `json:"trackerVersion"`
DoNotTrack bool `json:"DoNotTrack"`
}
type StartSessionRequest struct {
Token string `json:"token"`
UserUUID *string `json:"userUUID"`
RevID string `json:"revID"`
Timestamp int64 `json:"timestamp"`
Timezone string `json:"timezone"`
TrackerVersion string `json:"trackerVersion"`
IsSnippet bool `json:"isSnippet"`
DeviceMemory uint64 `json:"deviceMemory"`
JsHeapSizeLimit uint64 `json:"jsHeapSizeLimit"`
ProjectKey *string `json:"projectKey"`
Reset bool `json:"reset"`
UserID string `json:"userID"`
DoNotRecord bool `json:"doNotRecord"` // start record session or not
BufferDiff uint64 `json:"bufferDiff"` // buffer diff in ms for start record session
IsOffline bool `json:"isOffline"` // to indicate that we have to use user's start timestamp
Condition string `json:"condition"` // condition for start record session
Width int `json:"width"`
Height int `json:"height"`
AssistOnly bool `json:"assistOnly"`
}
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
AssistOnly bool `json:"assistOnly"`
Features map[string]bool `json:"features"`
}
func recordSession(req *StartSessionRequest) bool {
return !req.DoNotRecord && !req.AssistOnly
}
func modifyResponse(req *StartSessionRequest, res *StartSessionResponse) {
if req.AssistOnly {
res.AssistOnly = true
}
}