aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--fedauth.go14
-rw-r--r--git_hooks_deploy.go4
-rw-r--r--http_handle_repo_commit.go2
-rw-r--r--http_handle_repo_index.go8
-rw-r--r--http_handle_repo_log.go6
-rw-r--r--http_handle_repo_raw.go6
6 files changed, 20 insertions, 20 deletions
diff --git a/fedauth.go b/fedauth.go
index 2084eff..5957519 100644
--- a/fedauth.go
+++ b/fedauth.go
@@ -15,20 +15,20 @@ import (
"github.com/jackc/pgx/v5"
)
-func fedauth(ctx context.Context, userID int, service, remote_username, pubkey string) (bool, error) {
+func fedauth(ctx context.Context, userID int, service, remoteUsername, pubkey string) (bool, error) {
var err error
var resp *http.Response
matched := false
- username_escaped := url.PathEscape(remote_username)
+ usernameEscaped := url.PathEscape(remoteUsername)
switch service {
case "sr.ht":
- resp, err = http.Get("https://meta.sr.ht/~" + username_escaped + ".keys")
+ resp, err = http.Get("https://meta.sr.ht/~" + usernameEscaped + ".keys")
case "github":
- resp, err = http.Get("https://github.com/" + username_escaped + ".keys")
+ resp, err = http.Get("https://github.com/" + usernameEscaped + ".keys")
case "codeberg":
- resp, err = http.Get("https://codeberg.org/" + username_escaped + ".keys")
+ resp, err = http.Get("https://codeberg.org/" + usernameEscaped + ".keys")
case "tangled":
- resp, err = http.Get("https://tangled.sh/keys/" + username_escaped)
+ resp, err = http.Get("https://tangled.sh/keys/" + usernameEscaped)
// TODO: Don't rely on one webview
default:
return false, errors.New("unknown federated service")
@@ -77,7 +77,7 @@ func fedauth(ctx context.Context, userID int, service, remote_username, pubkey s
if _, err = tx.Exec(ctx, `UPDATE users SET type = 'federated' WHERE id = $1 AND type = 'pubkey_only'`, userID); err != nil {
return false, err
}
- if _, err = tx.Exec(ctx, `INSERT INTO federated_identities (user_id, service, remote_username) VALUES ($1, $2, $3)`, userID, service, remote_username); err != nil {
+ if _, err = tx.Exec(ctx, `INSERT INTO federated_identities (user_id, service, remote_username) VALUES ($1, $2, $3)`, userID, service, remoteUsername); err != nil {
return false, err
}
if err = tx.Commit(ctx); err != nil {
diff --git a/git_hooks_deploy.go b/git_hooks_deploy.go
index 992f892..86df6e3 100644
--- a/git_hooks_deploy.go
+++ b/git_hooks_deploy.go
@@ -44,10 +44,10 @@ func deployHooks() (err error) {
return err
}
- for _, hook_name := range []string{
+ for _, hookName := range []string{
"pre-receive",
} {
- if err = os.Symlink(filepath.Join(config.Hooks.Execs, "hookc"), filepath.Join(config.Hooks.Execs, hook_name)); err != nil {
+ if err = os.Symlink(filepath.Join(config.Hooks.Execs, "hookc"), filepath.Join(config.Hooks.Execs, hookName)); err != nil {
return err
}
}
diff --git a/http_handle_repo_commit.go b/http_handle_repo_commit.go
index f6ef4c1..2f0fa51 100644
--- a/http_handle_repo_commit.go
+++ b/http_handle_repo_commit.go
@@ -71,7 +71,7 @@ func httpHandleRepoCommit(w http.ResponseWriter, r *http.Request, params map[str
http.Error(w, "Error getting patch from commit: "+err.Error(), http.StatusInternalServerError)
return
}
- params["parent_commit_hash"] = parentCommitHash.String()
+ params["parent_commitHash"] = parentCommitHash.String()
params["patch"] = patch
params["file_patches"] = makeUsableFilePatches(patch)
diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go
index e274867..54fcd6b 100644
--- a/http_handle_repo_index.go
+++ b/http_handle_repo_index.go
@@ -17,7 +17,7 @@ func httpHandleRepoIndex(w http.ResponseWriter, r *http.Request, params map[stri
var repo *git.Repository
var repo_name string
var group_path []string
- var ref_hash plumbing.Hash
+ var refHash plumbing.Hash
var err error
var recent_commits []*object.Commit
var commit_object *object.Commit
@@ -32,7 +32,7 @@ func httpHandleRepoIndex(w http.ResponseWriter, r *http.Request, params map[stri
notes = append(notes, "Path contains newlines; HTTP Git access impossible")
}
- ref_hash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string))
+ refHash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string))
if err != nil {
goto no_ref
}
@@ -48,12 +48,12 @@ func httpHandleRepoIndex(w http.ResponseWriter, r *http.Request, params map[stri
}
params["branches"] = branches
- if recent_commits, err = getRecentCommits(repo, ref_hash, 3); err != nil {
+ if recent_commits, err = getRecentCommits(repo, refHash, 3); err != nil {
goto no_ref
}
params["commits"] = recent_commits
- if commit_object, err = repo.CommitObject(ref_hash); err != nil {
+ if commit_object, err = repo.CommitObject(refHash); err != nil {
goto no_ref
}
diff --git a/http_handle_repo_log.go b/http_handle_repo_log.go
index 2c27b03..39be231 100644
--- a/http_handle_repo_log.go
+++ b/http_handle_repo_log.go
@@ -14,18 +14,18 @@ import (
// TODO: I probably shouldn't include *all* commits here...
func httpHandleRepoLog(w http.ResponseWriter, r *http.Request, params map[string]any) {
var repo *git.Repository
- var ref_hash plumbing.Hash
+ var refHash plumbing.Hash
var err error
var commits []*object.Commit
repo = params["repo"].(*git.Repository)
- if ref_hash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string)); err != nil {
+ if refHash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string)); err != nil {
http.Error(w, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError)
return
}
- if commits, err = getRecentCommits(repo, ref_hash, -1); err != nil {
+ if commits, err = getRecentCommits(repo, refHash, -1); err != nil {
http.Error(w, "Error getting recent commits: "+err.Error(), http.StatusInternalServerError)
return
}
diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go
index a2e3536..e26f438 100644
--- a/http_handle_repo_raw.go
+++ b/http_handle_repo_raw.go
@@ -17,7 +17,7 @@ import (
func httpHandleRepoRaw(w http.ResponseWriter, r *http.Request, params map[string]any) {
var raw_path_spec, path_spec string
var repo *git.Repository
- var ref_hash plumbing.Hash
+ var refHash plumbing.Hash
var commit_object *object.Commit
var tree *object.Tree
var err error
@@ -26,12 +26,12 @@ func httpHandleRepoRaw(w http.ResponseWriter, r *http.Request, params map[string
repo, path_spec = params["repo"].(*git.Repository), strings.TrimSuffix(raw_path_spec, "/")
params["path_spec"] = path_spec
- if ref_hash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string)); err != nil {
+ if refHash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string)); err != nil {
http.Error(w, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError)
return
}
- if commit_object, err = repo.CommitObject(ref_hash); err != nil {
+ if commit_object, err = repo.CommitObject(refHash); err != nil {
http.Error(w, "Error getting commit object: "+err.Error(), http.StatusInternalServerError)
return
}