gitlin/pages/about.go

48 行
1.3 KiB
Go

package pages
import (
"gitler.moe/suwako/gitlin/utils"
"github.com/gofiber/fiber/v2"
"os"
"runtime"
)
type PrivacyInfo struct {
ProxyEnabled string
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{
ProxyEnabled: os.Getenv("GITLIN_PROXYING_ENABLED"),
IPAddr: os.Getenv("GITLIN_IP_LOGGED"),
ReqURL: os.Getenv("GITLIN_REQUEST_URL_LOGGED"),
UserAgent: os.Getenv("GITLIN_USER_AGENT_LOGGED"),
Diagnostics: os.Getenv("GITLIN_DIAGNOSTIC_INFO_LOGGED"),
Country: os.Getenv("GITLIN_INSTANCE_COUNTRY"),
Provider: os.Getenv("GITLIN_INSTANCE_PROVIDER"),
Cloudflare: os.Getenv("GITLIN_INSTANCE_CLOUDFLARE"),
PrivacyPolicy: os.Getenv("GITLIN_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,
})
}