fdroid

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoIndex = errors.New("no json index found inside jar")

Functions

This section is empty.

Types

type Apk

type Apk struct {
	VersName  string       `json:"versionName"`
	VersCode  int          `json:"versionCode"`
	Size      int64        `json:"size"`
	MinSdk    StringInt    `json:"minSdkVersion"`
	MaxSdk    StringInt    `json:"maxSdkVersion"`
	TargetSdk StringInt    `json:"targetSdkVersion"`
	ABIs      []string     `json:"nativecode"`
	ApkName   string       `json:"apkName"`
	SrcName   string       `json:"srcname"`
	Sig       HexVal       `json:"sig"`
	Signer    HexVal       `json:"signer"`
	Added     UnixDate     `json:"added"`
	Perms     []Permission `json:"uses-permission"`
	Feats     []string     `json:"features"`
	Hash      HexVal       `json:"hash"`
	HashType  string       `json:"hashType"`

	AppID   string `json:"-"`
	RepoURL string `json:"-"`
}

Apk is an Android package

func (*Apk) IsCompatible

func (a *Apk) IsCompatible(device *adb.Device) bool

func (*Apk) IsCompatibleABI

func (a *Apk) IsCompatibleABI(ABIs []string) bool

func (*Apk) IsCompatibleAPILevel

func (a *Apk) IsCompatibleAPILevel(sdk int) bool

func (*Apk) SrcURL

func (a *Apk) SrcURL() string

func (*Apk) URL

func (a *Apk) URL() string

type ApkList

type ApkList []Apk

func (ApkList) Len

func (al ApkList) Len() int

func (ApkList) Less

func (al ApkList) Less(i, j int) bool

func (ApkList) Swap

func (al ApkList) Swap(i, j int)

type App

type App struct {
	PackageName    string   `json:"packageName"`
	Name           string   `json:"name"`
	Summary        string   `json:"summary"`
	Added          UnixDate `json:"added"`
	Updated        UnixDate `json:"lastUpdated"`
	Icon           string   `json:"icon"`
	Description    string   `json:"description"`
	License        string   `json:"license"`
	Categories     []string `json:"categories"`
	Website        string   `json:"webSite"`
	SourceCode     string   `json:"sourceCode"`
	IssueTracker   string   `json:"issueTracker"`
	Changelog      string   `json:"changelog"`
	Donate         string   `json:"donate"`
	Bitcoin        string   `json:"bitcoin"`
	Litecoin       string   `json:"litecoin"`
	FlattrID       string   `json:"flattrID"`
	SugVersName    string   `json:"suggestedVersionName"`
	SugVersCode    int      `json:"suggestedVersionCode,string"`
	FdroidRepoName string   `json:"-"`
	FdroidRepoURL  string   `json:"-"`

	Localized map[string]Localization `json:"localized"`

	Apks []*Apk `json:"-"`
}

App is an Android application

func (*App) IconURL

func (a *App) IconURL() string

func (*App) IconURLForDensity

func (a *App) IconURLForDensity(density IconDensity) string

func (*App) SuggestedApk

func (a *App) SuggestedApk(device *adb.Device) *Apk

func (*App) TextDesc

func (a *App) TextDesc(w io.Writer)

type AppList

type AppList []App

func (AppList) Len

func (al AppList) Len() int

func (AppList) Less

func (al AppList) Less(i, j int) bool

func (AppList) Swap

func (al AppList) Swap(i, j int)

type HexVal

type HexVal []byte

func (*HexVal) String

func (hv *HexVal) String() string

func (*HexVal) UnmarshalText

func (hv *HexVal) UnmarshalText(text []byte) error

type IconDensity

type IconDensity uint
const (
	UnknownDensity IconDensity = 0
	LowDensity     IconDensity = 120
	MediumDensity  IconDensity = 160
	HighDensity    IconDensity = 240
	XHighDensity   IconDensity = 320
	XXHighDensity  IconDensity = 480
	XXXHighDensity IconDensity = 640
)

type Index

type Index struct {
	Repo     Repo             `json:"repo"`
	Apps     []App            `json:"apps"`
	Packages map[string][]Apk `json:"packages"`
}

func LoadIndexJSON

func LoadIndexJSON(r io.Reader) (*Index, error)

func LoadIndexJar

func LoadIndexJar(r io.ReaderAt, size int64, pubkey []byte) (*Index, error)

type Localization

type Localization struct {
	Name        string `json:"name"`
	Summary     string `json:"summary"`
	Description string `json:"description"`
}

type Permission added in v0.6.0

type Permission struct {
	Name   string
	MaxSdk string
}

func (*Permission) UnmarshalJSON added in v0.6.0

func (p *Permission) UnmarshalJSON(data []byte) error

type Repo

type Repo struct {
	Name        string   `json:"name"`
	Timestamp   UnixDate `json:"timestamp"`
	Address     string   `json:"address"`
	Icon        string   `json:"icon"`
	Version     int      `json:"version"`
	MaxAge      int      `json:"maxage"`
	Description string   `json:"description"`
}

type StringInt added in v0.6.0

type StringInt struct {
	Value int
}

https://codesahara.com/blog/golang-cannot-unmarshal-string-into-go-value-of-type-int/

func (*StringInt) UnmarshalJSON added in v0.6.0

func (st *StringInt) UnmarshalJSON(b []byte) error

type UnixDate

type UnixDate struct {
	time.Time
}

UnixDate is F-Droid's timestamp format. It's a unix time, but in milliseconds. We can ignore the extra digits, as they're always zero, and won't be displayed anyway.

func (*UnixDate) String

func (ud *UnixDate) String() string

func (*UnixDate) UnmarshalJSON

func (ud *UnixDate) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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