aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-23 06:07:14 -0700
committerFuwn <[email protected]>2024-10-23 06:07:14 -0700
commitd5324b441724b3af301079a2d514b979f5af4958 (patch)
treed49badb9d588e33e9ad54278dbb0cb2f48f1238c /internal
parent49e21d633c14f639659c8ec3312bb808dec3005e (diff)
downloadyae-d5324b441724b3af301079a2d514b979f5af4958.tar.xz
yae-d5324b441724b3af301079a2d514b979f5af4958.zip
fix(source): dynamically identify host
Diffstat (limited to 'internal')
-rw-r--r--internal/yae/source.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/yae/source.go b/internal/yae/source.go
index 185aba7..625a0f8 100644
--- a/internal/yae/source.go
+++ b/internal/yae/source.go
@@ -2,6 +2,7 @@ package yae
import (
"fmt"
+ "net/url"
"strings"
"github.com/charmbracelet/log"
@@ -91,7 +92,15 @@ func (source *Source) Update(sources *Sources, name string, force bool, forcePin
func (source *Source) fetchLatestGitTag() (string, error) {
if source.Type == "git" {
- repository := "https://github.com/" + strings.Split(source.URL, "/")[3] + "/" + strings.Split(source.URL, "/")[4]
+ url, err := url.Parse(source.URL)
+
+ if err != nil {
+ return "", err
+ }
+
+ domain := url.Host
+ pathSegments := strings.Split(url.Path, "/")
+ repository := url.Scheme + "://" + domain + "/" + pathSegments[1] + "/" + pathSegments[2]
remotes, err := command("bash", false, "-c", fmt.Sprintf("git ls-remote %s | awk -F'/' '{print $NF}' | sort -V", repository))
if err != nil {