Add crappy cookie file cause of windows

This commit is contained in:
itzaname 2023-10-27 13:10:15 -04:00
parent e76354651c
commit a8c65122fd

View File

@ -7,6 +7,7 @@ import (
"math"
"os"
"time"
"strings"
"git.itzana.me/itzaname/go-roblox"
"git.itzana.me/itzaname/rbxcompiler/internal/rbxbuilder"
@ -16,6 +17,7 @@ var script = flag.Bool("script", false, "If the target is a script.")
var doUpload = flag.Bool("upload", false, "If the model should be uploaded.")
var output = flag.String("output", "d", "Output path.")
var input = flag.String("input", "", "Input path.")
var cookieFile = flag.String("cookie", "", "Path to file containing roblox cookie")
var assetId = flag.Int("asset", 0, "Upload asset ID")
var groupId = flag.Int("group", 0, "Group ID")
var doGenerate = flag.Bool("generate", false, "If a place file should be dumped")
@ -47,7 +49,25 @@ func build() {
}
if *doUpload {
rbx, err := roblox.New(os.Getenv("RBXCOOKIE"))
rbxcookie := os.Getenv("RBXCOOKIE")
if rbxcookie == "" {
if cookieFile == nil {
fmt.Printf("No credentials provided\n")
os.Exit(1)
return
}
data, err := os.ReadFile(*cookieFile)
if err != nil {
fmt.Printf("Failed read cookie file: %s\n", err)
os.Exit(1)
return
}
rbxcookie = strings.Replace(string(data), "\n", "", -1)
}
rbx, err := roblox.New(rbxcookie)
if err != nil {
fmt.Printf("Failed to start roblox api client: %s\n", err)
os.Exit(1)