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}}
+