Can't connect WHM to safe_browser running private network

Hello all, I’ve been trying to get https://github.com/maidsafe/safe-web-hosting-manager-electron working properly. I currently have a functioning custom/private vault network and safe_browser built from source using the crust config values to allow for connection to the network and account creation.

I followed through the README for WHM, however for authentication it attempts to launch my system’s native browser (Chrome) and there is not documentation that explains how to connect with any sort of safe browser.

If I’m not mistaken, I am looking for:
A. A file to add my custom network config in so the electron app connects to the network directly (functional but probably not the best option)
B. A way to run part of the app for authentication in the safe browser. Some of the other examples use a model like that, may or may not be the right model.

What do I need to do to connect WHM Electron to my browser with a custom development/“live” network? (I am not using the mock vaults)

Hi Graham,
I’m not familiar with this myself but I’ve asked our guys to jump in if they can think of something to give you a hand.
Ta,
David.

Hey @grahamJenkins,

You need to run the Safe Browser 0.7.0 to register custom protocol handling (which is how we do inter process comms for app authentication).

I see you’ve already built that, but can you give it a go from the release version just to be sure.

If that’s still not working, then we’d have to look at what system you’re on (and see if there’s any issues with URI registration there).

1 Like

@grahamJenkins, just in case it’s not clear, you will also have to make sure that the browser (Peruse 0.7.0 as suggested by @joshuef ) you run is configured to also connect to your local network, so you need to have that setup and have an account created for your local network using the authenticator.

Hey @joshuef and @bochaco, thanks for the input. Yes, I am building version 0.7.0 from latest source on linux, and it is connecting to my private network successfully. (a handful of VPSs I own)

Can you tell me a bit more about how the inter process comms work? That appears to be the part I’m stuck on, WHM seems to be trying to communicate with Chrome (why???) or isn’t able to detect my custom safe_browser. (built from source currently) I’ll test with the release and report back.

@grahamJenkins I get you are using Linux, so you should have a file at ~/.local/share/applications/maidsafenet-ltd-safe-browser-authenticator.desktop which contains the information to register the safe-auth: protocol, e.g. mine looks like this:

[Desktop Entry]
Type=Application
Name=SAFE-Browser-Authenticator
Exec="/home/bochaco/Peruse-v0.7.0-linux-x64/peruse" %u
Terminal=false
MimeType=x-scheme-handler/safe-auth
NoDisplay=true

If you have a file like this one, perhaps you can try by running the following command:

$ xdg-open safe-auth:testing

this should launch the Peruse browser if it’s registered correctly. If not perhaps you can try removing all files that could have been created by the browser with

rm ~/.local/share/applications/maidsafenet*

and then try to launch the browser once more to see if it now registers itself corretly. You can test it again with the xdg-open command and/or with WHM.

Ohh, that actually looks like exactly what I need. I haven’t tested the other yet but this looks very promising. Thanks!

I think my core problem is:
/usr/bin/xdg-open: 782: /usr/bin/xdg-open: : Permission denied
Created new window in existing browser session. (at this point it’s opening Chrome as the default)

I’ll google around a bit, I did check permissions on the entire file structure. Google isn’t helping but it seems to be a system issue, I’ll see what I can figure out.

Edit: More info
@joshuef I did download the latest release, ultimately the permission denied is the problem I’m running into.

xdg-open safe-auth:test
/usr/bin/xdg-open: 782: /usr/bin/xdg-open: : Permission denied
Created new window in existing browser session.

I’ve been googling around for a while and am considering hijacking my x-www-browser (hijacking the default web browser) to see if I can redirect the auth request to the browser. It feels very wrong but might do the job. Unfortunately there is little information on the whole xdg-open: Permission denied issue on google. Has anyone else had this sort of issue?

Edit 2: Hijacking that messed with my sistem, still got permission errors. At this point it appears that the browser is having trouble accepting auth requests if I’m not mistaken. Maybe I can hack at WHM and make it open directly rather than using xdg-open to narrow down the issue.

Does your .desktop file have x permissions? (Although it isn’t needed according to https://askubuntu.com/a/419657/560447 .)

Also, check this answer, they hint that the exec parameter should not have quotes: https://elementaryos.stackexchange.com/a/4290

2 Likes

That looked like it worked, I got an auth request (a bit buggy but okay) though WHM never receives a response.

[Parent 28997, Gecko_IOThread] WARNING: pipe error (45): Connection reset by peer: file /build/firefox-wWf_B4/firefox-64.0+build3/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 363
This instance should quit. Ciao!

I’m not sure what it’s talking about with firefox, that’s definitely not one of my preferred browsers. I have to say, I have built a lot of tools from source, getting WHM to work is probably one of the bigger pains I’ve run into. Are there any up to date guides/walkthroughs to using it? It appears that the readme doesn’t have enough details to get up. I’m about at the point where I’m going to delete everything and try starting from scratch. I really love the concept behind maidsafe, but dang…readmes, guides and docs are in really bad shape. (even using prebuilt releases isn’t getting me anywhere)

Is there any other reliable way of getting code onto the network short of writing all the API calls from scratch? (I did play with the API playground, also another case of out of date docs, the best resource I found had different endpoints, things worked differently and no supporting docs to help sort it out. I’d really rather not hack together a node script with unknown API endpoints just to load a test site on the network. But I digress…is there any up to date guide for getting WHM set up?

-Ubuntu 18.04
-Node 8.0 (nvm)
-yarn from ppa (I believe)
-Private dev network (vaults running on prebuilt binaries)
-Manually built and prebuilt browser connecting to my network

Thanks for the input.

I guess you may be having a similar issue with the WHM registered scheme in the system. You should have this file ~/.local/share/applications/maidsafe-web-hosting-manager.desktop, and if you look at its content it should have a line like:

MimeType=x-scheme-handler/safe-bmv0lm1hawrzywzllmv4yw1wbgvzlndlymhvc3rpbmdtyw5hz2vy

so, again, you can try with xdg-open with the URI shown in that line of the file, e.g. in my case the response is sent to the WHM with:

$ xdg-open safe-bmv0lm1hawrzywzllmv4yw1wbgvzlndlymhvc3rpbmdtyw5hz2vy:testing

There is no other doc for building the WHM, and we weren’t even adding new features to it recently since there are some discussions around if we should migrate such a tool to be web-based, or perhaps a desktop app but with some different architecture/design to make it more lightweight and easier to build, also, mobile releases are around the corner so we may want to consider having something that can be easily ported to mobile as well, etc.

1 Like

Okay thanks for the input, I was thinking it migtht be something along those lines, I sort of scanned over that file but didn’t realize that the entire scheme was safe-XXXXX, my eyes glossed over and thought it was just offering to be another safe:// handler.

I’ll see if I can get that running in a bit and report back. Personally I’d love to see a more web based approach, the ease of getting the API playground seems to be far more intuitive to me. No IPC/xdg issues, just start a server up, load the address in the browser and let it go from there.

Thanks for the input, I’ll update this with my findings.

Edit: Tested, other issues.
~/.local/share/applications$ grep scheme maidsafe-web-hosting-manager.desktop
MimeType=x-scheme-handler/safe-bmv0lm1hawrzywzllmv4yw1wbgvzlndlymhvc3rpbmdtyw5hz2vy

xdg-open safe-bmv0lm1hawrzywzllmv4yw1wbgvzlndlymhvc3rpbmdtyw5hz2vy:hello
xdg-open: file ‘safe-bmv0lm1hawrzywzllmv4yw1wbgvzlndlymhvc3rpbmdtyw5hz2vy:hello’ does not exist

Sigh, I’m this close to setting up a Windows VM to get this sorted out…all I want to do is test uploading a couple of sites so I can see the network in action :expressionless:

Thanks for the continued testing @grahamJenkins.

Yeh I feel your pain. The WHM is sub optimal to say the least. But hopefully we’ll be able to get some other avenues for uploading on the go in the non too distant future. We’ve been looking at CLI tools as well as the web based approach ,which I’m hopeful to get into soon.

This kind of testing is very helpful though, as the registering of these URIs is a consistent pain point, so we need to get that smoothed out. Could you share with us the full contents of the .desktop file for the WHM, please.


Does the built WHM work for you? Have you tried that against the alpha2 network at all?

2 Likes

Hey there I have been unable to get WHM working thus far, regardless of network. My current environments are:

Ubuntu 18.04
nvm 0.33.11
-> Installed node 8.0.0
yarn 1.12.3 (installed from PPA)
git 2.17.1
safe_browser: Built from source as well as prebuilt (Peruse-v0.7.0-linux-x64-dev/Peruse-v0.7.0-linux-x64)
(regardless of network, they run fine, I just can’t get WHM to talk with them, re xdg-open issues)
WHM: Built from source following README from repo. At best it makes a request to the browser and never hears back. Tried on second Ubuntu 18.4 (I think) linux computer and ran into roughly the same issues and went for a Windows VM:

Windows 10 (I’m not on it currently, so I’m making some rough estimations now)
installed git
installed nvm
installed yarn
Found solutions to download VS addons/something to get Python in the path (tried installing manually, didn’t work, ended up with a npm command I believe)
Got windows safe_browser working fine from prebuilt
Build errors (during ‘yarn’) relating to flow-typed, upgraded version
Build stalled out without errors and won’t complete
WHM will “run” but fails due to missing libraries probably due to the stalled build

I have heard reports that WHM does run for some people on Windows, I don’t know if there are issues because I’m running in a VM (IMO that shouldn’t affect it) or I’m missing something, anyone have tips there?

Alternately, I don’t mind writing a small amount of code to work with the APIs directly, it’s just very sub-optimal. I have seen little excerpts that generally describe the process for working with the API, but again, the documentation that I have seen thus far is not complete enough that I’d want to attempt building something.
That said, if anybody can point me to any scripts that will allow for:

  1. Creation of safe:// url
  2. Definition of mutable content (the trip planner/todo example did half of this, the other half was broken)
  3. Upload even a single HTML file to the safe url
  4. Ideally standard update/delete options

I am comfortable writing/modifying node scripts which seems to back a lot of examples here, the main problem is getting those to communicate with the safe browser. (if they run a light server that can be loaded locally, awesome) After that, there is discrepancy between info in the examples (like the API playground) versus guides due to code being updated, and it’s usually a bad idea to try to develop against APIs without supporting documentation.

Any other tips/suggestions? Guides/walkthroughs/tutorials? At the end of the day I just want to upload content to a safe:// url and have spent the better part of the week running into walls. A really want to love the maidsafe project and contribute to its success, it’s just really hard when a fairly experienced linux fan with years of general development experience can’t get the tools to work after a week of tinkering and asking for help. Super frustrated!

That said, thanks for all the input

1 Like

Another note, I was playing with the web example which appears to be explained in detail here:
https://hub.safedev.org/platform/web/
While I did get the locally hosted app running and set some mutable data to the network, parts of the example were broken (inserting) and I wasn’t able to figure out where/why/how to fix it. Also the matter of defining a safe:// site and uploading content, it felt like I was going in the right direction and…got stuck :slight_smile:

1 Like

Update: Running a windows VM with prebuilt Peruse and WHM I was able to connect and upload content, that’s about the only combination I seem to be able to get working. Now I’m seeing routing/DNS issues that I’ll bring up in another thread.

This topic was automatically closed after 60 days. New replies are no longer allowed.