package handlers import ( "git.tijl.dev/tijl/tijl.dev-core/internal/user" "git.tijl.dev/tijl/tijl.dev-core/modules/i18n" "git.tijl.dev/tijl/tijl.dev-core/modules/web" "github.com/gofiber/fiber/v2" ) type Service struct { Name string Slug string Description string Url string InfoUrl string Color string Scale float64 } var services = []Service{ { Name: "Immich", Slug: "immich", Description: "...", Url: "https://fotos.tijl.dev/photos", InfoUrl: "https://immich.app", Color: "white", Scale: 0, }, { Name: "Element", Slug: "element", Description: "...", Url: "https://element.tijl.dev", InfoUrl: "https://matrix.org", Color: "#0DBD8B", Scale: 0.1, }, { Name: "Nextcloud", Slug: "nextcloud", Description: "...", Url: "https://cloud.tijl.dev", InfoUrl: "https://nextcloud.com", Color: "#00679e", Scale: -0.2, }, { Name: "Gitea", Slug: "gitea", Description: "...", Url: "https://git.tijl.dev", InfoUrl: "https://about.gitea.com", Color: "white", Scale: -0.2, }, } func servicesHandler(c *fiber.Ctx) error { data := *web.Common(c) data["Title"] = i18n.Translate(c, "services") data["Services"] = services return c.Render("services", data, "layouts/base") } func serviceHandler(c *fiber.Ctx) error { _, err := user.GetSession(c) if err != nil { return c.Next() } /* if services[c.Params("service")].Url != "" { return c.Redirect(services[c.Params("service")].Url) } */ return c.Next() } func serviceInfoHandler(c *fiber.Ctx) error { _, err := user.GetSession(c) if err != nil { return c.Next() } /* if services[c.Params("service")].Url != "" { return c.Redirect(services[c.Params("service")].InfoUrl) } */ return c.Next() }