From 0b8cc79ef485b4b38267140c37991a5b36aed953 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Fri, 7 Apr 2023 21:46:49 +0000 Subject: [PATCH 01/13] Remove the note --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 1f2eac5..5004f94 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,6 @@ Have an instance you want on the list? Make an issue or PR! You can find a json-list of the same in [gothub/gothub-instances](https://codeberg.org/gothub/gothub-instances). -[^1]: Has some modifications: https://git.vern.cc/vern/modifications/src/branch/master/gothub ## Setup See [gothub.app/docs](https://gothub.app/docs) for information about setting up GotHub. From 18876e9105843b35a095ddb434b118e03156aa6d Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Fri, 28 Apr 2023 22:38:04 +0530 Subject: [PATCH 02/13] specify branch using ldflag (closes #63) --- pages/about.go | 1 + pages/dirview.go | 1 + pages/explore.go | 5 +++-- pages/fileview.go | 17 +++++++++-------- pages/gist.go | 8 +++++--- pages/index.go | 1 + pages/repo.go | 1 + pages/user.go | 5 +++-- serve/serve.go | 8 +++++--- utils/version.go | 2 ++ views/file.html | 2 +- views/header.html | 2 +- 12 files changed, 33 insertions(+), 20 deletions(-) diff --git a/pages/about.go b/pages/about.go index 962e0a6..e7ce9bd 100644 --- a/pages/about.go +++ b/pages/about.go @@ -39,6 +39,7 @@ func HandleAbout(c *fiber.Ctx) error { return c.Render("about", fiber.Map{ "title": "About this instance", + "branch": utils.Branch, "privacyInformation": privacyInfoArray, }) } diff --git a/pages/dirview.go b/pages/dirview.go index 31cebf7..baf4c7f 100644 --- a/pages/dirview.go +++ b/pages/dirview.go @@ -88,6 +88,7 @@ func DirView(c *fiber.Ctx) error { dirArray = append(dirArray, Scrape) return c.Render("dir", fiber.Map{ "title": "Directory " + c.Params("+") + " | " + c.Params("user") + "/" + c.Params("repo"), + "branch": utils.Branch, "dir": dirArray, "files": dirFilesArray, "readme": string(readmeOutput), diff --git a/pages/explore.go b/pages/explore.go index a425673..0606011 100644 --- a/pages/explore.go +++ b/pages/explore.go @@ -36,7 +36,8 @@ func HandleExplore(c *fiber.Ctx) error { } return c.Render("explore", fiber.Map{ - "title": "Explore", - "repos": trendingReposArray, + "title": "Explore", + "branch": utils.Branch, + "repos": trendingReposArray, }) } diff --git a/pages/fileview.go b/pages/fileview.go index 514003e..0f46016 100644 --- a/pages/fileview.go +++ b/pages/fileview.go @@ -3,14 +3,14 @@ package pages import ( "bufio" "bytes" + "codeberg.org/gothub/gothub/utils" "context" - "html/template" - htmlfmt "github.com/alecthomas/chroma/v2/formatters/html" "github.com/alecthomas/chroma/v2/lexers" "github.com/alecthomas/chroma/v2/styles" "github.com/carlmjohnson/requests" "github.com/gofiber/fiber/v2" + "html/template" ) // FileView is the file view page @@ -57,11 +57,12 @@ func FileView(c *fiber.Ctx) error { writer.Flush() cssw.Flush() return c.Render("file", fiber.Map{ - "title": c.Params("+") + " | " + c.Params("user") + "/" + c.Params("repo"), - "file": template.HTML(buf.String()), - "css": template.CSS(cssbuf.String()), - "fullname": c.Params("user") + "/" + c.Params("repo"), - "name": c.Params("+"), - "branch": c.Params("branch"), + "title": c.Params("+") + " | " + c.Params("user") + "/" + c.Params("repo"), + "branch": utils.Branch, + "file": template.HTML(buf.String()), + "css": template.CSS(cssbuf.String()), + "fullname": c.Params("user") + "/" + c.Params("repo"), + "name": c.Params("+"), + "fileBranch": c.Params("branch"), }) } diff --git a/pages/gist.go b/pages/gist.go index 71d755b..350800c 100644 --- a/pages/gist.go +++ b/pages/gist.go @@ -3,6 +3,7 @@ package pages import ( "bufio" "bytes" + "codeberg.org/gothub/gothub/utils" "context" htmlfmt "github.com/alecthomas/chroma/v2/formatters/html" "github.com/alecthomas/chroma/v2/lexers" @@ -131,8 +132,9 @@ func HandleGist(c *fiber.Ctx) error { gistArray = append(gistArray, Scrape) return c.Render("gist", fiber.Map{ - "title": "Repository " + c.Params("user") + "/" + c.Params("gistID"), - "gist": gistArray, - "files": gistFilesArray, + "title": "Repository " + c.Params("user") + "/" + c.Params("gistID"), + "branch": utils.Branch, + "gist": gistArray, + "files": gistFilesArray, }) } diff --git a/pages/index.go b/pages/index.go index d3c5fab..6796c61 100644 --- a/pages/index.go +++ b/pages/index.go @@ -11,6 +11,7 @@ import ( func HandleIndex(c *fiber.Ctx) error { return c.Render("index", fiber.Map{ "host": c.Hostname(), + "branch": utils.Branch, "version": utils.Version(), "fiberversion": fiber.Version, "goversion": runtime.Version(), diff --git a/pages/repo.go b/pages/repo.go index 858397c..c7dc8d6 100644 --- a/pages/repo.go +++ b/pages/repo.go @@ -121,6 +121,7 @@ func HandleRepo(c *fiber.Ctx) error { repoArray = append(repoArray, Scrape) return c.Render("repo", fiber.Map{ "title": c.Params("user") + "/" + repoUrl + branchExists, + "branch": utils.Branch, "repo": repoArray, "files": repoFilesArray, "readme": readmeOutput, diff --git a/pages/user.go b/pages/user.go index bff5636..a96b2ce 100644 --- a/pages/user.go +++ b/pages/user.go @@ -181,7 +181,8 @@ func HandleUser(c *fiber.Ctx) error { userArray = append(userArray, Scrape) return c.Render("user", fiber.Map{ - "title": c.Params("user"), - "user": userArray, + "title": c.Params("user"), + "branch": utils.Branch, + "user": userArray, }) } diff --git a/serve/serve.go b/serve/serve.go index 4b2fc6c..fa39b43 100644 --- a/serve/serve.go +++ b/serve/serve.go @@ -47,8 +47,9 @@ func Serve(port string) { } _, link := regexp.MatchString(`\/.*\ `, err.Error()) err = ctx.Status(code).Render("error", fiber.Map{ - "error": err, - "link": link, + "error": err, + "link": link, + "branch": utils.Branch, }) if err != nil { return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error") @@ -73,7 +74,8 @@ func Serve(port string) { Expiration: 5 * time.Minute, LimitReached: func(c *fiber.Ctx) error { return c.Status(429).Render("ratelimit_gt", fiber.Map{ - "Title": "Rate limit exceeded", + "Title": "Rate limit exceeded", + "branch": utils.Branch, }) }, }) diff --git a/utils/version.go b/utils/version.go index a45512a..39b6090 100644 --- a/utils/version.go +++ b/utils/version.go @@ -4,6 +4,8 @@ import ( "runtime/debug" ) +var Branch = "Alpha" + // Version returns the git commit hash of the current build. Taken from https://git.vern.cc/pjals/bestofbot. func Version() string { if info, ok := debug.ReadBuildInfo(); ok { diff --git a/views/file.html b/views/file.html index 7f178a4..75be538 100644 --- a/views/file.html +++ b/views/file.html @@ -11,7 +11,7 @@ } diff --git a/views/header.html b/views/header.html index 57dd5d3..8d28837 100644 --- a/views/header.html +++ b/views/header.html @@ -20,7 +20,7 @@ height="30" width="30" alt="" - >GotHub (alpha)GotHub ({{.branch}}) From fd6bc0e6580baddb1c89c48bdea30e9a9395d0cc Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Mon, 8 May 2023 16:14:59 +0530 Subject: [PATCH 10/13] add master marking for normal Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6c08754..5321429 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apk --no-cache add git RUN git clone https://codeberg.org/gothub/gothub . RUN go mod download -RUN GOOS=linux GOARCH=$TARGETARCH go build -o /src/gothub +RUN GOOS=linux GOARCH=$TARGETARCH go build -o /src/gothub -ldflags="-X codeberg.org/gothub/gothub/utils.Branch=master" FROM alpine:3.16 as bin From 89da4a1b05726ce1eca7d0bdd4a749e9d03ba8f9 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Tue, 9 May 2023 15:58:35 +0530 Subject: [PATCH 11/13] move esmailelbob instance to dev --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 301a498..b2fbe73 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The ``master`` branch runs on the master branch of GotHub. This means that the i | Link | Cloudflare | Country | ISP | Branch | | -------- | ---------- | ----------- | ----- | ----- | | [gh.akisblack.dev](https://gh.akisblack.dev) | No | Germany | OVHcloud | master | +| [gothub.esmailelbob.xyz](https://gothub.esmailelbob.xyz) | No | Canada | OVHcloud | master | | [gh.odyssey346.dev](https://gh.odyssey346.dev) | No | France | OVHcloud (Trolling Solutions) | master | | [gh.phreedom.club](https://gh.phreedom.club) | No | Iceland | Flokinet | master | | [gothub.projectsegfau.lt](https://gothub.projectsegfau.lt) | No | GeoDNS (Luxembourg/USA/India) | BuyVM/Digital Ocean/Airtel | master | @@ -43,7 +44,6 @@ The ``master`` branch runs on the master branch of GotHub. This means that the i | [gothub.xbdm.fun](https://gothub.xbdm.fun) | Yes | Germany | Hetzner | master | | [dev.gh.akisblack.dev](https://dev.gh.akisblack.dev) | No | Germany | OVHcloud | dev | | [gh.creller.net](https://gh.creller.net) | No | Scotland | British Telecommunications PLC | dev | -| [gothub.esmailelbob.xyz](https://gothub.esmailelbob.xyz) | No | Canada | OVHcloud | dev | | [gothub.no-logs.com](https://gothub.no-logs.com/) | No | Sweden | Vultr | dev | | [gh.dev.odyssey346.dev](https://gh.dev.odyssey346.dev) | No | France | OVHcloud (Trolling Solutions) | dev | | [gothub.dev.projectsegfau.lt](https://gothub.dev.projectsegfau.lt) | No | Luxembourg | BuyVM | dev | From b524fbe0ad6e559373d5757c8c1a596822281e2c Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Wed, 10 May 2023 13:33:21 +0530 Subject: [PATCH 12/13] no-logs.com is master as well --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2fbe73..5aa428a 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ The ``master`` branch runs on the master branch of GotHub. This means that the i | -------- | ---------- | ----------- | ----- | ----- | | [gh.akisblack.dev](https://gh.akisblack.dev) | No | Germany | OVHcloud | master | | [gothub.esmailelbob.xyz](https://gothub.esmailelbob.xyz) | No | Canada | OVHcloud | master | +| [gothub.no-logs.com](https://gothub.no-logs.com/) | No | Sweden | Vultr | master | | [gh.odyssey346.dev](https://gh.odyssey346.dev) | No | France | OVHcloud (Trolling Solutions) | master | | [gh.phreedom.club](https://gh.phreedom.club) | No | Iceland | Flokinet | master | | [gothub.projectsegfau.lt](https://gothub.projectsegfau.lt) | No | GeoDNS (Luxembourg/USA/India) | BuyVM/Digital Ocean/Airtel | master | @@ -44,7 +45,6 @@ The ``master`` branch runs on the master branch of GotHub. This means that the i | [gothub.xbdm.fun](https://gothub.xbdm.fun) | Yes | Germany | Hetzner | master | | [dev.gh.akisblack.dev](https://dev.gh.akisblack.dev) | No | Germany | OVHcloud | dev | | [gh.creller.net](https://gh.creller.net) | No | Scotland | British Telecommunications PLC | dev | -| [gothub.no-logs.com](https://gothub.no-logs.com/) | No | Sweden | Vultr | dev | | [gh.dev.odyssey346.dev](https://gh.dev.odyssey346.dev) | No | France | OVHcloud (Trolling Solutions) | dev | | [gothub.dev.projectsegfau.lt](https://gothub.dev.projectsegfau.lt) | No | Luxembourg | BuyVM | dev | From bf64cedb0819382de68a50007a6fc24058bfe8b2 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Wed, 10 May 2023 13:33:55 +0530 Subject: [PATCH 13/13] add master/dev clarification in compose file --- compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yml b/compose.yml index a64c0db..e01b09b 100644 --- a/compose.yml +++ b/compose.yml @@ -1,7 +1,7 @@ version: "3" services: gothub: - image: codeberg.org/gothub/gothub:latest + image: codeberg.org/gothub/gothub:latest # Master branch # image: codeberg.org/gothub/gothub:dev # Dev branch restart: unless-stopped ports: @@ -21,4 +21,4 @@ services: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/version || exit 1 interval: 30s timeout: 5s - retries: 2 + retries: 2 \ No newline at end of file