News for hackers. Stuff that matters.
Re:Tiny PWAs and why I keep building them by albertgoeswoof on Sunday February 03, 2019 @07:21AM (#19069226)
> “surely there is a app for that!” A quick look leads to speedometer apps with ads and 30MB download weight, and simple screen light that also have ads that weight in at 5MB.

I’m finally groking what rms has been banging on about for so long. It is completely unacceptable that we are running software that does this to the user. Users need to be empowered and able to run code that they can control.

Re:Tiny PWAs and why I keep building them by megous on Sunday February 03, 2019 @08:36AM (#19069487)
Exactly. If more people's reaction, instead of searching an app store for a privacy respecting screen light, was to sit down and write:

    <!DOCTYPE html>
    <script>let on  true;</script>
    <body onclick="on = !on; this.style.background = on ? 'white' : 'black'">
and were able to easily upload it somewhere on a phone and run it locally from a shortcut on the screen. We'd have hacker culture encouraged right there.
Re:Tiny PWAs and why I keep building them by myfonj on Sunday February 03, 2019 @11:17AM (#19070399)
Upload? Come on, just load it as dataURI, bookmark it and you have offline "application" at your disposal. And as a bonus, here, have this "distributed app store" you can even print on paper [1].

[1] http://zxing.org/w/chart?cht=qr&chs=350x350&chld=L&choe=UTF-...

i.e. QR-coded dataURI document

    data:text/html;charset=utf-8,<!DOCTYPE html><title>Screen light</title><html onclick=on=!on;this.style.background=on%3F'white':'black'><body onload=on=true>
Re:Tiny PWAs and why I keep building them by t0astbread on Sunday February 03, 2019 @06:47PM (#19072965)
This is great! I added some text to it to make it more "user friendly" and compressed it a bit so that it fits inside a tweet: https://mobile.twitter.com/T0astBread/status/109220433722755...

  data:text/html,<title>Screen Light</title><html onclick=o=!o;style.background=o%3F0:'black';style.color=o%3F0:'white'><body onload=o=1><h1>Screen Light</h1><p>Turn your screen into a light source<br>Tap to toggle<p><a href=https:/news.ycombinator.com/item?id=19069487>Source
Re:Tiny PWAs and why I keep building them by myfonj on Tuesday February 05, 2019 @01:21PM (#19088044)
Yes, such "offline bookmarked dataURI applications" are great, underappreciated and ancient things. Sadly, current trend in modern browsers is to suppress them in sake of security, because in the past some crooks misused them them. Currently you cannot even link to them like you could in the past; anything other than direct navigation from bookmark or URLbar results in better case in blank screen, in worse is silently blocked. For example in the past you could redirect to them, or make datauri editor that encoded itself into another datauri, or both [1], but now you can not [2].

[0] Check out for example this HTML / SVG sketchbook: https://gist.github.com/myfonj/c8ce74bf549e19600026ce9022388... [1] http://tinyurl.com/selcoditor (see network log) [2] https://blog.mozilla.org/security/2017/11/27/blocking-top-le...

Re:Tiny PWAs and why I keep building them by jahewson on Sunday February 03, 2019 @01:21PM (#19071230)
My iPhone 6s doesn’t like this QR code, it just says “No usable data found”.
Re:Tiny PWAs and why I keep building them by masklinn on Sunday February 03, 2019 @02:23PM (#19071581)
The built-in QR detector is very finnicky/odd, apparently it just assumes every payload is an HTTP URL, nothing else works even remotely.

Other applications work much better for that, though they may or may not recognise non-http URIs e.g. here scanbot just displays the textual content and you're on the hook for copy/pasting it wherever you need.

Re:Tiny PWAs and why I keep building them by myfonj on Tuesday February 05, 2019 @01:30PM (#19088171)
Yes, I had no luck even with QR reader integrated in Nightly Android [0].

Sadly, copypasting resulting URI as plaintext is most probably the only option for modern browsers, because any other way of top level frame navigation to dataURI document is blocked. (Besides existing bookmark, that is.) I keep forgetting this, sorry for hurried "in theory it must work great" shout out.

[0] https://support.mozilla.org/en-US/kb/scan-qr-codes-firefox-a...

Re:Tiny PWAs and why I keep building them by rhizome on Sunday February 03, 2019 @02:21PM (#19071572)
is there a "don't try to use the data" setting, so it'll just present the plain text?
Re:Tiny PWAs and why I keep building them by masklinn on Sunday February 03, 2019 @02:25PM (#19071600)
Nope. Only setting is to not scan for qrcodes at all.
Re:Tiny PWAs and why I keep building them by eat_veggies on Sunday February 03, 2019 @09:28AM (#19069695)
I'd love that but I don't think it'll encourage hacker culture. Instead we'll have the Can-Code making things for the Can't-Code like we do now, but with even fewer checks for nefarious activity.

Case study: people copy-pasting random code into their Myspace profiles

Re:Tiny PWAs and why I keep building them by acct1771 on Sunday February 03, 2019 @10:38AM (#19070117)
Inspired a lot of "can kinda read code"s to learn more - so they didn't get their pages compromised, haha
Re:Tiny PWAs and why I keep building them by lazerwalker on Sunday February 03, 2019 @09:40AM (#19069769)
I wonder if https://glitch.com has a mobile-friendly IDE and will also let you set up a project to be a PWA? Seems like it'd be a great fit for what you're describing.
Re:Tiny PWAs and why I keep building them by jt2190 on Sunday February 03, 2019 @10:38AM (#19070118)
Hmm... When I pulled up one of my Glitch projects on my iPhone Xs the browser-based editor works but the editor view is either cut off on the right in portrait mode or almost offscreen when the keyboard displays in landscape mode.

I suspect you can get a better coding experience by connecting your Glitch account to Github and then using an editor that works well on your device.

The PWA part of Glitch is completely under your control.

Re:Tiny PWAs and why I keep building them by adrianhel on Sunday February 03, 2019 @09:25AM (#19069678)
You can do that with mobile-web-app-capable and add to home screen on both ios and Android. No address bar and it looks like any other app. You need to host the site though.
Re:Tiny PWAs and why I keep building them by megous on Tuesday February 05, 2019 @10:08AM (#19085887)
Running it from file:/// of the phone's local filesystem could be more hassle-free. Not sure if it would be bookmarkable, but I don't see why not. I don't have access to a smartphone to try.
Re:Tiny PWAs and why I keep building them by natch on Sunday February 03, 2019 @11:54AM (#19070640)
You can already do this. You just need a site to host it on.
Re:Tiny PWAs and why I keep building them by lazerwalker on Sunday February 03, 2019 @09:22AM (#19069662)
I agree the loss of control is unacceptable. I agree that only being able to get commercial apps like this that monetize through advertisements and selling opaquely-gathered tracking data is unacceptable.

But I'm curious how much download weight matters, outside of as a proxy for "how much bloated ad bullshit is hiding inside the app bundle"?

I'd wager the difference between a 2KB PWA and a 5MB or 30MB native app download is relatively insignificant — in storage space, in cellular data use, in initial download time — to your average user when compared to streaming a film on Netflix or downloading a F2P game with 100MBs to GBs of assets.

(where "average user" is assuming most of these apps are only localized in English and only available in largely-western countries — totally get how the story is very different in emerging markets)

Re:Tiny PWAs and why I keep building them by hawski on Sunday February 03, 2019 @09:52AM (#19069836)
In case of apps I imagine something like this:

2kB will feel instant. 5MB will feel mostly quick. 30MB will feel like it had to earn it.

When things are instant then it feels like magic. It's sad that having all those super fast machines everywhere we have to deal with so much bullshit. Your computer can push through gigabytes of memory on a second. Does it feel this way? That's why people still use CLI, at least there, many things feel instant and when not it's usually reasonable.

It's not only download speed, it's also verification time, compilation/optimization and whatever else happens during install. All of those will take longer the bigger the app is.

Similarly the problem with JavaScript on sites currently is not only download time and request count bloat. It's significant by itself, but it just takes time to even parse all this code and I did not start on execution.

But at the same time for me the proxy effect of "how much bloat and bullshit did they cram into it" is as important and can't be dismissed.

Re:Tiny PWAs and why I keep building them by lazerwalker on Sunday February 03, 2019 @10:51AM (#19070218)
I think it's worth distinguishing install time from subsequent launch time. You seem to be describing the time it takes to go from seeing the app to using it for the first time. For an app you use regularly (or even just more than a few times ever), how long it takes an already-installed app to open from cold start seems like a much more important metric.

While bundle size might sometimes correlate with cold start times for PWAs (depending on whether it's JS code that's bloating the bundle, or other media assets that won't trigger an initial parsing + evaluation hit), that's less likely to be the case with native apps.

Re:Tiny PWAs and why I keep building them by PavlovsCat on Sunday February 03, 2019 @10:51AM (#19070216)
> 2kB will feel instant. 5MB will feel mostly quick. 30MB will feel like it had to earn it.

And that's just one usage, by one user. Multitply by thousands of usages and billions of users. It's inexcusable from a craftsmanship viewpoint.

Re:Tiny PWAs and why I keep building them by nicoburns on Sunday February 03, 2019 @02:12PM (#19071521)
I'm not sure of that. Plenty of my friends and family in the UK are using phones that are a few years old and only come with 8gb or 16gb of storage, such that they are regularly running out of storage space.
Re:Tiny PWAs and why I keep building them by nerdponx on Sunday February 03, 2019 @10:20AM (#19070005)
Why don't browsers give us finer control over Javascript execution (eg whitelisting JS APIs)? Performance?
Re:Tiny PWAs and why I keep building them by pjmlp on Sunday February 03, 2019 @12:36PM (#19070930)
Because it would work like permissions on Android or Windows UAC, regular users would just turn everything on anyway.
Re:Tiny PWAs and why I keep building them by nerdponx on Sunday February 03, 2019 @02:27PM (#19071614)
Maybe.

On Android, iOS, Firefox extensions, and many websites, you can't give permission for one thing without giving permission for everything. Or those "I accept cookies popups" -- until recently, you couldn't choose which cookies you wanted to accept, so either you accept tracking cookies in order to use basic functionality, or you head elsewhere. The application developer could be a good citizen and request on the permissions needed -- but it's just easier to request that they be able to read and modify any and all data, regardless of their need or desire to do so.

On Windows, Unix, and other "system-level" permission systems, you have a different problem. There, there is no real ability to verify what an application is trying to do with its elevated permissions -- it just wants to be given God power, even if it only needs permission to do one or two very specific things in one or two very specific locations.

In fact, the web browser is probably the most accessible place to roll out a whitelisting-based permission system. It has already been demonstrated successfully with uBlock Matrix and uBlock Origin -- you can block specific types of activity coming from specific subdomains. Some sites break completely when you block the few specific elements you don't want to see, but most work just fine, or at least close to fine. Being able to whitelist specific Javascript APIs (e.g. the battery API, the ambient light API, etc) is a logical next step in my opinion.

An OS-level analogy would be the ability to block specific syscalls made by specific processes, optionally only when spawned by a specific parent process.

Re:Tiny PWAs and why I keep building them by pjmlp on Sunday February 03, 2019 @04:57PM (#19072488)
I would argue that it failed to be successfully demonstrated with uBlock, as my premise was about regular users, not consumers with technical skills to go into browser settings.
Re:Tiny PWAs and why I keep building them by nerdponx on Monday February 04, 2019 @01:27AM (#19074384)
Fair enough. I'm not aware of any studies on the UX success or failure of uBlock, I just know that it's (at least kind of) popular.
Re:Tiny PWAs and why I keep building them by kamikaz1k on Sunday February 03, 2019 @04:20PM (#19072286)
Who/what is "rms"?
Re:Tiny PWAs and why I keep building them by detaro on Sunday February 03, 2019 @04:20PM (#19072289)
Richard Stallman
Re:Tiny PWAs and why I keep building them by denniskane on Sunday February 03, 2019 @07:41AM (#19069294)
I started building something I like to call "Linux on the Web" (LOTW) 6+ years ago in order to start working on this problem (it's live on the web right now). Just like with node.js applications, the smallest legal file size for an app running inside of LOTW is precisely 0 bytes. I've tried to shave that down even more, but I seem to be running into physical limits :)
Re:Tiny PWAs and why I keep building them by jstanley on Sunday February 03, 2019 @08:43AM (#19069500)
Can you share a link? People reading your comment have no way to know how to learn more about your project, or even whether it is relevant to the topic at hand.

The most relevant result I could find for "linux on the web" was https://linuxontheweb.appspot.com/ which doesn't seem to be relevant at all.

Re:Tiny PWAs and why I keep building them by codetrotter on Sunday February 03, 2019 @10:26AM (#19070050)
I think that is the one actually because the looking at the post history [1] of the person you are responding to I find that the most recent post they made in the past was one titled “Linux on the Web” [2], which leads to that very URL that you found.

He also posted a comment in the thread with some more details:

> It makes heavy use of the HTML5 Filesytem for local storage, as well as Native Client for vim, python, and plugin codecs to enable highly configurable realtime a/v streaming via WebRTC peer connections. Windowed HTML5/JS applications can be developed live within the site itself. There is a feature to stream terminal sessions to each other, in order to show how to efficiently use vim to develop applications, for example.

[1]: https://news.ycombinator.com/submitted?id=denniskane

[2]: https://news.ycombinator.com/item?id=10977459

Re:Tiny PWAs and why I keep building them by denniskane on Sunday February 03, 2019 @10:50AM (#19070207)
Hi, yes, that stuff is from quite awhile ago, seeing that NaCl/PNaCl is quite dead, and WASM is now all the rage. I previously had actual vim running via NaCl, but the current (better IMO) version is just a fairly small JS clone (about 70kb). The whole system is rapidly stabilizing right now, what with the entire gui framework being fleshed out, both conceptually and technically.

I try to stay away from the above kinds of sweeping generalizations about the whole thing nowadays. It is best to let it speak for itself and evolve in its own good time.

Re:Tiny PWAs and why I keep building them by denniskane on Sunday February 03, 2019 @09:10AM (#19069618)
Did you try the "desk.os" link that is link number 3 on that page... https://linuxontheweb.appspot.com/desk.os ? I can really only guarantee that things work on a relatively recent version of Chrome (like within the last few stable releases). The version that is live now is a couple weeks old. I'm working on some really cool features for the modular synth app right now. I'd love to start sharing this stuff with you guys!

Also, link number 5, at https://linuxontheweb.appspot.com/shell.os is for people who just want to poke around the deep system internals via a command line. For that, you need to use the "import" command in order to pull in libraries of commands. For instance, running a command like:

$ import fs && vim

should open up my custom-made vim clone.

Re:Tiny PWAs and why I keep building them by jstanley on Sunday February 03, 2019 @03:43PM (#19072061)
How can you use this to implement a speedometer that runs on your phone?
Re:Tiny PWAs and why I keep building them by codetrotter on Sunday February 03, 2019 @10:34AM (#19070098)
Does it work on mobile? On iOS 12 Safari this is what I see: https://i.imgur.com/NJjoZhU.png
Re:Tiny PWAs and why I keep building them by zozbot123 on Sunday February 03, 2019 @09:50AM (#19069819)
> I’m finally groking what rms has been banging on about for so long. It is completely unacceptable that we are running software that does this to the user. Users need to be empowered and able to run code that they can control.

There are plenty of high-quality mobile apps on F-Droid, even with downloadable source. This is purely a PEBKAC issue.