-
Notifications
You must be signed in to change notification settings - Fork 30
[Extending API] /screen/resolution #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Extending API] /screen/resolution #61
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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)
|
$ref: "#/components/responses/InternalError" | ||
|
||
/screen/resolution: | ||
get: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
// SetScreenResolution endpoint | ||
// (GET /screen/resolution) |
There was a problem hiding this comment.
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.
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) | ||
} | ||
} |
There was a problem hiding this comment.
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", | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
[ @rgarcia ]
/screen/resolution
to server, to update the neko screen resolution from the APIonkernel/neko:#3
without changes to neko