mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 09:52:26 -05:00
compiling now
This commit is contained in:
parent
c2ff8f392b
commit
f61c3ddcf7
18 changed files with 345 additions and 226 deletions
|
|
@ -28,18 +28,15 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (t *transport) DereferenceMedia(ctx context.Context, iri *url.URL, expectedContentType string) ([]byte, error) {
|
||||
func (t *transport) DereferenceMedia(ctx context.Context, iri *url.URL) ([]byte, error) {
|
||||
l := logrus.WithField("func", "DereferenceMedia")
|
||||
l.Debugf("performing GET to %s", iri.String())
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", iri.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if expectedContentType == "" {
|
||||
req.Header.Add("Accept", "*/*")
|
||||
} else {
|
||||
req.Header.Add("Accept", expectedContentType)
|
||||
}
|
||||
|
||||
req.Header.Add("Accept", "*/*") // we don't know what kind of media we're going to get here
|
||||
req.Header.Add("Date", t.clock.Now().UTC().Format("Mon, 02 Jan 2006 15:04:05")+" GMT")
|
||||
req.Header.Add("User-Agent", fmt.Sprintf("%s %s", t.appAgent, t.gofedAgent))
|
||||
req.Header.Set("Host", iri.Host)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import (
|
|||
type Transport interface {
|
||||
pub.Transport
|
||||
// DereferenceMedia fetches the bytes of the given media attachment IRI, with the expectedContentType.
|
||||
DereferenceMedia(ctx context.Context, iri *url.URL, expectedContentType string) ([]byte, error)
|
||||
DereferenceMedia(ctx context.Context, iri *url.URL) ([]byte, error)
|
||||
// DereferenceInstance dereferences remote instance information, first by checking /api/v1/instance, and then by checking /.well-known/nodeinfo.
|
||||
DereferenceInstance(ctx context.Context, iri *url.URL) (*gtsmodel.Instance, error)
|
||||
// Finger performs a webfinger request with the given username and domain, and returns the bytes from the response body.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue