Files

51 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2026-03-19 16:29:26 -05:00
# Sample Go Plugin (sample)
2026-03-05 00:04:26 -06:00
2026-04-15 11:11:53 -05:00
This sample lives in the `plugins/` directory and builds a native Go plugin.
2026-03-05 00:04:26 -06:00
## Files to include in the plugin zip
At the root of the zip:
2026-03-19 16:29:26 -05:00
- sample-linux-amd64.so / sample-darwin-arm64.dylib / sample-windows-amd64.dll
2026-03-05 00:04:26 -06:00
- sample.html
- sample.css
- sample.js
2026-03-19 16:29:26 -05:00
## Build
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
Use the provided build scripts:
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
```bash
# Linux/macOS
2026-06-22 10:52:27 -05:00
cd sample-go
./build.sh
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
# Multiple targets
2026-06-22 10:52:27 -05:00
BUILD_TARGETS="linux-amd64 linux-arm64 darwin-arm64" ./build.sh
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
# Windows
2026-06-22 10:52:27 -05:00
sample-go\build.bat
2026-03-19 16:29:26 -05:00
```
2026-03-05 00:04:26 -06:00
## Create the zip
2026-03-19 16:29:26 -05:00
The build script automatically creates `sample.zip` containing the built
binaries and web assets.
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
Then place `sample.zip` in `Overlord-Server/plugins`.
2026-03-05 00:04:26 -06:00
## Open the UI
Navigate to:
- /plugins/sample?clientId=<CLIENT_ID>
2026-03-19 16:29:26 -05:00
Click "Send event" and the plugin will echo back to the server logs.
2026-03-05 00:04:26 -06:00
## OS detection (Windows-only logic)
The plugin receives host metadata in the `init` payload. The sample plugin shows
how to detect the host OS and branch logic (see
2026-04-15 11:11:53 -05:00
`sample-go/native/main.go`). For example:
2026-03-05 00:04:26 -06:00
- If `host.os == "windows"`, you can safely run Windows-only flows (e.g., WinAPI-backed behavior).
- Otherwise, skip or provide a fallback path.