diff --git a/.github/workflows/examples-js.yml b/.github/workflows/examples-js.yml index 70bb9bc..9327bbf 100644 --- a/.github/workflows/examples-js.yml +++ b/.github/workflows/examples-js.yml @@ -56,14 +56,19 @@ jobs: # Build owncast-plugin-test/serve from source and drop them into the # shared cache, replacing the released binaries postinstall fetched, so - # examples run against the current runtime. The runtime lives in owncast - # (services/plugins); GOPRIVATE + @develop matches release.yml. + # examples run against the current runtime. A matching branch in the + # Owncast repository takes precedence over develop for cross-repo stacks. - name: Build host binaries from source working-directory: host-runtime env: GOPRIVATE: github.com/owncast/owncast run: | - go get github.com/owncast/owncast@develop + owncast_ref=develop + if [[ -n "${GITHUB_HEAD_REF:-}" ]] && git ls-remote --exit-code --heads https://github.com/owncast/owncast.git "refs/heads/${GITHUB_HEAD_REF}" >/dev/null; then + owncast_ref="${GITHUB_HEAD_REF}" + fi + echo "Building against owncast@${owncast_ref}" + go get "github.com/owncast/owncast@${owncast_ref}" go build -o ../sdks/js/bin/.cache/owncast-plugin-test ./cmd/owncast-plugin-test go build -o ../sdks/js/bin/.cache/owncast-plugin-serve ./cmd/owncast-plugin-serve diff --git a/.github/workflows/examples-python.yml b/.github/workflows/examples-python.yml index 9e2fda1..d7128dc 100644 --- a/.github/workflows/examples-python.yml +++ b/.github/workflows/examples-python.yml @@ -39,14 +39,19 @@ jobs: go-version-file: host-runtime/go.mod cache-dependency-path: host-runtime/go.sum - # Build owncast-plugin-test/serve from the current owncast runtime - # (services/plugins). GOPRIVATE + @develop matches release.yml. + # Build owncast-plugin-test/serve from the current owncast runtime. + # A matching Owncast branch takes precedence over develop for stacked PRs. - name: Build host binaries from source working-directory: host-runtime env: GOPRIVATE: github.com/owncast/owncast run: | - go get github.com/owncast/owncast@develop + owncast_ref=develop + if [[ -n "${GITHUB_HEAD_REF:-}" ]] && git ls-remote --exit-code --heads https://github.com/owncast/owncast.git "refs/heads/${GITHUB_HEAD_REF}" >/dev/null; then + owncast_ref="${GITHUB_HEAD_REF}" + fi + echo "Building against owncast@${owncast_ref}" + go get "github.com/owncast/owncast@${owncast_ref}" mkdir -p "$GITHUB_WORKSPACE/pytoolchain/bin" "$GITHUB_WORKSPACE/pytoolchain/share" go build -o "$GITHUB_WORKSPACE/pytoolchain/bin/owncast-plugin-test" ./cmd/owncast-plugin-test go build -o "$GITHUB_WORKSPACE/pytoolchain/bin/owncast-plugin-serve" ./cmd/owncast-plugin-serve diff --git a/docs/PLUGIN_AUTHOR_GUIDE.md b/docs/PLUGIN_AUTHOR_GUIDE.md index a29166f..5e08f14 100644 --- a/docs/PLUGIN_AUTHOR_GUIDE.md +++ b/docs/PLUGIN_AUTHOR_GUIDE.md @@ -654,7 +654,7 @@ Sends are fire-and-forget: the call returns immediately and never blocks, even i Notes: - Up to 64 simultaneous connections per plugin. Over that the endpoint returns 503. `EventSource` reconnects automatically. -- If the channel matches one of your `admin.pages[]` globs it's auth-gated like any admin route, handy for an admin-only stats stream. +- If the channel matches one of your `admin.pages` path globs, it is auth-gated like any admin route. This is useful for an admin-only stats stream. - The endpoint is host-owned and reserved: your `onHttpRequest` never sees `/_sse/...` requests, and you can't serve your own route there. ### Knowing who is connected @@ -738,32 +738,33 @@ Prefer it over building a bespoke settings page and KV plumbing. ## Admin pages -Plugins can register pages that appear in the Owncast admin UI for configuration. Declare them in the manifest: +Plugins can register pages that appear in the Owncast admin UI for configuration. Each `pages` object key is a plugin-relative path glob: ```json { "permissions": ["http.serve"], "admin": { - "pages": [ - { "title": "Settings", "path": "/admin", "icon": "gear" }, - { "title": "Settings", "path": "/admin/*" } - ] + "pages": { + "/admin": { "title": "Settings", "icon": "gear" }, + "/admin/*": { "title": "Settings" } + } } } ``` -- `path` is a glob (e.g. `"/admin"`, `"/admin/*"`). Requests under `/plugins//` that match any declared glob are **auth-gated by the host**, unauthenticated requests get `401` before your plugin code ever runs. +- Each key is a path glob such as `"/admin"` or `"/admin/*"`. Requests under `/plugins//` that match any declared glob are **auth-gated by the host**. Unauthenticated requests get `401` before your plugin code runs. - Owncast's admin renders each declared page as a tab inside `/admin/plugins/configure?id=`, embedded as an iframe pointed at `/plugins//`. Each plugin gets its own bookmarkable URL plus a sidebar entry under **Plugins** in the admin nav. - Both static assets and dynamic endpoints under matched paths are auth-gated. You don't have to check `req.authenticated` yourself. -- The host auto-injects an admin-themed stylesheet (`/styles/admin/plugin-iframe.css`) into HTML responses on admin paths so plain ``/`