Switch to modernc.org/sqlite and update dockerfile
This commit is contained in:
@@ -10,9 +10,22 @@ import (
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
|
||||
func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository) fiber.Handler {
|
||||
func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository, staticDashboardPath, dashboardHost string) fiber.Handler {
|
||||
return func(c fiber.Ctx) error {
|
||||
domain := c.Hostname()
|
||||
|
||||
if staticDashboardPath != "" && domain == dashboardHost {
|
||||
urlPath := c.Path()
|
||||
filePath := filepath.Join(staticDashboardPath, filepath.Clean(urlPath))
|
||||
|
||||
info, err := os.Stat(filePath)
|
||||
if err == nil && !info.IsDir() {
|
||||
return c.SendFile(filePath)
|
||||
}
|
||||
|
||||
return c.SendFile(filepath.Join(staticDashboardPath, "index.html"))
|
||||
}
|
||||
|
||||
site, err := siteRepo.GetSiteByDomain(domain)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusInternalServerError).SendString("Failed to resolve site")
|
||||
|
||||
Reference in New Issue
Block a user