Documentation
¶
Overview ¶
Package capability probes runtime feature availability — both binary tools (ffmpeg, gs, libreoffice, vips) and external HTTP services (OnlyOffice, Drawio).
Results are cached so the /api/capabilities endpoint is cheap: 1h after a fully-successful probe round, but only 2 minutes when any external probe failed — a transient outage must not pin an "unreachable" banner in the UI for a whole hour.
Index ¶
- func MarshalJSONForResponse(c *model.Capabilities) ([]byte, error)
- type Service
- func (s *Service) AttachStorageResolver(resolver func(int64) (storage.Driver, error))
- func (s *Service) Get(ctx context.Context) (*model.Capabilities, error)
- func (s *Service) Invalidate()
- func (s *Service) ProbeExternal(ctx context.Context, name string) (*model.ExternalServiceState, error)
- func (s *Service) SetAppPlugins(v model.AppPluginsCapabilities)
- func (s *Service) SetAuthDrivers(names []string)
- func (s *Service) SetRecoveryLogin(on bool)
- func (s *Service) SetStaticInventory(authDrivers, storageDrivers []string, dbDriver string, searchEnabled bool, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalJSONForResponse ¶
func MarshalJSONForResponse(c *model.Capabilities) ([]byte, error)
MarshalJSONForResponse serializes Capabilities for the public API.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service answers /api/capabilities and persists external_services state.
func (*Service) AttachStorageResolver ¶
AttachStorageResolver wires the resolver used for per-storage capability probes. Optional — when nil the response omits the per-storage map.
func (*Service) Get ¶
Get returns the current Capabilities snapshot, refreshing if the cache expired (okTTL after a clean probe round, failTTL when any external probe failed).
func (*Service) Invalidate ¶
func (s *Service) Invalidate()
Invalidate forces the next Get to re-probe.
func (*Service) ProbeExternal ¶
func (s *Service) ProbeExternal(ctx context.Context, name string) (*model.ExternalServiceState, error)
ProbeExternal probes a single named external service immediately and returns its fresh state. The capability cache is invalidated as a side effect so the next /api/capabilities call sees the updated row.
func (*Service) SetAppPlugins ¶
func (s *Service) SetAppPlugins(v model.AppPluginsCapabilities)
SetAppPlugins records the app-plugin runtime state for the snapshot.
func (*Service) SetAuthDrivers ¶
SetAuthDrivers records the sign-in methods the login page offers. The Identity providers page changes them without a restart (internal/authsetup), so this is set on every swap, not only at boot.
func (*Service) SetRecoveryLogin ¶
SetRecoveryLogin records whether recovery sign-in is active (see model.Capabilities.AuthRecoveryLogin).
func (*Service) SetStaticInventory ¶
func (s *Service) SetStaticInventory( authDrivers, storageDrivers []string, dbDriver string, searchEnabled bool, version, build string, demoMode bool, demoUser, demoPass string, defaultLocale string, oidcAutoRedirect bool, )
SetStaticInventory wires the boot-time-known fields into the Capabilities response. Safe to call once before the first Get().