Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cloudflare/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (w *WarpAPI) UpdateAccount(authToken, deviceID, license string) (model.Iden
}

func (w *WarpAPI) UpdateBoundDevice(authToken, deviceID, otherDeviceID, name string, active bool) (model.IdentityDevice, error) {
reqUrl := fmt.Sprintf("%s/reg/%s/account/reg/%s", apiBase, deviceID, otherDeviceID)
reqUrl := fmt.Sprintf("%s/reg/%s/account/devices/%s", apiBase, deviceID, otherDeviceID)
method := "PATCH"

data := map[string]interface{}{
Expand Down Expand Up @@ -370,11 +370,11 @@ func (w *WarpAPI) UpdateBoundDevice(authToken, deviceID, otherDeviceID, name str
return rspData, nil
}

func (w *WarpAPI) UpdateSourceDevice(authToken, deviceID, publicKey string) (model.Identity, error) {
func (w *WarpAPI) UpdateSourceDevice(authToken, deviceID string, data map[string]interface{}) (model.Identity, error) {
reqUrl := fmt.Sprintf("%s/reg/%s", apiBase, deviceID)
method := "PATCH"

jsonBody, err := json.Marshal(map[string]interface{}{"key": publicKey})
jsonBody, err := json.Marshal(data)
if err != nil {
return model.Identity{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func runUpdate() error {

// Update device name if provided
if name != "" {
_, err = warpAPI.UpdateBoundDevice(identity.Token, identity.ID, identity.ID, name, true)
_, err = warpAPI.UpdateSourceDevice(identity.Token, identity.ID, map[string]interface{}{"name": name})
if err != nil {
return fmt.Errorf("failed to update device name: %w", err)
}
Expand Down
Loading