2024-10-15 14:31:19 -04:00
|
|
|
package vaultindex
|
2024-10-10 13:44:17 -04:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/ipfs/boxo/files"
|
|
|
|
|
"github.com/onsonr/sonr/internal/dwn/gen"
|
|
|
|
|
)
|
|
|
|
|
|
2024-10-18 13:07:52 -04:00
|
|
|
// BuildFile builds the index.html file for the vault
|
2024-10-10 13:44:17 -04:00
|
|
|
func BuildFile(cnfg *gen.Config) (files.Node, error) {
|
|
|
|
|
w := bytes.NewBuffer(nil)
|
2024-10-15 14:31:19 -04:00
|
|
|
err := IndexFile().Render(context.Background(), w)
|
2024-10-10 13:44:17 -04:00
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
indexData := w.Bytes()
|
|
|
|
|
return files.NewBytesFile(indexData), nil
|
|
|
|
|
}
|