diff --git a/dbg/app.go b/dbg/app.go index 5b4ea54..1829702 100644 --- a/dbg/app.go +++ b/dbg/app.go @@ -209,7 +209,20 @@ func getAppVersion() (AppMeta, error) { } func getProfiles() (Profiles, error) { - profilesPath := filepath.Join(ftbApp.InstallLocation, "profiles.json") + oldProfilesPath := filepath.Join(ftbApp.InstallLocation, "profiles.json") + oldProfilesExists := shared.DoesPathExist(oldProfilesPath) + if oldProfilesExists { + profilesRaw, err := os.ReadFile(oldProfilesPath) + if err != nil { + return Profiles{}, err + } + var profiles Profiles + if err := json.Unmarshal(profilesRaw, &profiles); err != nil { + return Profiles{}, err + } + return profiles, nil + } + profilesPath := filepath.Join(ftbApp.InstallLocation, "storage", "mc-accounts.json") profilesExists := shared.DoesPathExist(profilesPath) if profilesExists { profilesRaw, err := os.ReadFile(profilesPath) @@ -222,7 +235,7 @@ func getProfiles() (Profiles, error) { } return profiles, nil } - return Profiles{}, errors.New("profiles.json not found") + return Profiles{}, errors.New("profiles/mc-accounts.json not found") } func getAppLogs() (map[string]string, error) { diff --git a/dbg/structs.go b/dbg/structs.go index 4b64cf1..d991ad6 100644 --- a/dbg/structs.go +++ b/dbg/structs.go @@ -189,9 +189,13 @@ type ( Profiles struct { Version string `json:"version"` Profiles []struct { - UUID string `json:"uuid"` - LastLogin int `json:"lastLogin"` - Username string `json:"username"` + UUID string `json:"uuid"` + LastLogin int `json:"lastLogin,omitempty"` + Username string `json:"username,omitempty"` + MinecraftUsername string `json:"minecraftUsername,omitempty"` + MinecraftAccessTokenExpiresAt int `json:"minecraftAccessExpiresAt,omitempty"` + MicrosoftAccessTokenExpiresAt int `json:"microsoftAccessExpiresAt,omitempty"` + NotLoggedIn bool `json:"notLoggedIn,omitempty"` } `json:"profiles"` ActiveProfile string `json:"activeProfile"` }