Skip to content

Conversation

raiden-staging
Copy link
Contributor

[ @rgarcia ]


  • Added /screen/resolution to server, to update the neko screen resolution from the API
# | GET /screen/resolution
# | required : width,height
# | optional : rate
curl http://localhost:10001/screen/resolution?width=720&height=1280&rate=60
  • checks for ongoing ffmpeg processes to avoid interruptions in case replay is being recorded
  • uses neko websockets , adresses onkernel/neko:#3 without changes to neko

cursor[bot]

This comment was marked as outdated.

Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performed full review of 7429755...291dc99

5 files reviewed | 0 comments | Review on Mesa | Edit Reviewer Settings

parsedURL.Host = hostParts[0]
// Update the wsURL without the port
wsURL = parsedURL.String()
log.Info("fixed production WebSocket URL by removing port", "url", wsURL)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: IPv6 Parsing Error in WebSocket URL

The getWebSocketURL function incorrectly parses IPv6 addresses when removing ports. It splits the host string by :, which is problematic for IPv6 addresses that naturally contain multiple colons, leading to an invalid host and failed WebSocket connections.

Additional Locations (1)

Fix in Cursor Fix in Web

@raiden-staging
Copy link
Contributor Author

  • works on unikraft deployment now ✅

$ref: "#/components/responses/InternalError"

/screen/resolution:
get:
Copy link
Contributor

@matthewjmarangoni matthewjmarangoni Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POST may be more appropriate for modifying the screen state.

Adding a GET to retrieve the current screen state might be useful too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed!

Comment on lines +41 to +42
// SetScreenResolution endpoint
// (GET /screen/resolution)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible temporary note or outdated comment.

@matthewjmarangoni
Copy link
Contributor

Neat resolution!

A prior reduction of the default screen configuration for recording was done (PR #41). I'm unclear what the underlying host specifications are but perhaps someone else can chime in if there's value in reducing the maximum refresh rate from 240.

default:
http.Error(w, "unexpected response type", http.StatusInternalServerError)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raiden-staging cursor is correct here. The rough process to add a new endpoint:

  • add it to openapi.yaml
  • run make oapi-generate
  • implement the new method generated on StrictServerInterface

"ws://browser:8080/ws?password=admin&username=kernel",
// Local development fallback
"ws://localhost:8080/ws?password=admin&username=kernel",
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

127.0.0.1 should always work, right? We run this server alongside neko on the same instance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • should handle relaying to neko ws in different scenarios, resolves from internal / exposed / host subdomain
  • i tested on deployed unikraft with server+neko on same instance; but please confirm the api case

return SetScreenResolution409JSONResponse{
Message: "detected ongoing replay recording process, close the recording first before switching resolution",
}, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Sayan- on ideas for how this should interact with replays

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of a pgrep you could fetch the list of recorders and determine if we're actively recording via:

	recs := s.recordManager.ListActiveRecorders(ctx)
	for _, r := range recs {
		if r.IsRecording(ctx) {
			return true
		}
	}
	return false

I'd also recommend grabbing a lock and blocking StartRecording until we've completed the screen resizing

$ref: "#/components/responses/InternalError"

/screen/resolution:
get:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants