mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 17:12:25 -05:00 
			
		
		
		
	linting, fmt
This commit is contained in:
		
					parent
					
						
							
								2ed1e36ee0
							
						
					
				
			
			
				commit
				
					
						dda2c9ab1c
					
				
			
		
					 4 changed files with 11 additions and 11 deletions
				
			
		|  | @ -37,7 +37,6 @@ import ( | ||||||
| 	"github.com/superseriousbusiness/gotosocial/internal/transport" | 	"github.com/superseriousbusiness/gotosocial/internal/transport" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| /* | /* | ||||||
| 	publicKeyer is BORROWED DIRECTLY FROM https://github.com/go-fed/apcore/blob/master/ap/util.go | 	publicKeyer is BORROWED DIRECTLY FROM https://github.com/go-fed/apcore/blob/master/ap/util.go | ||||||
| 	Thank you @cj@mastodon.technology ! <3 | 	Thank you @cj@mastodon.technology ! <3 | ||||||
|  | @ -50,8 +49,8 @@ type publicKeyer interface { | ||||||
| 	getPublicKeyFromResponse is BORROWED DIRECTLY FROM https://github.com/go-fed/apcore/blob/master/ap/util.go | 	getPublicKeyFromResponse is BORROWED DIRECTLY FROM https://github.com/go-fed/apcore/blob/master/ap/util.go | ||||||
| 	Thank you @cj@mastodon.technology ! <3 | 	Thank you @cj@mastodon.technology ! <3 | ||||||
| */ | */ | ||||||
| func getPublicKeyFromResponse(c context.Context, b []byte, keyId *url.URL) (p crypto.PublicKey, err error) { | func getPublicKeyFromResponse(c context.Context, b []byte, keyID *url.URL) (p crypto.PublicKey, err error) { | ||||||
| 	m := make(map[string]interface{}, 0) | 	m := make(map[string]interface{}) | ||||||
| 	err = json.Unmarshal(b, &m) | 	err = json.Unmarshal(b, &m) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return | 		return | ||||||
|  | @ -77,19 +76,19 @@ func getPublicKeyFromResponse(c context.Context, b []byte, keyId *url.URL) (p cr | ||||||
| 			continue | 			continue | ||||||
| 		} | 		} | ||||||
| 		pkValue := pkpIter.Get() | 		pkValue := pkpIter.Get() | ||||||
| 		var pkId *url.URL | 		var pkID *url.URL | ||||||
| 		pkId, err = pub.GetId(pkValue) | 		pkID, err = pub.GetId(pkValue) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		if pkId.String() != keyId.String() { | 		if pkID.String() != keyID.String() { | ||||||
| 			continue | 			continue | ||||||
| 		} | 		} | ||||||
| 		pkpFound = pkValue | 		pkpFound = pkValue | ||||||
| 		break | 		break | ||||||
| 	} | 	} | ||||||
| 	if pkpFound == nil { | 	if pkpFound == nil { | ||||||
| 		err = fmt.Errorf("cannot find publicKey with id: %s", keyId) | 		err = fmt.Errorf("cannot find publicKey with id: %s", keyID) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	pkPemProp := pkpFound.GetW3IDSecurityV1PublicKeyPem() | 	pkPemProp := pkpFound.GetW3IDSecurityV1PublicKeyPem() | ||||||
|  |  | ||||||
|  | @ -998,6 +998,7 @@ func NewTestFaves() map[string]*gtsmodel.StatusFave { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // NewTestActivities returns a bunch of pub.Activity types for use in testing the federation protocols. | ||||||
| func NewTestActivities() map[string]pub.Activity { | func NewTestActivities() map[string]pub.Activity { | ||||||
| 	dmForZork := newNote( | 	dmForZork := newNote( | ||||||
| 		URLMustParse("https://fossbros-anonymous.io/users/foss_satan/statuses/5424b153-4553-4f30-9358-7b92f7cd42f6"), | 		URLMustParse("https://fossbros-anonymous.io/users/foss_satan/statuses/5424b153-4553-4f30-9358-7b92f7cd42f6"), | ||||||
|  |  | ||||||
|  | @ -43,15 +43,15 @@ func NewTestTransportController(db db.DB, client pub.HttpClient) transport.Contr | ||||||
| // NewMockHTTPClient returns a client that conforms to the pub.HttpClient interface, | // NewMockHTTPClient returns a client that conforms to the pub.HttpClient interface, | ||||||
| // but will always just execute the given `do` function, allowing responses to be mocked. | // but will always just execute the given `do` function, allowing responses to be mocked. | ||||||
| func NewMockHTTPClient(do func(req *http.Request) (*http.Response, error)) pub.HttpClient { | func NewMockHTTPClient(do func(req *http.Request) (*http.Response, error)) pub.HttpClient { | ||||||
| 	return &mockHttpClient{ | 	return &mockHTTPClient{ | ||||||
| 		do: do, | 		do: do, | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type mockHttpClient struct { | type mockHTTPClient struct { | ||||||
| 	do func(req *http.Request) (*http.Response, error) | 	do func(req *http.Request) (*http.Response, error) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (m *mockHttpClient) Do(req *http.Request) (*http.Response, error) { | func (m *mockHTTPClient) Do(req *http.Request) (*http.Response, error) { | ||||||
| 	return m.do(req) | 	return m.do(req) | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue