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

Secure preview frame #2107

Merged
merged 8 commits into from
Jan 25, 2020
Merged

Conversation

pwjablonski
Copy link
Contributor

@pwjablonski pwjablonski commented Jan 24, 2020

Hey @outoftime!

Here's my first pass at #804

  • creates static preview.html file
  • loads previewSupport into preview.html via webpack
  • Replaces srcDoc with src reference to preview.html
  • Sends message with source from previewFrame component to the iframe
  • Recieves source from the message and write content to iframe document
  • fixes iframe settings to allow for camera/audio access

Appreciate your feedback especially around the chunking in webpack

@@ -0,0 +1,5 @@
<!DOCTYPE html>
<html>
<head> </head>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Delete extra space

@@ -361,4 +304,56 @@ module.exports = (env = process.env.NODE_ENV || 'development') => {
},
devtool,
};

const mainConfig = {...baseConfig};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems a bit hacky - open to suggestions on how to better make two configs from the same base.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is totally fine/quite idiomatic! The only thing I would change is just constructing each variant of the config in a single literal, e.g.:

const mainConfig = {
  ...baseConfig,
  name: 'main',
  entry: isTest
    ? undefined
    : {
        inline: 'first-input-delay',
        main: './application.js',
      },
  //...
};

Copy link
Contributor

@outoftime outoftime 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 cool! So much cleaner!

@@ -361,4 +304,56 @@ module.exports = (env = process.env.NODE_ENV || 'development') => {
},
devtool,
};

const mainConfig = {...baseConfig};
Copy link
Contributor

Choose a reason for hiding this comment

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

This is totally fine/quite idiomatic! The only thing I would change is just constructing each variant of the config in a single literal, e.g.:

const mainConfig = {
  ...baseConfig,
  name: 'main',
  entry: isTest
    ? undefined
    : {
        inline: 'first-input-delay',
        main: './application.js',
      },
  //...
};

webpack.config.js Show resolved Hide resolved
src/previewSupport/handleSourceUpdates.js Show resolved Hide resolved
src/html/preview.html Show resolved Hide resolved
src/components/PreviewFrame.jsx Show resolved Hide resolved
src/components/PreviewFrame.jsx Outdated Show resolved Hide resolved
Copy link
Contributor

@outoftime outoftime left a comment

Choose a reason for hiding this comment

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

Nice! A couple final comments, also I want to take it for a spin, but pretty much good to go here.

src/components/PreviewFrame.jsx Show resolved Hide resolved
webpack.config.js Show resolved Hide resolved
@outoftime outoftime merged commit c2096f8 into popcodeorg:master Jan 25, 2020
outoftime added a commit that referenced this pull request Feb 11, 2020
outoftime added a commit that referenced this pull request Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants