Documentation
¶
Index ¶
- Constants
- Variables
- func ConstructAppId(appName string) string
- func GetAppConfigPath(config *Config, appId string) string
- func GetConfigPath() (string, error)
- func GetTransactionsPath() (string, error)
- func GithubApiFetchReleases(username string, reponame string) (*[]GithubApiRelease, error)
- func InstallDesktopFile(paths *AppPaths, content string) error
- func ParseGithubRepoUrl(url string) (bool, string, string)
- func ReadSourceConfig(sourceId SourceId, sourcePath string) (any, error)
- func RequestGithubApi[T any](method string, route string) (*T, error)
- func SaveAppConfig(configPath string, config *AppConfig) error
- func SaveConfig(config *Config) error
- func SaveSourceConfig[T any](configPath string, config T) error
- func SaveTransactions(transactions *Transactions) error
- func UninstallDesktopFile(desktopFilePath string) error
- func UpdateTransactions(performer UpdateTransactionFunc) error
- type AppConfig
- type AppImageAssetMatch
- type AppPaths
- type Asset
- type AssetDownloadFunc
- type Config
- type ConstructAppPathsOptions
- type DeflatedAppImage
- type DeflatedAppImageMetadata
- type GithubApiRelease
- func GithubApiFetchLatestAny(username string, reponame string) (*GithubApiRelease, error)
- func GithubApiFetchLatestPreRelease(username string, reponame string) (*GithubApiRelease, error)
- func GithubApiFetchLatestRelease(username string, reponame string) (*GithubApiRelease, error)
- func GithubApiFetchTaggedRelease(username string, reponame string, tag string) (*GithubApiRelease, error)
- type GithubApiReleaseAsset
- type GithubSource
- type GithubSourceRelease
- type HttpSource
- type LocalSource
- type NetworkAssetMetadata
- type PendingInstallation
- type Source
- type SourceId
- type SourceUpdate
- type Transactions
- type UpdateTransactionFunc
Constants ¶
View Source
const AppCodeName = "pho"
View Source
const AppDescription = "AppImage Manager"
View Source
const AppExecutableName = "pho"
View Source
const AppGithubOwner = "zyrouge"
View Source
const AppGithubRepo = "pho"
View Source
const AppName = "Pho"
View Source
const AppVersion = "0.1.12"
Variables ¶
View Source
var GithubRepoUrlRegex = regexp.MustCompile(`^([^\/]+)\/([^\/]+)$`)
Functions ¶
func ConstructAppId ¶
func GetAppConfigPath ¶ added in v0.1.3
func GetConfigPath ¶
func GetTransactionsPath ¶
func GithubApiFetchReleases ¶
func GithubApiFetchReleases(username string, reponame string) (*[]GithubApiRelease, error)
func InstallDesktopFile ¶ added in v0.1.0
func SaveAppConfig ¶
func SaveConfig ¶
func SaveSourceConfig ¶
func SaveTransactions ¶
func SaveTransactions(transactions *Transactions) error
func UninstallDesktopFile ¶
func UpdateTransactions ¶
func UpdateTransactions(performer UpdateTransactionFunc) error
Types ¶
type AppConfig ¶
type AppConfig struct {
Id string `json:"Id"`
Version string `json:"Version"`
Source SourceId `json:"Source"`
Paths AppPaths `json:"Paths"`
}
func ReadAppConfig ¶
type AppImageAssetMatch ¶
type AppImageAssetMatch int
const ( AppImageAssetNoMatch AppImageAssetMatch = iota AppImageAssetPartialMatch AppImageAssetExactMatch )
func ChooseAptAppImageAsset ¶
func ChooseAptAppImageAsset[T any](assets []T, assetNameFunc func(*T) string) (AppImageAssetMatch, *T)
type AppPaths ¶
type AppPaths struct {
Dir string `json:"Dir"`
Config string `json:"Config"`
SourceConfig string `json:"SourceConfig"`
AppImage string `json:"AppImage"`
Icon string `json:"Icon"`
Desktop string `json:"Desktop"`
Symlink string `json:"Symlink"`
}
func ConstructAppPaths ¶ added in v0.1.0
func ConstructAppPaths(config *Config, appId string, options *ConstructAppPathsOptions) *AppPaths
type Asset ¶
type Asset struct {
Source string
Size int64
Download AssetDownloadFunc
}
type AssetDownloadFunc ¶
type AssetDownloadFunc func() (io.ReadCloser, error)
func LocalAssetDownload ¶
func LocalAssetDownload(name string) AssetDownloadFunc
func NetworkAssetDownload ¶
func NetworkAssetDownload(url string) AssetDownloadFunc
type Config ¶
type Config struct {
AppsDir string `json:"AppsDir"`
DesktopDir string `json:"DesktopDir"`
Installed map[string]string `json:"Installed"`
EnableIntegrationPrompt bool `json:"EnableIntegrationPrompt"`
SymlinksDir string `json:"SymlinksDir"`
}
func ReadConfig ¶
type ConstructAppPathsOptions ¶ added in v0.1.7
type ConstructAppPathsOptions struct {
Symlink bool
}
type DeflatedAppImage ¶
func DeflateAppImage ¶
func DeflateAppImage(appImagePath string, parentDir string) (*DeflatedAppImage, error)
func (*DeflatedAppImage) ExtractExecName ¶
func (deflated *DeflatedAppImage) ExtractExecName() (string, error)
func (*DeflatedAppImage) ExtractMetadata ¶
func (deflated *DeflatedAppImage) ExtractMetadata() (*DeflatedAppImageMetadata, error)
type DeflatedAppImageMetadata ¶
type DeflatedAppImageMetadata struct {
*DeflatedAppImage
ExecName string
IconPath string
DesktopPath string
}
func (*DeflatedAppImageMetadata) CopyIconFile ¶
func (metadata *DeflatedAppImageMetadata) CopyIconFile(paths *AppPaths) error
func (*DeflatedAppImageMetadata) InstallDesktopFile ¶
func (metadata *DeflatedAppImageMetadata) InstallDesktopFile(paths *AppPaths) error
func (*DeflatedAppImageMetadata) Symlink ¶ added in v0.1.7
func (metadata *DeflatedAppImageMetadata) Symlink(paths *AppPaths) error
type GithubApiRelease ¶
type GithubApiRelease struct {
ApiUrl string `json:"url"`
HtmlUrl string `json:"html_url"`
TagName string `json:"tag_name"`
Draft bool `json:"draft"`
PreRelease bool `json:"prerelease"`
Assets []GithubApiReleaseAsset `json:"assets"`
}
func GithubApiFetchLatestAny ¶ added in v0.1.3
func GithubApiFetchLatestAny(username string, reponame string) (*GithubApiRelease, error)
func GithubApiFetchLatestPreRelease ¶
func GithubApiFetchLatestPreRelease(username string, reponame string) (*GithubApiRelease, error)
func GithubApiFetchLatestRelease ¶
func GithubApiFetchLatestRelease(username string, reponame string) (*GithubApiRelease, error)
func GithubApiFetchTaggedRelease ¶
func GithubApiFetchTaggedRelease(username string, reponame string, tag string) (*GithubApiRelease, error)
func (*GithubApiRelease) ChooseAptAsset ¶
func (release *GithubApiRelease) ChooseAptAsset() (AppImageAssetMatch, *GithubApiReleaseAsset)
type GithubApiReleaseAsset ¶
type GithubApiReleaseAsset struct {
ApiUrl string `json:"url"`
DownloadUrl string `json:"browser_download_url"`
Name string `json:"name"`
Size int64 `json:"size"`
}
func (*GithubApiReleaseAsset) ToAsset ¶
func (asset *GithubApiReleaseAsset) ToAsset() *Asset
type GithubSource ¶
type GithubSource struct {
UserName string `json:"UserName"`
RepoName string `json:"RepoName"`
Release GithubSourceRelease `json:"Release"`
TagName string `json:"TagName"`
}
func ReadGithubSourceConfig ¶
func ReadGithubSourceConfig(configPath string) (*GithubSource, error)
func (*GithubSource) CheckUpdate ¶
func (source *GithubSource) CheckUpdate(app *AppConfig, reinstall bool) (*SourceUpdate, error)
func (*GithubSource) FetchAptLatestRelease ¶
func (source *GithubSource) FetchAptLatestRelease() (*GithubApiRelease, error)
func (*GithubSource) FetchAptRelease ¶
func (source *GithubSource) FetchAptRelease() (*GithubApiRelease, error)
func (*GithubSource) SupportUpdates ¶
func (source *GithubSource) SupportUpdates() bool
type GithubSourceRelease ¶ added in v0.1.3
type GithubSourceRelease string
const ( GithubSourceReleaseLatest GithubSourceRelease = "latest" GithubSourceReleasePreRelease GithubSourceRelease = "prerelease" GithubSourceReleaseTagged GithubSourceRelease = "tag" GithubSourceReleaseAny GithubSourceRelease = "any" )
type HttpSource ¶
type HttpSource struct{}
func ReadHttpSourceConfig ¶
func ReadHttpSourceConfig(configPath string) (*HttpSource, error)
func (*HttpSource) CheckUpdate ¶
func (*HttpSource) CheckUpdate(app *AppConfig, reinstall bool) (*SourceUpdate, error)
func (*HttpSource) SupportsUpdates ¶
func (*HttpSource) SupportsUpdates() bool
type LocalSource ¶
type LocalSource struct{}
func ReadLocalSourceConfig ¶
func ReadLocalSourceConfig(configPath string) (*LocalSource, error)
func (*LocalSource) CheckUpdate ¶
func (*LocalSource) CheckUpdate(app *AppConfig, reinstall bool) (*SourceUpdate, error)
func (*LocalSource) SupportUpdates ¶
func (*LocalSource) SupportUpdates() bool
type NetworkAssetMetadata ¶
type NetworkAssetMetadata struct {
Size int64
}
func ExtractNetworkAssetMetadata ¶
func ExtractNetworkAssetMetadata(url string) (*NetworkAssetMetadata, error)
type PendingInstallation ¶
type Source ¶
type Source interface {
SupportUpdates() bool
CheckUpdate(app *AppConfig, reinstall bool) (*SourceUpdate, error)
}
type SourceId ¶
type SourceId string
const GithubSourceId SourceId = "github"
const HttpSourceId SourceId = "http"
const LocalSourceId SourceId = "local"
type SourceUpdate ¶
type SourceUpdate struct {
Version string
MatchScore AppImageAssetMatch
*Asset
}
type Transactions ¶
type Transactions struct {
PendingInstallations map[string]PendingInstallation
}
func GetTransactions ¶
func GetTransactions() (*Transactions, error)
type UpdateTransactionFunc ¶
type UpdateTransactionFunc func(transactions *Transactions) error
Click to show internal directories.
Click to hide internal directories.