Skip to content

Easier Postmessage Origin handling & Popup Build Script#30

Merged
dan-f merged 2 commits intomasterfrom
dan-f/popup-build-script
Sep 13, 2017
Merged

Easier Postmessage Origin handling & Popup Build Script#30
dan-f merged 2 commits intomasterfrom
dan-f/popup-build-script

Conversation

@dan-f
Copy link
Copy Markdown
Contributor

@dan-f dan-f commented Sep 8, 2017

This PR:

  • Removes the need to statically template in the application origin
  • Adds a distributed CLI script to more easily build the popup

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 85.773% when pulling ce3a4e9 on dan-f/popup-build-script into 492b294 on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 85.773% when pulling ce3a4e9 on dan-f/popup-build-script into 492b294 on master.

@dan-f dan-f force-pushed the dan-f/popup-build-script branch from ce3a4e9 to 99dab3c Compare September 8, 2017 20:10
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 85.773% when pulling 99dab3c on dan-f/popup-build-script into 492b294 on master.

@dan-f dan-f force-pushed the dan-f/popup-build-script branch from 99dab3c to 0fd6f74 Compare September 8, 2017 20:19
@dan-f dan-f requested a review from RubenVerborgh September 8, 2017 20:21
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 85.773% when pulling 0fd6f74 on dan-f/popup-build-script into 492b294 on master.

@dan-f dan-f force-pushed the dan-f/popup-build-script branch from 0fd6f74 to 657569b Compare September 13, 2017 17:29
@dan-f dan-f changed the title Simplify Popup Building Easier Postmessage Origin handling & Popup Build Script Sep 13, 2017
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.2%) to 86.2% when pulling 657569b on dan-f/popup-build-script into b457128 on master.

Additionally, add `solid-auth-client` CLI for generating the popup.
@dan-f dan-f force-pushed the dan-f/popup-build-script branch from 657569b to aecd02e Compare September 13, 2017 17:37
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.2%) to 86.2% when pulling aecd02e on dan-f/popup-build-script into b457128 on master.

@dan-f
Copy link
Copy Markdown
Contributor Author

dan-f commented Sep 13, 2017

@RubenVerborgh this is ready for review!

Copy link
Copy Markdown
Contributor

@RubenVerborgh RubenVerborgh left a comment

Choose a reason for hiding this comment

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

Tested, works.

build a static popup bound to your application's name.

Keeping this in mind, here's how to get things working.
Keeping this in mind, it's pretty simple to build a popup for your app!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suppose they could even just edit the HTML at this point, it has become so easy 😉


// helpers

function ns(fn) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe a comment about what this does?


function ns(fn) {
return function() {
fn.apply(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's no need for apply anymore in ES6, just use the spread operator.

'dist-popup/popup.html'
)
if (!fs.existsSync(templateFilename)) {
const issueUrl = 'https://github.com/solid/solid-auth-client/issues'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe hoist all the way up the file?

}
}

const log = ns(console.log.bind(console))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to bind; log works independently (in Node, not the browser).

}

function getStoredAppOrigin() {
return getData(sessionStorage).then(data => data.appOrigin)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd just use async/await consistently.

src/ipc.js Outdated
if (origin !== clientOrigin) {
console.warn(
`SECURITY WARNING: solid-auth-client is listening for messages from ${childOrigin},` +
`SECURITY WARNING: solid-auth-client is listening for messages from ${clientOrigin},` +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd explicitly say that the message has been rejected.

src/popup.js Outdated

export const appOriginHandler = (req: request): ?Promise<response> => {
const { id, method } = req
switch (method) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could be a simple if I suppose.


program
.version(version)
.command('generate-popup <trusted-name> [filename]')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is required? Also, I found the name confusing.

@@ -1 +0,0 @@
POPUP_URI=http://localhost:8081/popup.html
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some mentions of the .env files are left in the README.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.2%) to 86.145% when pulling eb8ab9a on dan-f/popup-build-script into b457128 on master.

@dan-f dan-f merged commit 685b1ae into master Sep 13, 2017
@dan-f dan-f deleted the dan-f/popup-build-script branch September 13, 2017 20:07
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.

3 participants