|
|
@ -3,7 +3,6 @@ package caddyhugo |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"html/template" |
|
|
|
"html/template" |
|
|
|
"io/ioutil" |
|
|
|
|
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
|
|
|
|
|
|
|
@ -90,14 +89,9 @@ func (ch *CaddyHugo) Setup(dir string) error { |
|
|
|
return fmt.Errorf("edit template invalid: %v", err) |
|
|
|
return fmt.Errorf("edit template invalid: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
thumbDir, err := ioutil.TempDir("", "thumbs") |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return fmt.Errorf("couldn't initialize media: %v", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ch.Media = &media.MediaSource{ |
|
|
|
ch.Media = &media.MediaSource{ |
|
|
|
StorageDir: path.Join(dir, "media"), |
|
|
|
StorageDir: path.Join(dir, "media"), |
|
|
|
ThumbDir: thumbDir, |
|
|
|
ThumbDir: path.Join(dir, "thumbs"), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = os.MkdirAll(ch.Media.StorageDir, 0755) |
|
|
|
err = os.MkdirAll(ch.Media.StorageDir, 0755) |
|
|
|