unfurl

package
v2.10.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassifyDomain

func ClassifyDomain(domain string) chat1.UnfurlType

func ClassifyDomainFromURI

func ClassifyDomainFromURI(uri string) (typ chat1.UnfurlType, domain string, err error)

func GetDefaultFaviconURL

func GetDefaultFaviconURL(uri string) (string, error)

func GetDomain

func GetDomain(uri string) (res string, err error)

func GetHostname

func GetHostname(uri string) (string, error)

func IsDomain

func IsDomain(domain, target string) bool

Types

type Extractor

type Extractor struct {
	utils.DebugLabeler
	// contains filtered or unexported fields
}

func NewExtractor

func NewExtractor(log logger.Logger) *Extractor

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, body string, userSettings *Settings) (res []ExtractorHit, err error)

type ExtractorHit

type ExtractorHit struct {
	URL string
	Typ ExtractorHitTyp
}

type ExtractorHitTyp

type ExtractorHitTyp int
const (
	ExtractorHitUnfurl ExtractorHitTyp = iota
	ExtractorHitPrompt
)

type Packager

type Packager struct {
	utils.DebugLabeler
	// contains filtered or unexported fields
}

func NewPackager

func NewPackager(l logger.Logger, store attachments.Store, s3signer s3.Signer,
	ri func() chat1.RemoteInterface) *Packager

func (*Packager) Package

func (p *Packager) Package(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID,
	raw chat1.UnfurlRaw) (res chat1.Unfurl, err error)

type Scraper

type Scraper struct {
	utils.DebugLabeler
}

func NewScraper

func NewScraper(logger logger.Logger) *Scraper

func (*Scraper) Scrape

func (s *Scraper) Scrape(ctx context.Context, uri string) (res chat1.UnfurlRaw, err error)

type Settings

type Settings struct {
	utils.DebugLabeler
	// contains filtered or unexported fields
}

func NewSettings

func NewSettings(log logger.Logger, storage types.ConversationBackedStorage) *Settings

func (*Settings) Get

func (s *Settings) Get(ctx context.Context) (res chat1.UnfurlSettings, err error)

func (*Settings) Set

func (s *Settings) Set(ctx context.Context, settings chat1.UnfurlSettings) (err error)

func (*Settings) SetMode

func (s *Settings) SetMode(ctx context.Context, mode chat1.UnfurlMode) (err error)

func (*Settings) WhitelistAdd

func (s *Settings) WhitelistAdd(ctx context.Context, domain string) (err error)

func (*Settings) WhitelistRemove

func (s *Settings) WhitelistRemove(ctx context.Context, domain string) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL