mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 18:20:33 +09:00
unsplash pkg fixes
This commit is contained in:
parent
f70b1b17c5
commit
3ded18c66a
2 changed files with 4 additions and 3 deletions
|
@ -46,7 +46,6 @@ import (
|
|||
"github.com/anytypeio/go-anytype-middleware/util/linkpreview"
|
||||
"github.com/anytypeio/go-anytype-middleware/util/ocache"
|
||||
"github.com/anytypeio/go-anytype-middleware/util/pbtypes"
|
||||
"github.com/anytypeio/go-anytype-middleware/util/unsplash"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -252,7 +251,6 @@ type service struct {
|
|||
sendEvent func(event *pb.Event)
|
||||
closed bool
|
||||
linkPreview linkpreview.LinkPreview
|
||||
unsplash unsplash.Unsplash
|
||||
process process.Service
|
||||
doc doc.Service
|
||||
app *app.App
|
||||
|
@ -270,7 +268,6 @@ func (s *service) Init(a *app.App) (err error) {
|
|||
s.anytype = a.MustComponent(core.CName).(core.Service)
|
||||
s.status = a.MustComponent(status.CName).(status.Service)
|
||||
s.linkPreview = a.MustComponent(linkpreview.CName).(linkpreview.LinkPreview)
|
||||
s.unsplash = a.MustComponent(unsplash.CName).(unsplash.Unsplash)
|
||||
s.process = a.MustComponent(process.CName).(process.Service)
|
||||
s.sendEvent = a.MustComponent(event.CName).(event.Sender).Send
|
||||
s.source = a.MustComponent(source.CName).(source.Service)
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -36,6 +37,7 @@ type Unsplash interface {
|
|||
}
|
||||
|
||||
type unsplashService struct {
|
||||
mu sync.Mutex
|
||||
cache ocache.OCache
|
||||
client *unsplash.Unsplash
|
||||
limit int
|
||||
|
@ -110,6 +112,8 @@ func newFromPhoto(v unsplash.Photo) (Result, error) {
|
|||
}
|
||||
|
||||
func (l *unsplashService) lazyInitClient() {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
if l.client != nil {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue