aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git_misc.go4
-rw-r--r--handle_category_index.go10
-rw-r--r--handle_repo_index.go6
-rw-r--r--handle_repo_tree.go6
-rw-r--r--main.go6
-rw-r--r--templates/category_repos.html8
-rw-r--r--templates/repo_index.html2
-rw-r--r--templates/repo_tree_dir.html2
-rw-r--r--templates/repo_tree_file.html2
9 files changed, 23 insertions, 23 deletions
diff --git a/git_misc.go b/git_misc.go
index 64d1ff5..984d0f2 100644
--- a/git_misc.go
+++ b/git_misc.go
@@ -11,8 +11,8 @@ import (
"go.lindenii.runxiyu.org/lindenii-common/misc"
)
-func open_git_repo(category_name, repo_name string) (*git.Repository, error) {
- return git.PlainOpen(filepath.Join(config.Git.Root, category_name, repo_name+".git"))
+func open_git_repo(group_name, repo_name string) (*git.Repository, error) {
+ return git.PlainOpen(filepath.Join(config.Git.Root, group_name, repo_name+".git"))
}
func build_display_git_tree(tree *object.Tree) []display_git_tree_entry_t {
diff --git a/handle_category_index.go b/handle_category_index.go
index f9b201c..f194cee 100644
--- a/handle_category_index.go
+++ b/handle_category_index.go
@@ -7,11 +7,11 @@ import (
"strings"
)
-func handle_category_repos(w http.ResponseWriter, r *http.Request) {
+func handle_group_repos(w http.ResponseWriter, r *http.Request) {
data := make(map[string]any)
- category_name := r.PathValue("category_name")
- data["category_name"] = category_name
- entries, err := os.ReadDir(filepath.Join(config.Git.Root, category_name))
+ group_name := r.PathValue("group_name")
+ data["group_name"] = group_name
+ entries, err := os.ReadDir(filepath.Join(config.Git.Root, group_name))
if err != nil {
_, _ = w.Write([]byte("Error listing repos: " + err.Error()))
return
@@ -26,7 +26,7 @@ func handle_category_repos(w http.ResponseWriter, r *http.Request) {
}
data["repos"] = repos
- err = templates.ExecuteTemplate(w, "category_repos", data)
+ err = templates.ExecuteTemplate(w, "group_repos", data)
if err != nil {
_, _ = w.Write([]byte("Error rendering template: " + err.Error()))
return
diff --git a/handle_repo_index.go b/handle_repo_index.go
index cdcc092..0f38fc2 100644
--- a/handle_repo_index.go
+++ b/handle_repo_index.go
@@ -7,9 +7,9 @@ import (
func handle_repo_index(w http.ResponseWriter, r *http.Request) {
data := make(map[string]any)
// TODO: Sanitize path values
- category_name, repo_name := r.PathValue("category_name"), r.PathValue("repo_name")
- data["category_name"], data["repo_name"] = category_name, repo_name
- repo, err := open_git_repo(category_name, repo_name)
+ group_name, repo_name := r.PathValue("group_name"), r.PathValue("repo_name")
+ data["group_name"], data["repo_name"] = group_name, repo_name
+ repo, err := open_git_repo(group_name, repo_name)
if err != nil {
_, _ = w.Write([]byte("Error opening repo: " + err.Error()))
return
diff --git a/handle_repo_tree.go b/handle_repo_tree.go
index 8397a84..26d7fd6 100644
--- a/handle_repo_tree.go
+++ b/handle_repo_tree.go
@@ -18,9 +18,9 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request) {
data := make(map[string]any)
// TODO: Sanitize path values
raw_path_spec := r.PathValue("rest")
- ref_name, category_name, repo_name, path_spec := r.PathValue("ref"), r.PathValue("category_name"), r.PathValue("repo_name"), strings.TrimSuffix(raw_path_spec, "/")
- data["ref"], data["category_name"], data["repo_name"], data["path_spec"] = ref_name, category_name, repo_name, path_spec
- repo, err := open_git_repo(category_name, repo_name)
+ ref_name, group_name, repo_name, path_spec := r.PathValue("ref"), r.PathValue("group_name"), r.PathValue("repo_name"), strings.TrimSuffix(raw_path_spec, "/")
+ data["ref"], data["group_name"], data["repo_name"], data["path_spec"] = ref_name, group_name, repo_name, path_spec
+ repo, err := open_git_repo(group_name, repo_name)
if err != nil {
_, _ = w.Write([]byte("Error opening repo: " + err.Error()))
return
diff --git a/main.go b/main.go
index 6c69af4..5997e08 100644
--- a/main.go
+++ b/main.go
@@ -34,9 +34,9 @@ func main() {
serve_source()
http.HandleFunc("/{$}", handle_index)
- http.HandleFunc("/{category_name}/repos/{$}", handle_category_repos)
- http.HandleFunc("/{category_name}/repos/{repo_name}/{$}", handle_repo_index)
- http.HandleFunc("/{category_name}/repos/{repo_name}/tree/{ref}/{rest...}", handle_repo_tree)
+ http.HandleFunc("/{group_name}/repos/{$}", handle_group_repos)
+ http.HandleFunc("/{group_name}/repos/{repo_name}/{$}", handle_repo_index)
+ http.HandleFunc("/{group_name}/repos/{repo_name}/tree/{ref}/{rest...}", handle_repo_tree)
listener, err := net.Listen(config.HTTP.Net, config.HTTP.Addr)
if err != nil {
diff --git a/templates/category_repos.html b/templates/category_repos.html
index 406fee4..aa4c926 100644
--- a/templates/category_repos.html
+++ b/templates/category_repos.html
@@ -1,14 +1,14 @@
-{{- define "category_repos" -}}
+{{- define "group_repos" -}}
<!DOCTYPE html>
<html>
<head>
{{ template "head_common" . }}
- <title>Repos in {{ .category_name }} &ndash; Lindenii Forge</title>
+ <title>Repos in {{ .group_name }} &ndash; Lindenii Forge</title>
</head>
- <body class="category-index">
+ <body class="group-index">
<div class="padding-wrapper">
<h1>
- Repos in {{ .category_name }}
+ Repos in {{ .group_name }}
</h1>
<ul>
{{- range .repos }}
diff --git a/templates/repo_index.html b/templates/repo_index.html
index bc29cf1..7ae7bcd 100644
--- a/templates/repo_index.html
+++ b/templates/repo_index.html
@@ -3,7 +3,7 @@
<html>
<head>
{{ template "head_common" . }}
- <title>{{ .category_name }}/repos/{{ .repo_name }} &ndash; Lindenii Forge</title>
+ <title>{{ .group_name }}/repos/{{ .repo_name }} &ndash; Lindenii Forge</title>
</head>
<body class="repo-index">
<div class="padding-wrapper">
diff --git a/templates/repo_tree_dir.html b/templates/repo_tree_dir.html
index 207fcaa..60d9ede 100644
--- a/templates/repo_tree_dir.html
+++ b/templates/repo_tree_dir.html
@@ -3,7 +3,7 @@
<html>
<head>
{{ template "head_common" . }}
- <title>{{ .category_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} &ndash; Lindenii Forge</title>
+ <title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} &ndash; Lindenii Forge</title>
</head>
<body class="repo-tree-dir">
<div class="padding-wrapper">
diff --git a/templates/repo_tree_file.html b/templates/repo_tree_file.html
index 26c8eef..b1ba877 100644
--- a/templates/repo_tree_file.html
+++ b/templates/repo_tree_file.html
@@ -4,7 +4,7 @@
<head>
{{ template "head_common" . }}
<link rel="stylesheet" href="/static/chroma.css" />
- <title>{{ .category_name }}/repos/{{ .repo_name }}/{{ .path_spec }} &ndash; Lindenii Forge</title>
+ <title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }} &ndash; Lindenii Forge</title>
</head>
<body class="repo-tree-file">
<p>