Skip to content

Modern Docker Management, Designed for Everyone

feat: add version label to the login page

Kyle Mendell6d16da243128
diff --git a/backend/internal/services/version_service.go b/backend/internal/services/version_service.go
index 07c331bc1..8ebdf94d0 100644
--- a/backend/internal/services/version_service.go
+++ b/backend/internal/services/version_service.go
@@ -71,7 +71,7 @@ func (s *VersionService) GetLatestVersion(ctx context.Context) (string, error) {
return "", fmt.Errorf("GitHub API returned empty tag name")
}
- return strings.TrimPrefix(payload.TagName, "v"), nil
+ return payload.TagName, nil
})
var staleErr *cache.ErrStale
@@ -101,7 +101,11 @@ func (s *VersionService) ReleaseURL(version string) string {
if strings.TrimSpace(version) == "" {
return "https://github.com/ofkm/arcane/releases/latest"
}
- return "https://github.com/ofkm/arcane/releases/tag/v" + version
+ v := strings.TrimSpace(version)
+ if !strings.HasPrefix(v, "v") {
+ v = "v" + v
+ }
+ return "https://github.com/ofkm/arcane/releases/tag/" + v
}
type VersionInformation struct {
@@ -112,7 +116,13 @@ type VersionInformation struct {
}
func (s *VersionService) GetVersionInformation(ctx context.Context, currentVersion string) (*VersionInformation, error) {
- cur := strings.TrimPrefix(strings.TrimSpace(currentVersion), "v")
+ if currentVersion == "" {
+ currentVersion = s.version
+ }
+ cur := strings.TrimSpace(currentVersion)
+ if !strings.HasPrefix(cur, "v") && len(cur) > 0 && cur[0] >= '0' && cur[0] <= '9' {
+ cur = "v" + cur
+ }
if s.disabled {
return &VersionInformation{
@@ -180,12 +190,18 @@ func (s *VersionService) getDisplayVersion() string {
if strings.Contains(strings.ToLower(version), "next") && s.revision != "" && s.revision != "unknown" {
return fmt.Sprintf("next-%s", s.revision)
}
+ if s.isSemverVersion() {
+ return "v" + version
+ }
return version
}
// GetAppVersionInfo returns application version information including display version
func (s *VersionService) GetAppVersionInfo(ctx context.Context) *dto.VersionInfoDto {
- version := strings.TrimPrefix(strings.TrimSpace(s.version), "v")
+ version := strings.TrimSpace(s.version)
+ if s.isSemverVersion() && !strings.HasPrefix(version, "v") {
+ version = "v" + version
+ }
displayVersion := s.getDisplayVersion()
isSemver := s.isSemverVersion()
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 7dca5393b..0f4986d39 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1224,7 +1224,7 @@
"sidebar_select_one": "Select one",
"sidebar_local_docker_socket": "unix:///var/run/docker.sock",
"sidebar_manage_environments": "Manage Environments",
- "sidebar_version": "v{version}",
+ "sidebar_version": "{version}",
"sidebar_update_available": "Update available",
"sidebar_update_available_tooltip": "Update available: {version}",
"sidebar_management": "Management",
diff --git a/frontend/src/routes/auth/login/+page.svelte b/frontend/src/routes/auth/login/+page.svelte
index e34fa7c6f..ac52961fe 100644
--- a/frontend/src/routes/auth/login/+page.svelte
+++ b/frontend/src/routes/auth/login/+page.svelte
@@ -240,7 +240,7 @@
</div>
<div class="fixed right-0 bottom-4 left-0 p-4">
- <div class="text-muted-foreground flex items-center justify-center">
+ <div class="text-muted-foreground flex flex-col items-center justify-center gap-2">
<a
href="https://github.com/ofkm/arcane"
target="_blank"
@@ -249,6 +249,9 @@
>
{m.common_view_on_github()}
</a>
+ {#if data.versionInformation?.displayVersion}
+ <span class="text-xs opacity-50">{data.versionInformation.displayVersion}</span>
+ {/if}
</div>
</div>
diff --git a/frontend/src/routes/auth/login/+page.ts b/frontend/src/routes/auth/login/+page.ts
index eb65e1261..3c83fd685 100644
--- a/frontend/src/routes/auth/login/+page.ts
+++ b/frontend/src/routes/auth/login/+page.ts
@@ -14,6 +14,7 @@ export const load = async ({ parent, url }) => {
return {
settings: data.settings,
redirectTo,
- error
+ error,
+ versionInformation: data.versionInformation
};
};