Documentation
¶
Index ¶
- Constants
- Variables
- func GetCloudflareWorkerAPIUrl() string
- func GetGithubDevCommitAPIUrl() string
- func GetGithubLatestReleaseAPIUrl() string
- func GetGithubReleasesListAPIUrl() string
- func GetShortHash() string
- func GetUrl(path string) string
- func SetReleaseProvider(p ReleaseProvider)
- type Info
- type ReleaseProvider
- type ReleaseType
- type RuntimeInfo
- type TCommit
- type TRelease
- type TReleaseAsset
Constants ¶
View Source
const ( GithubDevCommitAPI = "https://api.github.com/repos/0xJacky/nginx-ui/commits/dev?per_page=1" CloudflareWorkerAPI = "https://cloud.nginxui.com/" GithubLatestReleaseAPI = "https://api.github.com/repos/0xJacky/nginx-ui/releases/latest" GithubReleasesListAPI = "https://api.github.com/repos/0xJacky/nginx-ui/releases" )
Variables ¶
View Source
var ( ErrInvalidCommitSHA = e.New(53001, "invalid commit SHA") ErrReleaseAPIFailed = e.New(53002, "release API request failed: {0}") )
View Source
var ( Version = "" BuildId = 0 TotalBuild = 0 Hash = "" )
Functions ¶
func GetCloudflareWorkerAPIUrl ¶
func GetCloudflareWorkerAPIUrl() string
func GetGithubDevCommitAPIUrl ¶
func GetGithubDevCommitAPIUrl() string
func GetGithubLatestReleaseAPIUrl ¶
func GetGithubLatestReleaseAPIUrl() string
func GetGithubReleasesListAPIUrl ¶
func GetGithubReleasesListAPIUrl() string
func GetShortHash ¶
func GetShortHash() string
func SetReleaseProvider ¶
func SetReleaseProvider(p ReleaseProvider)
SetReleaseProvider installs a release override. Call once, at boot.
Types ¶
type Info ¶
type Info struct {
Version string `json:"version"`
BuildId int `json:"build_id"`
TotalBuild int `json:"total_build"`
ShortHash string `json:"short_hash"`
}
func GetVersionInfo ¶
func GetVersionInfo() *Info
type ReleaseProvider ¶
type ReleaseProvider interface {
// Release returns the release for a channel, or false to fall through to
// the real lookup.
Release(channel string) (TRelease, bool)
}
ReleaseProvider overrides where release metadata comes from.
The slot defaults to nil and only internal/demo fills it, so a production binary always asks GitHub. A demo instance cannot install an upgrade anyway, and should not be making outbound API calls on every visit to the About page.
type ReleaseType ¶
type ReleaseType string
const ( ReleaseTypeStable ReleaseType = "stable" ReleaseTypePrerelease ReleaseType = "prerelease" ReleaseTypeDev ReleaseType = "dev" )
type RuntimeInfo ¶
type RuntimeInfo struct {
OS string `json:"os"`
Arch string `json:"arch"`
ExPath string `json:"ex_path"`
CurVersion *Info `json:"cur_version"`
InDocker bool `json:"in_docker"`
}
func GetRuntimeInfo ¶
func GetRuntimeInfo() (r RuntimeInfo, err error)
type TRelease ¶
type TRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
PublishedAt time.Time `json:"published_at"`
Body string `json:"body"`
Prerelease bool `json:"prerelease"`
Type ReleaseType `json:"type"`
HTMLURL string `json:"html_url"`
Assets []TReleaseAsset `json:"assets"`
}
func GetRelease ¶
func (*TRelease) GetAssetsMap ¶
func (t *TRelease) GetAssetsMap() (m map[string]TReleaseAsset)
type TReleaseAsset ¶
Click to show internal directories.
Click to hide internal directories.