feat(webid): add HTTP API server (releases, resolve, installer scripts)

Serves the HTTP API for webinstall.dev:
- GET /api/releases/{pkg}.json — classified release list from fsstore
- GET /v1/resolve/{pkg} — resolve OS/arch/version to a specific asset
- GET /api/installers/{pkg}.sh — render installer shell script
- GET /api/installers/{pkg}.ps1 — render installer PowerShell script

Git-clone packages include git_tag and git_commit_hash in responses.
UA detection infers OS/arch from User-Agent when not query-specified.
This commit is contained in:
AJ ONeal
2026-05-16 21:53:05 -06:00
parent 59b2956d60
commit ac59e4728e
10 changed files with 2259 additions and 2 deletions
+5 -2
View File
@@ -42,8 +42,9 @@ type Params struct {
Minor string
Patch string
Build string
GitTag string
GitBranch string
GitTag string
GitBranch string
GitCommitHash string
LTS string // "true" or "false"
Channel string
Ext string // archive extension (e.g. "tar.gz", "zip")
@@ -106,6 +107,7 @@ func Bash(tplPath, installersDir, pkgName string, p Params) (string, error) {
{"WEBI_BUILD", p.Build},
{"WEBI_GIT_BRANCH", p.GitBranch},
{"WEBI_GIT_TAG", p.GitTag},
{"WEBI_GIT_COMMIT_HASH", p.GitCommitHash},
{"WEBI_LTS", p.LTS},
{"WEBI_CHANNEL", p.Channel},
{"WEBI_EXT", p.Ext},
@@ -160,6 +162,7 @@ func PowerShell(tplPath, installersDir, pkgName string, p Params) (string, error
{"WEBI_HOST", p.Host},
{"WEBI_VERSION", p.Version},
{"WEBI_GIT_TAG", p.GitTag},
{"WEBI_GIT_COMMIT_HASH", p.GitCommitHash},
{"WEBI_PKG_URL", p.PkgURL},
{"WEBI_PKG_FILE", p.PkgFile},
{"WEBI_PKG_PATHNAME", p.PkgFile},
+6
View File
@@ -67,6 +67,12 @@ func (la LegacyAsset) ToAsset() Asset {
arch = "x86_64"
case "arm64":
arch = "aarch64"
case "armv7l":
arch = "armv7"
case "armv6l":
arch = "armv6"
case "arm":
arch = "armv5"
case "*":
arch = ""
}