-
Notifications
You must be signed in to change notification settings - Fork 7
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
No SAFE-DOM-APIs on localhost? #3
Comments
Hey, @gnunicorn I hadn't considered that, and it's a gooood point. I'll look into getting this sorted out. I think it's a simple matter with beaker-plugins. If it is, it'll follow when I've gotten your PR in. Thanks! |
So, this turns out to be a little more complicated than initially expected. I thought I could just remove the Instead I also had to add the http protocol in the beaker-plugins protocol sections, too, like so: protocols: [ safeProtocol,
{
scheme: 'http',
label: 'Localhosting',
register: function(){}
}
], That is clearly not gonna work for our case, as this would expose the SAFE-DOM-Elements on all |
@gnunicorn yeh, it's so so clear cut for beaker and exposing the APIs. For now, for development I think perhaps we'll need to make a shim for safe-js. We could look at building out a polyfill with the compiled code that will check/create the
and the pollyfill would simply do something like: var polyfillSafeAuth = {
// this would be the actual safe-js functionality, natch
authorise : function()
{
console.log( 'polyfilled auth method!' );
}
}
if( ! window.safeAuth )
{
window.safeAuth = polyfillSafeAuth;
} This allows for development with the same API methods (via For production build of What do you think, @gnunicorn ? |
I've implemented a polyfill, which is available in the npm package as of safe-js 0.1.3. This will add the |
@joshuef that's a good intermediate solution. However, the latest beaker from master currently blocks my localhost requests through CSP headers:
|
Do I have to explicitly add the |
@gnunicorn I think you need to go in the "BeakerDev" menu and click on "Toggle WebSecurity for new tabs".
|
@frabrunelle that doesn't have any effect. Still having the same issue. |
@gnunicorn you're testing this in a newly opened tab after toggling the option? As it does not affect currently open tabs. |
@joshuef dunno why it didn't work, does now. Would be nice to have an indicator after switching – I have things running for a long time, with laptop sleeps in between and it's impossible to remember ;) . |
Grand. That I can add to the list: #12 |
Heyah,
it appears that though the
window.safe*
-APIs are made available on allsafe://
-URLs, I can't access them from http://localhost nor the file-system, which makes this really inconvenient for development :( .Any chance we can whitelist localhost for the APIs?
The text was updated successfully, but these errors were encountered: