2024-11-18 19:04:10 -05:00
|
|
|
package static
|
2024-10-10 13:44:17 -04:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/ipfs/boxo/files"
|
2024-11-18 19:04:10 -05:00
|
|
|
|
|
|
|
|
dwn "github.com/onsonr/sonr/pkg/motr/config"
|
2024-11-06 13:32:51 -05:00
|
|
|
"github.com/onsonr/sonr/pkg/nebula/views"
|
2024-10-10 13:44:17 -04:00
|
|
|
)
|
|
|
|
|
|
2024-11-06 13:32:51 -05:00
|
|
|
// BuildVaultFile builds the index.html file for the vault
|
2024-11-18 19:04:10 -05:00
|
|
|
func BuildVaultFile(cnfg *dwn.Config) (files.Node, error) {
|
2024-10-10 13:44:17 -04:00
|
|
|
w := bytes.NewBuffer(nil)
|
2024-11-06 13:32:51 -05:00
|
|
|
err := views.VaultIndexFile().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
|
|
|
|
|
}
|