Logical extension from APP ZERO. I want it to be extremely approachable, and eventually have tutorials and walkthrough code for anyone creating web apps with safe-js. (the site will ultimately be SAFE-hosted, once the examples work, so that people can click the boxes to make the commands actually execute with launcher)
Auth was covered by APP ZERO, but it looks like creating the basic folders is the logical next step, and a bit confused by the example code both on the MaidSafe website (bare-js? didn’t work) and safe-js gh readme.
tl;dr NEED HELP WITH CREATING DIRECTORY IN SAFE-JS so I’ll tag @joshuef@DavidMtl (did you get your SimpleSafe working?) @happybeing and anyone else can help, submit PR’s etc (site repo, & code repo)
And I know that even if this site gets finished today, let’s say, then it will have to be majorly reworked after Launcher turns into Authenticator, and we have a new API for apps to interface with SAFE directly.
But I AM FINE with making those changes when they occur and it will mostly just be code edits, not major changes to the website. So I still want to finish this
@WhiteOutMashups there’s a new folder with a couple of JS files that loop through a lot of this (in nodejs), so you should be able to convert this to a working demo site:
Although right now getFile in Safe Browser won’t work as expected, until this version is included in a browser bundle (planned for later today).
Please can you add in the default values for optional parameters to this documentation (isPathShared etc)?
I don’t know if there’s a convention for JavaScript but I always liked the format of C++ function definitions with assignments used to show both optional nature, and default value, such as:
Yeh, this is just running a function after the result (then) has returned a value. So in there you could do whatever you want. This is simply just running a console.log on the result.
In advance forgive me; I’m more of a systems engineer than a programmer.
I’ve been looking at the docs and API calls. I setup an authorization payload that is basically the same listed in the API docs with changes to name, ide, vendor, and such.
I then called that javascript file from index.html expecting to see a request to approve the app in SAFE launcher but nothing happens. Two questions I have right now are:
1.) Is that how I’m supposed to do it?
2.) How can I log what the error is.
I’m sure these are pretty basic questions but that accurately reflects my level of experience in this realm.
For safe-js to work you need to upload the website to the safe network and then open it with safe browser or for local use you need to use safe js polyfill , I don’t haven’t on me, someone here might send you one, best of luck
Thanks, I’ll look around and see if it is posted.
I did upload it and have attempted to run it from SAFE but it never requested approval from the launcher. I assumed my process was wrong. So if I am doing it right then it must be something else.
Look for “App Zero” on the community forum I think which shows you how to do this, but be aware that API is being replaced as we speak by a SAFE Node.js thing that I’ve not looked at yet, and is not yet documented (but exists in the repo). Authorisation should be very similar though, so I don’t think you are necessarily wasting your time.
If you want to test locally, easier in the long run, you can do this with the polyfill as Joseph said - you can get this from the repos too, and there are topics explaining how to do this if you search (eg for polyfill).
In case you have not realised yet, to can often see what’s wrong using the browser debugger console (Shift-Alt-J or K or something!). So open this and then load your page and see what output it generates. You’ll also be able to set breakpoints, inspect variables etc.
Sorry I don’t have time to dig the links out just now but say if you can’t find what you need and someone will help. Good luck