gitlin/pages/about.go
2023-04-28 22:38:04 +05:30

46 行
1.2 KiB
Go

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 HandleAbout(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("about", fiber.Map{
"title": "About this instance",
"branch": utils.Branch,
"privacyInformation": privacyInfoArray,
})
}