Added site index file and created_at

This commit is contained in:
2026-04-06 18:01:37 +02:00
parent 3f1deae70e
commit 38fcdbf391
9 changed files with 59 additions and 14 deletions
+3
View File
@@ -110,6 +110,9 @@ func validateIncomingSite(site *models.Site) error {
if site.NotFoundFile == "" {
site.NotFoundFile = "404.html"
}
if site.IndexFile == "" {
site.IndexFile = "index.html"
}
if site.ForwardRules == nil {
site.ForwardRules = []models.ForwardRule{}
}
+3 -3
View File
@@ -62,7 +62,7 @@ func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository) fi
}
if urlPath == "/" || urlPath == "." {
urlPath = "/index.html"
urlPath = "/" + site.IndexFile
}
basePath := filepath.Join(storagePath, site.ID)
@@ -71,7 +71,7 @@ func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository) fi
info, err := os.Stat(filePath)
if err == nil {
if info.IsDir() {
indexPath := filepath.Join(filePath, "index.html")
indexPath := filepath.Join(filePath, site.IndexFile)
if _, err := os.Stat(indexPath); err == nil {
return c.SendFile(indexPath)
}
@@ -81,7 +81,7 @@ func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository) fi
}
if site.Spa {
indexPath := filepath.Join(basePath, "index.html")
indexPath := filepath.Join(basePath, site.IndexFile)
if _, err := os.Stat(indexPath); err == nil {
return c.SendFile(indexPath)
}