Documentation
¶
Overview ¶
Package source reads the builds published by a GitHub repository's releases or by an AltStore source, so installed apps can be installed from and track updates of the IPA they were built from.
Index ¶
- Constants
- Variables
- func DeriveFilter(picked string, others []string) string
- func FileName(downloadURL string) string
- func FilterMatches(kind, filter string, b Build) bool
- func IsIPAName(name string) bool
- func Normalize(kind, location string) (string, error)
- func ParseRepo(input string) (string, error)
- func Suggest(builds []Build, deviceClass string) string
- func Tokens(name string) []string
- func ValidateFilter(kind, filter string) error
- type Build
- type DownloadRequest
- type Feed
- type Platform
- type Preview
- type RateLimitError
Constants ¶
const ( KindGitHub = "github" KindAltStore = "altstore" )
Variables ¶
var ( // ErrNotFound reports a source that does not exist or is private. ErrNotFound = errors.New("not found") // ErrNoMatch reports that no build matches; it is wrapped with details. ErrNoMatch = errors.New("no matching build") // ErrAmbiguous reports that several builds match and the user must choose. ErrAmbiguous = errors.New("several builds match") )
Functions ¶
func DeriveFilter ¶
DeriveFilter returns an asset-name filter that keeps selecting the variant picked among the IPA assets of a release (Obtainium's asset filter): the first word of picked that is neither a version number nor shared with the other assets, or else the whole name with its version numbers made generic so that it keeps matching in later releases. When the variants differ only in numbers (App_tvOS_15.ipa, App_tvOS_17.ipa), the generic name would match them all, so the filter is the exact name of picked.
func FilterMatches ¶
FilterMatches reports whether build b is selected by filter.
func ParseRepo ¶
ParseRepo returns "owner/repo" from a repository name or GitHub URL such as https://github.com/owner/repo/releases/tag/v1.0.
func Suggest ¶
Suggest returns the ID of the build to preselect for deviceClass, or "" when the user must choose.
func Tokens ¶
Tokens returns the lowercase words of name without its IPA extension, split on every rune that is not a-z or 0-9.
func ValidateFilter ¶
ValidateFilter checks a stored filter for kind: a GitHub filter is a regular expression on the asset name, an AltStore filter a bundle identifier.
Types ¶
type Build ¶
type Build struct {
ID string `json:"id"` // GitHub: asset id; AltStore: stable hash of the version
Name string `json:"name"` // GitHub: asset file name; AltStore: app name
Version string `json:"version"` // GitHub: release tag; AltStore: version (and build)
Date time.Time `json:"date"` // GitHub: asset creation date; AltStore: version date
Size int64 `json:"size"` // bytes
DownloadURL string `json:"download_url"` // IPA download URL
PageURL string `json:"page_url"` // GitHub: release page
IconURL string `json:"icon_url"` // AltStore: app icon
BundleID string `json:"bundle_id"` // AltStore: bundle identifier
Developer string `json:"developer"` // AltStore: developer name
Subtitle string `json:"subtitle"` // AltStore: app subtitle
Prerelease bool `json:"prerelease"` // GitHub: release is a pre-release
Platform Platform `json:"platform"` // name-based hint
Filter string `json:"filter"` // filter that keeps tracking this build in later releases
}
Build is one installable IPA published by a source.
type DownloadRequest ¶ added in v0.6.1
DownloadRequest describes the server-side HTTP request used to fetch a source build. Header is internal download metadata and is never sent to the frontend.
func ResolveDownload ¶ added in v0.6.1
func ResolveDownload(kind, location, buildID, downloadURL string) (DownloadRequest, error)
ResolveDownload returns the request used to download a source build. GitHub builds use the authenticated release-asset API when a token is configured; AltStore builds keep their published download URL.
type Feed ¶
type Feed interface {
// Preview lists the builds the user can pick for deviceClass.
Preview(deviceClass string, prerelease bool) (*Preview, error)
// Latest returns the newest build tracked by filter.
Latest(filter string, prerelease bool, deviceClass string) (Build, error)
// Find returns the build with id, searching everything that was fetched.
Find(id string) (Build, error)
}
Feed is one fetched source (one network request).
type Platform ¶
type Platform string
Platform is a hint derived from names; never used alone to install.
func DevicePlatform ¶
DevicePlatform returns the platform of a device class.
func PlatformHint ¶
PlatformHint guesses the platform from words in texts: it is tvOS or iOS only when the words name that platform alone.
type Preview ¶
type Preview struct {
Kind string `json:"kind"`
URL string `json:"url"` // normalized: GitHub "owner/repo"; AltStore the source URL
Title string `json:"title"` // GitHub: release name or tag; AltStore: source name
PageURL string `json:"page_url"` // GitHub: release page; AltStore: source URL
Builds []Build `json:"builds"` // builds the user can pick from
SuggestedID string `json:"suggested_id"` // "" when the user must choose
}
Preview is what the user picks from when installing or linking.
type RateLimitError ¶
RateLimitError reports the GitHub unauthenticated quota (60 req/h) is exhausted until Reset.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string