Added site index file and created_at
This commit is contained in:
@@ -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{}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user