session

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 22 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.

Documentation

Overview

Package session 统一配置解析、SDK client 创建与 required/optional 认证生命周期。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithOptionalAuth

func WithOptionalAuth(options *Options, errOut io.Writer, fn func(*Client) error) error

WithOptionalAuth permits anonymous requests and honors explicit auto-relogin.

func WithRequiredAuth

func WithRequiredAuth(options *Options, errOut io.Writer, fn func(*Client) error) error

WithRequiredAuth performs the local account check before the operation.

Types

type Client

type Client struct {
	*javdb.Client
	// contains filtered or unexported fields
}

Client adds the CLI authentication lifecycle to the public SDK client. Network operations still use the public SDK; each rejected operation is replayed once.

func New

func New(options *Options, token string) (*Client, error)

New 读取配置、校验命令行 host 与 proxy、解析运行时,并在 auto 时先完成线路选择,再构造 携带给定 token 的公开 SDK client。固定 host 完全绕过 route cache 与 selector。基线配置在 host/proxy 无副作用校验与 device UUID provision 之后创建;无效 host/proxy 不落盘,选线 失败也不回滚已创建的本机基线状态。

func NewRequired

func NewRequired(options *Options) (*Client, error)

NewRequired checks local credentials before network route selection.

func NewWithDefaultToken

func NewWithDefaultToken(options *Options) (*Client, error)

NewWithDefaultToken builds a client using the default account of this invocation.

func (*Client) AllEntityMovies

func (c *Client) AllEntityMovies(ctx context.Context, kind, entityID string, opt javdb.EntityMoviesOptions, maxPages int) ([]map[string]any, error)

AllEntityMovies executes the SDK operation under the CLI authentication policy.

func (*Client) Browse

Browse executes the SDK operation under the CLI authentication policy.

func (*Client) Collected

func (c *Client) Collected(ctx context.Context, kind string) ([]map[string]any, error)

Collected executes the SDK operation under the CLI authentication policy.

func (*Client) EntityDetail

func (c *Client) EntityDetail(ctx context.Context, kind, id string) (map[string]any, error)

EntityDetail executes the SDK operation under the CLI authentication policy.

func (*Client) EntityMovies

func (c *Client) EntityMovies(ctx context.Context, kind, entityID string, opt javdb.EntityMoviesOptions) (javdb.SearchResult, error)

EntityMovies executes the SDK operation under the CLI authentication policy.

func (*Client) ListInfo

func (c *Client) ListInfo(ctx context.Context, listID string) (map[string]any, error)

ListInfo executes the SDK operation under the CLI authentication policy.

func (*Client) LoadOrRefreshTaxonomy

func (c *Client) LoadOrRefreshTaxonomy(ctx context.Context, zone string, force bool) (*tags.Doc, string, error)

LoadOrRefreshTaxonomy executes the SDK operation under the CLI authentication policy.

func (*Client) Mark

func (c *Client) Mark(ctx context.Context, movieID, status string, score int, content string) (map[string]any, error)

Mark executes the SDK operation under the CLI authentication policy.

func (*Client) MovieAssets

func (c *Client) MovieAssets(ctx context.Context, movieID string) ([]javdb.MovieAsset, error)

MovieAssets executes the SDK operation under the CLI authentication policy.

func (*Client) MovieComments

func (c *Client) MovieComments(ctx context.Context, movieID string, page, limit int) ([]map[string]any, error)

MovieComments executes the SDK operation under the CLI authentication policy.

func (*Client) MovieDetail

func (c *Client) MovieDetail(ctx context.Context, movieID string) (map[string]any, error)

MovieDetail executes the SDK operation under the CLI authentication policy.

func (*Client) MovieMagnets

func (c *Client) MovieMagnets(ctx context.Context, movieID string) ([]map[string]any, error)

MovieMagnets executes the SDK operation under the CLI authentication policy.

func (*Client) MyLists

func (c *Client) MyLists(ctx context.Context, page, limit int, sortBy string) (javdb.SearchResult, error)

MyLists executes the SDK operation under the CLI authentication policy.

func (*Client) RankingsActors

func (c *Client) RankingsActors(ctx context.Context, period string) (javdb.SearchResult, error)

RankingsActors executes the SDK operation under the CLI authentication policy.

func (*Client) RankingsMovies

func (c *Client) RankingsMovies(ctx context.Context, type_, period string) (javdb.SearchResult, error)

RankingsMovies executes the SDK operation under the CLI authentication policy.

func (*Client) RankingsPlayback

func (c *Client) RankingsPlayback(ctx context.Context, filterBy, period string) (javdb.SearchResult, error)

RankingsPlayback executes the SDK operation under the CLI authentication policy.

func (*Client) RecentViewed

func (c *Client) RecentViewed(ctx context.Context) ([]map[string]any, error)

RecentViewed executes the SDK operation under the CLI authentication policy.

func (*Client) RefreshTagTaxonomy

func (c *Client) RefreshTagTaxonomy(ctx context.Context, zone string) (*tags.Doc, error)

RefreshTagTaxonomy executes the SDK operation under the CLI authentication policy.

func (*Client) RelatedLists

func (c *Client) RelatedLists(ctx context.Context, movieID string, page, limit int) (javdb.SearchResult, error)

RelatedLists executes the SDK operation under the CLI authentication policy.

func (*Client) ResolveEntity

func (c *Client) ResolveEntity(ctx context.Context, kind, ref, zone string) (string, error)

ResolveEntity executes the SDK operation under the CLI authentication policy.

func (*Client) ResolveMovieID

func (c *Client) ResolveMovieID(ctx context.Context, number string) (string, error)

ResolveMovieID executes the SDK operation under the CLI authentication policy.

func (*Client) ResolveMovieIDExact

func (c *Client) ResolveMovieIDExact(ctx context.Context, number string) (string, error)

ResolveMovieIDExact executes the SDK operation under the CLI authentication policy.

func (*Client) ResolveTags

func (c *Client) ResolveTags(ctx context.Context, refs []string, zone string) ([]string, error)

ResolveTags executes the SDK operation under the CLI authentication policy.

func (*Client) Search

func (c *Client) Search(ctx context.Context, keyword string, opt javdb.SearchOptions) (javdb.SearchResult, error)

Search executes the SDK operation under the CLI authentication policy.

func (*Client) SearchByImage

SearchByImage uses the public SDK linker with authenticated lookups, so a rejected JavDB operation is replayed without uploading the image to the provider again.

func (*Client) Top250

func (c *Client) Top250(ctx context.Context, zone, year string, startRank, page, limit int, ignoreWatched bool) (javdb.SearchResult, error)

Top250 executes the SDK operation under the CLI authentication policy.

func (*Client) Unmark

func (c *Client) Unmark(ctx context.Context, movieID string) (bool, error)

Unmark executes the SDK operation under the CLI authentication policy.

func (*Client) WantMovies

func (c *Client) WantMovies(ctx context.Context) ([]map[string]any, error)

WantMovies executes the SDK operation under the CLI authentication policy.

func (*Client) WatchedMovies

func (c *Client) WatchedMovies(ctx context.Context) ([]map[string]any, error)

WatchedMovies executes the SDK operation under the CLI authentication policy.

type LoginError

type LoginError struct {
	Key   string
	Cause error
}

LoginError keeps the user action separate from the complete upstream cause.

func (*LoginError) Error

func (e *LoginError) Error() string

func (*LoginError) MessageKey

func (e *LoginError) MessageKey() string

func (*LoginError) Unwrap

func (e *LoginError) Unwrap() error

type Options

type Options struct {
	Logger *slog.Logger
	Proxy  string
	Host   string
	// contains filtered or unexported fields
}

Options owns flags and the authentication state of one CLI invocation.

type ReverseSearchSetup

type ReverseSearchSetup struct {
	Client *Client
	// Source 是本次调用选中的 source(已展开环境 header);builtin 时
	// Name 为 "builtin"。
	Source javdb.ReverseSearchSource
	// CacheEnabled 反映配置与 --no-cache 之外的缓存开关。
	CacheEnabled bool
	// HTTPClient 是装配了最终代理配置的 HTTP client,供图片 URL 读取与
	// provider 请求共用(图片 URL、provider、JavDB 共用同一代理契约)。
	HTTPClient *http.Client
}

ReverseSearchSetup 是一次反搜调用所需的公开 SDK client 与已解析 source。

func NewReverseSearchClient

func NewReverseSearchClient(options *Options, explicitSource string) (*ReverseSearchSetup, error)

NewReverseSearchClient 解析反搜配置(含环境 header 展开)、装配本机文件 缓存并构造携带反搜选项与默认账号 token 的公开 SDK client。explicitSource 非空时覆盖 default_source。配置损坏显式失败,绝不偷回 builtin。

Directories

Path Synopsis
Package authstore 只负责默认认证文件的路径、目录与 store 打开。
Package authstore 只负责默认认证文件的路径、目录与 store 打开。

Jump to

Keyboard shortcuts

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