about summary refs log tree commit diff stats
path: root/src/main.nim
Commit message (Collapse)AuthorAgeFilesLines
* client: mostly merge into pagerbptato2024-12-091-1/+3
| | | | | | | | not completely, because that would break the existing API :/ this also fixes the broken interruptHandler - it no longer crashes, but it's still inefficient... probably it should "just" handle SIGINT instead
* Fix casingbptato2024-12-051-1/+1
|
* config, mailcap: remove std/streams dependency, specialize mmapbptato2024-12-051-1/+1
| | | | | | | | | | * use PosixStream/mmap for mailcap reading too; this finally lets us get rid of std/streams in the entire codebase * split up recvDataLoopOrMmap into 3 functions: one that can fall back to recvAll, one that falls back to recvDataLoop, and one that does not fall back to anything * use MAP_PRIVATE in mmap for read (we don't care if changes are propagated, as we do no changes to cached files)
* mimetypes: refactor, use mime.types for inline image extensionsbptato2024-12-051-0/+2
| | | | | | | | | | | | * remove std/streams use from mime.types; mmap and parse directly * use mime.types for inline image extensions * add some jpeg file extensions Latter came up because I was trying to add a format locally and it wouldn't recognize it on images from my file system (i.e. by extension). As a security measure we still do not allow additional extensions for predefined inline image types.
* main: support -C/path etc.bptato2024-12-051-10/+15
| | | | it's unambiguous anyway
* toml, config: skip copying buf, use PosixStreambptato2024-12-031-7/+9
| | | | | | | one std/streams less I used mmap for reading the user config. It shouldn't matter in any realistically sized config, but who knows.
* config.configdir -> config.dirbptato2024-11-261-3/+3
|
* twtstr: beforeLast -> untilLastbptato2024-11-151-1/+1
| | | | for consistency
* formdata: eliminate a global varbptato2024-11-151-1/+4
|
* chapath: fix a few more bugs, simplifybptato2024-11-131-1/+4
| | | | | | | | | * fix incorrect :- behavior * merge non-standard '${%VARIABLE}' syntax with regular syntax; now all internal variables are exported to the environment, so the behavior should be equivalent. * handle terminal symbol appropriately in all states * deny numeric curly substitutions
* config: refactor, accept more possible config dirsbptato2024-10-281-18/+26
| | | | | | | | | | | | | | | | | | | | | I'm starting to favor dotfiles over XDG basedirs, but there's no reason why we couldn't have both. So now the search path is: 0. if config was set through -C, use that 1. $CHA_CONFIG_DIR is set -> $CHA_CONFIG_DIR/config.toml 2. $XDG_CONFIG_HOME is set -> $XDG_CONFIG_HOME/chawan/config.toml 3. ~/.config/chawan/config.toml exists -> use that 4. ~/.chawan/config.toml exists -> use that Notably, this makes it so the default directory is ~/.chawan *if* you don't have an existing config.toml file. So in that case known_hosts will be placed in ~/.chawan/known_hosts. However, configurations with a config in ~/.config/chawan/config.toml continue to work as expected, as for those the known_hosts file remains inside ~/.config/chawan/. Finally, I've added a default user CGI directory to reduce friction in setting CGI up. (Like known_hosts, it's also relative to whatever config dir you have.)
* termcap: merge into termbptato2024-10-231-1/+0
| | | | | again, not that useful to put it in a separate module if only term uses it
* gmifetch: rewrite in Nimbptato2024-10-121-1/+2
| | | | | | | | | | This finally makes it possible to use socks5 for Gemini. Also slightly refactored the config, to make it easier to pass on the config dir. By the way, the known_hosts file is now stored in the config dir too. The adapter will try to move it to there from the old location.
* term: don't panic if termcap tgetent failsbptato2024-08-171-0/+11
| | | | | | | | If TERM is unrecognized by termcap, retry as dosansi. When that fails, just fall back to the non-termcap code path. (There is no reason to panic without termcap; it's just one of the several capability detection mechanisms we use.)
* main, forkserver: optimize startupbptato2024-07-061-2/+2
| | | | | Merge "load config" with "fork loader", so that the loader process gets forked one packet earlier.
* main: misc improvementsbptato2024-07-051-9/+29
|
* Move JS wrapper into Monouchabptato2024-06-031-6/+5
| | | | Operation "modularize Chawan somewhat" part 3
* main: fix tmpdir/sockdir permsbptato2024-05-311-3/+4
|
* config: fix -C with files not in CWDbptato2024-05-311-1/+1
|
* forkserver: simplify fcLoadConfigbptato2024-05-181-1/+1
|
* config: separate tmp dir for sockets, usersbptato2024-05-161-2/+3
| | | | | | | * add $LOGNAME to the tmp directory name, so that tmpdirs of separate users don't conflict * use separate directory for sockets, so that we do not have to give buffers access to all cached pages
* Use isSome instead of isOkbptato2024-05-051-1/+1
| | | | no point in having identical overloads
* client: make quit() actually quit, misc fixesbptato2024-05-041-13/+16
| | | | | | | * unwind the QJS stack with an uncatchable exception when quit is called * clean up JS references in JSRuntime free even when the Nim counterparts are still alive * simplify some tests
* Add capsicum supportbptato2024-03-281-3/+4
| | | | | | | | | | | | | It's the sandboxing system of FreeBSD. Quite pleasant to work with. (Just trying to figure out the basics with this one before tackling the abomination that is seccomp.) Indeed, the only non-trivial part was getting newSelector to work with Capsicum. Long story short it doesn't, so we use an ugly pointer cast + assignment. But even that is stdlib's "fault", not Capsicum's. This also gets rid of that ugly SocketPath global.
* config: improve input systembptato2024-03-261-1/+11
| | | | as described in <https://todo.sr.ht/~bptato/chawan/6>
* main: refactor slightlybptato2024-03-211-149/+134
| | | | | | * put forkServer into main() * use a ctx type instead of closures * get rid of types/opt import
* main: set CHA_LIBEXEC_DIR env var at startupbptato2024-03-191-1/+5
| | | | This way, we can use it everywhere (e.g. in mailcap).
* client: refactor inputbptato2024-03-181-3/+3
| | | | | * move mouse handling to term * do not use File for input just to disable buffering anyway
* config: clean up/simplifybptato2024-03-171-13/+13
| | | | | | | | | * Parse the default config at runtime. There's no significant performance difference, but this makes it much less painful to write config code. * Add better error reporting * Make fromJS2 easier to use * Unquote ChaPaths while parsing config
* Move SIGCHLD ignore call to forkserverbptato2024-03-171-4/+0
| | | | seems like it confuses popen()
* main: ignore SIGCHLDbptato2024-03-171-0/+4
| | | | to avoid zombies
* Move around some modulesbptato2024-03-141-1/+1
| | | | | | | | * extern -> gone, runproc absorbed by pager, others moved into io/ * display -> local/ (where else would we display?) * xhr -> html/ * move out WindowAttributes from term, so we don't depend on local from server
* Replace Chakasu with Chagashibptato2024-02-221-1/+1
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* forkserver: clean upbptato2024-01-291-2/+1
| | | | | Move forkBuffer into forkserver (why was it in container anyway), remove unused mainproc variable, etc.
* Remove std/terminal dependencybptato2024-01-171-1/+1
| | | | It is mostly unnecessary, and conflicts with our use of termcap anyway.
* Use std/* imports everywherebptato2024-01-071-7/+4
|
* break up twtstr somewhatbptato2023-12-131-0/+1
| | | | | Avoid computing e.g. charwidth data for http which does not need it at all.
* config: better path handling; fix array parsing bugbptato2023-12-101-1/+8
| | | | | | | | | * Paths are now parsed through an unified code path with some useful additions like environment variable substitution. * Fix a bug in parseConfigValue where strings would be appended to existing arrays (and not override them). * Fix beforeLast calling afterLast for some reason. * Add a default CGI directory.
* Move clang workaround to config.nimsbptato2023-11-211-4/+0
|
* Add -C optionbptato2023-10-271-144/+162
|
* Fix crash on `cha -'bptato2023-10-181-3/+5
|
* move workaround from previous commitbptato2023-10-051-0/+4
| | | | agh... it didn't work with GCC
* Accept bare strings in -o, fix -o with missing newlinebptato2023-09-201-1/+1
| | | | | | | | * Bare strings are now allowed when specifying config options through -o. * Fix a bug where options specified with -o would be disregarded unless a newline was included. * (Also, add a TOML stringifier routine for debugging.)
* main: set tmpdir for main processbptato2023-09-161-0/+2
|
* move around more modulesbptato2023-09-141-2/+2
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* move some modules to local/bptato2023-09-141-1/+1
| | | | makes a bit more sense than the previous arrangement
* main: remove stray eprint, update -o info textbptato2023-09-061-2/+1
| | | | | QUIT was old-style declarative keybinding syntax, this is no longer supported.
* fix typobptato2023-09-061-2/+2
|
* main: allow grouped single-letter paramsbptato2023-09-051-59/+94
| | | | | so for example now -MV sets monochrome + visual mode instead of erroring out
* config: fix overriding default headersbptato2023-08-261-2/+0
| | | | | * simplify ActionMap reading * introduce separate case for Table