Commit Graph

790 Commits

Author SHA1 Message Date
Kartik K. Agaram 1316940f25 smol.tv: get a few feeds reliably parsing 2022-04-23 01:17:38 -07:00
Kartik K. Agaram f7636967c5 smol.tlv: start of a browser for the small web 2022-04-23 00:31:47 -07:00
Kartik K. Agaram 54e727641c document `arg` var for commandline arguments 2022-04-22 22:55:09 -07:00
Kartik K. Agaram b7fc541cbc avoid overly long lines in manual 2022-04-22 22:51:57 -07:00
Kartik K. Agaram 6656abeb4e . 2022-04-16 20:15:56 -07:00
Kartik K. Agaram e5b5a82970 a sharp edge in Lua's dorequire()
You can't call it on a file that isn't a module, i.e. that doesn't
return something at the end. Use dofile() instead.
2022-04-11 23:32:56 -07:00
Kartik K. Agaram 394c9f894c fix a few sample apps
Broken since Mar 18, when I started running tests in src/file.lua.

It's more than a little ugly that .lua files in src/ require helpers
inside .tlv apps.
2022-04-11 22:43:26 -07:00
Kartik K. Agaram 98e657d6e2 actually _use_ the ask permission 2022-04-07 09:19:55 -07:00
Kartik K. Agaram dad78ac424 new perm: files under dir specified at commandline
I think we can now use a file browser app with relative safety. Just
give it inargs permissions, and provide a top-level directory at the
commandline to gain access to everything under it.
2022-04-05 22:49:43 -07:00
Kartik K. Agaram 9d81974a31 new permission: any file specified at commandline 2022-04-05 22:39:17 -07:00
Kartik K. Agaram 6099fa7fb2 experiment: ask for permission on file operations
I'm not quite sure how to think about asking for permissions with
respect to my red/orange/green color codes. On the one hand, it seems
safer than many alternatives. On the other hand, it's liable to lead to
fatigue and blindly allowing apps to do stuff. For now I consider ask to
be orange. Ask + network allowed = red in summary, though it's orange on
the permissions screen since there's more space to convey nuance. Then
again, nobody may heed the nuance. The summary up top on the permissions
screen is definitely still a work in progress. And there's a
chicken-and-egg problem here: I can't really get a good feel for
real-world bugs in the permissions screen until _other programmers_ are
building apps to use the permissions screen, but they're almost certain
to have a crappy time of it.

I considered introducing a primitive called ask() in the Lua
interpreter, but it doesn't really make sense to validate it and so on.
I'm also not really supporting mixing Ask with other features so far.

This is a major step towards turning my permissions screen into
spaghetti; monitoring closely.
2022-04-05 22:26:43 -07:00
Kartik K. Agaram 5b64c4b3bc show common suggestions when editing permissions
Computer owners shouldn't get in the habit of trusting app authors
regarding permissions. But they have to trust somebody, and they already
trust the Teliva platform if they are running it.
2022-04-05 20:50:51 -07:00
Kartik K. Agaram b5aca9a571 toot-toot: stop clobbering existing files
I've been reluctant to do this until now because it makes it more
difficult to grant an app the ideal permissions. Here's what I use:

  return string.find(filename, 'toot') == 1

But I'm also trying to keep people from looking to the app to figure out
what permissions to give it :/
2022-03-31 08:51:05 -07:00
Kartik K. Agaram 3618487289 toot-toot: disable ctrl-k
Rather than invest LoC in asking for confirmation or an undo feature,
just have people restart to clear the page.

I fucking suck for how many ways I can come up with to lose data in a
text editor. It really should have been fucking obvious that clearing
the page so easily was a footgun just waiting to happen.
2022-03-30 21:36:34 -07:00
Kartik K. Agaram b56590ddc9 some more reorg of the standard library
Now life.tlv and gemini.tlv are also minimizing how much of the standard
library they pull in, just to be easy to read.
2022-03-27 11:42:19 -07:00
Kartik K. Agaram 14446eefc4 helper: count permutations 2022-03-27 11:24:56 -07:00
Kartik K. Agaram dd7da2c62a helper: count 2022-03-27 10:53:41 -07:00
Kartik K. Agaram 455870d114 reorg 2022-03-20 18:00:42 -07:00
Kartik K. Agaram 9ec94aa982 disallow all relative paths (./ or ../)
Teliva's model doesn't include any way to change directory. We just have
relative paths and absolute paths. Relative paths should not be able to
reach into parent directories.

The current test is a bit hacky; it also disallows directories ending in
a period. Hopefully not an issue.
2022-03-20 17:58:14 -07:00
Kartik K. Agaram c7d3037e9d graphviz: show topology in multiple lines 2022-03-19 21:13:55 -07:00
Kartik K. Agaram fddbe08fc8 graphviz: for basic stats, show all nodes ordered
The ordering is topological; nodes come before their dependencies.

Also some more helpful functions in the template for new apps.
2022-03-19 16:59:30 -07:00
Kartik K. Agaram 7859317ece standardize common helpers across all apps
In particular, I merged take_out in anagrams.tlv with all_but in
graphviz.
2022-03-19 00:19:58 -07:00
Kartik K. Agaram ad0ce8b83e graphviz: second sketch to present the Focus
In the process we fix some bugs in how we compare tables and count nodes
in the graph.
2022-03-19 00:03:26 -07:00
Kartik K. Agaram b94f07e0b5 . 2022-03-18 23:48:39 -07:00
Kartik K. Agaram aed89b8d35 graphviz: draft notion of nodes in 'focus'
Now the REPL isn't about deciding what to calculate, but just what nodes
to calculate it for.
2022-03-18 21:22:18 -07:00
Kartik K. Agaram c21cefa888 idiom: table.insert for appending
Stop using arr[#arr+1].
2022-03-18 20:55:07 -07:00
Kartik K. Agaram a05f713dc1 graphviz: tweak data structure slightly
A node's edges contain an associative array of target nodes rather than
a linear array.

This way we automatically dedup edges when we load multiple graphs.
2022-03-18 18:02:07 -07:00
Kartik K. Agaram 03a3883555 graphviz: read multiple .dot files
It's useful to be able to import dependencies for multiple packages at
once, so that we can see common dependencies.
2022-03-18 17:58:25 -07:00
Kartik K. Agaram 824705f770 fix a warning 2022-03-18 17:49:26 -07:00
Kartik K. Agaram 7586b773d9 graphviz: sketch of the dashboard 2022-03-18 17:40:18 -07:00
Kartik K. Agaram 06615231ae graphviz: done parsing directed graphs
This is mostly what I want since I'm interested in parsing the output of
debtree.
2022-03-18 17:09:47 -07:00
Kartik K. Agaram 7dc0928f52 graphviz: show error when lacking permissions 2022-03-18 10:43:48 -07:00
Kartik K. Agaram 29d53c21ac graphviz: don't interpret substrings as regexes 2022-03-18 10:43:48 -07:00
Kartik K. Agaram 0374e82aa5 show current definition being edited
This serves two purposes:
- Things get confusing if function being defined doesn't match the
  definition name. Displaying the current definition helps diagnose this
  situation.
- We're already able to see callers at a glance even if the cursor is
  below the fold. The name of the current definition is arguably more
  important in that situation.
2022-03-18 10:39:56 -07:00
Kartik K. Agaram af8d3addd2 stale references to caller 2022-03-18 10:39:56 -07:00
Kartik K. Agaram 6c85513499 beginnings of a parser for .dot files
I'm following https://graphviz.org/doc/info/lang.html. Just tokenization
so far.
2022-03-18 10:39:56 -07:00
Kartik K. Agaram 4a90a28a15 fake to stand in for start_reading in tests 2022-03-18 09:24:53 -07:00
Kartik K. Agaram 5c42b1de32 break.tlv: nascent live-updating stack language
Joint work with Sumeet Agarwal. In the process we discovered several
bugs in our fake window helpers for tests. Thanks Sumeet!

Previous prototypes:
  - https://archive.org/details/akkartik-2min-2020-12-06
  - https://merveilles.town/@akkartik/105759816342173743
2022-03-17 23:36:15 -07:00
Kartik K. Agaram 56f1b97b9c sandbox os.remove 2022-03-17 15:38:50 -07:00
Kartik K. Agaram 1d3101507e fix some warnings 2022-03-17 00:15:16 -07:00
Kartik K. Agaram f9fc4a3d58 file handles vs file objects, ugh 2022-03-17 00:01:36 -07:00
Kartik K. Agaram 5380817ce6 function names from globals rather than debug info
This reclaims all the slowdown in sieve.tlv, and it also is now smart
enough to detect calls to global bindings that pass through variables.

On the flip side, we lose names for non-globals. But that's not very
useful anyway in Teliva's context.

This is still not enough to detect callers through coroutines
(intervening anonymous functions), though.
2022-03-16 23:53:08 -07:00
Kartik K. Agaram 76d1dda240 bring back hack when caller is main
Partially undoes commit f2d29c22f8.
2022-03-16 23:45:42 -07:00
Kartik K. Agaram 785dfaa1ec cache function names
This brings down the slowdown in sieve.tlv from 50% to 25% (15s).
2022-03-16 23:45:38 -07:00
Kartik K. Agaram 155f6a8027 standardize some names 2022-03-16 21:48:41 -07:00
Kartik K. Agaram fffcc8b9ab stop running task.scheduler by default
sieve.tlv is 50% slower (18s vs 12s) with the new function call
instrumentation.
2022-03-16 21:38:34 -07:00
Kartik K. Agaram d6554919b1 delete dead code 2022-03-16 21:28:58 -07:00
Kartik K. Agaram ef5195dee9 simplify function call instrumentation
src/ldo.c now has a minimal diff with Lua 5.1.

It might be a bit slower than it was before, but not noticeably so..

This approach doesn't support indirect calls.
2022-03-16 21:19:19 -07:00
Kartik K. Agaram 182408ec54 drop a header 2022-03-16 20:33:28 -07:00
Kartik K. Agaram ed5efcd8a0 drop a forward decl 2022-03-16 20:31:43 -07:00