porting all github actions from bluesky-social/indigo to tangled CI
1
fork

Configure Feed

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

identity: add configurable User-Agent header in requests

+16
+2
atproto/identity/base_directory.go
··· 33 // 34 // The intended use-case for this flag is as an optimization for services which do not care about handles, but still want to use the `Directory` interface (instead of `ResolveDID`). For example, relay implementations, or services validating inter-service auth requests. 35 SkipHandleVerification bool 36 } 37 38 var _ Directory = (*BaseDirectory)(nil)
··· 33 // 34 // The intended use-case for this flag is as an optimization for services which do not care about handles, but still want to use the `Directory` interface (instead of `ResolveDID`). For example, relay implementations, or services validating inter-service auth requests. 35 SkipHandleVerification bool 36 + // User-Agent header for HTTP requests. Optional (ignored if empty string). 37 + UserAgent string 38 } 39 40 var _ Directory = (*BaseDirectory)(nil)
+8
atproto/identity/did.go
··· 98 if err != nil { 99 return nil, fmt.Errorf("constructing HTTP request for did:web resolution: %w", err) 100 } 101 resp, err := d.HTTPClient.Do(req) 102 103 // look for NXDOMAIN ··· 143 if err != nil { 144 return nil, fmt.Errorf("constructing HTTP request for did:plc resolution: %w", err) 145 } 146 resp, err := d.HTTPClient.Do(req) 147 if err != nil { 148 return nil, fmt.Errorf("%w: PLC directory lookup: %w", ErrDIDResolutionFailed, err)
··· 98 if err != nil { 99 return nil, fmt.Errorf("constructing HTTP request for did:web resolution: %w", err) 100 } 101 + if d.UserAgent != "" { 102 + req.Header.Set("User-Agent", d.UserAgent) 103 + } 104 + 105 resp, err := d.HTTPClient.Do(req) 106 107 // look for NXDOMAIN ··· 147 if err != nil { 148 return nil, fmt.Errorf("constructing HTTP request for did:plc resolution: %w", err) 149 } 150 + if d.UserAgent != "" { 151 + req.Header.Set("User-Agent", d.UserAgent) 152 + } 153 + 154 resp, err := d.HTTPClient.Do(req) 155 if err != nil { 156 return nil, fmt.Errorf("%w: PLC directory lookup: %w", ErrDIDResolutionFailed, err)
+3
atproto/identity/directory.go
··· 8 "time" 9 10 "github.com/bluesky-social/indigo/atproto/syntax" 11 ) 12 13 // Ergonomic interface for atproto identity lookup, by DID or handle. ··· 80 TryAuthoritativeDNS: true, 81 // primary Bluesky PDS instance only supports HTTP resolution method 82 SkipDNSDomainSuffixes: []string{".bsky.social"}, 83 } 84 cached := NewCacheDirectory(&base, 250_000, time.Hour*24, time.Minute*2, time.Minute*5) 85 return &cached
··· 8 "time" 9 10 "github.com/bluesky-social/indigo/atproto/syntax" 11 + 12 + "github.com/carlmjohnson/versioninfo" 13 ) 14 15 // Ergonomic interface for atproto identity lookup, by DID or handle. ··· 82 TryAuthoritativeDNS: true, 83 // primary Bluesky PDS instance only supports HTTP resolution method 84 SkipDNSDomainSuffixes: []string{".bsky.social"}, 85 + UserAgent: "indigo-identity/" + versioninfo.Short(), 86 } 87 cached := NewCacheDirectory(&base, 250_000, time.Hour*24, time.Minute*2, time.Minute*5) 88 return &cached
+3
atproto/identity/handle.go
··· 131 if err != nil { 132 return "", fmt.Errorf("constructing HTTP request for handle resolution: %w", err) 133 } 134 135 resp, err := d.HTTPClient.Do(req) 136 if err != nil {
··· 131 if err != nil { 132 return "", fmt.Errorf("constructing HTTP request for handle resolution: %w", err) 133 } 134 + if d.UserAgent != "" { 135 + req.Header.Set("User-Agent", d.UserAgent) 136 + } 137 138 resp, err := d.HTTPClient.Do(req) 139 if err != nil {