source

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

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

View Source
const (
	KindGitHub   = "github"
	KindAltStore = "altstore"
)

Variables

View Source
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

func DeriveFilter(picked string, others []string) string

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 FileName

func FileName(downloadURL string) string

FileName returns the file name of a download URL.

func FilterMatches

func FilterMatches(kind, filter string, b Build) bool

FilterMatches reports whether build b is selected by filter.

func IsIPAName

func IsIPAName(name string) bool

IsIPAName reports whether name is an IPA file name (.ipa, or TrollStore's .tipa).

func Normalize

func Normalize(kind, location string) (string, error)

Normalize validates and normalizes a user-supplied source location.

func ParseRepo

func ParseRepo(input string) (string, error)

ParseRepo returns "owner/repo" from a repository name or GitHub URL such as https://github.com/owner/repo/releases/tag/v1.0.

func Suggest

func Suggest(builds []Build, deviceClass string) string

Suggest returns the ID of the build to preselect for deviceClass, or "" when the user must choose.

func Tokens

func Tokens(name string) []string

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

func ValidateFilter(kind, filter string) error

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

type DownloadRequest struct {
	URL    string
	Header http.Header
}

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).

func Fetch

func Fetch(kind, location string) (Feed, error)

Fetch downloads the source with exactly one HTTP request. location must be normalized.

type Platform

type Platform string

Platform is a hint derived from names; never used alone to install.

const (
	PlatformUnknown Platform = ""
	PlatformTVOS    Platform = "tvos"
	PlatformIOS     Platform = "ios"
)

func DevicePlatform

func DevicePlatform(deviceClass string) Platform

DevicePlatform returns the platform of a device class.

func Opposite

func Opposite(p Platform) Platform

Opposite returns the other known platform, or PlatformUnknown.

func PlatformHint

func PlatformHint(texts ...string) Platform

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

type RateLimitError struct {
	Reset time.Time
}

RateLimitError reports the GitHub unauthenticated quota (60 req/h) is exhausted until Reset.

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

Jump to

Keyboard shortcuts

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