(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol. margin.at
extension web atproto comments
98
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add client timeouts for plc lookups

scanash00 7acc9b44 433aeaad

+11 -2
+4 -1
backend/internal/api/annotations.go
··· 480 480 481 481 func resolveDIDToPDS(did string) (string, error) { 482 482 if strings.HasPrefix(did, "did:plc:") { 483 - resp, err := http.Get("https://plc.directory/" + did) 483 + client := &http.Client{ 484 + Timeout: 10 * time.Second, 485 + } 486 + resp, err := client.Get("https://plc.directory/" + did) 484 487 if err != nil { 485 488 return "", err 486 489 }
+7 -1
backend/internal/api/apikey.go
··· 311 311 return nil, fmt.Errorf("invalid session DPoP key: %w", err) 312 312 } 313 313 314 - pds, _ := resolveDIDToPDS(sessDID) 314 + pds, err := resolveDIDToPDS(sessDID) 315 + if err != nil { 316 + return nil, fmt.Errorf("failed to resolve PDS: %w", err) 317 + } 318 + if pds == "" { 319 + return nil, fmt.Errorf("PDS not found for DID: %s", sessDID) 320 + } 315 321 316 322 return &SessionData{ 317 323 DID: sessDID,