SAFEBBrowser Pre-release: 0.2.4 Test the API!

Just gave it a shot, and couldn’t build with ./configure or make, which I usually use to compile.

Also just tried getting the last releases (0.2.3 and 0.2.2) to work on my new Ubuntu surface and couldn’t get them to start. I would just double click on the application and nothing would happen

Don’t know if I need / am missing any special dependencies perhaps?

Great news ! I’ll test this right now and see if I can revive my safeshare project thanks to your work on safe-js

2 Likes

Mac release available here now: https://github.com/joshuef/beaker/releases/tag/0.2.4-pre2

Ill update op.

could you elaborate a bit ? I tried to call safe-js authorise from a script inside a safe hosted web page, with no avail so far .

What would be the correct syntax to call safe.utils.authorise( LOCAL_STORAGE_TOKEN_KEY, app ); in this context ?

what looked natural to me was :

window.safeAuth.autorise( key, app ) , but this returns undefined

I can! I’ve changed ‘utils’ to safeAuth inside of beaker (makes more sense than the vague ‘utils’), this will be reflected in safe-js soon, but for now in SBB: window.safeAuth.authorise is indeed what you’re looking for (though you have a typo in what you posted here, fyi).

Are you on a safe: site? the APIs are only present on safe protocol sites. Let me know if you’re still not seeing the APIs at all, please.

yes this is on : safe://testing.testbeakerapp, you can check it, it is online, but here is the page source anyways :

<!doctype html>
<html lang="en">
<head>
  <title>beaker web app test</title>
  <meta charset="utf-8">
</head>
<body style="margin: 0;">
    auth ?
 
  <script>            
 
    window.onload = function() {
    const LOCAL_STORAGE_TOKEN_KEY = 'BING';
    const app =
    {
        name: "beakerapptest",
        id: "id",
        version: "0.1",
        vendor: "vendor_name"
    };
    
    var test = window.safeAuth.authorise( LOCAL_STORAGE_TOKEN_KEY, app );    
        
    console.log ("test" , test );   
    }
  </script>
</body>
</html>

I suppose I am missing some linking or import ?

1 Like

aha! you’re running in to a bug in safe-js/beaker compat.

I’ve got this sorted locally, and you’ll be please to know that your site auths. I’ll going to finalise this commit and push the fix, so hopefully in ~30 mins there’ll be a new build that will work.

Coming back to you with the link once it’s up!

1 Like

new builds:

mac/linux: https://github.com/joshuef/beaker/releases/tag/0.2.4-pre3
win : https://github.com/joshuef/beaker/releases/tag/untagged-0e008b804cf43918aa43

Your code is working for me with this release on mac :thumbsup:


op updated

1 Like

As im working through here, I’m seeing issues with file writing, Auth is working fine for me locally, as is directory interaction, but creating / modifying files is currently broken.

Working on fixes for this now.

Bing !

Good news :smiley: this works just fine now, building from the source for 0.2.4-pre3 that you released here : https://github.com/joshuef/beaker/archive/0.2.4-pre3.tar.gz

Bad news : I still do not manage to use the binaries that you released : if I try to run the browser as extracted from safer-beaker-browser-0.2.4-0.tar.gz , I get an error with ressources/app.asar :

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module '~/archives/maidsafe/beaker-binaries/safer-beaker-browser-0.2.4-0/resources/app.asar/node_modules/sqlite3/lib/binding/electron-v1.3-linux-x64/node_sqlite3.node'

When browsing the unpacked folders, ressources/app.asar doesn’t appear as a folder but as an unknown file type , same for electron.asar - ie , there is no node_modules folder inside app.asar

I am not sure if the error comes from my side, like I am skipping a step somewhere, or from your packaging ?

All news is good news. One step closer. Hmmmmm…

So this is on linux? (which build?)

Definitely seems like something is going wrong with the CI packaging there. Not sure what’s changed, I had it running on ubun16 VBs here. I’ll dive back in with the build once I’m a bit further with the API.

Good that you can get it going for now at least!


I expect to get another test release out later today, with file writing sorted. So you should be able to start using the network for app data storage properly oh so soon. :smiley:

this is on fedora 21, 64 bits

Hint : when building from the git repo, if I do a npm run burnthemall, then starting the browser fails with a very similar error:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module '~/archives/maidsafe/beaker/app/node_modules/sqlite3/lib/binding/electron-v1.3-linux-x64/node_sqlite3.node'

then if I do a npm run rebuild, sqlite3.c is being rebuilt and everything goes fine

so my guess is that the package that you release is missing the sqlite module built some way.
I am not very aware of npm and packaging, but I hope this can help !

1 Like

it does. It’s a textbook error so far as this project goes :slight_smile:

npm rebuild has to be done for dev, but as to why it’s not being done in packaging. Hmmmmm. Well, it’s a lead for fedora problems. So :thumbsup:

Thanks for testing, @nice

2 Likes

Aaand, a build with read/write/rename functionality working:

mac/linux: https://github.com/joshuef/beaker/releases/tag/0.2.4-pre4
win: https://github.com/joshuef/beaker/releases/tag/untagged-9454501c80a9d8cc4711

4 Likes

I’m now experimenting with NFS functions, and it took me a while to understand how to retrieve a directory content.

I have had to dig deep into window.safeNFS.getDir 's response in order to decode the returned directory information, this way :

        var dir = window.safeNFS.getDir ( tok , "" , false );
        dir.then ( function (result) {                                
                var data = result.body._readableState.buffer.head.data ; 
                var datastr = Decodeuint8arr ( data ) ; console.log ( datastr );        
                 } );        

This gives me :

> {"info":{"name":"beakerapptest-Root-Dir","isPrivate":true,"createdOn":"2016-09-14T13:53:21.341Z","modifiedOn":"2016-09-14T13:53:21.341Z","metadata":""},"files":[],"subDirectories":[]}

with which I am quite happy :slight_smile:

If I understand correctly, safeNFS.getDir returns ‘body’ as a stream, is it how things are supposed to be now ? I think I remember reading a dev update about this a few weeks ago, but I think I must have missed a train !

4 Likes

Awesome.

Yeh, everything currently is simply returning the response from the API. This doesn’t have to be the case mind you, we could chuck out the rest of the response or reformat to something simpler…

That’s a general safe-js question. Right now it’s all pretty low level, which was helping me get to figuring it out. But it could be changed.

Let me know how you get on and if you have thoughts on any of that we can take a look.

and aye, sorry you’re diving in without a map! I’m aiming to get some docs in this weekend :smiley:

3 Likes

I am under the impression that it would be very important to keep the ability to access low level functionnality of the safe network when using safe-js, just like I discovered with the stream example.

On the other hand, in this precise case ( but I guess it may well be the case for various other situations ) , it seems that while manipulating streams in node-js is relatively straight forward using the stream module various powerful functions, in the browser it is another story, as there is no ( - well, I didn’t find any ? ) easily available library to access the stream contents at this level.

In the end by tinkering with the object’s internals I could locate what I was interested in, hiding in _readableState.buffer.head.data , so I suppose one could write functions to manipulate and use these results , but it seems it would be quite some work.

So, my feelings about this would be that :

  • it would be really important to keep safe-js capacity to transmit streams so that one can play with huge or real time files transmission

  • it would be very nice if there was a way to easily play with these streams in the browser , like one does in node.js with the stream module ( someone , a link ? :wink: ) )

  • it would be really nice, too, if one could ask safe-js for a non streaming version of a file, for instance if safe-js implemented both safeNFS.getFile and safeNFS.getFileAsStream

2 Likes

great feedback, thanks!

What you say makes sense, so I’ll look at what we can do in safe-js to these ends :thumbsup:


In other news, I’ve finally got the linux builds behaving. The current release https://github.com/joshuef/beaker/releases/tag/v0.2.5-0 has been tested on Ubuntu 14.04 and 16.04. It also spits out some more linux formats, so you can choose which works best for you.

There’s no changes in this release… beyond it working on linux again.

3 Likes