uc

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

UC Cloud Drive

This source mounts a folder from an authenticated UC website session. It supports metadata, paged directory listing, original-file streaming and exact single byte ranges. It can serve as a Core Copy source. Core.Remove moves one file into the UC recycle bin by file ID. The driver confirms the native task result and rechecks the original directory by ID. An unconfirmed result retains an unknown effect. Directory and conditional removal are unavailable.

The host opens a browser tab on the UC website and provides its CDP context and a page call that evaluates a function with one JSON argument. Use WebsiteAccount to check the signed-in account, then call OpenWebsite with the account and folder path. Save the returned RootID and supply it when reopening the mount.

OpenWebsite verifies the account, folder and first page before adopting the release callback. Until it succeeds, the host owns the tab and its cleanup. The driver correlates the selected file, the website's download grant and the attachment response before opening the stream. The browser must stay available until the mount closes. Empty files that the website downloads locally and downloads without a usable website folder route are unsupported.

Documentation

Index

Constants

View Source
const WebsiteURL = websiteOrigin + "/"

WebsiteURL is the page where a user signs in to UC Cloud Drive.

Variables

View Source
var (
	ErrWebsiteSignIn          = errors.New("the UC website needs sign-in")
	ErrWebsiteBindingMismatch = errors.New("the UC website account or folder changed")
)

Functions

func WebsiteAccount

func WebsiteAccount(ctx context.Context, call WebsiteCall) (string, error)

WebsiteAccount verifies the account in the authenticated page.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver exposes an authenticated UC folder.

func OpenWebsite

func OpenWebsite(ctx context.Context, o WebsiteOptions) (*Driver, error)

OpenWebsite checks the bound account, root identity and first native page.

func (*Driver) Close

func (d *Driver) Close() error

func (*Driver) Enumerate

func (d *Driver) Enumerate(ctx context.Context, q core.NativeQuery) (core.Iterator, error)

func (*Driver) Open

func (d *Driver) Open(ctx context.Context, address core.NativeAddress, options core.OpenOptions) (core.Opened, error)

func (*Driver) Remove added in v0.2.0

func (d *Driver) Remove(ctx context.Context, p core.NativeAddress, options ...core.RemoveOptions) (core.Change, error)

func (*Driver) RemoveWithDisposition added in v0.2.0

func (d *Driver) RemoveWithDisposition(ctx context.Context, target core.NativeAddress, options core.RemoveOptions) (core.Change, error)

func (*Driver) RootID

func (d *Driver) RootID() string

RootID returns the native identity of the mounted folder.

func (*Driver) Stat

func (d *Driver) Stat(ctx context.Context, address core.NativeAddress, selections ...core.ReadSelection) (core.Metadata, error)

type WebsiteCall

type WebsiteCall = func(context.Context, string, json.RawMessage) (json.RawMessage, error)

WebsiteCall evaluates a UC page function with one JSON argument.

type WebsiteOptions

type WebsiteOptions struct {
	Tab              context.Context
	Call             WebsiteCall
	Account          string
	RootPath, RootID string
	Release          func() error

	// Origin and GrantEndpoint override the download endpoints for loopback fixtures.
	Origin, GrantEndpoint string
}

WebsiteOptions binds an authenticated page to a selected UC folder. The caller retains the page on failure. The Driver owns Release on success.

Jump to

Keyboard shortcuts

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