* feat: add plugin system * fix db docker build * fix hammerhead readme, add strava subscription news to docs * fixes and sdk improvements * fix: reduce Meilisearch load, debounce federation sync (#1012) * optimize meili trail index * several fixes --------- Co-authored-by: Flomp <Flomp@users.noreply.github.com> * Bump svelte from 5.55.5 to 5.56.0 in /docs (#1032) Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 5.55.5 to 5.56.0. - [Release notes](https://github.com/sveltejs/svelte/releases) - [Changelog](https://github.com/sveltejs/svelte/blob/main/packages/svelte/CHANGELOG.md) - [Commits](https://github.com/sveltejs/svelte/commits/svelte@5.56.0/packages/svelte) --- updated-dependencies: - dependency-name: svelte dependency-version: 5.56.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Flomp <Flomp@users.noreply.github.com> * Release v0.19.2 (#1035) * chore: release v0.19.2 * add changelog --------- Co-authored-by: Flomp <26000991+Flomp@users.noreply.github.com> Co-authored-by: Christian Beutel <> * speed up plugin sync and several small fixes * concepts for security improvements and process stability * improve concept * security concept implemented * remove insecure TLS * worker concept implemented * fixes and cleanup * fixes * docu * mermaid, namings * WASM plugin host improvements, plugin logging * fix db migration * Improve plugin config and category mapping UI * fixes * further fixes * remove manual test sync * fix db migration and strava mapping * type added, UI improvements * fix plugin card toggle clickable area * optimize synch status card layout * plugin type 'trails' instead of 'integration' * session auth validation in UI * fix komoot date and waypoints * improve category mapping * fix send to hammerhead: trail name * plugin setup error handling improved * fix review findings * re-mapping added * rename remote_category --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Flomp <Flomp@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Flomp <26000991+Flomp@users.noreply.github.com>
213 lines
7.3 KiB
Go
213 lines
7.3 KiB
Go
package pluginsystem
|
|
|
|
const (
|
|
ManifestVersion = "1.0"
|
|
RuntimeWASM = "wasm"
|
|
|
|
PluginTypeTrails = "trails"
|
|
|
|
AuthTypeOAuth2 = "oauth2"
|
|
AuthTypeAPIKey = "api_key"
|
|
AuthTypeBearer = "bearer"
|
|
AuthTypeSession = "session"
|
|
|
|
AuthRefreshModeHost = "host"
|
|
AuthRefreshModePlugin = "plugin"
|
|
|
|
AuthPlacementQuery = "query"
|
|
AuthHeaderAuthorization = "Authorization"
|
|
AuthSchemeBearer = "Bearer"
|
|
TokenRequestFormatJSON = "json"
|
|
TokenAuthClientSecretPost = "client_secret_post"
|
|
TokenAuthClientSecretBasic = "client_secret_basic"
|
|
|
|
HostRequestBodyTypeJSON = "json"
|
|
HostRequestBodyTypeForm = "form"
|
|
HostRequestBodyTypeMultipart = "multipart"
|
|
MultipartSourceTrail = "trail"
|
|
MultipartSourceTrailGPX = "trail.gpx"
|
|
MultipartTrailFilename = "trail.gpx"
|
|
)
|
|
|
|
type Manifest struct {
|
|
ManifestVersion string `json:"manifestVersion"`
|
|
ID string `json:"id"`
|
|
Type string `json:"type"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description,omitempty"`
|
|
Version string `json:"version"`
|
|
Runtime RuntimeManifest `json:"runtime"`
|
|
Capabilities []CapabilityManifest `json:"capabilities"`
|
|
Auth AuthManifest `json:"auth,omitempty"`
|
|
Permissions PermissionManifest `json:"permissions,omitempty"`
|
|
ConfigSchema []ConfigField `json:"configSchema,omitempty"`
|
|
HostConfig map[string]any `json:"hostConfig,omitempty"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|
|
|
|
type RuntimeManifest struct {
|
|
Type string `json:"type"`
|
|
Entrypoint string `json:"entrypoint"`
|
|
}
|
|
|
|
type CapabilityManifest struct {
|
|
Name string `json:"name"`
|
|
Version string `json:"version"`
|
|
Export string `json:"export"`
|
|
RequiredFunctions []string `json:"requiredHostFunctions,omitempty"`
|
|
Job string `json:"job,omitempty"`
|
|
}
|
|
|
|
type ConfigField struct {
|
|
Key string `json:"key"`
|
|
Type string `json:"type"`
|
|
Label string `json:"label,omitempty"`
|
|
Labels map[string]string `json:"labels,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
Descriptions map[string]string `json:"descriptions,omitempty"`
|
|
Options []ConfigFieldOption `json:"options,omitempty"`
|
|
Default any `json:"default,omitempty"`
|
|
Required bool `json:"required,omitempty"`
|
|
Hidden bool `json:"hidden,omitempty"`
|
|
}
|
|
|
|
type ConfigFieldOption struct {
|
|
Value string `json:"value"`
|
|
Label string `json:"label,omitempty"`
|
|
Labels map[string]string `json:"labels,omitempty"`
|
|
}
|
|
|
|
type AuthManifest struct {
|
|
Contexts map[string]AuthContext `json:"contexts,omitempty"`
|
|
}
|
|
|
|
type AuthContext struct {
|
|
Type string `json:"type"`
|
|
Fields []string `json:"fields,omitempty"`
|
|
AuthorizationURL string `json:"authorizationUrl,omitempty"`
|
|
TokenURL string `json:"tokenUrl,omitempty"`
|
|
Scopes []string `json:"scopes,omitempty"`
|
|
ScopeSeparator string `json:"scopeSeparator,omitempty"`
|
|
PKCE bool `json:"pkce,omitempty"`
|
|
TokenRequestFormat string `json:"tokenRequestFormat,omitempty"`
|
|
TokenAuth string `json:"tokenAuth,omitempty"`
|
|
AuthorizationParams map[string]string `json:"authorizationParams,omitempty"`
|
|
Refresh *AuthRefresh `json:"refresh,omitempty"`
|
|
Placement string `json:"placement,omitempty"`
|
|
Name string `json:"name,omitempty"`
|
|
SecretField string `json:"secretField,omitempty"`
|
|
SecretFields []string `json:"secretFields,omitempty"`
|
|
}
|
|
|
|
type AuthRefresh struct {
|
|
Mode string `json:"mode"`
|
|
GrantType string `json:"grantType,omitempty"`
|
|
Function string `json:"function,omitempty"`
|
|
}
|
|
|
|
type PermissionManifest struct {
|
|
Network NetworkPermissions `json:"network,omitempty"`
|
|
Auth []string `json:"auth,omitempty"`
|
|
Downloads DownloadPermissions `json:"downloads,omitempty"`
|
|
Uploads UploadPermissions `json:"uploads,omitempty"`
|
|
}
|
|
|
|
type NetworkPermissions struct {
|
|
Connectors []ConnectorTargetPermission `json:"connectors,omitempty"`
|
|
Redirects RedirectPermissions `json:"redirects,omitempty"`
|
|
}
|
|
|
|
type ConnectorTargetPermission struct {
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
FixedBaseURL string `json:"fixedBaseURL,omitempty"`
|
|
ConfigKey string `json:"configKey,omitempty"`
|
|
AllowedPathPrefixes []string `json:"allowedPathPrefixes,omitempty"`
|
|
Auth []string `json:"auth,omitempty"`
|
|
SupportsMediaAuth bool `json:"supportsMediaAuth,omitempty"`
|
|
SupportsStorageRedirects bool `json:"supportsStorageRedirects,omitempty"`
|
|
SupportsCustomTLS bool `json:"supportsCustomTLS,omitempty"`
|
|
}
|
|
|
|
type RedirectPermissions struct {
|
|
Mode string `json:"mode,omitempty"`
|
|
Hosts []string `json:"hosts,omitempty"`
|
|
}
|
|
|
|
type DownloadPermissions struct {
|
|
MaxBytes int64 `json:"maxBytes,omitempty"`
|
|
ContentTypes []string `json:"contentTypes,omitempty"`
|
|
}
|
|
|
|
type UploadPermissions struct {
|
|
MaxBytes int64 `json:"maxBytes,omitempty"`
|
|
ContentTypes []string `json:"contentTypes,omitempty"`
|
|
}
|
|
|
|
type HostRequestSpec struct {
|
|
Method string `json:"method"`
|
|
Target RequestTarget `json:"target"`
|
|
Auth string `json:"auth,omitempty"`
|
|
Headers map[string]string `json:"headers,omitempty"`
|
|
Body *HostRequestBody `json:"body,omitempty"`
|
|
Expect ResponseExpect `json:"expect,omitempty"`
|
|
FollowRedirects *bool `json:"followRedirects,omitempty"`
|
|
}
|
|
|
|
type RequestTarget struct {
|
|
Type string `json:"type"`
|
|
Connector string `json:"connector,omitempty"`
|
|
Path string `json:"path,omitempty"`
|
|
Query []QueryParam `json:"query,omitempty"`
|
|
}
|
|
|
|
type QueryParam struct {
|
|
Name string `json:"name"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
type HostRequestBody struct {
|
|
Type string `json:"type"`
|
|
JSON any `json:"json,omitempty"`
|
|
Form []FormField `json:"form,omitempty"`
|
|
Parts []MultipartPart `json:"parts,omitempty"`
|
|
}
|
|
|
|
type FormField struct {
|
|
Name string `json:"name"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
type MultipartPart struct {
|
|
Name string `json:"name"`
|
|
Source string `json:"source,omitempty"`
|
|
Filename string `json:"filename,omitempty"`
|
|
ContentType string `json:"contentType,omitempty"`
|
|
JSON any `json:"json,omitempty"`
|
|
}
|
|
|
|
type ResponseExpect struct {
|
|
ContentTypes []string `json:"contentTypes,omitempty"`
|
|
MaxBytes int64 `json:"maxBytes,omitempty"`
|
|
}
|
|
|
|
type TrackTransferPlan struct {
|
|
Format string `json:"format"`
|
|
Transfer HostRequestSpec `json:"transfer"`
|
|
}
|
|
|
|
type TrailSendPlan struct {
|
|
Request HostRequestSpec `json:"request"`
|
|
}
|
|
|
|
type PluginError struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message,omitempty"`
|
|
RetryAfterSeconds *int `json:"retryAfterSeconds,omitempty"`
|
|
}
|
|
|
|
type HostLogEntry struct {
|
|
Level string `json:"level"`
|
|
Message string `json:"message"`
|
|
}
|