Files
overlord/plugin-sample-go/README.md
T

50 lines
1.1 KiB
Markdown
Raw Normal View History

2026-03-19 16:29:26 -05:00
# Sample Go Plugin (sample)
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
This sample lives at the repo root 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
./build-plugin.sh
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
# Multiple targets
BUILD_TARGETS="linux-amd64 linux-arm64 darwin-arm64" ./build-plugin.sh
2026-03-05 00:04:26 -06:00
2026-03-19 16:29:26 -05:00
# Windows
build-plugin.bat
```
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-03-19 16:29:26 -05:00
`plugin-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.