admin: auto-sync tries to sync themes if it doesn't exists yet
This commit is contained in:
parent
63cf665f2d
commit
75eae43f60
@ -234,8 +234,30 @@ func autoSync(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if theTheme == nil {
|
if theTheme == nil {
|
||||||
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": fmt.Sprintf("Theme not found %q", p)})
|
// The theme doesn't exists locally, perhaps it has not been imported already?
|
||||||
return
|
rThemes, err := sync.GetThemes(sync.GlobalImporter)
|
||||||
|
if err == nil {
|
||||||
|
for _, theme := range rThemes {
|
||||||
|
if theme == p {
|
||||||
|
sync.SyncThemes(sync.GlobalImporter)
|
||||||
|
|
||||||
|
themes, err := fic.GetThemes()
|
||||||
|
if err == nil {
|
||||||
|
for _, theme := range themes {
|
||||||
|
if theme.Path == p {
|
||||||
|
theTheme = theme
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if theTheme == nil {
|
||||||
|
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": fmt.Sprintf("Theme not found %q", p)})
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !IsProductionEnv {
|
if !IsProductionEnv {
|
||||||
|
Loading…
Reference in New Issue
Block a user