RetroShare / RSNewWebUI

30 stars 20 forks source link

Config network #76

Closed zelfroster closed 1 year ago

zelfroster commented 1 year ago

Added features to set Dynamic DNS, configure TOR/I2P SOCKS Proxy from the webui. Fixed some UI issues and refactored code.

Some issues are still there but not from webui, they need to be fixed/implemented on the libretroshare, probably.

zelfroster commented 1 year ago

Here is what it looks like from the webui. 1686047390_Jun06_15:59:50

zelfroster commented 1 year ago

Now, Everything is working perfectly. This PR is also ready for review. 1686334902_Jun09_23:51:42

zelfroster commented 1 year ago

Looks good, thanks

Thanks to you, And I had a question about mithril.js. In config_network.js, line number 366, in main component Component. We have two variables sslId and component and we are using oninit to fetch the data and store in the variables. So, I tried passing sslId and details to the other components as props from the main component, which were doing the same fetch call for sslId and details inside them using oninit. But after fetching the data in the main Component, they didn't seem to update the props (variables). Since, after fetching only the view UI is redrawn, so I tried updating them in the view, but that resulted in an infinite re-rendering.

After researching, I found that, m.stream() could be used to have a state like functionality like what we have in React. But I think the version of mithril.js used in webui doesn't have m.stream() functionality.

Is there any way to do it, so we could make the code more reusable and reduce the number of data fetching? @rottencandy

rottencandy commented 1 year ago

Mithril has an automatic redrawing system that should trigger rerender once any m.request promise chain completes (which is what rsJsonApiRequest is using) but looks like in this case you're making nested calls so that might be the reason. You could try promise-chaining the requests so that there are no nested requests. If that doesn't work you could try manually triggering a rerender with m.redraw.

m.stream seems to be a separate package so you'll have to add it separately if you want to use it.

But I'm not entirely sure if nested calls is the reason, I'll also try to reproduce this and see if I can figure out what's happening.

zelfroster commented 1 year ago

You could try promise-chaining the requests so that there are no nested requests. If that doesn't work you could try manually triggering a rerender with m.redraw.

I had already tried promise-chaining + manual rerender with m.redraw(). But It didn't work.