Skip to content

Commit

Permalink
fix: don't check for success oEmbed status (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
KararTY authored May 25, 2021
1 parent a75f7f1 commit 80e1ce0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased

- Added support for customizable oEmbed resolving for websites with the `providers.json` file. See [`data/oembed/providers.json`](data/oembed/providers.json). Three new environment variables can be set. See [`internal/resolvers/oembed/README.md`](internal/resolvers/oembed/README.md) (#139)
- Added support for customizable oEmbed resolving for websites with the `providers.json` file. See [`data/oembed/providers.json`](data/oembed/providers.json). Three new environment variables can be set. See [`internal/resolvers/oembed/README.md`](internal/resolvers/oembed/README.md) (#139, #152)
- Breaking: Environment variable `CHATTERINO_API_CACHE_TWITCH_CLIENT_ID` was renamed to `CHATTERINO_API_TWITCH_CLIENT_ID`. (#144)
- Dev, Breaking: Replaced `dankeroni/gotwitch` with `nicklaw5/helix`. This change requires you to add new environment variable: `CHATTERINO_API_TWITCH_CLIENT_SECRET` - it's a client secret generated for your Twitch application.

Expand Down
6 changes: 3 additions & 3 deletions internal/resolvers/oembed/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# oEmbed

The oEmbed resolver requires a `resolvers.json` to be loadable from the application.
The oEmbed resolver requires a `providers.json` to be loadable from the application.

The `CHATTERINO_API_OEMBED_PROVIDERS_PATH` environment variable can be set to change where the file is loaded from, and if no environment variable is set it tries to load the file from `./resolvers.json`.
The `CHATTERINO_API_OEMBED_PROVIDERS_PATH` environment variable can be set to change where the file is loaded from, and if no environment variable is set it tries to load the file from `./providers.json`.

If the Facebook and Instagram resolvers are part of your `resolvers.json` file, you can specify the `CHATTERINO_API_OEMBED_FACEBOOK_APP_ID` and `CHATTERINO_API_OEMBED_FACEBOOK_APP_SECRET` environment variables to grant Authorization for those requests, giving you rich data for Facebook and Instagram posts.
If Facebook and Instagram oEmbed providers are in your `providers.json` file, you can specify the `CHATTERINO_API_OEMBED_FACEBOOK_APP_ID` and `CHATTERINO_API_OEMBED_FACEBOOK_APP_SECRET` environment variables to grant Authorization for those requests, giving you rich data for Facebook and Instagram posts.
2 changes: 1 addition & 1 deletion internal/resolvers/oembed/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func load(requestedURL string, r *http.Request) (interface{}, time.Duration, err
}, cache.NoSpecialDur, nil
}

if data.Status < http.StatusOK || data.Status > http.StatusMultipleChoices {
if data.Status > http.StatusOK {
log.Printf("[oEmbed] Skipping url %s because status code is %d\n", requestedURL, data.Status)
return &resolver.Response{
Status: data.Status,
Expand Down

0 comments on commit 80e1ce0

Please sign in to comment.