Skip to content

Commit

Permalink
feat: remove twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Feb 3, 2023
1 parent fb8617c commit a6fcc99
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 354 deletions.
16 changes: 1 addition & 15 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,12 @@ user:
published: 2000-01-01T00:00:00Z
# Other identities the user may have.
identities:
- https://twitter.com/profile
- https://github.com/profile
- https://facebook.com/profile
- https://my.other/profile

# Syndications configuration.
syndications:
# Enable Twitter syndication. Requires twitter to be set.
twitter: true
syndications: {}

# Notifications configuration.
notifications:
Expand Down Expand Up @@ -156,17 +153,6 @@ webmentions:
# Optional XRay configuration.
xray:
endpoint: https://xray.p3k.app
# Enable Twitter integration. Requires twitter to be set.
twitter: true

# Optional Twitter (https://developer.twitter.com) credentials.
# Can be used with xray and syndications.
twitter:
user:
key:
secret:
token:
tokenSecret:

# Optional BunnyCDN (https://bunny.net) credentials used for the micropub
# media endpoint, for media such as 'photos', for webmentions author photos,
Expand Down
24 changes: 1 addition & 23 deletions eagle/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ func (u *User) validate() error {
return nil
}

type Syndication struct {
Twitter bool
}
type Syndication struct{}

type Telegram struct {
Token string
Expand Down Expand Up @@ -303,15 +301,6 @@ type Webmentions struct {

type XRay struct {
Endpoint string
Twitter bool
}

type Twitter struct {
User string
Key string
Secret string
Token string
TokenSecret string
}

type BunnyCDN struct {
Expand Down Expand Up @@ -342,7 +331,6 @@ type Config struct {
Micropub Micropub
Webmentions Webmentions
XRay *XRay
Twitter *Twitter
BunnyCDN *BunnyCDN
Miniflux *Miniflux
ImgProxy *ImgProxy
Expand Down Expand Up @@ -374,10 +362,6 @@ func (c *Config) validate() error {
return err
}

if c.Syndications.Twitter && c.Twitter == nil {
return errors.New("syndication.twitter is true but twitter is not defined")
}

err = c.Micropub.validate()
if err != nil {
return err
Expand All @@ -394,12 +378,6 @@ func (c *Config) validate() error {
return fmt.Errorf("Micropub.Sections can only use sections defined in Sections")
}

if c.XRay != nil {
if c.XRay.Twitter && c.Twitter == nil {
return errors.New("xray.twitter is true but twitter is not defined")
}
}

return nil
}

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
git.jlel.se/jlelse/go-geouri v0.0.0-20210525190615-a9c1d50f42d6
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/dchest/uniuri v1.2.0
github.com/dghubble/oauth1 v0.7.1
github.com/dgraph-io/ristretto v0.1.1
github.com/fsnotify/fsnotify v1.6.0
github.com/gabriel-vasile/mimetype v1.4.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/dghubble/oauth1 v0.7.1 h1:JjbOVSVVkms9A4h/sTQy5Jb2nFuAAVb2qVYgenJPyrE=
github.com/dghubble/oauth1 v0.7.1/go.mod h1:0eEzON0UY/OLACQrmnjgJjmvCGXzjBCsZqL1kWDXtF0=
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
Expand Down
9 changes: 0 additions & 9 deletions hooks/context_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ func NewContextFetcher(c *eagle.Config, fs *fs.FS, media *media.Media) (*Context
UserAgent: fmt.Sprintf("Eagle/0.0 (%s) XRay", c.ID()),
}

if c.XRay.Twitter && c.Twitter != nil {
xrayConf.Twitter = &xray.Twitter{
Key: c.Twitter.Key,
Secret: c.Twitter.Secret,
Token: c.Twitter.Token,
TokenSecret: c.Twitter.TokenSecret,
}
}

xray, err := xray.NewXRay(xrayConf, log.S().Named("xray"))
return &ContextFetcher{
xray: xray,
Expand Down
15 changes: 0 additions & 15 deletions pkg/xray/xray.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ var (
ErrPostNotFound = errors.New("post xray not found")
)

type Twitter struct {
Key string
Secret string
Token string
TokenSecret string
}

type Config struct {
Twitter *Twitter
GitHubToken string
Endpoint string
UserAgent string
Expand Down Expand Up @@ -67,13 +59,6 @@ func (x *XRay) Fetch(urlStr string) (*Post, interface{}, error) {
data := urlpkg.Values{}
data.Set("url", url.String())

if strings.Contains(url.Host, "twitter.com") && x.c.Twitter != nil {
data.Set("twitter_api_key", x.c.Twitter.Key)
data.Set("twitter_api_secret", x.c.Twitter.Secret)
data.Set("twitter_access_token", x.c.Twitter.Token)
data.Set("twitter_access_token_secret", x.c.Twitter.TokenSecret)
}

if strings.Contains(url.Host, "github.com") && x.c.GitHubToken != "" {
data.Set("github_access_token", x.c.GitHubToken)
}
Expand Down
5 changes: 0 additions & 5 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/hacdias/eagle/services/miniflux"
"github.com/hacdias/eagle/services/postgres"
"github.com/hacdias/eagle/services/telegram"
"github.com/hacdias/eagle/services/twitter"
"github.com/hacdias/eagle/webmentions"
"github.com/hacdias/indieauth/v3"
"github.com/hashicorp/go-multierror"
Expand Down Expand Up @@ -176,10 +175,6 @@ func NewServer(c *eagle.Config) (*Server, error) {

s.initActions()

if c.Twitter != nil && c.Syndications.Twitter {
s.syndicator.Add(twitter.NewTwitter(c.Twitter))
}

if c.XRay != nil && c.XRay.Endpoint != "" {
xray, err := hooks.NewContextFetcher(c, s.fs, s.media)
if err != nil {
Expand Down
198 changes: 0 additions & 198 deletions services/twitter/twitter.go

This file was deleted.

Loading

0 comments on commit a6fcc99

Please sign in to comment.