martinber / noaa-apt

NOAA APT weather satellite image decoder, for Linux, Windows, RPi 2+, OSX and Android+Termux
http://noaa-apt.mbernardi.com.ar
GNU General Public License v3.0
600 stars 54 forks source link

Consider adding support for being a WASM application #61

Open JoshuaKimsey opened 1 year ago

JoshuaKimsey commented 1 year ago

Since I've been getting into Rust-based WASM applications recently, I thought I'd ask if this had ever been considered for Noaa-Apt? It seems like it would be a great candidate for it, as it means there would no longer be a need for a native app via GTK and could instead just be accessed via a browser window. It could even be hosted somewhere for cheap, even on the current website, and since the processing would be able to be done locally, there would be no server processing costs involved.

No idea if that's something the project would be interested in, or the direction it would want to move. But, there are some great UI options now for Rust and WASM, such as egui, or even Leptos, that could work for this. Just curious to hear what other's might think about this proposal. :)

(Apologies if this wasn't the right place to suggest this. Feel free to move this to Discussions if desired.)

martinber commented 1 year ago

Hello. This is the right place for the request. I think it is a good idea, I actually was thinking about this some time ago.

Because of the time I would be willing to spend on this, I think its not realistic to expect a full web version (I remember I spent a looot of time in the GUI for all the different settings and packaging for different OSs).

It would be enough to have a simple decoder to black and white, with 3/4 settings and a text in the bottom saying "if you want more download the program"

Not sure how WASM works. If possible, instead of doing a WASM GUI I would do a native HTML/JS thing with a few buttons and checkboxes that calls the decode and process functions as done here https://github.com/martinber/noaa-apt/blob/master/src/main.rs#L102-L115

JoshuaKimsey commented 1 year ago

Cool, yeah Noaa-Apt seems like an ideal candidate to become a WASM app, given the audience and use case!

I remember I spent a looot of time in the GUI for all the different settings and packaging for different OSs

That's actually the nice thing about a WASM app. Since it's written to run in a browser, it's platform agnostic. So you can just write it once and it'll run anywhere, even on mobile browsers. Given that all of the back-end functionality is there already, it shouldn't be too hard (always famous last words...) to simply plug in the function calls into something like Leptos or egui.

And speaking of those two, that would be an important choice to make as well. For a more "traditional" web look, Leptos would be a good choice, as it's a reactive web framework written in Rust. I'm actually using it currently to make Wolfrs, a front-end for the Lemmy federated social network. Alternatively, there is egui, which while it's a bit deeper in complexity, has a lot more features available to it, as you can see in this demo of it.

A bolder, and perhaps more long-term goal, could be to drop the GTK Rust UI code that Noaa-Apt uses now, and eventually migrate to using either Leptos or egui exclusively. Then, you'll have the option of having it be web-based in a browser (that can either be hosted or run locally on a machine), or package it to be a native application using something like Tauri, so that it becomes truly platform agnostic. But, like I said, that's probably a longer-term goal.

For now, just getting the back-end code working with a WASM front-end would be a good start. Mostly just comes down to what front-end design you want to work with? No need to worry about any choices later on for something like Tauri, as both leptos and egui work with it natively. Check out the resources above and see which you'd think would make a good fit for Noaa-Apt. :)