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

Channel Preview Issue #1

Closed
chrisjpowers opened this issue Oct 6, 2017 · 6 comments
Closed

Channel Preview Issue #1

chrisjpowers opened this issue Oct 6, 2017 · 6 comments
Assignees
Labels
bug something isn't working right

Comments

@chrisjpowers
Copy link
Contributor

screen shot 2017-10-06 at 3 49 21 pm

I'm running the app locally and trying to use the "Preview" feature on the Channels page. It pulls up the preview page, but an error from the cast_receiver.js Google lib is hosing the page. It's trying to connect to a WebSocket port on 8008, but I'm not sure where that's supposed to be coming from?

It's worth noting there are not any Chromecasts on the network currently, but I assumed I could preview a channel regardless.

Have you seen this issue before?

@superhawk610
Copy link
Owner

You should be able to preview the channel (it should still display correctly). Since Previews render the page exactly as it will be displayed on the Chromecast, it's loading cast_receiver.js, which is a script that only functions correctly when accessed from a Chromecast device (I believe port 8008 is used internally by Chromecast devices, while 8009 is used externally for receiving incoming connections).

To my knowledge, this should be harmless aside from clogging up the console.

This can be rather easily fixed by adding an additional URL to the Express schema to essentially strip this script from the preview page when viewed via Preview and not on an actual device, something like



app.get('/channel/:channel_id', (req, res) => {
  res.render('channel', { ... , casting: true })
})

app.get('/channel/:channel_id/preview', (req, res) => {
  res.render('channel', { ... , casting: false })
})

and then just conditionally including cast_receiver.js on the channel page.

@superhawk610 superhawk610 self-assigned this Oct 6, 2017
@superhawk610 superhawk610 added bug something isn't working right non-critical labels Oct 6, 2017
@chrisjpowers
Copy link
Contributor Author

chrisjpowers commented Oct 6, 2017 via email

@superhawk610
Copy link
Owner

Any chance the content you're trying to load has a header that blocks it from being loaded in an iframe? Anything like the following:

X-Frame-Options: DENY
X-Frame-Options: SAMEORIGIN
X-Frame-Options: ALLOW-FROM https://not-your-url.com/

In Firefox, it will throw an error in the console when this prevents loading. Are you trying to load your own content or someone else's page?

@Brekmister
Copy link
Contributor

@superhawk610 That's what I am seeing whenever I load something that's not mine on some sites.

I don't think this is an issue, it's a security feature built into the spec. Whether if it's an good feature or not...well, that's a topic for another day.

@Brekmister
Copy link
Contributor

But, there is a low possibility that we can probably catch that and put on a page saying "Sorry, this page cannot be loaded...Error xxx: X-frame denied"

@superhawk610
Copy link
Owner

superhawk610 commented Oct 9, 2017

I'm also fairly sure we could proxy each page and strip those headers, though I'm not sure how nefarious that is seeing as it contradicts the ideology behind that spec..

I like the idea of catching the errors, I'll try to throw that into the next release.

superhawk610 added a commit that referenced this issue Oct 11, 2017
- added new preset channel listing when adding a new channel
- upped font size for alerts (addresses #12)
- conditionally includes Google's cast script only when displayed on receiver device (addresses #1)
- added --serve-only flag to prevent interrupting devices while debugging
- added multicast bin to package.json to simplify startup and prepare for NPM (see #9)
- added new features to README
- cleaned up code formatting
@superhawk610 superhawk610 added this to the v1.1 Release Schedule milestone Nov 14, 2017
@superhawk610 superhawk610 mentioned this issue Dec 30, 2017
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working right
Projects
None yet
Development

No branches or pull requests

3 participants