mirror of
https://gh-proxy.org/https://github.com/klinsmaya/CLIProxyAPI.git
synced 2026-11-10 18:36:47 +08:00
feat(pluginhost): introduce browser-navigable plugin resources in Management API
- Added `resources` field in `management.register` for defining browser-accessible resources. - Updated examples and documentation to reflect resource-based paths under `/v0/resource/plugins/<pluginID>/...`. - Replaced legacy `GET` menu routes with resource-based implementations for consistent plugin behavior. - Enhanced request handling for resource paths, including proper response headers and streamlined test coverage.
This commit is contained in:
@@ -498,7 +498,12 @@ func (a *rpcPluginAdapter) RegisterManagement(ctx context.Context, req pluginapi
|
||||
route.Handler = a
|
||||
routes = append(routes, route)
|
||||
}
|
||||
return pluginapi.ManagementRegistrationResponse{Routes: routes}, nil
|
||||
resources := make([]pluginapi.ResourceRoute, 0, len(resp.Resources))
|
||||
for _, route := range resp.Resources {
|
||||
route.Handler = a
|
||||
resources = append(resources, route)
|
||||
}
|
||||
return pluginapi.ManagementRegistrationResponse{Routes: routes, Resources: resources}, nil
|
||||
}
|
||||
|
||||
func (a *rpcPluginAdapter) HandleManagement(ctx context.Context, req pluginapi.ManagementRequest) (pluginapi.ManagementResponse, error) {
|
||||
|
||||
Reference in New Issue
Block a user