version

package
v1.9.10-0...-1ccd1c0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

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 GetUrl

func GetUrl(path string) 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 TCommit

type TCommit struct {
	SHA    string `json:"sha"`
	Commit struct {
		Message   string `json:"message"`
		Committer struct {
			Date time.Time `json:"date"`
		} `json:"committer"`
	} `json:"commit"`
}

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 GetRelease(channel string) (data TRelease, err error)

func (*TRelease) GetAssetsMap

func (t *TRelease) GetAssetsMap() (m map[string]TReleaseAsset)

type TReleaseAsset

type TReleaseAsset struct {
	Name               string `json:"name"`
	BrowserDownloadUrl string `json:"browser_download_url"`
	Size               uint   `json:"size"`
}

Jump to

Keyboard shortcuts

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