From 6c60594dff95b55aa4914c8a7ec1fab9ecafd8e4 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Wed, 30 Nov 2022 15:04:41 +0100 Subject: [PATCH 001/170] Woodpecker + Docker --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 61a0282..60f37a0 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -13,7 +13,7 @@ pipeline: image: plugins/docker settings: registry: codeberg.org - repo: codeberg.org/odyssium/gothub + repo: codeberg.org/Midou36O/gothub username: from_secret: user password: @@ -27,7 +27,7 @@ pipeline: image: plugins/docker settings: registry: codeberg.org - repo: codeberg.org/odyssium/gothub + repo: codeberg.org/Midou36O/gothub username: from_secret: user password: From 162f1b72275e63b9a432c0f2183e4cbe14907605 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Wed, 30 Nov 2022 15:08:39 +0100 Subject: [PATCH 002/170] it should be lowercase --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 60f37a0..87719e8 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -13,7 +13,7 @@ pipeline: image: plugins/docker settings: registry: codeberg.org - repo: codeberg.org/Midou36O/gothub + repo: codeberg.org/midou36o/gothub username: from_secret: user password: @@ -27,7 +27,7 @@ pipeline: image: plugins/docker settings: registry: codeberg.org - repo: codeberg.org/Midou36O/gothub + repo: codeberg.org/midou36o/gothub username: from_secret: user password: From 1a3909683d87272d9ae24596383509da81c5c64e Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Tue, 7 Mar 2023 19:07:16 +0530 Subject: [PATCH 003/170] make ratelimiter only used for api-based routes --- serve/serve.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/serve/serve.go b/serve/serve.go index 8da421f..942e3ca 100644 --- a/serve/serve.go +++ b/serve/serve.go @@ -99,18 +99,18 @@ func Serve() { app.Static("/favicon.ico", "./public/assets/favicon.ico", staticConfig) app.Static("/logo.svg", "./public/assets/logo.svg", staticConfig) app.Get("/explore", ratelimiter, pages.HandleExplore) - app.Get("/:user", ratelimiter, pages.HandleUser) + app.Get("/:user", pages.HandleUser) app.Get("/avatar/:id", func(c *fiber.Ctx) error { utils.ProxyRequest(c, "https://avatars.githubusercontent.com/u/"+c.Params("id")+"?v=4") return nil }) - app.Get("/:user/:repo", ratelimiter, pages.HandleRepo) + app.Get("/:user/:repo", pages.HandleRepo) app.Get("/:user/:repo/tree/:branch/+", pages.FileView) - app.Get("/download/:user/:repo/:branch", ratelimiter, func(c *fiber.Ctx) error { + app.Get("/download/:user/:repo/:branch", func(c *fiber.Ctx) error { utils.ProxyRequest(c, "https://github.com/"+c.Params("user")+"/"+c.Params("repo")+"/archive/"+c.Params("branch")+".zip") return nil }) - app.Get("/raw/:user/:repo/:branch/:file", ratelimiter, func(c *fiber.Ctx) error { + app.Get("/raw/:user/:repo/:branch/:file", func(c *fiber.Ctx) error { utils.ProxyRequest(c, "https://raw.githubusercontent.com/"+c.Params("user")+"/"+c.Params("repo")+"/"+c.Params("branch")+"/"+c.Params("file")) return nil }) From 539bdbe770f820862465d6e87f81b522825c4623 Mon Sep 17 00:00:00 2001 From: HexagonCDN Date: Tue, 7 Mar 2023 13:40:41 +0000 Subject: [PATCH 004/170] Add `docker` syntax highlighting for README.md (#70) Reviewed-on: https://codeberg.org/gothub/gothub/pulls/70 Co-authored-by: HexagonCDN Co-committed-by: HexagonCDN --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b8a68a3..eabff88 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ You can find a json-list of the same in [gothub/gothub-instances](https://codebe ### Docker We recommend Docker as it is easy to update GotHub that way and it is easy to setup. [Packages page](https://codeberg.org/gothub/-/packages/container/gothub/latest) -``` +```docker docker run -d -p 3000:3000 --name gothub codeberg.org/gothub/gothub ``` From 4b6defbf9c6011cbca3ddac17a4e7fb6ce58bed6 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Tue, 7 Mar 2023 19:55:52 +0530 Subject: [PATCH 005/170] add instance privacy information page (closes #56) --- README.md | 11 +++++++++++ pages/privacy.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ serve/serve.go | 1 + views/header.html | 1 + views/privacy.html | 24 ++++++++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 pages/privacy.go create mode 100644 views/privacy.html diff --git a/README.md b/README.md index eabff88..d140e56 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,17 @@ go build -o gothub If you don't want to use port 3000 for GotHub, set the GOTHUB_PORT environment variable to the port you want to use. +If you want to be in the official instance list, you also need to fill these Instance Privacy environment variables: +``` +GOTHUB_IP_LOGGED=true/false +GOTHUB_REQUEST_URL_LOGGED=true/false +GOTHUB_USER_AGENT_LOGGED=true/false +GOTHUB_DIAGNOSTIC_INFO_LOGGED=true/false +GOTHUB_INSTANCE_PRIVACY_POLICY="" +GOTHUB_INSTANCE_COUNTRY="" +GOTHUB_INSTANCE_PROVIDER="" +GOTHUB_INSTANCE_CLOUDFLARE=true/false +``` ### Web server configuration (Caddy) We recommend Caddy for the web server, as it provides automatic HTTPS, HTTP/3 and is easy to setup. ```caddyfile diff --git a/pages/privacy.go b/pages/privacy.go new file mode 100644 index 0000000..a663bf2 --- /dev/null +++ b/pages/privacy.go @@ -0,0 +1,44 @@ +package pages + +import ( + "codeberg.org/gothub/gothub/utils" + "github.com/gofiber/fiber/v2" + "os" + "runtime" +) + +type PrivacyInfo struct { + IPAddr string + ReqURL string + UserAgent string + Diagnostics string + Country string + Provider string + Cloudflare string + PrivacyPolicy string + Version string + GoVersion string + FiberVersion string +} + +func HandlePrivacy(c *fiber.Ctx) error { + var privacyInfoArray []PrivacyInfo + privacyInfoArray = append(privacyInfoArray, PrivacyInfo{ + IPAddr: os.Getenv("GOTHUB_IP_LOGGED"), + ReqURL: os.Getenv("GOTHUB_REQUEST_URL_LOGGED"), + UserAgent: os.Getenv("GOTHUB_USER_AGENT_LOGGED"), + Diagnostics: os.Getenv("GOTHUB_DIAGNOSTIC_INFO_LOGGED"), + Country: os.Getenv("GOTHUB_INSTANCE_COUNTRY"), + Provider: os.Getenv("GOTHUB_INSTANCE_PROVIDER"), + Cloudflare: os.Getenv("GOTHUB_INSTANCE_CLOUDFLARE"), + PrivacyPolicy: os.Getenv("GOTHUB_INSTANCE_PRIVACY_POLICY"), + Version: utils.Version(), + FiberVersion: fiber.Version, + GoVersion: runtime.Version(), + }) + + return c.Render("privacy", fiber.Map{ + "title": "Instance Privacy", + "privacyInformation": privacyInfoArray, + }) +} diff --git a/serve/serve.go b/serve/serve.go index 942e3ca..d778193 100644 --- a/serve/serve.go +++ b/serve/serve.go @@ -98,6 +98,7 @@ func Serve() { app.Static("/robots.txt", "./public/robots.txt", staticConfig) app.Static("/favicon.ico", "./public/assets/favicon.ico", staticConfig) app.Static("/logo.svg", "./public/assets/logo.svg", staticConfig) + app.Get("/privacy", pages.HandlePrivacy) app.Get("/explore", ratelimiter, pages.HandleExplore) app.Get("/:user", pages.HandleUser) app.Get("/avatar/:id", func(c *fiber.Ctx) error { diff --git a/views/header.html b/views/header.html index 94d4ad4..8bb5d79 100644 --- a/views/header.html +++ b/views/header.html @@ -16,6 +16,7 @@ GotHub (alpha) diff --git a/views/privacy.html b/views/privacy.html new file mode 100644 index 0000000..df11d6b --- /dev/null +++ b/views/privacy.html @@ -0,0 +1,24 @@ +{{template "header" .}} + +
+

Instance Privacy

+{{ if .privacyInformation}} +{{ range $key, $value := .privacyInformation}} +

The goal of this page is to bring transparency to the data collected by the instances and to encourage privacy friendly practices.

+

If this page isn't filled, please contact your instance's maintainer.

+

IP Address logged: {{.IPAddr}}

+

Request URL logged: {{.ReqURL}}

+

User Agent logged: {{.UserAgent}}

+

Diagnostic Information logged: {{.Diagnostics}}

+{{ if .PrivacyPolicy }} +

You can see the maintainer's Privacy Policy for more information.

+{{end}} +

Additional Information

+

GotHub version: {{.Version}}

+

Fiber version: {{ .FiberVersion}}, running on {{ .GoVersion}}

+

Country: {{.Country}}

+

Cloudflare: {{.Cloudflare}}

+

ISP: {{.Provider}}

+{{end}} +{{end}} +
From 9bb7d60c733394c83faab77de074c90d163016f4 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Tue, 7 Mar 2023 16:36:25 +0100 Subject: [PATCH 006/170] Center the privacy policy and add some spacing. --- views/privacy.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/privacy.html b/views/privacy.html index df11d6b..7a38a7e 100644 --- a/views/privacy.html +++ b/views/privacy.html @@ -1,6 +1,6 @@ {{template "header" .}} -
+

Instance Privacy

{{ if .privacyInformation}} {{ range $key, $value := .privacyInformation}} From 39f4535f0dfed2ca06e3a838f41d2acb2f8f3843 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Tue, 7 Mar 2023 21:30:33 +0530 Subject: [PATCH 007/170] fix stray main tag issue --- views/error.html | 2 ++ views/explore.html | 4 +++- views/file.html | 2 ++ views/header.html | 2 -- views/index.html | 2 ++ views/privacy.html | 2 ++ views/ratelimit.html | 4 +++- views/ratelimit_gt.html | 4 +++- views/repo.html | 2 ++ views/user.html | 2 ++ 10 files changed, 21 insertions(+), 5 deletions(-) diff --git a/views/error.html b/views/error.html index 75a7eed..be680fe 100644 --- a/views/error.html +++ b/views/error.html @@ -7,3 +7,5 @@

Think this is a bug? Create an issue on Codeberg.

+ + diff --git a/views/explore.html b/views/explore.html index ae01c1a..6b3731a 100644 --- a/views/explore.html +++ b/views/explore.html @@ -28,4 +28,6 @@ {{ else }}

There are no trending repositories at the moment.

{{ end }} -
\ No newline at end of file + + + diff --git a/views/file.html b/views/file.html index 7f50c4d..1c7665b 100644 --- a/views/file.html +++ b/views/file.html @@ -16,3 +16,5 @@ {{end}} + + diff --git a/views/header.html b/views/header.html index 8bb5d79..c5e1ff6 100644 --- a/views/header.html +++ b/views/header.html @@ -21,5 +21,3 @@ - - diff --git a/views/index.html b/views/index.html index ad7dbe8..9c0b1b8 100644 --- a/views/index.html +++ b/views/index.html @@ -29,3 +29,5 @@ GotHub version: Date: Tue, 7 Mar 2023 17:43:56 +0100 Subject: [PATCH 009/170] Add Pinned/Popular frontend code --- public/css/global.css | 321 +++++++++++++++++++++--------------------- views/user.html | 163 +++++++++++---------- 2 files changed, 251 insertions(+), 233 deletions(-) diff --git a/public/css/global.css b/public/css/global.css index 55b627a..b0ba4b5 100644 --- a/public/css/global.css +++ b/public/css/global.css @@ -1,277 +1,284 @@ /* god bless you */ @font-face { - font-family: 'Lato'; - src: url('/fonts/Lato-Regular.ttf'); - font-display: swap; + font-family: "Lato"; + src: url("/fonts/Lato-Regular.ttf"); + font-display: swap; } :root { - --text: #fff; - --background: #252525; - --secondary-background: #353535; - --background-darker: #151515; - --accent: #00b7c3; - color-scheme: dark; + --text: #fff; + --background: #252525; + --secondary-background: #353535; + --background-darker: #151515; + --accent: #00b7c3; + color-scheme: dark; } body { - font-family: 'Lato', sans-serif; - color: #FFF; - background-color: #151515; - transition: ease-in-out .25s; - margin: 0; + font-family: "Lato", sans-serif; + color: #fff; + background-color: #151515; + transition: ease-in-out 0.25s; + margin: 0; } ::-webkit-scrollbar { - width: 8px; - height: 10px; + width: 8px; + height: 10px; } ::-webkit-scrollbar-thumb { - border-radius: 8px; - background: #252525; + border-radius: 8px; + background: #252525; } main { - margin: 0 24vw; + margin: 0 24vw; } .navbar { - display: flex; - align-items: center; - justify-content: space-between; - flex-direction: row; - padding: 8px; + display: flex; + align-items: center; + justify-content: space-between; + flex-direction: row; + padding: 8px; - margin-bottom: 8px; + margin-bottom: 8px; - background-color: var(--background); + background-color: var(--background); } .indexGitHub { - background: #252525; - color: #fff; - padding: 4px; - border-radius: 8px; + background: #252525; + color: #fff; + padding: 4px; + border-radius: 8px; } .brand { - display: flex; - align-items: center; - gap: 8px; - transition: ease-in-out .25s; - color: var(--text); + display: flex; + align-items: center; + gap: 8px; + transition: ease-in-out 0.25s; + color: var(--text); } .navbarSlogan:hover { - text-decoration: underline; - text-underline-offset: 5px; + text-decoration: underline; + text-underline-offset: 5px; } .brand:hover { - color: var(--text); - text-decoration: underline; + color: var(--text); + text-decoration: underline; } .error { - background-color: #252525; - padding: 8px; - border-radius: 4px; - font-family: 'Lato', sans-serif; - color: #fff; + background-color: #252525; + padding: 8px; + border-radius: 4px; + font-family: "Lato", sans-serif; + color: #fff; } .center { - text-align: center; + text-align: center; } a { - color: white; - text-decoration: underline; - text-underline-offset: 5px; + color: white; + text-decoration: underline; + text-underline-offset: 5px; } a:hover { - color: #00b7c3; + color: #00b7c3; } /* URI: /explore */ .exploreIDontKnowWhatToNameThisDiv { - background-color: #252525; - padding: 8px; - border-radius: 4px; - margin: 8px 0 8px 0; + background-color: #252525; + padding: 8px; + border-radius: 4px; + margin: 8px 0 8px 0; - text-overflow: ellipsis; - white-space: wrap; - text-decoration: none; - display: flex; + text-overflow: ellipsis; + white-space: wrap; + text-decoration: none; + display: flex; - transition: ease-in-out .25s; + transition: ease-in-out 0.25s; } .exploreIDontKnowWhatToNameThisDiv:hover { - background-color: var(--secondary-background); - color: var(--text); + background-color: var(--secondary-background); + color: var(--text); } /* URI: /:user */ .userProfile { - background-color: var(--background); - padding: 8px; - border-radius: 4px; - margin: 8px; - display: flex; - flex-direction: column; - align-items: center; + background-color: var(--background); + padding: 8px; + border-radius: 4px; + margin: 8px; + display: flex; + flex-direction: column; + align-items: center; } .userProfile h1 { - color: #00b7c3; - margin: 4px; - word-wrap: nowrap; - text-overflow: ellipsis; + color: #00b7c3; + margin: 4px; + word-wrap: nowrap; + text-overflow: ellipsis; } -.userProfile h2 { - margin: 4px; +.userProfile h2 { + margin: 4px; } .userProfile p { - margin: 4px; + margin: 4px; } .userProfile img { - border: 4px solid #00b7c3; - border-radius: 50%; + border: 4px solid #00b7c3; + border-radius: 50%; } -.userBio, .userReadme { - background-color: var(--background); - padding: 8px; - border-radius: 4x; - margin: 8px; +.userBio, +.userReadme, +.mainRepos { + background-color: var(--background); + padding: 8px; + border-radius: 4x; + margin: 8px; } -.userBioText, .userReadmeText { - background-color: var(--background-darker); - padding: 8px; - border-radius: 4px; - margin-bottom: 0; +.userBioText, +.userReadmeText, +.mainReposText { + background-color: var(--background-darker); + padding: 8px; + border-radius: 4px; + margin-bottom: 0; +} + +.mainReposTextDim { + color: #8c8c8c; } .userReadmeText { - margin-top: 0; + margin-top: 0; } .sociallinks { - display: flex; - flex-direction: row; + display: flex; + flex-direction: column; } /* URI: /:user/:repo */ .button { - background-color: var(--background); - padding: 8px; - border-radius: 4px; - margin: 8px; - color: var(--text); - text-decoration: none; - text-align: center; - display: inline-block; + background-color: var(--background); + padding: 8px; + border-radius: 4px; + margin: 8px; + color: var(--text); + text-decoration: none; + text-align: center; + display: inline-block; } .button:hover { - background-color: var(--secondary-background); - color: var(--text); + background-color: var(--secondary-background); + color: var(--text); } .buttonParent { - display: flex; - justify-content: center; - align-items: center; - flex-direction: row; + display: flex; + justify-content: center; + align-items: center; + flex-direction: row; } .filesList { - list-style-type: none; - padding: 0; - margin: 0; + list-style-type: none; + padding: 0; + margin: 0; } .filesUList { - padding: 0; - margin: 0; - list-style-type: none; + padding: 0; + margin: 0; + list-style-type: none; } /* URI: /file/:user/:repo/:file */ .userReadme pre { - padding: 8px; - border-radius: 4px; - /*white-space: pre-wrap;*/ - overflow-x: auto; + padding: 8px; + border-radius: 4px; + /*white-space: pre-wrap;*/ + overflow-x: auto; } .userContainer { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; } - .secondary { - background-color: var(--secondary-background); + background-color: var(--secondary-background); } @media screen and (prefers-color-scheme: light) { - :root { - --text: #000; - --background: #ececec; - --secondary-background: #f5f5f5; - --background-darker: #dddddd; - color-scheme: light; - } - body { - background-color: var(--background-darker); - color: #000; - } - a { - color: black; - } - a:hover { - color: #00b7c3; - } - .exploreIDontKnowWhatToNameThisDiv { - background-color: var(--background); - color: #000; - } + :root { + --text: #000; + --background: #ececec; + --secondary-background: #f5f5f5; + --background-darker: #dddddd; + color-scheme: light; + } + body { + background-color: var(--background-darker); + color: #000; + } + a { + color: black; + } + a:hover { + color: #00b7c3; + } + .exploreIDontKnowWhatToNameThisDiv { + background-color: var(--background); + color: #000; + } } @media screen and (max-width: 900px) { - main { - margin: 8px; - } + main { + margin: 8px; + } - .navbarSlogan { - display: none; - } + .navbarSlogan { + display: none; + } - .navbarImg { - height: 40px; - } + .navbarImg { + height: 40px; + } - .exploreIDontKnowWhatToNameThisDiv { - margin-left: 0; - margin-bottom: 8px; - margin-right: 0; - } + .exploreIDontKnowWhatToNameThisDiv { + margin-left: 0; + margin-bottom: 8px; + margin-right: 0; + } - .sociallinks { - flex-direction: column; - } + .sociallinks { + flex-direction: column; + } } diff --git a/views/user.html b/views/user.html index 514d7e1..dc1994a 100644 --- a/views/user.html +++ b/views/user.html @@ -1,83 +1,94 @@ {{ template "header" .}}
- {{ if .user }} - {{ range $key, $value := .user}} - -
- {{.Login}}'s avatar - {{ if .Name }} -

{{.Name}}

- {{ end }} -

{{.Login}}

- {{ if eq .Type "http://schema.org/Person" }} -

{{.Followers}} followers - {{.Following}} following

- {{ else }} -

{{.Followers}} followers

- {{ end }} - {{ if .StatusEmoji}} -

{{.StatusEmoji}} {{.Status}}

- {{ end }} - {{ if .Location }} -

๐ŸŒ {{.Location}}

- {{ end }} - {{ if .Timezone }} -

๐Ÿ•‘๏ธ {{.Timezone}}

- {{ end }} - {{ if .Link }} -

๐ŸŒ {{.Link}}

- {{ end }} - {{ if .Email }} -

โœ‰๏ธ {{.Email}}

- {{ end }} - {{ if .Social }} - - {{ end }} - {{ if .Organizations }} -

Organizations: - {{range .Organizations}} - {{.}} - {{ end }} -

- {{ end }} - {{ if .OrgMembers }} -

Members: - {{range .OrgMembers}} - @{{.}} - {{ end }} -

- {{ end }} - {{ if .Company }} -

๐Ÿข {{.Company}}

- {{ end }} - {{ if eq .Type "http://schema.org/Person" }} -

โœ๏ธ {{ if .Name }} {{.Name}} {{ else }} {{.Login}} {{ end }} has made {{.Contributions}}

- {{ end }} -
- - {{ if .Bio }} -
-

Bio

-

{{.Bio}}

-
- {{ end }} - {{ if .Readme }} -
-

README

-
{{ unescape .Readme}}
-
- {{ end }} - {{ end }} - {{ else }} -

User not found

-

That user doesn't exist.

+ {{ if .user }} {{ range $key, $value := .user}} + +
+ {{.Login}}'s avatar + {{ if .Name }} +

{{.Name}}

{{ end }} +

{{.Login}}

+ {{ if eq .Type "http://schema.org/Person" }} +

{{.Followers}} followers - {{.Following}} following

+ {{ else }} +

{{.Followers}} followers

+ {{ end }} {{ if .StatusEmoji}} +

{{.StatusEmoji}} {{.Status}}

+ {{ end }} {{ if .Location }} +

๐ŸŒ {{.Location}}

+ {{ end }} {{ if .Timezone }} +

๐Ÿ•‘๏ธ {{.Timezone}}

+ {{ end }} {{ if .Link }} +

๐ŸŒ {{.Link}}

+ {{ end }} {{ if .Email }} +

โœ‰๏ธ {{.Email}}

+ {{ end }} {{ if .Social }} + + {{ end }} {{ if .Organizations }} +

+ Organizations: {{range .Organizations}} + {{.}} + {{ end }} +

+ {{ end }} {{ if .OrgMembers }} +

+ Members: {{range .OrgMembers}} + @{{.}} + {{ end }} +

+ {{ end }} {{ if .Company }} +

๐Ÿข {{.Company}}

+ {{ end }} {{ if eq .Type "http://schema.org/Person" }} +

+ โœ๏ธ {{ if .Name }} {{.Name}} {{ else }} {{.Login}} {{ end }} has made + {{.Contributions}} +

+ {{ end }} +
+ + {{ if .Bio }} +
+

Bio

+

{{.Bio}}

+
+ {{ end }} {{ if .Readme }} +
+

README

+
{{ unescape .Readme}}
+
+ {{ end }} {{ if .MainRepos }} +
+

{{.PinOrPopular}}:

+ {{range .MainRepos}} +
+

{{.Name}}

+ {{if .ForkOf}} +

Forked from: {{.ForkOf}}

+ {{else}} {{end}} + {{if .Desc}} +

{{.Desc}}

+ {{else}} {{end}} +

{{if .Stars}}โญ {{.Stars}}{{else}}{{end}} {{if .Forks}} ๐Ÿด {{.Forks}} {{else}}{{end}} {{if .Lang}} ๐Ÿ—’๏ธ {{.Lang}} {{else}}{{end}}

+
+ {{ end }} +
+ {{ end }} {{ end }} {{ else }} +

User not found

+

That user doesn't exist.

+ {{ end }}
From 889c8c399d6a62bcdec8a14986e81c3f994c549e Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Tue, 7 Mar 2023 22:28:55 +0530 Subject: [PATCH 010/170] prettier --- views/.prettierignore | 2 + views/error.html | 21 ++++--- views/explore.html | 57 ++++++++++--------- views/file.html | 39 ++++++++----- views/footer.html | 2 + views/header.html | 34 +++++++----- views/index.html | 80 ++++++++++++++++++--------- views/privacy.html | 53 ++++++++++-------- views/ratelimit.html | 19 +++---- views/ratelimit_gt.html | 14 +++-- views/repo.html | 118 +++++++++++++++++++--------------------- views/user.html | 19 ++++--- 12 files changed, 261 insertions(+), 197 deletions(-) create mode 100644 views/.prettierignore create mode 100644 views/footer.html diff --git a/views/.prettierignore b/views/.prettierignore new file mode 100644 index 0000000..d4333f7 --- /dev/null +++ b/views/.prettierignore @@ -0,0 +1,2 @@ +header.html +footer.html diff --git a/views/error.html b/views/error.html index be680fe..3a5f3a4 100644 --- a/views/error.html +++ b/views/error.html @@ -1,11 +1,18 @@ {{ template "header" .}}
-
-

Error

-

Someone pushed to production. Just kidding, that's probably not what happened. Here's the error:

+
+

Error

+

+ Someone pushed to production. Just kidding, that's probably not what + happened. Here's the error: +

{{.error}}
-

Think this is a bug? Create an issue on Codeberg.

-
+

+ Think this is a bug? + Create an issue on Codeberg. +

+
- - +{{ template "footer" .}} diff --git a/views/explore.html b/views/explore.html index 6b3731a..7e72b7c 100644 --- a/views/explore.html +++ b/views/explore.html @@ -1,33 +1,32 @@ {{template "header" .}}
-

Trending repositories

-

25 repositories shown, sorted by most stars.

- {{ if .repos}} - {{ range $key, $value := .repos}} - -
-

{{.Fullname}}

-

{{.Description}}

- {{ if .Language }} - {{ if .License }} -

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ {{.License}} ๐Ÿ—’๏ธ {{.Language}}

- {{ else }} -

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ No license ๐Ÿ—’๏ธ {{.Language}}

- {{ end }} - {{ else }} - {{ if .License }} -

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ {{.License}}

- {{ else }} -

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ No license

- {{ end }} - {{ end }} -
-
- {{ end }} - {{ else }} -

There are no trending repositories at the moment.

- {{ end }} +

Trending repositories

+

25 repositories shown, sorted by most stars.

+ {{ if .repos}} {{ range $key, $value := .repos}} + +
+

{{.Fullname}}

+

{{.Description}}

+ {{ if .Language }} {{ if .License }} +

+ โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ {{.License}} ๐Ÿ—’๏ธ + {{.Language}} +

+ {{ else }} +

+ โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ No license ๐Ÿ—’๏ธ + {{.Language}} +

+ {{ end }} {{ else }} {{ if .License }} +

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ {{.License}}

+ {{ else }} +

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ No license

+ {{ end }} {{ end }} +
+
+ {{ end }} {{ else }} +

There are no trending repositories at the moment.

+ {{ end }}
- - +{{template "footer" .}} diff --git a/views/file.html b/views/file.html index 1c7665b..9f58fb8 100644 --- a/views/file.html +++ b/views/file.html @@ -1,20 +1,29 @@ {{ template "header" .}}
- {{ if .file }} - - + {{ if .file }} + + -
-
-

{{.name}}

- Raw -
- {{ .file}} -
- {{end}} +
+
+

{{.name}}

+ Raw +
+ {{ .file}} +
+ {{end}}
- - +{{ template "footer" .}} diff --git a/views/footer.html b/views/footer.html new file mode 100644 index 0000000..308b1d0 --- /dev/null +++ b/views/footer.html @@ -0,0 +1,2 @@ + + diff --git a/views/header.html b/views/header.html index c5e1ff6..e3483c6 100644 --- a/views/header.html +++ b/views/header.html @@ -1,23 +1,31 @@ - + {{ if .title }} {{ .title }} - GotHub {{ else }} GotHub {{ end }} - - - - - + + + + + diff --git a/views/index.html b/views/index.html index 9c0b1b8..fda5419 100644 --- a/views/index.html +++ b/views/index.html @@ -1,33 +1,63 @@ {{template "header" .}}
-

GotHub is an alternative front-end for GitHub.

-

Features

-
    +

    GotHub is an alternative front-end for GitHub.

    +

    Features

    +
    • Lightweight - for both you and the instance host
    • No JavaScript - pure HTML and CSS goodness
    • -
    • No requests made to Micro$oft - they won't even know you made a request!
    • +
    • + No requests made to Micro$oft - they won't even know you made a request! +
    • Open source - for peer review & trustworthiness
    • Save bandwidth - no JavaScript/tracking bloat loaded!
    • -
    -

    Privacy

    -

    GitHub is owned by Microsoft, a big tech company known to track it's users. If you care, you can read GitHub's privacy policy here or if you don't care enough to read all that and want it condensed. GotHub solves this by proxying all GitHub requests for you!

    -

    Usage

    -

    Just replace github.com with {{.host}}!

    -

    DMCA/Copyright Notice

    -

    All content shown on this site are from GitHub. Any issues with content shown on this site needs to be reported to GitHub, not the instance host's internet or domain provider. GitHub is a registered trademark of GitHub, Inc. GotHub is not affiliated with GitHub, Inc.

    -

    This project was made as a "spiritual successor" to Riverside Rocks' 1337git which is, unfortunately, hosted on GitHub. Kinda ironic.

    -This project does not let you clone GitHub repositories. I would recommend using a VPN if you have to clone a GitHub repository and want to keep yourself private from them instead. -

    Credits

    -Midou36O - desigining the GotHub logo -

    Info

    -{{ if eq .version "unknown, please build with Go 1.13+ or use Git"}} -GotHub version: unknown -{{ else }} -GotHub version: {{ .version}} -{{ end }} -
    -Fiber version: {{ .fiberversion}}, running on {{ .goversion}} +
+

Privacy

+

+ GitHub is owned by Microsoft, a big tech company known to track it's users. + If you care, you can read GitHub's privacy policy here + or + if you don't care enough to read all that and want it condensed. GotHub solves this by proxying all GitHub requests for you! +

+

Usage

+

+ Just replace github.com with + {{.host}}! +

+

DMCA/Copyright Notice

+

+ All content shown on this site are from GitHub. Any issues with content + shown on this site needs to be reported to GitHub, not the instance host's + internet or domain provider. GitHub is a registered trademark of GitHub, + Inc. GotHub is not affiliated with GitHub, Inc. +

+

+ This project was made as a "spiritual successor" to + Riverside Rocks' + 1337git which is, + unfortunately, hosted on GitHub. Kinda ironic. +

+ This project does not let you clone GitHub repositories. I would recommend + using a VPN if you have to clone a GitHub repository and want to keep + yourself private from them instead. +

Credits

+ Midou36O - desigining the GotHub logo +

Info

+ {{ if eq .version "unknown, please build with Go 1.13+ or use Git"}} GotHub + version: unknown {{ else }} GotHub version: + {{ .version}} + {{ end }} +
+ Fiber version: {{ .fiberversion}}, running on {{ .goversion}}
- - +{{ template "footer" .}} diff --git a/views/privacy.html b/views/privacy.html index 57ce98c..619d097 100644 --- a/views/privacy.html +++ b/views/privacy.html @@ -1,26 +1,33 @@ {{template "header" .}} -
-

Instance Privacy

-{{ if .privacyInformation}} -{{ range $key, $value := .privacyInformation}} -

The goal of this page is to bring transparency to the data collected by the instances and to encourage privacy friendly practices.

-

If this page isn't filled, please contact your instance's maintainer.

-

IP Address logged: {{.IPAddr}}

-

Request URL logged: {{.ReqURL}}

-

User Agent logged: {{.UserAgent}}

-

Diagnostic Information logged: {{.Diagnostics}}

-{{ if .PrivacyPolicy }} -

You can see the maintainer's Privacy Policy for more information.

-{{end}} -

Additional Information

-

GotHub version: {{.Version}}

-

Fiber version: {{ .FiberVersion}}, running on {{ .GoVersion}}

-

Country: {{.Country}}

-

Cloudflare: {{.Cloudflare}}

-

ISP: {{.Provider}}

-{{end}} -{{end}} +
+

Instance Privacy

+ {{ if .privacyInformation}} {{ range $key, $value := .privacyInformation}} +

+ The goal of this page is to bring transparency to the data collected by the + instances and to encourage privacy friendly practices. +

+

If this page isn't filled, please contact your instance's maintainer.

+

IP Address logged: {{.IPAddr}}

+

Request URL logged: {{.ReqURL}}

+

User Agent logged: {{.UserAgent}}

+

Diagnostic Information logged: {{.Diagnostics}}

+ {{ if .PrivacyPolicy }} +

+ You can see the maintainer's + Privacy Policy for more information. +

+ {{end}} +

Additional Information

+

+ GotHub version: + {{.Version}} +

+

Fiber version: {{ .FiberVersion}}, running on {{ .GoVersion}}

+

Country: {{.Country}}

+

Cloudflare: {{.Cloudflare}}

+

ISP: {{.Provider}}

+ {{end}} {{end}}
- - diff --git a/views/ratelimit.html b/views/ratelimit.html index e29adcf..b0bd3d6 100644 --- a/views/ratelimit.html +++ b/views/ratelimit.html @@ -1,16 +1,15 @@ {{ template "header" .}}
-

{{.Title}}

-

Try another instance or wait.

+

{{.Title}}

+

Try another instance or wait.

-

Info

- {{ range $key, $value := .ratelimit}} -

Limit: {{.Limit}}

-

Remaining: {{.Remaining}}

- {{ end }} +

Info

+ {{ range $key, $value := .ratelimit}} +

Limit: {{.Limit}}

+

Remaining: {{.Remaining}}

+ {{ end }} - Todo: implement GitHub API keys + Todo: implement GitHub API keys
- - +{{ template "footer" .}} diff --git a/views/ratelimit_gt.html b/views/ratelimit_gt.html index 500c159..6f0fcd8 100644 --- a/views/ratelimit_gt.html +++ b/views/ratelimit_gt.html @@ -1,11 +1,13 @@ {{ template "header" .}}
-

{{.Title}}

-

Wait 5 minutes before trying again.

+

{{.Title}}

+

Wait 5 minutes before trying again.

-

Info

-

GotHub has implemented ratelimits in order to prevent rate-limits by GitHub. You've been hit by the rate limiter.

+

Info

+

+ GotHub has implemented ratelimits in order to prevent rate-limits by GitHub. + You've been hit by the rate limiter. +

- - +{{ template "footer" .}} diff --git a/views/repo.html b/views/repo.html index fe2cdb0..3c7c20b 100644 --- a/views/repo.html +++ b/views/repo.html @@ -1,67 +1,63 @@ {{ template "header" .}}
- {{ if .repo }} - {{ range $key, $value := .repo}} - + {{ if .repo }} {{ range $key, $value := .repo}} + -
-

{{.Fullname}}

- {{ if .Parent }} -

This repository is a fork of {{.Parent}}.

- {{ end }} - {{ if .Description }} -

{{.Description}}

- {{ end }} - {{ if .License }} -

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ {{.License}} ๐ŸŒฟ {{.DefaultBranch}}

- {{ else }} -

โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ No license ๐ŸŒฟ {{.DefaultBranch}}

- {{ end }} - {{ if .Language }} -

๐Ÿ—’๏ธ - {{range .Language}} - {{.}} - {{end}} -

- {{end}} -
- {{end}} - {{ if .files}} -
-

Files

-
- -
-
- {{ end }} - {{ if .readme}} -
- {{ if .repo }} - {{ range $key, $value := .repo}} -

{{.Readme}}

- {{end}} - {{end}} -
- {{ unescape .readme}} -
-
- {{ end }} +
+

{{.Fullname}}

+ {{ if .Parent }} +

This repository is a fork of {{.Parent}}.

+ {{ end }} {{ if .Description }} +

{{.Description}}

+ {{ end }} {{ if .License }} +

+ โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ {{.License}} ๐ŸŒฟ + {{.DefaultBranch}} +

{{ else }} -

Repository not found

-

That repository doesn't exist.

- {{ end }} +

+ โญ {{.Stars}} ๐Ÿด {{.Forks}} ๐Ÿ‘€ {{.Watchers}} โš–๏ธ No license ๐ŸŒฟ + {{.DefaultBranch}} +

+ {{ end }} {{ if .Language }} +

๐Ÿ—’๏ธ {{range .Language}} {{.}} {{end}}

+ {{end}} +
+ {{end}} {{ if .files}} +
+

Files

+
+ +
+
+ {{ end }} {{ if .readme}} +
+ {{ if .repo }} {{ range $key, $value := .repo}} +

{{.Readme}}

+ {{end}} {{end}} +
{{ unescape .readme}}
+
+ {{ end }} {{ else }} +

Repository not found

+

That repository doesn't exist.

+ {{ end }}
- - +{{ template "footer" .}} diff --git a/views/user.html b/views/user.html index dc1994a..9ba2acd 100644 --- a/views/user.html +++ b/views/user.html @@ -74,15 +74,19 @@

{{.PinOrPopular}}:

{{range .MainRepos}}
-

{{.Name}}

+

{{.Name}}

{{if .ForkOf}} -

Forked from: {{.ForkOf}}

- {{else}} {{end}} - {{if .Desc}} +

+ Forked from: {{.ForkOf}} +

+ {{else}} {{end}} {{if .Desc}}

{{.Desc}}

{{else}} {{end}} -

{{if .Stars}}โญ {{.Stars}}{{else}}{{end}} {{if .Forks}} ๐Ÿด {{.Forks}} {{else}}{{end}} {{if .Lang}} ๐Ÿ—’๏ธ {{.Lang}} {{else}}{{end}}

-
+

+ {{if .Stars}}โญ {{.Stars}}{{else}}{{end}} {{if .Forks}} ๐Ÿด {{.Forks}} + {{else}}{{end}} {{if .Lang}} ๐Ÿ—’๏ธ {{.Lang}} {{else}}{{end}} +

+ {{ end }} {{ end }} {{ end }} {{ else }} @@ -90,5 +94,4 @@

That user doesn't exist.

{{ end }}
- - +{{ template "footer" .}} From 813ebcb1bd297eaa3ec4d829c8cd1e50f78de833 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Tue, 7 Mar 2023 18:20:54 +0100 Subject: [PATCH 011/170] Mistype (ForkOff -> ForkOf) --- views/user.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/user.html b/views/user.html index 9ba2acd..65ce304 100644 --- a/views/user.html +++ b/views/user.html @@ -77,7 +77,7 @@

{{.Name}}

{{if .ForkOf}}

- Forked from: {{.ForkOf}} + Forked from: {{.ForkOf}}

{{else}} {{end}} {{if .Desc}}

{{.Desc}}

From a705f04a4b2b5c8904b609e99905618d1b22fe53 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Tue, 7 Mar 2023 18:38:11 +0100 Subject: [PATCH 012/170] Add a darker accent color for light mode (accessibility), partially solves #53 --- public/css/global.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/css/global.css b/public/css/global.css index b0ba4b5..9cc8f19 100644 --- a/public/css/global.css +++ b/public/css/global.css @@ -130,7 +130,7 @@ a:hover { } .userProfile h1 { - color: #00b7c3; + color: var(--accent); margin: 4px; word-wrap: nowrap; text-overflow: ellipsis; @@ -145,7 +145,7 @@ a:hover { } .userProfile img { - border: 4px solid #00b7c3; + border: 4px solid var(--accent); border-radius: 50%; } @@ -241,6 +241,7 @@ a:hover { --background: #ececec; --secondary-background: #f5f5f5; --background-darker: #dddddd; + --accent: #0083c3; color-scheme: light; } body { @@ -251,7 +252,7 @@ a:hover { color: black; } a:hover { - color: #00b7c3; + color: #0083c3; } .exploreIDontKnowWhatToNameThisDiv { background-color: var(--background); From 08b4fd7b4db084ed02a806a75435c47d1f6f9034 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Tue, 7 Mar 2023 18:40:32 +0100 Subject: [PATCH 013/170] Welp, firefox did not like this color (too bright according to WCAG standards --- public/css/global.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/css/global.css b/public/css/global.css index 9cc8f19..0429be7 100644 --- a/public/css/global.css +++ b/public/css/global.css @@ -241,7 +241,7 @@ a:hover { --background: #ececec; --secondary-background: #f5f5f5; --background-darker: #dddddd; - --accent: #0083c3; + --accent: #005ec3; color-scheme: light; } body { @@ -252,7 +252,7 @@ a:hover { color: black; } a:hover { - color: #0083c3; + color: #005ec3; } .exploreIDontKnowWhatToNameThisDiv { background-color: var(--background); From 474f72372baf06952148578b4caa1577b2a2c1b7 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Wed, 8 Mar 2023 14:40:27 +0530 Subject: [PATCH 014/170] fix privacy policy link --- views/privacy.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/privacy.html b/views/privacy.html index 619d097..890bdb0 100644 --- a/views/privacy.html +++ b/views/privacy.html @@ -15,7 +15,7 @@ {{ if .PrivacyPolicy }}

You can see the maintainer's - Privacy Policy for more information. + Privacy Policy for more information.

{{end}}

Additional Information

From 3aac8e39d7b683c9059266ff2e3442e89df4cd0f Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Wed, 8 Mar 2023 16:32:54 +0530 Subject: [PATCH 015/170] remove trailing / from header --- views/header.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/views/header.html b/views/header.html index e3483c6..e886a94 100644 --- a/views/header.html +++ b/views/header.html @@ -6,9 +6,9 @@ {{ else }} GotHub {{ end }} - - - + + +