Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export OUTPUT_DIR=/tmp/recordings

- **YAML Spec**: `GET /spec.yaml`
- **JSON Spec**: `GET /spec.json`
- **Process execution guide**: [`docs/processes.md`](docs/processes.md)
- **Browser REPL guide**: [`docs/repl.md`](docs/repl.md)

## 🔧 Development
Expand Down
11 changes: 9 additions & 2 deletions server/cmd/api/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ type ApiService struct {
watches map[string]*fsWatch

// Process management
procMu sync.RWMutex
procs map[string]*processHandle
procMu sync.RWMutex
procs map[string]*processHandle
processOutput *processOutputBudget

// Neko authenticated client
nekoAuthClient *nekoclient.AuthClient
Expand Down Expand Up @@ -195,6 +196,7 @@ func New(
s2Storage S2Storage,
egressPolicy *egresspolicy.State,
webauthnHook *webauthnhook.Hook,
processOutputConfig ProcessOutputConfig,
) (*ApiService, error) {
switch {
case recordManager == nil:
Expand All @@ -215,6 +217,10 @@ func New(
return nil, fmt.Errorf("webauthnHook cannot be nil")
}

outputBudget, err := newProcessOutputBudget(processOutputConfig)
if err != nil {
return nil, err
}
screenshotEnabled := func() bool { return telemetrySession.CategoryEnabled(events.Screenshot) }
mon := cdpmonitor.New(upstreamMgr, telemetrySession.Publish, displayNum, slog.Default(), screenshotEnabled)
_ = mon.SetTelemetry(false)
Expand All @@ -226,6 +232,7 @@ func New(
defaultRecorderID: "default",
watches: make(map[string]*fsWatch),
procs: make(map[string]*processHandle),
processOutput: outputBudget,
upstreamMgr: upstreamMgr,
stz: stz,
nekoAuthClient: nekoAuthClient,
Expand Down
2 changes: 1 addition & 1 deletion server/cmd/api/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ func testWebAuthnWithMetro(t *testing.T, metroURL string) *webauthnhook.Hook {
func newSvc(t *testing.T, mgr recorder.RecordManager) (*ApiService, error) {
t.Helper()
ts, es := newTelemetrySession(t)
return New(mgr, newMockFactory(), newTestUpstreamManager(), scaletozero.NewNoopController(), newMockNekoClient(t), ts, es, 0, nil, nil, testEgressPolicy(t), testWebAuthn(t))
return New(mgr, newMockFactory(), newTestUpstreamManager(), scaletozero.NewNoopController(), newMockNekoClient(t), ts, es, 0, nil, nil, testEgressPolicy(t), testWebAuthn(t), ProcessOutputConfig{})
}

func TestApiService_PatchChromiumFlags(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion server/cmd/api/api/display_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func testFFmpegFactory(t *testing.T, tempDir string) recorder.FFmpegRecorderFact
func newTestServiceWithFactory(t *testing.T, mgr recorder.RecordManager, factory recorder.FFmpegRecorderFactory) *ApiService {
t.Helper()
ts, es := newTelemetrySession(t)
svc, err := New(mgr, factory, newTestUpstreamManager(), scaletozero.NewNoopController(), newMockNekoClient(t), ts, es, 0, nil, nil, testEgressPolicy(t), testWebAuthn(t))
svc, err := New(mgr, factory, newTestUpstreamManager(), scaletozero.NewNoopController(), newMockNekoClient(t), ts, es, 0, nil, nil, testEgressPolicy(t), testWebAuthn(t), ProcessOutputConfig{})
require.NoError(t, err)
return svc
}
Expand Down
Loading
Loading