Safe Browser Dev Updates (@v0.4.2)

safe-browser

#82

Ctrl+$ to increase MAID price by 1000 in https://poloniex.com/exchange#btc_maid
to rescue my disastrous long MAID position…


#83

On ittttttttt :money_with_wings:


#84

@frabrunelle pointed out a bug on init of our safe-cyn data, which should have been revolved with the latest release:

as ever, let me know of any issues :thumbsup:


#85

Looks great! But first thing I notice is I type in my page address and it still gives me the following, wasn’t it updated to default to safe:// as the default protocol? was looking forward to this thanks!


#86

Also @joshuef , trying real hard to get your NFS examples to work, but stuck on the first one. Tried many things, here’s a gitub gist of my current code, and I just can’t get it to authorize, no matter what I do.

I’ve tried “authorise” (like your github examples show) and “authorize,” and changing the order of many things, and lots of other things, but no matter what I do the only way I can get safe-js to actually authorize with launcher is to do the window.safeAuth method, beause safejs.auth... etc never ever works for me. And it is a crucial part of these examples I’m trying to get


#87

Yup, was supposed to… heh.

Looks like I lost some commits as I merged into master. Dang.

Reapplying the implementation and I’ll get another release along shortly.


#88

It looks like you’re trying to do es6 style imports into the browser.

If you’re working on local development, you should be using the safe-js polyfill to get the window.safeXXX methods, then you can develop your code in a way that ports easily onto the live network where these methods are available as part of beaker.

Importing/bundling safe-js directly and trying to run it will likely just give you X-domain issues as it tries to access localhost:8100.


As an aside, es6 import directives only work in other js files. So they’re suited more to node or precompiling your code via webpack etc.

More info on import and webpack


Soooo in the end something like this should work:


<!DOCTYPE html>
<html>
	<head>
		<title>NFS EXAMPLES</title>	
                <script src="<your copy of safe-js polyfill>" type="text/javascript" />
		<script>
			function authorize() {
				const app =
					{
				    name: "SUCCESS!!!!!!!",
				    id: "id",
				    version: "0.0.0.0.0.0.0.0.1",
				    vendor: "SUCCESSFULMAN!!!",
				    permissions: ["SAFE_DRIVE_ACCESS"]
					};
				window.safeAuth.authorise(app);
			};
		</script>
	</head>
	<body bgcolor="black"><center>
		<button onClick="authorize()">Click to Authenticate!!</button><br>
	</body></center>
</html>

#89

@WhiteOutMashups

again with safe: auto functionality.

Please let me know how you get on in windows with sync and the safe: protocol as well (ie. does this cause the safe browser to open? [this works fine on my osx tests, fyi… windows is thus far an unknown quantity])


#90

No every attempt I was doing I uploaded to SAFE every time and ran it in your browser, for every test


#91

Thanks very much for going through that with me.

And then when I’m ready to deploy to SAFE, I just delete the < script src=“polyfill…”> line and change all the window.foo entries to the correct matches in safejs.foo right? (and also add “import * as safejs” I think) Huge Help so far thanks!


#92

@joshuef, a feature request if it is not already implemented in beaker: folder tread (and upload) by drag and drop

Supported by Chrome, and just implemented in Firefox v50, this would be very useful in helping users manager the transition between local and safe storage, and for all sorts of SAFE Apps:

https://bugzilla.mozilla.org/show_bug.cgi?id=876480#c21


#93

Yup pretty much. The calls to window.safe don’t need to be changed for deploy to safe:, that’s the joy of the polyfill. It uses the same syntax / calls so it should just be as simple as removing the script tag as you note :thumbsup:


#94

So, quick question here. I’ve been toying a bit around with Elm lately, just trying to learn some basics, and it’s a pretty fun and logical language to use imo. (looking at you JS).

I was just wondering how one would go about authenticating with something else than safe-js, because if im not mistaken http requests are not allowed in Safe Beaker Browser? So a normal REST request would not work?

I imagine one could use the port function in Elm to call on js functions but it would be cool to do everything within Elm.


#95

Hey @aenemic.

You’re right in that HTTP requests qould be blocked as cross origin. But in the safe browser safe-js is baked into each window object. So it’s always accessible and doesn’t function in a http request manner as far as the window object is concerned.

So you’d still use safe-js that and the window.safeXXX methods in the safe browser. Assuming that you can use these in elm (which as i compiles to js, I would guess so?)


#96

Yes, one could use their ports function (https://guide.elm-lang.org/interop/javascript.html) for that I imagine, it would just be “prettier” to be able to do everything inside a .elm file. Gotta wait for someone who knows what their doing to make a elm-safe-api package I can import. Hah.


#97

Just saying, I like JS and safe-js :slight_smile:

So keep it up! :smiley:


#98

Another wee update: https://github.com/joshuef/beaker/releases/tag/v0.4.2-5

Featuring:

  • Updated package naming
  • Some choice beaker-browser updates from master, thanks to @frabrunelle.

This is a RC, so let me know if any problems arise, if not, I’ll mark this release as stable :thumbsup:


#99

Love it, just started it up and typed in my safesite and it default booted safe://… PERFECTLY thanks a bunch!! very intuitive


#100

No, just tested on my windows 7 and didn’t work, but then again I didn’t use the installer only the zipped bunch of files so I’m sure that is the reason. I’ll look up how to set defaults for custom protocols


#101

0.4.2 Release

After a few iterations here, 0.4.2 is available here: