Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Rename

Neeraj Guptaece4d1f7193b
diff --git a/internal/api/client.go b/internal/api/client.go
index 38756f7f93..f392fc5a2a 100644
--- a/internal/api/client.go
+++ b/internal/api/client.go
@@ -72,9 +72,9 @@ func NewClient(p Params) *Client {
}
func attachToken(req *resty.Request) {
- accountId := readValueFromContext(req.Context(), "account_id")
- if accountId != nil && accountId != "" {
- if token, ok := tokenMap[accountId.(string)]; ok {
+ accountKey := readValueFromContext(req.Context(), "account_key")
+ if accountKey != nil && accountKey != "" {
+ if token, ok := tokenMap[accountKey.(string)]; ok {
req.SetHeader(TokenHeader, token)
}
}
diff --git a/pkg/secrets/key_holder.go b/pkg/secrets/key_holder.go
index 621077b1f6..dc82c72d1b 100644
--- a/pkg/secrets/key_holder.go
+++ b/pkg/secrets/key_holder.go
@@ -43,7 +43,7 @@ func (k *KeyHolder) LoadSecrets(account model.Account) (*model.AccSecretInfo, er
}
func (k *KeyHolder) GetAccountSecretInfo(ctx context.Context) *model.AccSecretInfo {
- accountKey := ctx.Value("account_id").(string)
+ accountKey := ctx.Value("account_key").(string)
return k.AccountSecrets[accountKey]
}
diff --git a/pkg/store.go b/pkg/store.go
index 4bfdc86759..7dd7321980 100644
--- a/pkg/store.go
+++ b/pkg/store.go
@@ -82,8 +82,8 @@ func (c *ClICtrl) PutValue(ctx context.Context, store model.PhotosStore, key []b
})
}
func getAccountStore(ctx context.Context, tx *bolt.Tx, storeType model.PhotosStore) (*bolt.Bucket, error) {
- accountId := ctx.Value("account_id").(string)
- accountBucket := tx.Bucket([]byte(accountId))
+ accountKey := ctx.Value("account_key").(string)
+ accountBucket := tx.Bucket([]byte(accountKey))
if accountBucket == nil {
return nil, fmt.Errorf("account bucket not found")
}
diff --git a/pkg/sync.go b/pkg/sync.go
index dd56802459..02f5a068ca 100644
--- a/pkg/sync.go
+++ b/pkg/sync.go
@@ -62,7 +62,7 @@ func (c *ClICtrl) SyncAccount(account model.Account) error {
func (c *ClICtrl) buildRequestContext(ctx context.Context, account model.Account) context.Context {
ctx = context.WithValue(ctx, "app", string(account.App))
- ctx = context.WithValue(ctx, "account_id", account.AccountKey())
+ ctx = context.WithValue(ctx, "account_key", account.AccountKey())
ctx = context.WithValue(ctx, "user_id", account.UserID)
return ctx
}