mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-24 11:57:15 +00:00
feat(panel): surface dev-build version in UI, bot, and CLI
A dev build now shows its `dev+<commit>` identity instead of a misleading stable-looking version in the sidebar badge, dashboard card, update modal, Telegram status report, startup log, and `x-ui -v`. Adds a shared formatPanelVersion helper (single v prefix; dev labels shown verbatim) and fixes the mobile-tag double-v. Renames the version getters for clarity: config.GetVersion to GetBaseVersion (raw embedded version), config.GetReportedVersion to GetPanelVersion (advertised/displayed), and the xray process GetVersion to GetXrayVersion.
This commit is contained in:
@@ -5,23 +5,23 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetReportedVersion(t *testing.T) {
|
||||
func TestGetPanelVersion(t *testing.T) {
|
||||
orig := buildCommit
|
||||
t.Cleanup(func() { buildCommit = orig })
|
||||
|
||||
buildCommit = ""
|
||||
if got := GetReportedVersion(); got != GetVersion() {
|
||||
t.Fatalf("stable build: GetReportedVersion = %q, want %q", got, GetVersion())
|
||||
if got := GetPanelVersion(); got != GetBaseVersion() {
|
||||
t.Fatalf("stable build: GetPanelVersion = %q, want %q", got, GetBaseVersion())
|
||||
}
|
||||
|
||||
buildCommit = "1d1128cf"
|
||||
if got := GetReportedVersion(); got != "dev+1d1128cf" {
|
||||
t.Fatalf("dev build: GetReportedVersion = %q, want %q", got, "dev+1d1128cf")
|
||||
if got := GetPanelVersion(); got != "dev+1d1128cf" {
|
||||
t.Fatalf("dev build: GetPanelVersion = %q, want %q", got, "dev+1d1128cf")
|
||||
}
|
||||
|
||||
buildCommit = "1d1128cf945c4615efa05cf41ba7fa766e2ee428"
|
||||
if got := GetReportedVersion(); got != "dev+1d1128cf" {
|
||||
t.Fatalf("dev build (full sha): GetReportedVersion = %q, want %q", got, "dev+1d1128cf")
|
||||
if got := GetPanelVersion(); got != "dev+1d1128cf" {
|
||||
t.Fatalf("dev build (full sha): GetPanelVersion = %q, want %q", got, "dev+1d1128cf")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user