by eiy5weiN · 6y ago · 0 comments
This was not nostalgia either : the reason for doing that is because I was writing webapps for my pinephone. Toying with the phone, I decided I wanted my apps to be webapps rather than GTK apps, so that I can access them either from mobile or laptop (through local network), but I didn't want to have the apps running all the time, in order for them to consume less energy (which directly translates to battery lifetime on a mobile). Turns out that CGI is perfect for that : the only process always running are nginx and fcgiwrap, then all my apps are started only on demand, for the lifetime of the request.
I did expect a big performance hit, but I was surprised it was not so bad. I guess that's because they are C app rather than written in languages which require loading an interpreter before running anything. One app that I rewrote from libmicrohttpd had actually better perfs (although it was the first time I used libmicrohttpd, so it was probably something I didn't do correctly).
This is a really nice idea. It almost makes me wish browsers could just make a local CGI request directly, without a webserver at all. A quick search turns up an extension for ye olde Firefox: https://github.com/RufusHamade/lcgi. I suppose with native messaging APIs it's probably possible with new extension APIs too, if a bit more convoluted.
Nuts on the battery life. Yeah, I'm not too fussed on the apps though, because I did want to write my own in Rust.
Ok, will wait it out a bit longer :)
Thanks again
Isn't this what most people use their phone for? What exactly are you compromising on in this list? You might as well say you just need a fully-functional smartphone, not a hacking project.
Video playback (Netflix), potentially choice of audio playback (I choose Spotify, not local mp3s or something), banking apps, authenticator, an app store, games, ridesharing, home security camera viewer. Probably the number 1 smartphone app wasn't included, Facebook.
I'm guessing 75% of most people's phone use is compromised, at least by changing to a web app. What the GP listed would be about 20% of my use, personally.
I don't remember if there was any other option on the server we had, but I had to write that sucker in C! Reading and parsing a .csv file, handling search options, working as a CGI program, what a pain, especially for a dumb high schooler like me!
Although, now that I understand fastcgi better, I guess fcgiwrap could be adapted for lighttpd, if it doesn't work for it as is (my package manager's description mentions explicitly it's for nginx).
Thanks for the advice, I'll dig that.
and for fcgi as well, without fcgiwrap at all: https://github.com/jerryvig/lighttpd-fastcgi-c