Documentation
¶
Index ¶
- Constants
- func CloudreveAlreadyExists(err *CloudreveAPIError) bool
- func CloudreveLogin(ctx context.Context, client *http.Client, baseURL, email, password string) (json.RawMessage, CloudreveLoginResponse, *CloudreveAPIError)
- func CloudreveOwnerNotFound(err *CloudreveAPIError) bool
- func ImmichRequest(ctx context.Context, client *http.Client, baseURL, method, path string, ...) error
- func LogoutCloudreveSession(ctx context.Context, client *http.Client, baseURL, refreshToken string) *skerrors.StackKitError
- func LogoutImmichSession(ctx context.Context, client *http.Client, baseURL, token string) *skerrors.StackKitError
- func LogoutJellyfinSession(ctx context.Context, client *http.Client, baseURL, token string) *skerrors.StackKitError
- func NewCloudreveHTTPClient() *http.Client
- func NewImmichHTTPClient() *http.Client
- func NewJellyfinHTTPClient() *http.Client
- func ParseCloudreveErrorBody(raw []byte) (int, string)
- func SupportsNativeAction(action, adapter string) bool
- type CloudreveAPIError
- func CloudreveJSON(ctx context.Context, client *http.Client, method, baseURL, path, token string, ...) (json.RawMessage, *CloudreveAPIError)
- func CloudreveRaw(ctx context.Context, client *http.Client, ...) (json.RawMessage, *CloudreveAPIError)
- func EnsureCloudreveOwnerAccount(ctx context.Context, client *http.Client, ...) *CloudreveAPIError
- type CloudreveLoginResponse
- type CloudreveOwnerRequest
- type CloudreveOwnerResult
- type CloudreveUserGroup
- type HomeAssistantOwnerRequest
- type HomeAssistantOwnerResult
- type ImmichOwnerRequest
- type ImmichOwnerResult
- type JellyfinOwnerRequest
- type JellyfinOwnerResult
- type NativeActionDescription
- type VaultwardenOwnerRequest
- type VaultwardenOwnerResult
Constants ¶
const ( // CloudrevePinnedVersion is the version admitted by the native Files // workload. The server ping is checked before any owner mutation. CloudrevePinnedVersion = "4.18.0" )
const ( // HomeAssistantPinnedVersion is the Home Assistant release used by the // native Architecture v2 workload. Callers must bind setup to the version // admitted by their applied workload. HomeAssistantPinnedVersion = architecturev2renderer.HomeAssistantRelease )
const (
JellyfinPinnedVersion = architecturev2renderer.JellyfinRelease
)
const ( // VaultwardenPinnedVersion is the release admitted by the native // Vaultwarden workload. The adapter refuses to mutate another release. VaultwardenPinnedVersion = architecturev2renderer.VaultwardenRelease )
Variables ¶
This section is empty.
Functions ¶
func CloudreveAlreadyExists ¶
func CloudreveAlreadyExists(err *CloudreveAPIError) bool
CloudreveAlreadyExists reports the registration idempotency response used by Cloudreve v4. It intentionally accepts the message form as well because older compatible builds have returned the same condition with a different HTTP status.
func CloudreveLogin ¶
func CloudreveLogin(ctx context.Context, client *http.Client, baseURL, email, password string) (json.RawMessage, CloudreveLoginResponse, *CloudreveAPIError)
CloudreveLogin performs the pinned password login without exposing token fields through any credential-free result type.
func CloudreveOwnerNotFound ¶
func CloudreveOwnerNotFound(err *CloudreveAPIError) bool
CloudreveOwnerNotFound reports only Cloudreve v4's documented user-not-found code. Other login errors, including free-form messages that happen to say "not found", must not trigger an account-creation mutation.
func ImmichRequest ¶
func ImmichRequest(ctx context.Context, client *http.Client, baseURL, method, path string, payload any, token string, out any) error
ImmichRequest is the shared bounded Immich transport. Error messages never retain response bodies, which can reflect credentials or session material.
func LogoutCloudreveSession ¶
func LogoutCloudreveSession(ctx context.Context, client *http.Client, baseURL, refreshToken string) *skerrors.StackKitError
LogoutCloudreveSession uses Cloudreve 4.18's DELETE /session/token refresh-token endpoint. The endpoint is deliberately called without an Authorization header: Cloudreve parses the refresh token from the JSON request body and revokes its root session.
func LogoutImmichSession ¶
func LogoutImmichSession(ctx context.Context, client *http.Client, baseURL, token string) *skerrors.StackKitError
LogoutImmichSession invalidates one in-memory Immich session through the pinned v2 API. Callers that own a handoff must pass context.Background() (or another live context) so cleanup still runs after the setup operation fails.
func LogoutJellyfinSession ¶
func LogoutJellyfinSession(ctx context.Context, client *http.Client, baseURL, token string) *skerrors.StackKitError
LogoutJellyfinSession invalidates one temporary Jellyfin session. The pinned endpoint returns 204 with no JSON success envelope; any other status is treated as an unconfirmed cleanup.
func NewCloudreveHTTPClient ¶
NewCloudreveHTTPClient returns the bounded client used by the local Cloudreve setup adapter. Credentials and bearer tokens must not be sent to an environment-controlled proxy or followed across a redirect.
func NewImmichHTTPClient ¶
NewImmichHTTPClient returns the bounded client used by the legacy API bootstrap path. Immich setup carries credentials and bearer tokens, so the default transport must not consult proxy environment variables and redirects must fail closed. Native setup supplies its own already-admitted client and does not pass through this constructor.
func NewJellyfinHTTPClient ¶
NewJellyfinHTTPClient returns the bounded client used by the Jellyfin setup adapter. Credentials and session tokens must not be sent through an environment-controlled proxy or across a redirect.
func ParseCloudreveErrorBody ¶
ParseCloudreveErrorBody extracts only the public code/message fields from a failed response. The body itself is never returned as an error field when an envelope is present.
func SupportsNativeAction ¶
SupportsNativeAction reports executable adapter support, separately from CUE's declared application intent. Unsupported adapters never fall back.
Types ¶
type CloudreveAPIError ¶
CloudreveAPIError is the bounded error returned by the shared Cloudreve transport. Response bodies are never retained, because they can contain session or credential material.
func CloudreveJSON ¶
func CloudreveJSON(ctx context.Context, client *http.Client, method, baseURL, path, token string, payload any) (json.RawMessage, *CloudreveAPIError)
CloudreveJSON sends one JSON request through the shared v4 envelope parser. The returned bytes are the envelope's data value, never the complete response body.
func CloudreveRaw ¶
func CloudreveRaw(ctx context.Context, client *http.Client, method, baseURL, path, token, contentType string, body []byte) (json.RawMessage, *CloudreveAPIError)
CloudreveRaw sends one request through the shared Cloudreve v4 envelope parser. It is also used for the existing binary file-content handoff.
func EnsureCloudreveOwnerAccount ¶
func EnsureCloudreveOwnerAccount(ctx context.Context, client *http.Client, baseURL, email, password, language string) *CloudreveAPIError
EnsureCloudreveOwnerAccount performs the official v4 first-user registration request. The server assigns administrator privileges to its first user; the caller still verifies that role through /admin/summary.
func (*CloudreveAPIError) Error ¶
func (e *CloudreveAPIError) Error() string
func (*CloudreveAPIError) Unwrap ¶
func (e *CloudreveAPIError) Unwrap() error
type CloudreveLoginResponse ¶
type CloudreveLoginResponse struct {
User struct {
ID json.RawMessage `json:"id"`
Email string `json:"email"`
Group *CloudreveUserGroup `json:"group,omitempty"`
} `json:"user"`
Token struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
} `json:"token"`
}
CloudreveLoginResponse is the v4 password-login response used by the legacy Files session bridge and the native adapter's in-memory handoff. The token fields never appear in CloudreveOwnerResult.
type CloudreveOwnerRequest ¶
type CloudreveOwnerRequest struct {
Email string
Password string
Language string
ExpectedVersion string
// AllowFirstOwnerRegistration must be explicitly selected by the caller
// before a missing login can cause POST /user. Cloudreve's public API does
// not expose a user-count/initialized flag, so the adapter never treats an
// unknown owner as permission to create a normal account by default.
AllowFirstOwnerRegistration bool
}
CloudreveOwnerRequest contains only owner choices supplied by the caller. Password is used during this bounded operation and is never copied into CloudreveOwnerResult or setup evidence.
type CloudreveOwnerResult ¶
type CloudreveOwnerResult struct {
ServerInitialized bool `json:"serverInitialized"`
Version string `json:"version"`
UserID string `json:"userId"`
UserEmail string `json:"userEmail"`
UserGroup string `json:"userGroup,omitempty"`
UserIsAdmin bool `json:"userIsAdmin"`
// contains filtered or unexported fields
}
CloudreveOwnerResult is the credential-free readback of a Cloudreve owner bootstrap. The temporary login material is private and can only be handed to a caller that explicitly owns a legacy session handoff.
func BootstrapCloudreveOwner ¶
func BootstrapCloudreveOwner( ctx context.Context, client *http.Client, baseURL string, request CloudreveOwnerRequest, ) (result CloudreveOwnerResult, returnErr *skerrors.StackKitError)
BootstrapCloudreveOwner performs the single technical Cloudreve owner sequence shared by native setup and the legacy Files handoff: version/initialization readback, first-user registration when the requested owner is absent, password login, current-user readback, and an admin-only readback. It does not seed demo content or consult PocketID.
func (CloudreveOwnerResult) AccessTokenForHandoff ¶
func (r CloudreveOwnerResult) AccessTokenForHandoff() string
AccessTokenForHandoff exposes only the in-memory access token to a caller that owns a separate legacy browser/session handoff.
func (*CloudreveOwnerResult) Cleanup ¶
func (r *CloudreveOwnerResult) Cleanup(ctx context.Context, client *http.Client, baseURL string) *skerrors.StackKitError
Cleanup invalidates the temporary Cloudreve session through the official refresh-token logout endpoint and then clears all in-memory token material.
func (CloudreveOwnerResult) LoginResponseForHandoff ¶
func (r CloudreveOwnerResult) LoginResponseForHandoff() json.RawMessage
LoginResponseForHandoff returns a defensive copy of the login payload for the legacy browser bridge. Native evidence must use CloudreveOwnerResult, which has no token fields.
type CloudreveUserGroup ¶
type HomeAssistantOwnerRequest ¶
type HomeAssistantOwnerRequest struct {
Username string
Password string
DisplayName string
Language string
ExpectedVersion string
}
HomeAssistantOwnerRequest contains the credentials used for the local Home Assistant owner setup. Passwords and tokens are used only in memory.
type HomeAssistantOwnerResult ¶
type HomeAssistantOwnerResult struct {
UserID string `json:"userId"`
UserIsOwner bool `json:"userIsOwner"`
UserIsAdmin bool `json:"userIsAdmin"`
ServerInitialized bool `json:"serverInitialized"`
OnboardingComplete bool `json:"onboardingComplete"`
Version string `json:"version"`
}
HomeAssistantOwnerResult is the typed, post-login readback of the owner setup. A successful return proves the current authenticated user is both an owner and an administrator; onboarding completion is reported separately.
func BootstrapHomeAssistantOwner ¶
func BootstrapHomeAssistantOwner( ctx context.Context, client *http.Client, baseURL string, request HomeAssistantOwnerRequest, ) (result HomeAssistantOwnerResult, returnErr error)
BootstrapHomeAssistantOwner creates the local owner only when the user onboarding step is still open, then always authenticates through the normal Home Assistant login flow and verifies the owner over WebSocket. The refresh token is revoked before returning, including on failure.
type ImmichOwnerRequest ¶
type ImmichOwnerRequest struct {
Email string
Password string
DisplayName string
CompleteOnboarding bool
}
ImmichOwnerRequest contains the technical setup choices supplied by the caller. The password is used only for the bounded bootstrap requests and is never copied into setup evidence.
type ImmichOwnerResult ¶
type ImmichOwnerResult struct {
ServerInitialized bool `json:"serverInitialized"`
UserID string `json:"userId"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserIsAdmin bool `json:"userIsAdmin"`
OnboardingComplete bool `json:"onboardingComplete"`
// contains filtered or unexported fields
}
func BootstrapImmichOwner ¶
func BootstrapImmichOwner( ctx context.Context, client *http.Client, baseURL string, request ImmichOwnerRequest, ) (result ImmichOwnerResult, returnErr *skerrors.StackKitError)
BootstrapImmichOwner performs the shared, app-local Immich owner bootstrap. It owns only technical Immich setup and readback; callers remain responsible for any separate identity or demo-data handoff.
func (ImmichOwnerResult) AccessTokenForHandoff ¶
func (r ImmichOwnerResult) AccessTokenForHandoff() string
AccessTokenForHandoff exposes the in-memory session only to a follow-up identity handoff. JSON serialization never includes it.
func (*ImmichOwnerResult) Cleanup ¶
func (r *ImmichOwnerResult) Cleanup(ctx context.Context, client *http.Client, baseURL string) *skerrors.StackKitError
Cleanup invalidates the temporary session created by BootstrapImmichOwner. The operation is idempotent and clears the in-memory token before making the bounded logout request.
type JellyfinOwnerRequest ¶
type JellyfinOwnerRequest struct {
Username string
Password string
ExpectedVersion string
CompleteOnboarding bool
}
JellyfinOwnerRequest contains only explicit operator credentials and the requested startup transition. The password is used in memory for this bounded operation and is never copied into the result or evidence.
type JellyfinOwnerResult ¶
type JellyfinOwnerResult struct {
Version string `json:"version"`
UserID string `json:"userId"`
UserName string `json:"userName"`
UserIsAdmin bool `json:"userIsAdmin"`
StartupWizardCompleted bool `json:"startupWizardCompleted"`
// contains filtered or unexported fields
}
JellyfinOwnerResult is the credential-free readback of the Jellyfin owner setup. The temporary access token remains private for cleanup and is never serialized or handed to another client.
func BootstrapJellyfinOwner ¶
func BootstrapJellyfinOwner( ctx context.Context, client *http.Client, baseURL string, request JellyfinOwnerRequest, ) (result JellyfinOwnerResult, returnErr *skerrors.StackKitError)
BootstrapJellyfinOwner performs the bounded Jellyfin owner sequence: version/startup readback, explicit first-user preparation when startup is incomplete, optional startup completion, password login, administrator and startup readback, and caller-owned bounded cleanup. The required first-run initialization response is discarded; only explicit owner credentials are used.
func (*JellyfinOwnerResult) Cleanup ¶
func (r *JellyfinOwnerResult) Cleanup(ctx context.Context, client *http.Client, baseURL string) *skerrors.StackKitError
Cleanup invalidates the temporary session created by BootstrapJellyfinOwner. The token is cleared before the bounded logout request is made.
type NativeActionDescription ¶
type NativeActionDescription struct {
Title string
CredentialFields []string
CredentialsFile string
GuideURL string
SupportsOnboardingCompletion bool
}
NativeActionDescription is the user-facing metadata for a native setup action. It is shared by status surfaces so they do not maintain their own application or credential lists.
func DescribeNativeAction ¶
func DescribeNativeAction(action, adapter string) (NativeActionDescription, bool)
DescribeNativeAction returns the bounded native setup contract for an action and adapter pair.
type VaultwardenOwnerRequest ¶
VaultwardenOwnerRequest contains only the explicit owner invitation input. AdminToken is resolved from the signed Apply/deployment custody by the caller, used for this bounded operation, and never copied into a result.
type VaultwardenOwnerResult ¶
type VaultwardenOwnerResult struct {
UserID string `json:"userId"`
UserEnabled bool `json:"userEnabled"`
AdminLoginVerified bool `json:"adminLoginVerified"`
Preparation string `json:"preparation"`
Version string `json:"version"`
// contains filtered or unexported fields
}
VaultwardenOwnerResult is a secret-free observation of the administrator invitation state. It deliberately does not claim personal login, encryption-key setup, or client usability.
func BootstrapVaultwardenOwner ¶
func BootstrapVaultwardenOwner( ctx context.Context, client *http.Client, baseURL string, request VaultwardenOwnerRequest, ) (result VaultwardenOwnerResult, returnErr error)
BootstrapVaultwardenOwner authenticates the exact owner-custodied admin session, checks the pinned API/config identity, and invites the requested email only when no server-side user exists. Existing invited or registered users are read back and never reinvited. The admin session must be cleaned up by the caller through Cleanup before setup evidence is persisted.
func (*VaultwardenOwnerResult) Cleanup ¶
Cleanup requests Vaultwarden's admin logout, then clears the temporary cookie value held in memory. The admin JWT is stateless in Vaultwarden, so this does not claim server-side token revocation. The extra arguments preserve the existing appsetup adapter shape; the authenticated session is bound to the client and URL admitted above.