Skip to content

Commit

Permalink
Remove /twitchemotes/ endpoints (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada authored Apr 8, 2023
1 parent 4fe8a81 commit 3225a43
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 287 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Breaking: Remove the `/twitchemotes/` endpoints. See [issue 332](https://github.com/Chatterino/api/issues/332) for more information. (#465)

## 2.0.2

- Minor: Our User-Agent now properly reflects the version of the API. (#459)
Expand Down
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@ Go web service that serves as a cache to APIs that each Chatterino client could

## Routes

### Resolve Twitch emote set

`twitchemotes/set/:setID`
Returns information about a given Twitch emote set. Example response:

```javascript
{
"channel_name": "forsen", // twitch user name
"channel_id": "22484632", // twitch user id
"type": "sub", // string describing what type of emote set this is (e.g. "sub")
"custom": false // indicates whether this is added/modified by us or straight passthrough from the twitchemotes API
"tier": 1, // integer describing what tier the sub emote is part of
}
```

### Resolve URL

`link_resolver/:url`
Expand Down
7 changes: 0 additions & 7 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import (
"net/url"
"time"

"github.com/Chatterino/api/internal/caches/twitchusernamecache"
"github.com/Chatterino/api/internal/db"
"github.com/Chatterino/api/internal/logger"
"github.com/Chatterino/api/internal/migration"
defaultresolver "github.com/Chatterino/api/internal/resolvers/default"
"github.com/Chatterino/api/internal/routes/twitchemotes"
"github.com/Chatterino/api/internal/twitchapiclient"
"github.com/Chatterino/api/pkg/cache"
"github.com/Chatterino/api/pkg/config"
Expand Down Expand Up @@ -124,23 +122,18 @@ func main() {
// Strip trailing slashes from API requests
router.Use(StripSlashes)

var helixUsernameCache cache.Cache

helixClient, err := twitchapiclient.New(ctx, cfg)
if err != nil {
log.Warnw("Error initializing Twitch API client",
"error", err,
)
} else {
helixUsernameCache = twitchusernamecache.New(ctx, cfg, pool, helixClient)
}

if cfg.EnablePrometheus {
// Host a prometheus metrics instance on cfg.PrometheusBindAddress (127.0.0.1:9382 by default)
listenPrometheus(cfg)
}

twitchemotes.Initialize(ctx, cfg, pool, router, helixClient, helixUsernameCache)
handleRoot(router)
handleHealth(router)
handleLegal(router)
Expand Down
3 changes: 0 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
# Cache duration for Twitch clip links
#twitch-clip-cache-duration: 1h

# Cache duration for the Twitchemotes.com emote cache
#twitchemotes-emote-cache-duration: 30m

# YouTube API key, provides rich information for YouTube video links
#youtube-api-key: ""

Expand Down
24 changes: 0 additions & 24 deletions internal/caches/twitchusernamecache/cache.go

This file was deleted.

1 change: 0 additions & 1 deletion internal/caches/twitchusernamecache/cache_test.go

This file was deleted.

36 changes: 0 additions & 36 deletions internal/caches/twitchusernamecache/username_loader.go

This file was deleted.

70 changes: 0 additions & 70 deletions internal/routes/twitchemotes/initialize.go

This file was deleted.

28 changes: 0 additions & 28 deletions internal/routes/twitchemotes/initialize_test.go

This file was deleted.

101 changes: 0 additions & 101 deletions internal/routes/twitchemotes/set_loader.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func init() {
pflag.Bool("enable-animated-thumbnails", true, "When enabled, will attempt to use libvips library to build animated thumbnails. Can increase CPU usage and cache storage by a lot. Enabled by default")
pflag.Uint("max-thumbnail-size", 300, "Maximum width/height pixel size count of the thumbnails sent to the clients.")
pflag.Duration("twitch-username-cache-duration", 1*time.Hour, "Cache timeout for twitch usernames")
pflag.Duration("twitchemotes-emote-cache-duration", 30*time.Minute, "Cache timeout for twitch emotes")
pflag.Duration("bttv-emote-cache-duration", 1*time.Hour, "Cache timeout for bttv emotes")
pflag.Duration("thumbnail-cache-duration", 10*time.Minute, "Cache timeout for default thumbnails")
pflag.Duration("default-link-cache-duration", 10*time.Minute, "Cache timeout for default links")
Expand Down
1 change: 0 additions & 1 deletion pkg/config/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type APIConfig struct {
MaxThumbnailSize uint `mapstructure:"max-thumbnail-size" json:"max-thumbnail-size"`

TwitchUsernameCacheDuration time.Duration `mapstructure:"twitch-username-cache-duration" json:"twitch-username-cache-duration"`
TwitchemotesEmoteCacheDuration time.Duration `mapstructure:"twitchemotes-emote-cache-duration" json:"twitchemotes-emote-cache-duration"`
BttvEmoteCacheDuration time.Duration `mapstructure:"bttv-emote-cache-duration" json:"bttv-emote-cache-duration"`
ThumbnailCacheDuration time.Duration `mapstructure:"thumbnail-cache-duration" json:"thumbnail-cache-duration"`
DefaultLinkCacheDuration time.Duration `mapstructure:"default-link-cache-duration" json:"default-link-cache-duration"`
Expand Down

0 comments on commit 3225a43

Please sign in to comment.