Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onebox improved error handling and support for Instagram Access Tokens #11253

Merged
merged 9 commits into from
Nov 18, 2020

Conversation

jbrw
Copy link
Contributor

@jbrw jbrw commented Nov 16, 2020

FEATURE: display error if Oneboxing fails due to HTTP error

  • display warning if onebox URL is unresolvable
  • display warning if attributes are missing

FEATURE: Use new Instagram oEmbed endpoint if access token is configured

Instagram requires an Access Token to access their oEmbed endpoint. The requirements (from https://developers.facebook.com/docs/instagram/oembed/) are as follows:

  • a Facebook Developer account, which you can create at developers.facebook.com
  • a registered Facebook app
  • the oEmbed Product added to the app
  • an Access Token
  • The Facebook app must be in Live Mode

The generated Access Token, once added to SiteSetting.facebook_app_access_token, will be passed to onebox. Onebox can then use this token to access the oEmbed endpoint to generate a onebox for Instagram.

DEV: update user agent string

Updated to a recent MacOS Safari user agent (one lacking webp support). This is a possible fix to the issue of Akamai serving webp images in response to requests for jpegs or gifs.

DEV: don’t do HEAD requests against news.yahoo.com

news.yahoo.com seems to return 404s for HEAD requests, which stops the whole oneboxing flow from happening. Force a GET when talking to news.yahoo.com.

- display warning if onebox URL is unresolvable
- display warning if attributes are missing
Instagram requires an Access Token to access their oEmbed endpoint. The requirements (from https://developers.facebook.com/docs/instagram/oembed/) are as follows:

- a Facebook Developer account, which you can create at developers.facebook.com
- a registered Facebook app
- the oEmbed Product added to the app
- an Access Token
- The Facebook app must be in Live Mode

The generated Access Token, once added to SiteSetting.facebook_app_access_token, will be passed to onebox. Onebox can then use this token to access the oEmbed endpoint to generate a onebox for Instagram.
Copy link
Contributor

@eviltrout eviltrout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good so far!

lib/onebox/templates/preview_error_onebox.mustache Outdated Show resolved Hide resolved
lib/oneboxer.rb Outdated Show resolved Hide resolved
lib/oneboxer.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@eviltrout eviltrout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, but I'm curious to hear from Gerhard.

@jbrw jbrw requested a review from gschlager November 18, 2020 16:53
config/locales/server.en.yml Outdated Show resolved Hide resolved
lib/oneboxer.rb Outdated Show resolved Hide resolved
Co-authored-by: Gerhard Schlager <mail@gerhard-schlager.at>
@jbrw jbrw merged commit 331236d into master Nov 18, 2020
@jbrw jbrw deleted the onebox-improved-error-handling branch November 18, 2020 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants