Skip to content

Conversation

@tadic-luka
Copy link
Contributor

@tadic-luka tadic-luka commented Nov 4, 2025

Summary:

adds a new route /device/send-wol/:mac-addr to send the magic WOL package to the specified mac-addr.
Method is POST and is protected.
Internally, the url handler uses already existing function from wol.go called rpcSendWOLMagicPacket.

Useful for custom wake up scripts: example is sending HTTP request through iOS shortcut to wake up a server.

I could also add a feature to specify the name of the device set up in the WOL UI if needed.

Test plan:

calling the API with curl with valid mac addr

$ curl -X POST   http://<jetkvm-ip>/device/send-wol/xx:xx:xx:xx:xx:xx
WOL sent to xx:xx:xx:xx:xx:xx

and observing the magic packet on my laptop/PC:

$ ncat -u -l 9 -k | xxd
00000000: ffff ffff ffff d050 9978 a620 d050 9978  .......P.x. .P.x
00000010: a620 d050 9978 a620 d050 9978 a620 d050  . .P.x. .P.x. .P
00000020: 9978 a620 d050 9978 a620 d050 9978 a620  .x. .P.x. .P.x.
00000030: d050 9978 a620 d050 9978 a620 d050 9978  .P.x. .P.x. .P.x
00000040: a620 d050 9978 a620 d050 9978 a620 d050  . .P.x. .P.x. .P
00000050: 9978 a620 d050 9978 a620 d050 9978 a620  .x. .P.x. .P.x.

Calling the API with curl with invalid mac addr:

curl -X POST   http://<jetkvm-ip>/device/send-wol/22 -v
...
> POST /device/send-wol/22 HTTP/1.1
...
* Request completely sent off
< HTTP/1.1 400 Bad Request
< Content-Type: text/plain; charset=utf-8
...
Invalid mac address provided

@CLAassistant
Copy link

CLAassistant commented Nov 4, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@IDisposable IDisposable left a comment

Choose a reason for hiding this comment

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

Other than to minor validation, this looks great! Thanks for the submission. Make sure you get the CLA agreement sorted, please.

@IDisposable IDisposable requested a review from Copilot November 4, 2025 22:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Wake-on-LAN (WOL) magic packet functionality to the web API, enabling remote wake-up of devices via HTTP endpoint.

  • Adds a new POST endpoint /device/send-wol/:mac-addr to send WOL magic packets
  • Implements the handleSendWOLMagicPacket handler to process WOL requests
  • Removes an extraneous blank line in the WebRTC signal handler

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tadic-luka
Copy link
Contributor Author

Updated commit:

  • added mac address validation
  • updated author email in the commit to fix the CLA issue

```

adds a new route /device/send-wol/:mac-addr to send the magic WOL package
to the specified mac-addr.
Method is POST and is protected.

Useful for custom wake up scripts: example is sending HTTP request through iOS shortcut

Test plan:
calling the API with curl
```
$ curl -X POST   http://<jetkvm-ip>/device/send-wol/xx:xx:xx:xx:xx:xx
WOL sent to xx:xx:xx:xx:xx:xx
```

and observing the magic packet on my laptop/PC:
```
$ ncat -u -l 9 -k | xxd
00000000: ffff ffff ffff d050 9978 a620 d050 9978  .......P.x. .P.x
00000010: a620 d050 9978 a620 d050 9978 a620 d050  . .P.x. .P.x. .P
00000020: 9978 a620 d050 9978 a620 d050 9978 a620  .x. .P.x. .P.x.
00000030: d050 9978 a620 d050 9978 a620 d050 9978  .P.x. .P.x. .P.x
00000040: a620 d050 9978 a620 d050 9978 a620 d050  . .P.x. .P.x. .P
00000050: 9978 a620 d050 9978 a620 d050 9978 a620  .x. .P.x. .P.x.
```

calling the api with invalid mac addr returns HTTP 400 error
```
$ curl -X POST -v http://<jetkvm-ip>/device/send-wol/abcd
...
* Request completely sent off
< HTTP/1.1 400 Bad Request
...
...
Invalid mac address provided
@tadic-luka
Copy link
Contributor Author

@IDisposable apologies if I am making too much notfications, still getting used to GitHub workflow.

@IDisposable
Copy link
Contributor

@IDisposable apologies if I am making too much notfications,

There's no such thing as too much information ;)

still getting used to GitHub workflow.

You're rocking it!

@IDisposable
Copy link
Contributor

I resolved the trivial golint issue (which directly changed your branch), make sure you FETCH/PULL to get current before doing more.

Also, for future ease on your side, I recommend not doing edits directly against the dev branch, you should create a branch for the feature/fix you're working.

@ym ym merged commit 36f06a0 into jetkvm:dev Nov 6, 2025
5 checks passed
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.

5 participants