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

nwjs 0.13 beta2 - sockets.tcp.connect: Does not have permission #4143

Closed
cTn-dev opened this issue Jan 3, 2016 · 8 comments
Closed

nwjs 0.13 beta2 - sockets.tcp.connect: Does not have permission #4143

cTn-dev opened this issue Jan 3, 2016 · 8 comments

Comments

@cTn-dev
Copy link

cTn-dev commented Jan 3, 2016

Hi guys, i have a weird problem when it comes to using the chrome.sockets.tcp.connect

If i simply load my chrome app (not providing package.json) chrome.sockets works, but in this state i can't really embed external javascript due to the security policy (i need to use the "https://www.youtube.com/iframe_api").

If i provide a package.json (which will make the app behave more like nwjs app) embedding external javascript works just fine, but i can't open/connect through the chrome.sockets api.

Is there any workaround that i could use to resolve this?
If you need some more detailed error messages from the console, let me know, ill paste them in.

Thank you.

@ghostoy
Copy link
Member

ghostoy commented Jan 4, 2016

Currently NW doesn't support setting permissions for Chrome APIs within NW app. We will consider this feature in future releases.

@rogerwang
Copy link
Member

@cTn-dev if it is a NW app, it's supposed to be able to run chrome.* APIs by default. Could you please upload a sample where you "can't open/connect through the chrome.sockets api" ? We'll fix it soon.

@rogerwang
Copy link
Member

@ghostoy the problem is not NW lacking permissions field in manifest. NW app should be able to use all chrome.* APIs by default.

@cTn-dev
Copy link
Author

cTn-dev commented Jan 4, 2016

Hi guys, here is a very simple demo code https://dl.dropboxusercontent.com/u/31740/storage/demo_4143.zip

All the fun stuff is in the console, if you load the demo directory as is, it will load as NW app and give you an permission error for the chrome.sockets.tcp.connect.

To run in it as chrome app simply delete the package.json and load the app again, in this case the app will have the required permissions and it will connect to the irc server.

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

NW uses the following way to tell NW app from Chrome app: when there is package.json, it's a NW app, otherwise if there is manifest.json, it's a Chrome app. NW app has all the permissions to use chrome.* API. Will add this to doc.

@cTn-dev
Copy link
Author

cTn-dev commented Jan 4, 2016

Sorry for asking a stupid question, but does that mean the chrome.sockets api will now be usable in the NW app, and it was simply missing from the permissions list?

Thank you guys for all the hard work you put into NW

@rogerwang
Copy link
Member

@cTn-dev I think the first comment confuses you. Permission list is not needed in NW app to use chrome.* APIs. What you've reported is a bug and fixed in the last nightly: http://dl.nwjs.io/live-build/01-05-2016/

@cTn-dev
Copy link
Author

cTn-dev commented Jan 5, 2016

Thanks @rogerwang just tested the latest nightly build, the socket api works just the way it should!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants