bazaar

package
v0.0.0-...-c8dcdd0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBazaarPackageREADME

func GetBazaarPackageREADME(ctx context.Context, repoURL, repoHash, pkgType string) (ret string)

GetBazaarPackageREADME 获取集市包的在线 README。

func GetBazaarPackagesMap

func GetBazaarPackagesMap(pkgType, frontend string) map[string]*Package

GetBazaarPackagesMap 返回按包名索引的在线集市包映射(plugins 类型需要传递 frontend 参数)。

func GetCurrentBackend

func GetCurrentBackend() string

func GetPreferredLocaleString

func GetPreferredLocaleString(m LocaleStrings, fallback string) string

GetPreferredLocaleString 从 LocaleStrings 中按当前语种取值,无则回退 default、en、en_US(历史命名兼容),再回退 fallback。

func InstallPackage

func InstallPackage(repoURL, repoHash, installPath, systemID, pkgType, packageName string) error

InstallPackage 安装集市包

func IsIncompatibleKernelPlugin

func IsIncompatibleKernelPlugin(plugin *Package) bool

IsIncompatibleKernelPlugin 判断内核插件是否与当前环境不兼容

func IsIncompatiblePlugin

func IsIncompatiblePlugin(plugin *Package, frontend string) bool

IsIncompatiblePlugin 判断插件是否与当前环境不兼容

func IsTargetSupported

func IsTargetSupported(platforms []string, target string) bool

IsTargetSupported 检查 platforms 中是否包含 target 或 "all"

func ParseInstalledPlugin

func ParseInstalledPlugin(name, frontend string) (found bool, version, displayName string, incompatible, disabledInPublish, disallowInstall, kernelIncompatible bool)

func ReadInstalledPackageDirs

func ReadInstalledPackageDirs(basePath string) ([]os.DirEntry, error)

ReadInstalledPackageDirs 读取本地集市包的目录列表

func RemovePackageInfo

func RemovePackageInfo(pkgType, pkgName string)

RemovePackageInfo 删除集市包的持久化信息

func SetInstalledPackageMetadata

func SetInstalledPackageMetadata(pkg *Package, installPath, baseURLPath, pkgType, frontend string, bazaarPackagesMap map[string]*Package) bool

SetInstalledPackageMetadata 设置本地集市包的通用元数据

func UninstallPackage

func UninstallPackage(installPath string) (err error)

UninstallPackage 卸载集市包

Types

type BazaarInfo

type BazaarInfo struct {
	Packages map[string]map[string]*PackageInfo `json:"packages"`
}

BazaarInfo 集市的持久化信息

type Funding

type Funding struct {
	OpenCollective string   `json:"openCollective"`
	Patreon        string   `json:"patreon"`
	GitHub         string   `json:"github"`
	Custom         []string `json:"custom"`
}

type LocaleStrings

type LocaleStrings map[string]string

LocaleStrings 表示按语种 key 的字符串表,key 为语种如 "default"、"en_US"、"zh_CN" 等

type Package

type Package struct {
	Author            string        `json:"author"`
	URL               string        `json:"url"`
	Version           string        `json:"version"`
	MinAppVersion     string        `json:"minAppVersion"`
	DisabledInPublish bool          `json:"disabledInPublish"`
	Kernels           []string      `json:"kernels"`
	Backends          []string      `json:"backends"`
	Frontends         []string      `json:"frontends"`
	DisplayName       LocaleStrings `json:"displayName"`
	Description       LocaleStrings `json:"description"`
	Readme            LocaleStrings `json:"readme"`
	Funding           *Funding      `json:"funding"`
	Keywords          []string      `json:"keywords"`

	PreferredFunding string `json:"preferredFunding"`
	PreferredName    string `json:"preferredName"`
	PreferredDesc    string `json:"preferredDesc"`
	PreferredReadme  string `json:"preferredReadme"`

	Name       string `json:"name"`    // 包名,不一定是仓库名
	RepoURL    string `json:"repoURL"` // 形式为 https://github.com/owner/repo
	RepoHash   string `json:"repoHash"`
	PreviewURL string `json:"previewURL"`
	IconURL    string `json:"iconURL"`

	Installed               bool   `json:"installed"`
	Outdated                bool   `json:"outdated"`
	Current                 bool   `json:"current"`
	Updated                 string `json:"updated"`
	Stars                   int    `json:"stars"`
	OpenIssues              int    `json:"openIssues"`
	Size                    int64  `json:"size"`
	HSize                   string `json:"hSize"`
	InstallSize             int64  `json:"installSize"`
	HInstallSize            string `json:"hInstallSize"`
	HInstallDate            string `json:"hInstallDate"`
	HUpdated                string `json:"hUpdated"`
	Downloads               int    `json:"downloads"`
	DisallowInstall         bool   `json:"disallowInstall"`
	DisallowUpdate          bool   `json:"disallowUpdate"`
	UpdateRequiredMinAppVer string `json:"updateRequiredMinAppVer,omitempty"` // 升级目标要求的最小应用版本

	// 专用字段,nil 时不序列化
	InstalledIncompatible *bool     `json:"installedIncompatible,omitempty"` // Plugin:本地已安装版本是否不兼容
	BazaarIncompatible    *bool     `json:"bazaarIncompatible,omitempty"`    // Plugin:在线集市版本是否不兼容
	Enabled               *bool     `json:"enabled,omitempty"`               // Plugin:是否启用
	Modes                 *[]string `json:"modes,omitempty"`                 // Theme:支持的模式列表
}

Package 描述了集市包元数据和传递给前端的其他信息。

func FilterPackages

func FilterPackages(packages []*Package, keyword string) []*Package

FilterPackages 按关键词过滤集市包列表

func GetBazaarPackages

func GetBazaarPackages(pkgType string, frontend string) (packages []*Package)

GetBazaarPackages 返回指定类型的在线集市包列表(plugins 类型需要传递 frontend 参数)。

func ParsePackageJSON

func ParsePackageJSON(filePath string) (ret *Package, err error)

ParsePackageJSON 解析集市包 JSON 文件

type PackageInfo

type PackageInfo struct {
	InstallTime int64 `json:"installTime"` // 安装时间戳(毫秒)
}

PackageInfo 集市包的持久化信息

type StageBazaarResult

type StageBazaarResult struct {
	StageIndex  *StageIndex             // stage 索引
	BazaarStats map[string]*bazaarStats // 统计信息
	Online      bool                    // online 状态
	StageErr    error                   // stage 错误
}

type StageIndex

type StageIndex struct {
	Repos []*StageRepo `json:"repos"`
	// contains filtered or unexported fields
}

type StageRepo

type StageRepo struct {
	URL         string `json:"url"` // owner/repo@hash 形式
	Updated     string `json:"updated"`
	Stars       int    `json:"stars"`
	OpenIssues  int    `json:"openIssues"`
	Size        int64  `json:"size"`
	InstallSize int64  `json:"installSize"`

	// Package 与 stage/*.json 内嵌的完整 package 一致,可直接用于构建列表
	Package *Package `json:"package"`
}

Jump to

Keyboard shortcuts

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