Skip to content

Commit

Permalink
don't use user for token on gogs
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperspencer committed Sep 2, 2024
1 parent d346b1d commit c68a3ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions gogs/gogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Description: r.Description,
Private: r.Private,
Issues: GetIssues(r, client, repo),
NoTokenUser: true,
})
if repo.Wiki {
repos = append(repos, types.Repo{
Expand All @@ -210,6 +211,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Hoster: types.GetHost(repo.URL),
Description: r.Description,
Private: r.Private,
NoTokenUser: true,
})
}

Expand All @@ -233,6 +235,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Description: r.Description,
Private: r.Private,
Issues: GetIssues(r, client, repo),
NoTokenUser: true,
})
if repo.Wiki {
repos = append(repos, types.Repo{
Expand All @@ -246,6 +249,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Hoster: types.GetHost(repo.URL),
Description: r.Description,
Private: r.Private,
NoTokenUser: true,
})
}
}
Expand Down Expand Up @@ -324,6 +328,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Description: r.Description,
Private: r.Private,
Issues: GetIssues(r, client, repo),
NoTokenUser: true,
})
if repo.Wiki {
repos = append(repos, types.Repo{
Expand All @@ -337,6 +342,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Hoster: types.GetHost(repo.URL),
Description: r.Description,
Private: r.Private,
NoTokenUser: true,
})
}

Expand All @@ -360,6 +366,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Description: r.Description,
Private: r.Private,
Issues: GetIssues(r, client, repo),
NoTokenUser: true,
})

if repo.Wiki {
Expand All @@ -374,6 +381,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Hoster: types.GetHost(repo.URL),
Description: r.Description,
Private: r.Private,
NoTokenUser: true,
})
}
}
Expand Down
12 changes: 9 additions & 3 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,15 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
return false
}
case repo.Token != "":
auth = &http.BasicAuth{
Username: "xyz",
Password: repo.Token,
if repo.NoTokenUser {
auth = &http.BasicAuth{
Username: repo.Token,
}
} else {
auth = &http.BasicAuth{
Username: "xyz",
Password: repo.Token,
}
}
case repo.Origin.Username != "" && repo.Origin.Password != "":
auth = &http.BasicAuth{
Expand Down
1 change: 1 addition & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ type Repo struct {
Description string
Issues map[string]interface{}
Private bool
NoTokenUser bool
}

// Site TODO.
Expand Down

0 comments on commit c68a3ae

Please sign in to comment.