Browse Source

feat: hugo download with indicator

main
decentral1se 7 months ago
parent
commit
b8f6b195f4
No known key found for this signature in database GPG Key ID: 3789458B3D0C410
  1. 5
      app.go
  2. 4
      frontend/index.html

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
}

4
frontend/index.html

@ -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>