cpa-plugin-usage-keeper

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 14 Imported by: 0

README

CPA Usage Keeper Plugin

CPA plugin for CLIProxyAPI that adds a Keeper resource entry to CPAMC and opens CPA Usage Keeper inside the management-center plugin iframe.

This plugin requires cpa-usage-keeper v1.12.2 or later.

The plugin does not proxy Keeper APIs and does not create Keeper sessions. It only registers a browser resource route and embeds the configured Keeper application URL with embed=cpamc.

Configuration

Enable the plugin in CPA and configure the Keeper application root URL:

plugins:
  enabled: true
  configs:
    keeper:
      enabled: true
      priority: 1
      keeper_url: "https://cpa.example.com/keeper/"

keeper_url must be a full http:// or https:// application root URL. It must not include query parameters or fragments.

The configured Keeper instance must run cpa-usage-keeper v1.12.2 or later.

Examples:

https://cpa.example.com/keeper/
https://keeper.example.com/

For the most reliable embedded login experience, deploy Keeper under the same browser origin as CPAMC, preferably as a subpath such as /keeper/.

Management API

The plugin declares the management_api capability and registers a single browser resource route. It does not add JSON management endpoints and does not proxy requests to Keeper.

Resource Page

The plugin registers one Management API resource:

GET /v0/resource/plugins/keeper/open

CPAMC renders plugin resources in an iframe. This resource page immediately loads Keeper in an inner iframe with:

<keeper_url>?embed=cpamc

If the plugin is missing keeper_url, or the value is invalid, the resource page renders a small configuration message instead.

If Keeper cannot be reached, is served from the wrong base path, or runs an older version that does not support CPAMC embed readiness, the resource page shows a small troubleshooting message instead of exposing a browser error page.

Keeper owns its own authentication. Cross-site iframe login may fail when the browser blocks third-party cookies or when Keeper is deployed with incompatible cookie settings. This plugin does not implement a token bridge or popup login flow.

Build

Requires Go 1.26.10 and a C compiler for the target platform.

make test
make build
make package

On macOS this creates:

dist/keeper.dylib
dist/keeper_0.1.1_darwin_arm64.zip
dist/keeper_0.1.1_darwin_arm64.zip.sha256

Install locally by copying the dynamic library to CPA's plugin discovery directory, for example:

mkdir -p /path/to/CLIProxyAPI/plugins/darwin/arm64
cp dist/keeper.dylib /path/to/CLIProxyAPI/plugins/darwin/arm64/keeper.dylib

Target platform, output directory, and runtime plugin version can be overridden:

make build GOOS=darwin GOARCH=arm64 BUILD_DIR=/path/to/plugins/darwin/arm64
make package VERSION=0.1.1

Plugin Store Release

For plugin-store installation, each GitHub release must include:

keeper_<version>_<goos>_<goarch>.zip
checksums.txt

The release workflow publishes the following platform archives:

Expected asset names for version 0.1.1:

keeper_0.1.1_darwin_amd64.zip
keeper_0.1.1_darwin_arm64.zip
keeper_0.1.1_freebsd_amd64.zip
keeper_0.1.1_linux_amd64.zip
keeper_0.1.1_linux_arm64.zip
keeper_0.1.1_windows_amd64.zip
keeper_0.1.1_windows_arm64.zip
checksums.txt

Each zip must contain the dynamic library at the zip root:

  • Darwin: keeper.dylib
  • FreeBSD: keeper.so
  • Linux: keeper.so
  • Windows: keeper.dll

checksums.txt must be in sha256sum format.

Generate a local aggregate checksum file with:

make checksums VERSION=0.1.1

This plugin is already listed in router-for-me/CLIProxyAPI-Plugins-Store. Publish a new stable GitHub release to distribute an update; CPA reads the latest release from this repository. The registry only needs updating when the plugin's listing information changes, such as its repository or description.

Pushing a v<version> tag triggers the release workflow to build the platform archives and publish them with checksums.txt. Pushing commits to main alone does not publish a plugin update.

License

This project is open source under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL