Clean up and change to double knock request helper
This commit is contained in:
parent
d8dd5eb671
commit
66fbf9afbb
1 changed files with 3 additions and 14 deletions
|
@ -419,25 +419,14 @@ func ImportRemoteAccountByAPUrl(apUrl string) (*models.User, error) {
|
|||
// Reason: Implementations should be switching over from cavage to the final implementation
|
||||
// (rfc9421) slowly, but might not support the latter. Double-knocking will work
|
||||
// around this
|
||||
response, err = webshared.RequestSignedRFC9421("GET", apUrl, nil, linstromActor)
|
||||
response, _, err = webshared.RequestSigned("GET", apUrl, nil, linstromActor)
|
||||
if err != nil {
|
||||
return nil, other.Error("activitypub", "failed to complete rfc9421 signed request", err)
|
||||
return nil, other.Error("activitypub", "failed to complete signed request", err)
|
||||
}
|
||||
body, _ := io.ReadAll(response.Body)
|
||||
response.Body.Close()
|
||||
if response.StatusCode != 200 {
|
||||
log.Debug().
|
||||
Int("status-code", response.StatusCode).
|
||||
Msg("RFC9421 signed request failed, trying cavage signature")
|
||||
response, err = webshared.RequestSignedCavage("GET", apUrl, nil, linstromActor)
|
||||
if err != nil {
|
||||
return nil, other.Error("activitypub", "failed to complete cavage signed request", err)
|
||||
}
|
||||
body, _ = io.ReadAll(response.Body)
|
||||
response.Body.Close()
|
||||
if response.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("activitypub: invalid status code: %v", response.StatusCode)
|
||||
}
|
||||
return nil, fmt.Errorf("activitypub: invalid status code: %v", response.StatusCode)
|
||||
}
|
||||
var data inboundImportUser
|
||||
err = json.Unmarshal(body, &data)
|
||||
|
|
Loading…
Reference in a new issue