This commit is contained in:
2vb 2024-05-29 00:30:33 -07:00
parent f301bfd90e
commit e5e3c59521

View File

@ -3,11 +3,8 @@ package storage
import ( import (
"embed" "embed"
"encoding/json" "encoding/json"
"io" "os"
"net/http"
"strings" "strings"
"github.com/ectrc/snow/aid"
) )
var ( var (
@ -29,15 +26,15 @@ func Asset(file string) (*[]byte) {
} }
func HttpAsset[T interface{}](file string) (*T) { func HttpAsset[T interface{}](file string) (*T) {
client := http.Client{} // client := http.Client{}
resp, err := client.Get(aid.Config.API.Host + "/snow/httpassets/" + file)
// resp, err := client.Get("https://raw.githubusercontent.com/ectrc/ectrc/main/" + file) // resp, err := client.Get("https://raw.githubusercontent.com/ectrc/ectrc/main/" + file)
if err != nil { // if err != nil {
return nil // return nil
} // }
data, err := io.ReadAll(resp.Body) data, err := os.ReadFile("./data/" + file)
// data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil return nil
} }