feat: hugo download with indicator
This commit is contained in:
parent
10ad82eee7
commit
b8f6b195f4
5
app.go
5
app.go
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@ -61,7 +62,9 @@ func ensureHugoBin(homeDir string) error {
|
||||
hugoTarPath := filepath.Join(hugoDir, fmt.Sprintf("hugo-%s.tar.gz", hugoVersion))
|
||||
url := fmt.Sprintf("https://github.com/gohugoio/hugo/releases/download/v%s/hugo_extended_%s_linux-amd64.tar.gz", hugoVersion, hugoVersion)
|
||||
|
||||
if _, err := os.Stat(hugoBinPath); err != nil && os.IsNotExist(err) {
|
||||
if _, err := os.Stat(hugoBinPath); err == nil {
|
||||
return nil
|
||||
} else if errors.Is(err, os.ErrNotExist) {
|
||||
if err := httpGetFile(hugoTarPath, url); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- TODO(d1): hx-indicator for loading... -->
|
||||
<div id="app" hx-get="/init" hx-trigger="load once"></div>
|
||||
<div id="app" hx-get="/init" hx-trigger="load once" hx-indicator="#initial-loader"></div>
|
||||
<p id="initial-loader" class="htmx-indicator">Initialising Hugo...</p>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user