1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 09:35:00 +09:00

GO-1168 Switch unsplash to our backend proxy

This commit is contained in:
Mikhail Iudin 2023-04-25 18:17:59 +02:00
parent e913e9ce06
commit 7a60ffc262
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
4 changed files with 14 additions and 6 deletions

2
go.mod
View file

@ -37,7 +37,7 @@ require (
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
github.com/h2non/filetype v1.1.1
github.com/hashicorp/go-multierror v1.1.1
github.com/hbagdi/go-unsplash v0.0.0-20210330151707-a7612e80fdd5
github.com/hbagdi/go-unsplash v0.0.0-20230414214043-474fc02c9119
github.com/huandu/skiplist v1.2.0
github.com/improbable-eng/grpc-web v0.14.1
github.com/ipfs/go-cid v0.4.1

4
go.sum
View file

@ -493,8 +493,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hbagdi/go-unsplash v0.0.0-20210330151707-a7612e80fdd5 h1:CTLa0zHC9w2QWdzZKf6GEzWJMGU9W7BrRWkj8iB3zIQ=
github.com/hbagdi/go-unsplash v0.0.0-20210330151707-a7612e80fdd5/go.mod h1:DEzhU5CxSdknL3hUXTco1n5AO2BZHs4KeJo5ADWU0Iw=
github.com/hbagdi/go-unsplash v0.0.0-20230414214043-474fc02c9119 h1:Xqi5LlXRyF1GlNGXSb2NZJuOeTrXGzwGiQDwkwNXEc8=
github.com/hbagdi/go-unsplash v0.0.0-20230414214043-474fc02c9119/go.mod h1:DEzhU5CxSdknL3hUXTco1n5AO2BZHs4KeJo5ADWU0Iw=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c=
github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U=

View file

@ -3,7 +3,6 @@ package unsplash
import (
"context"
"fmt"
"github.com/anytypeio/go-anytype-middleware/core/anytype/config/loadenv"
"io"
"io/ioutil"
"net/http"
@ -20,6 +19,7 @@ import (
"github.com/hbagdi/go-unsplash/unsplash"
"golang.org/x/oauth2"
"github.com/anytypeio/go-anytype-middleware/core/anytype/config/loadenv"
"github.com/anytypeio/go-anytype-middleware/core/configfetcher"
"github.com/anytypeio/go-anytype-middleware/pkg/lib/core"
"github.com/anytypeio/go-anytype-middleware/pkg/lib/logging"
@ -35,6 +35,7 @@ const (
CName = "unsplash"
cacheTTL = time.Minute * 10
cacheGCPeriod = time.Minute * 5
anytypeURL = "https://unsplash.anytype.io/"
)
type Unsplash interface {
@ -306,4 +307,10 @@ func init() {
if DefaultToken == "" {
DefaultToken = loadenv.Get("UNSPLASH_KEY")
}
setAnytypeURL()
}
func setAnytypeURL() {
unsplash.SetupBaseUrl(anytypeURL)
}

View file

@ -1,11 +1,12 @@
package unsplash
import (
"github.com/rwcarlsen/goexif/exif"
"github.com/stretchr/testify/require"
"io"
"os"
"testing"
"github.com/rwcarlsen/goexif/exif"
"github.com/stretchr/testify/require"
)
func Test_injectArtistIntoExif(t *testing.T) {