Skip to content

feat(server): add screenshot command - #1435

Open
jooola wants to merge 15 commits into
mainfrom
server-screenshot
Open

jooola wants to merge 15 commits into
mainfrom
server-screenshot

Conversation

@jooola

@jooola jooola commented Jun 15, 2026

Copy link
Copy Markdown
Member

Adds a new hcloud server screenshot -o screenshot.png <server>, that take a screenshot of the server console using a VNC client.

Fixes #1420

@jooola

jooola commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Still missing from this PR:

  • Finalize the e2e test.
  • Replace slog logger with what the CLI is using.
  • Hide log messages from the go-vnc library.
  • Check if another fork og go-vnc is better that the one from alexnet, I saw other forks being a bit more active.
  • Maybe golang.org/x/net/websocket is not the best library, but it does not add a new dependency. Check if this is important.

@jooola jooola self-assigned this Jun 15, 2026
@jooola
jooola requested review from apricote and phm07 June 15, 2026 13:28
@codecov

codecov Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.21212% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.61%. Comparing base (c9b04e2) to head (3af1171).

Files with missing lines Patch % Lines
internal/cmd/server/screenshot.go 58.58% 41 Missing ⚠️
internal/cmd/util/vncutil/screenshot.go 82.35% 15 Missing ⚠️
internal/cli/root.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1435      +/-   ##
==========================================
+ Coverage   75.48%   79.61%   +4.13%     
==========================================
  Files         303      305       +2     
  Lines        9593     9787     +194     
==========================================
+ Hits         7241     7792     +551     
+ Misses       2352     1995     -357     
Flag Coverage Δ
e2e 55.14% <69.19%> (?)
unit 74.22% <12.62%> (-1.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread docs/reference/manual/hcloud_server.md Resolved
@apricote

apricote commented Jun 15, 2026 •

Copy link
Copy Markdown
Member

Would be awesome if users could directly show it in their terminal.

For example with the Kitty graphics protocol I can run this right now to render the image in the terminal (Ghostty):

hcloud server screenshot <name>
viu screenshot.png

If -o - would mean stdout:

hcloud server screenshot <name> -o - | viu -

@phm07
phm07 force-pushed the server-screenshot branch 2 times, most recently from 02a2d51 to 63d4b60 Compare October 14, 2026 11:05
@phm07
phm07 marked this pull request as ready for review October 14, 2026 12:15
@phm07
phm07 requested a review from a team as a code owner October 14, 2026 12:15
Comment thread internal/cmd/util/vncutil/screenshot.go Resolved
Comment thread internal/cmd/util/vncutil/screenshot.go Resolved

@jooola jooola left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looks good, maybe we could improve the maintainability of this new code.

Please rebase on top of the main branch.

Comment thread internal/cmd/util/screenshot.go Resolved
Comment thread internal/cmd/util/vncutil/screenshot.go Resolved
Comment thread internal/cmd/util/screenshot.go Resolved
@phm07
phm07 force-pushed the server-screenshot branch from 68c9986 to 1162052 Compare November 5, 2026 14:51
serverMessages chan vnc.ServerMessage
}

func OpenVNCSession(ctx context.Context, wsURL string, debugOut io.Writer) (*VNCSession, error) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
func OpenVNCSession(ctx context.Context, wsURL string, debugOut io.Writer) (*VNCSession, error) {
func NewVNCSession(ctx context.Context, wsURL string, debugOut io.Writer) (*VNCSession, error) {

@jooola jooola left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Great, thanks for pushing this the extra mile!

Looks good, free to address my suggestion or merge directly.

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.

Add a server-side console screenshot endpoint / hcloud server screenshot (PNG of the VGA console, no interactive VNC session)

3 participants