174 points · by speckx · 1y ago · 131 comments
Alas it looks like it's web/electron based. :/ Downloading it and yep, 443.8 MB on MacOS. The Linux one is a bit better at 183.3 MB.
Electron really should get a kickback from disk manufacturers! ;)
Shameless plug, I've been working on a HTML inspired lightweight UI toolkit because I'm convinced we can make these sort of apps and they should only be ~10-20 MB [1] with nice syntax, animation, theming, etc. I'm finally making a suite of widgets. Maybe I can make a basic clone of this! Bet I could get in < 10MB. :)
python -m http.server
But variations exist for a lot of languages. Php has one built-in too
#!/usr/bin/env bash
set -e; [[ $TRACE ]] && set -x
port=8080
dir="."
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
echo "usage: http-server [PORT] [DIRECTORY]"
echo " PORT Port to listen on (default: 8080)"
echo " DIRECTORY Directory to serve (default: .)"
exit 0
fi
if [ -n "$1" ]; then
port=$1
fi
if [[ -n "$2" ]]; then
dir=$2
fi
python3 -m http.server --directory "$dir" --protocol HTTP/1.1 "$port"That whole script could just be the last line! Maybe you could add defaults like
"${port:-8080}" #!/bin/bash
while :; do nc -l 80 < index.html; doneHTTP/0.9 web browser sends:
GET /
Netcat sends: <!doctype html>
...
Nowadays a browser will send `GET / HTTP/1.1` and then a bunch of headers, which a true HTTP/0.9 server may be able to filter out and ignore, but of course this script will just send the document and the browser will still assume it's a legacy server.(I'm sure if I dug in the http.server documentation I could find all those options too.)
The Sovereign Tech Agency, under the Federal Ministry for Economic Affairs and Climate Action, fund OpenJS, specifically for improving the state of open source in JavaScript.
Electron is now part of OpenJS.
For me this contradicts the claim of being simple. As opposed to this:
python -m http.server 8080I recently explored both Tauri [1] and Wails [2]. Especially Wails is lots of fun. The simplicity of go paired with the fast iteration I get from using React just feels awesome. And the final application is ~10 MB in size!
It's almost as if web crap is optimizing for developer experience at the expense of users.
Just like many native apps will also be horrible in terms of UX. Good apps are good. And I believe that it's entire possible to build an amazing app with Electron.
Although not everyone might agree, IMO VSCode is a great example of that.
https://x.com/daniel_nguyenx/status/1734495508746702936
Further discussion can be found here: https://www.macstories.net/linked/is-electron-really-that-ba... and in the linked video.
You say at the expense of users. But when even Apple does't go all native, it's telling.
I use one that is 99K static binary.
Even the full-featured TLS/HTTPS forward proxy I use, linked with bloated OpenSSL, is still less than 10MB static binary: 8.7MB. When linked to WolfSSL it's only 4.6MB static binary. The proxy can serve small, static HTML pages, preloading them into memory at startup.
It's not only easy: it runs (or ran) huge sites in production.
I want to try adding a JavaScript runtime with simple DOM built on Figuro nodes instead. But there’s some issues with Nim’s memory management and QuickJs.
server {
listen 80;
server_name ~^(?<sub>\w+)(\.|-)(?<port>\d+).*; # projectx-20201-127-0-0-1.nip.io
root sites/$sub/public_html;
try_files $uri @backend;
location @backend {
proxy_pass http://127.0.0.1:$port;
access_log logs/$sub.access;
}
}
Configuration is done via the domain name like projectx-20205-127-0-0-1.nip.io which specifies the directory and port.All you need to do is create a junction (mklink /J domain folder_path). This maps the domain to a folder.
I think proxy_pass will forward traffic even when the root and try_files directives fail because the junction/symlink don't exist? And "listen 80" binds on all interfaces doesn't it, not just on localhost?
Is this clever? Sure. But this is also the thing you forget about in 6 months and then when you install any app that has a localhost web management interface (like syncthing) you've accidentally exposed your entire computer including your ssh keys to the internet.
server_name ~^(?<service>(?:lubelogger|wiki|kibana|zabbix|mail|grafana|git|books|zm))\.domain\.example$;
location / {
resolver 127.0.0.1;
include proxy.conf;
proxy_set_header Authorization "";
proxy_set_header Host $service.internal;
proxy_set_header Origin http://$service.internal;
proxy_redirect http://$proxy_host/ /;
proxy_pass http://$service.internal;
}
Basically any regex matched subdomain is extracted and resolved as $service.internal and proxy passed to it. For this to work, of course any new service has to be registered in internal DNS. Adding whitelisted IPs and basic auth is also a good idea ( which I have, just removed from example ).Gnome does this, you can develop apps in Typescript.
But, they started to migrate some of their own apps to Typescript and immediately received backlash from the community [0]. Although granted, the Phoronix forums can be quite toxic.
My observation is that there is just a big disconnect between younger devs who just want to get the job done, and the more old-school community that care about resource efficients. Both are good intentions that I can understand, but they clash badly. This unfortunately hinders progress on this point.
[0] https://www.phoronix.com/forums/forum/phoronix/latest-phoron...
I agree that this is, at least often, a case of where your roots lie. Whats most shocking to me is that the likes of Apple and Mircosoft don't seem to be interested in/capable of building an actually good framework.
I feel like Microsoft tried with .NET Maui, but that really isn't a viable choice if you go by developer sentiment.
I have been coding since 1986, nowadays most of the UIs I get paid to work on are Web based, yet when I want to have fun in side projects I only code for native UIs, if a GUI is needed.
Want to code like VB and Delphi? Plenty of options available, and yes they do scalable layouts, just like they used to do already back in the 1990's for anyone that actually bothered to read the programming manuals.
The big player these days seems to be web-based (Electron and friends), though the JVM stack with a native theme for Win/Mac is certainly usable in an environment where you can rely on Java being around.
I think the best option would be some kind of cross-application client-side HTML etc. renderer that apps could use for their user interaction. We could call it a "browser". That avoids the problem of 10 copies of the whole electron stack for 10 apps.
Years ago, Microsoft had their own version of this called HTA (HTml Application) where you could delegate UI to the built-in browser (IE) and get native-looking controls. Something like that but cross-platfom would be nice, especially as one motivation for this project is that Chrome apps are no longer supported so "Web Server for Chrome" is going away. So the "like electron but most of the overhead is handled by Chrome" option is actively being discontinued.
I think Tauri is trying to go for this - a web app without the whole chromium bundled, but using a native web view
You want to write separate versions for MacOS, Linux, and Windows Visual .NET#++ and maintain 3 separate source trees in 3 languages and sync all their features and deal with every bug 3 times?
That would certainly make this more useful than `python3 -m http.server`.
There does seem to be a weird limitation that you can't enable both HTTP and HTTPS on the same port for some reason. That should be easy enough to code a fix for though.
Do any real web servers support this?
Its the same transport (TCP assuming something like HTTP 1.1) and trying to mix HTTP and HTTPS seems like a difficult thing to do correctly and securely.
Doing anything other than disconnecting or returning an error seems like a bad idea though.
These days just using `caddy` might be easier though.
cargo install --locked miniserve
miniserve path/to/directory
[1]: https://github.com/svenstaro/miniservephp -S localhost:8080
Many helpful options are available, just check the docs...
bun index.html
Anyway, Web UI != easy to administer.
docker run --rm -p 8080:80 -v "$(pwd):/usr/share/nginx/html:ro" nginx:alpine
will host the current directory on 8080Python 2 had a similar function (`python -m SimpleHTTPServer`). I know there's a Python 3 equivalent, but I don't have it memorized.
and I used this. Though I would prefer a way to keep it downloading from where it left because this method ISNT reliable for 40 gigs transfer
I am also wondering about this comment in the gist which was linked (gist.github.com/willurd/5720255) by olejorgenb which is
Limiting request to a certain interface (eg.: do not allow request from the network)
python -m http.server --bind 127.0.0.1
Like what does that really do? Maybe its also nice, IDK?
I usually do the opposite - 0.0.0.0 - which allows connections from any device.
mini_httpd -p 8080 # and no need to install a whole python interpreter