From a5cbb4c4fb5f850c9435f3e3f57425a6da027ad4 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 17 Jan 2024 12:38:52 -0500 Subject: [PATCH] fix: tier to use AccountTier struct --- api/s5/http.go | 17 +++++++++++++++-- api/s5/messages.go | 18 +++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/api/s5/http.go b/api/s5/http.go index f355daa..b2573f6 100644 --- a/api/s5/http.go +++ b/api/s5/http.go @@ -17,6 +17,7 @@ import ( "go.sia.tech/jape" "go.uber.org/zap" "io" + "math" "mime/multipart" "net/http" "strings" @@ -529,7 +530,13 @@ func (h *HttpHandler) AccountInfo(jc jape.Context) { QuotaExceeded: false, EmailConfirmed: false, IsRestricted: false, - Tier: 0, + Tier: AccountTier{ + Id: 1, + Name: "default", + UploadBandwidth: math.MaxUint64, + StorageLimit: math.MaxUint64, + Scopes: []interface{}{}, + }, } jc.Encode(info) @@ -544,7 +551,13 @@ func (h *HttpHandler) AccountStats(jc jape.Context) { QuotaExceeded: false, EmailConfirmed: false, IsRestricted: false, - Tier: 0, + Tier: AccountTier{ + Id: 1, + Name: "default", + UploadBandwidth: math.MaxUint64, + StorageLimit: math.MaxUint64, + Scopes: []interface{}{}, + }, }, Stats: AccountStats{ Total: AccountStatsTotal{ diff --git a/api/s5/messages.go b/api/s5/messages.go index 6ec2353..527acd6 100644 --- a/api/s5/messages.go +++ b/api/s5/messages.go @@ -23,11 +23,11 @@ type AccountLoginChallengeResponse struct { Challenge string `json:"challenge"` } type AccountInfoResponse struct { - Email string `json:"email"` - QuotaExceeded bool `json:"quotaExceeded"` - EmailConfirmed bool `json:"emailConfirmed"` - IsRestricted bool `json:"isRestricted"` - Tier uint8 `json:"tier"` + Email string `json:"email"` + QuotaExceeded bool `json:"quotaExceeded"` + EmailConfirmed bool `json:"emailConfirmed"` + IsRestricted bool `json:"isRestricted"` + Tier AccountTier `json:"tier"` } type AccountStatsResponse struct { @@ -35,6 +35,14 @@ type AccountStatsResponse struct { Stats AccountStats `json:"stats"` } +type AccountTier struct { + Id uint64 `json:"id"` + Name string `json:"name"` + UploadBandwidth uint64 `json:"uploadBandwidth"` + StorageLimit uint64 `json:"storageLimit"` + Scopes []interface{} `json:"scopes"` +} + type AccountStats struct { Total AccountStatsTotal `json:"total"` }