orbitdb-archive / orbit

A distributed, serverless, peer-to-peer chat application on IPFS
MIT License
1.64k stars 117 forks source link

[WIP] configuration ui for ipfs daemon #184

Closed theobat closed 7 years ago

theobat commented 7 years ago

Simple

Composed (refactoring IpfsDaemonConfig)

theobat commented 7 years ago

@haadcode, I am struggling with this error:

app.js:48 TypeError: ipfs.object.put is not a function(…)

Which comes from the fact that I pass an ipfs instance through ipc communication in electron (from backend to frontend once daemon started successfully) and this communication serialize objects as JSON (so functions disappear).

Do you have any idea how I could communicate full JS objects between main and renderers in electron ? I have not been able to find any solution to that yet

haadcode commented 7 years ago

@theobat Hmmm... afaik Electron supports full objects in the IPC, so that shouldn't be the problem. What you could try is to not pass the IPFS instance as a param of the event (mainWindow.webContents.send('ipfs-daemon-instance')), but save it into global.IpfsInstance (like it was) and on the client side when you receive the event, just read it from global.IpfsInstance.

theobat commented 7 years ago

Seems it's using JSON.stringify in the ipc functions: https://github.com/electron/electron/issues/3923

But the global variable might be a good solution, thanks !

haadcode commented 7 years ago

@theobat let me know when you want a code review on this PR.

Making good progress I see! :)

theobat commented 7 years ago

So this PR is almost ready, you can probably start the review but bear in mind the configuration page is ugly (because there is no styling at the moment).

A few remarkable things:

And a question for the mergability of this, should I build everything ?

haadcode commented 7 years ago

@theobat I'll start reviewing this now. First I'll check how it works, looks and feels and then move on to code. Would you prefer feedback line-by-line for the code or would you prefer me doing a PR against this PR and do changes directly in the code?

theobat commented 7 years ago

@haadcode as you wish, it probably depends on whether you feel there's a lot to change in the current PR or not... But I'm available today to make changes as you request them. Hold on just a sec for another push (although it's just styling it does make a difference for your eyes)

haadcode commented 7 years ago

I'm trying to run Orbit with this PR but get the following errors after hitting "Connect" in the login screen.

screen shot 2016-11-16 at 10 08 58 screen shot 2016-11-16 at 10 09 01

theobat commented 7 years ago

@haadcode, thanks for the thorough review ! gonna try to change all this today. I get it for the Orbit object and design. The default ipfs-daemon-configs are not passed properly it seems. First a push with ui stuff and then clarifying the whole process.

haadcode commented 7 years ago

Thanks @theobat! Looking forward to wrap this up and merge :)

haadcode commented 7 years ago

Leave a comment when this is ready for a new CR.

theobat commented 7 years ago

@haadcode, so overall this looks way better now and works pretty well. I still have a problem when shutting down the ipfs daemon though, it is called and seems to work on disconnect but when you try to reconnect it just hangs on the loading screen without any error... Any idea ?

(Note: it does launch a new ipfs node on reconnect without any error, but stay on the loading screen)

haadcode commented 7 years ago

Left couple of comments for the code: need to refactor the flow a little more, see above for the comments on the startDaemon/init orbit/network.connect part.

I think with that fixed, we're close.

The other remaining big issue is the styling of the configuration screen. I saw you made some more changes to it which are close to Orbit's general style. Let's get the styling to a good state so that it doesn't pop up as much as it does now and we're good.

One more request, and you don't have to do that in this PR if you don't want to, would be to expose the Orbit's data dir to the configuration too. Same as Ipfs Data Directory but the one in OrbitConfig, so that we can say "Start Orbit using data from this directory" in order to isolate all instances properly (ie. running multiple Orbit's on the same machine).

theobat commented 7 years ago

Hi @haadcode, modified the flow with your code, refactored a few things and retested everything.
I am now working on the styling of the form, would you agree with using https://github.com/JedWatson/react-input-autosize to get a proper size for the path inputs ?

As far as this is concerned :

One more request, and you don't have to do that in this PR if you don't want to, would be to expose the Orbit's data dir to the configuration too. Same as Ipfs Data Directory but the one in OrbitConfig, so that we can say "Start Orbit using data from this directory" in order to isolate all instances properly (ie. running multiple Orbit's on the same machine).

I don't mind putting it in the same PR but the review might be a bit cumbersome in the end. Let me know your preference I'll adapt.

theobat commented 7 years ago

Stylesheet is ready as well now, you can review all the changes. :) (Without answer I chose not to add any dependency, thus the input's length is fixed for now)

haadcode commented 7 years ago

Excellent! I will review this today.

haadcode commented 7 years ago

Ok, went through the code and tested it. Here's my thoughts: