"APP ZERO": Beginners SAFE Web App Tutorial

Hmm I’ll get this fixed and synced

EDIT: Not sure what you mean, this is the link and it’s working fine for me, showing up correctly on github, can see all the python code right there

Cracked the code!!! :smiley: :smiley:

SAFE-JS VERSION OF APP ZERO NOW WORKS!!!

Oh my look how tiny that code is :smiley: :smiley: That’s what App Zero is all about!

More of a testament to how great and clean safe-js is than anything, though :slight_smile:

Very glad to be rid of the CSP headers! Now websites / web apps are unleashed!!

10 Likes

Well done Will, where you cut the trail, many will follow!

3 Likes

CSP headers

Content Security Policy?

1 Like

I would guess that’s correct.

Was something that blocked parts of your html, like inline scripts and most tags.

But now they’re gone so anyone’s free to make websites as they wish now! :slight_smile:

Nice one. Works for me. Where do you see people taking this now?

1 Like

Well for me personally it’s a good entry point into safe-js for uploading files etc. I think a web app replacement of the demo app will be a great thing, since all you need to do with it is create public / private folders, upload files, and map dns. Should take some burden off MaidSafe if I can get it done.

In general, everyone should take it every Direction they can! SAFE apps need to be built! Replace clearnet in every use case :slight_smile:

8 Likes

Time to kickstart some Authenticator apps!!

MaidSafe Asia is offering a:

$50 BTC bounty to the first person who can make APP ZERO work with the Authenticator Browser!!

_

Here’s everything you need to start!

Don’t forget, APP ZERO is all about the BARE MINIMUM needed to be a SAFE (web) app that just authenticates with the Network. Just one HTML file with some JS for the commands will suffice!!

Happy coding! I’ll be working on this as well!

4 Likes

I think I might have done this already but I am still having a bit of trouble with the web hosting manager so I am not able to test it

3 Likes

Great, keep us posted!

Is this still going?

Okay, so I assume that one needs to copy what’s already been built (web_hosting_manager), take it apart and then make a minimal design work.

1 Like

Yeah, we have this APP ZERO code for authenticator,

We’re just waiting for the web_hosting_manager to work so that we can upload it to SAFE (mock) and try it out.

This is the code:

//Intial function
"Use strict";

/*
 *              		   New Safe JS App Zero
 */
const app = {
  id: "net.app.zero",
  name: "Safe Web Demo",
  version: '1',
  vendor: "Joe",
};

var parmissions = {
  anydir: ['Read']
};

(function() {
  console.log('Initialising website');
  window.safeApp.initialise(app)
    .then((appInit) => {
      console.log("Initialise Token :" + appInit);
      console.log("Authorising website");
      window.safeApp.authorise(appInit, permissions)
        .then((auth) => {
          console.log(auth);
        }, (err) => {
          console.error(err);
        });
    })
    ((err) => {
      console.error(err);
    });
})();
4 Likes

Oh, so once it’s fixed, the first person here that’s not an internal dev that puts up a site wins 50 bucks?

Is the id the domain name? What about top level demains and such. Does that exist on the SAFE Network?

Well that code belongs to @Joseph_Meagher

He was the first so submit it. I’ll add some html to it, but if his js works then he wins because he submitted first

1 Like

Too bad then, but then again an opportunity to make my first real site.

[Update]

Looks like you can upload it now.

1 Like

hope u still will make other sites!!

1 Like

What do you mean?

I will make my first site on the SAFE Network.
No need to use CLEARNet.

I just got in with _public and _publiNames. No idea what to do with that though.

2 Likes

This is the new code with minor fixes

 //Intial function
"Use strict";

/*
 *              		   New Safe JS App Zero
 */
const app = {
  id: "net.app.zero",
  name: "Safe Web Demo",
  version: '1',
  vendor: "Joe",
};

var permissions = {
  _public: ['Read']
};

(function() {
  console.log('Initialising website');
  window.safeApp.initialise(app)
    .then((appInit) => {
      console.log("Initialise Token :" + appInit);
      console.log("Authorising website");
      window.safeApp.authorise(appInit, permissions)
        .then((auth) => {
          alert(auth);
        }, (err) => {
          console.error(err);
        });
    })
    ((err) => {
      console.error(err);
    });
})();
5 Likes

Note folks, I think you need to replace > with > in the above.

2 Likes

Thanks, all fixed now

1 Like