about summary refs log tree commit diff stats
path: root/res
Commit message (Collapse)AuthorAgeFilesLines
* cascade: adjust prefers-color-scheme based on terminal backgroundbptato2024-11-101-0/+7
| | | | also, default link color is now blue for light terminal backgrounds
* utils, types: merge some modulesbptato2024-11-031-1/+1
| | | | | * line, vector, matrix -> path * twtuni, charcategory -> twtstr
* config: refactor, accept more possible config dirsbptato2024-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | 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.)
* sandbox: replace libseccomp with chaseccompbptato2024-10-231-3/+2
| | | | | | | | | | | | | | | This drops libseccomp as a dependency. Also, move the capsicum/pledge definitions from bindings to sandbox.nim because they are only used there. Interestingly, after integrating chaseccomp I found that the stbi process would mysteriously crash by a getrandom(2) syscall. Closer investigation revealed it is only called on the initialization of glibc's malloc; presumably it had never surfaced before because libseccomp would always allocate before entering the sandbox. So I've added getrandom to our filter as well.
* ua.css: disable reverse video on <code> in <pre>bptato2024-10-211-0/+4
| | | | | | | | | | | | The intention is that only inline code tags have reverse video; otherwise it often messes with syntax highlighting. I've made it a descendant selector (instead of a cheaper parent selector) because I can easily imagine markup like <pre><div><code>... which really shouldn't enable reverse video either.
* config.toml: add ?q=/path Google redirectbptato2024-10-181-2/+6
| | | | apparently this is relative to the current page
* css: add reverse video extensionbptato2024-10-151-0/+4
| | | | | | | | | | | | Called -cha-reverse. Mostly to solve the problem that code tags are indistinguishable from regular text - on a graphical browser this is normally served by monospace font, but we always use monospace... So now the default ua.css adds reverse video to code and xmp. pre remains as it was, because it means "preformatted", not "monospaced". Also, it would mess with our whatever-to-HTML converter output.
* Add `nc' tool & adjust finger/spartan to use itbptato2024-10-121-1/+1
| | | | | | | | | Simple netcat clone, useful for portable scripts. Especially because some netcats will close the connection as soon as I close stdin... this one only quits when either stdout or the socket refuses new data. Also, it uses our standard TCP connection routine, meaning it respects ALL_PROXY. (i.e. now spartan works with socks5 too)
* dirlist: separate out into dirlist2htmlbptato2024-10-121-0/+1
| | | | | Now the dirlist parser lives inside dirlist2html, and the file protocol just emulates FTP LIST.
* gmifetch: rewrite in Nimbptato2024-10-121-1/+1
| | | | | | | | | | 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.
* ftp: remove libcurl dependencybptato2024-10-011-2/+1
| | | | | | | | | | | | | This splits out sftp into a separate binary that *does* depend on libcurl. However, ftp now uses the same socket code as gopher. ftps is dropped, because I've never even tested it. Maybe I'll add it back when we have working OpenSSL bindings. This is still "doing the easy part first", now I have no clue how to handle sftp because my initial plan ("just use the sftp binary") doesn't work - sftp batch mode doesn't accept passwords. libssh2 remains the sole candidate, but that's what libcurl wraps anyway.
* config.toml: switch to Google searchbptato2024-09-301-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm not happy about this, but the alternatives are worse. * DDG has degraded a lot lately: - (I think?) it appends my location to the Bing queries, which might be useful for searching restaurants, but only increases noise when looking for something technical. - Lately it also shoves LLM-generated summaries of websites in my face - which I wouldn't even mind if the "summaries" weren't in the typical overly verbose LLM style... Also, not a degradation per se, but DDG can't load images without JS (neither lite nor html), while Google can. Only relevant now that we have images. * Other large search providers either don't load without JS, or give us a layout that we can't render. * Smaller search providers (Mojeek, Marginalia) sadly don't have CJK support. (DDG performs quite poorly here, too.) * Metasearch engines (Searx, etc.) require self-hosting to work consistently, which I lack resources for. I'm sending ucbcb=1 and gbv=1, both of which are appended by Google and apparently stand for "no cookies" and "no JS", respectively. Also, I have added a siteconf entry to strip the click tracking. The default ddg: omni-rule remains, so users who wish to switch back can set in config.toml: [page] C-k = '() => pager.load("ddg:")'
* Update monouchabptato2024-09-291-3/+5
| | | | | Now we use QuickJS-NG, which is better maintained than QJS and has column tracking.
* gopher: do not depend on libcurlbptato2024-09-281-1/+0
| | | | | | | | I'm thinking of making libcurl entirely optional; let's start with the easiest part. I've added a SOCKS5 client for ALL_PROXY support; I know curl supported others too, but whatever.
* Update docsbptato2024-09-261-0/+2
|
* pager: improve hover text handlingbptato2024-09-222-8/+9
| | | | | | | | | | | * align status truncating behavior with w3m (not exactly, clipping is still different, but this should be fine for now) * add "su" for "show last alert" - w3m's solution here is to scroll one char at a time with "u", but that's extremely annoying to use. We already have a line editor that can navigate lines, so reuse that instead. * fix peekCursor showing empty text * update todo
* Update to Unicode 16.0.0bptato2024-09-144-12882/+13154
|
* config: add display.sixel-colorsbptato2024-09-101-0/+1
|
* config: fix broken references to commandsbptato2024-09-101-1/+1
|
* pager: fix saveSourcebptato2024-09-101-1/+1
| | | | | | Welp. The fence was needed after all. The keybinding was broken anyway; fix that too.
* md2html: code, pre, inline fixesbptato2024-09-071-1/+1
|
* url: reduce idna sizebptato2024-09-012-2148/+1171
| | | | | Instead of storing pointers to cstrings, put all of them in a single huge string and store indices of that.
* canvas: move to separate CGI scriptbptato2024-09-011-0/+1
| | | | | | | | | | * stream: and passFd is now client-based, and accessible for buffers * Bitmap's width & height is now int, not uint64 * no more non-network Bitmap special case in the pager for canvas I just shoehorned it into the static image model, so it still doesn't render changes after page load. But at least now it doesn't crash the browser.
* sixel: break out into a separate cgi scriptbptato2024-08-241-0/+1
| | | | | | | | This caches sixel output. Works best when the line height is a multiple of 6px, but should still be faster than the previous solution everywhere else too (simply by virtue of encoding separate images in parallel). Next step: actual color quantization
* loader: move back data URL handlingbptato2024-08-031-1/+0
| | | | | | | data URIs can get megabytes long; however, you can only stuff so many bytes into the envp. (This was thwarting my efforts to view pandoc- generated standalone HTML in Chawan.) So put `data:' back into the loader process.
* Update readme, licensebptato2024-07-291-2/+3
|
* cascade: move some presentational hints to ua.cssbptato2024-07-291-0/+101
|
* buffer, pager, config: add meta-refresh + misc fixesbptato2024-07-281-0/+1
| | | | | | | | | * buffer, pager, config: add meta-refresh value, which makes it possible to follow http-equiv=refresh META tags. * config: clean up redundant format mode parser * timeout: accept varargs for params to pass on to functions * pager: add "options" dict to JS gotoURL * twtstr: remove redundant startsWithNoCase
* img: add webp decoder (jebp)bptato2024-07-203-0/+28
| | | | | | | | | | It works fine AFAICT, just missing VP8 deblocking filters, so lossy WebP images don't look great. I have extended the API a bit to allow reading from stdin, not just paths. Otherwise, it's the same as matanui159/jebp. TODO: add loop filters
* config: support smart casebptato2024-07-161-1/+1
| | | | and enable it by default.
* fix compilation on 2.0.8bptato2024-07-101-1/+1
|
* main: misc improvementsbptato2024-07-051-2/+1
|
* config: add various missing optionsbptato2024-06-291-0/+7
| | | | | | | Mainly things you could already set with [[siteconf]] but not normally. Also, a `styling' option to disable author styles. Also, `images' is now documented as an "experimental" option, since it's halfway usable now.
* img, loader: add image resizing, misc fixesbptato2024-06-281-3/+4
| | | | | | | | | | | | | | | * resize images with stb_image_resize * use tee for output handle redirection (redirectToFile blocks) * cache original image files * accept lseek in sandbox * misc stbi fixes For now, I just pulled in stb_image_resize v1. v2 is an extra 150K in size, not sure if it's worth the cost. (Either way, we can always switch later if needed, since the API is almost the same.) Next step: move sixel/kitty encoders to CGI, and cache their output in memory instead of the intermediate RGBA representation.
* stbi: add encodersbptato2024-06-211-2/+3
|
* img, term: try to detect unknown images, improve kitty encoderbptato2024-06-211-20/+21
| | | | | | * preserve alpha in kitty + simplify encoder * pass unknown image types to stbi (as image/x-unknown) and let it detect the type
* img: use stb_image, drop zlib as dependencybptato2024-06-203-6/+18
| | | | | | | Now we have decoders for gif, jpeg, bmp. Also, the in-house PNG decoder has been replaced in favor of the stbi implementation; this means we no longer depend on zlib, since stbi comes with a built in inflate implementation.
* img, loader: separate out png codec into cgi, misc improvementsbptato2024-06-201-0/+1
| | | | | | | | | | | | | | | * multi-processed and sandboxed PNG decoding & encoding (through local CGI) * improved request body passing (including support for output id as response body) * simplified & faster blob()/text() - now every request starts suspended, and OngoingData.buf has been replaced with loader's buffering capability * image caching: we no longer pull bitmaps from the container after every single getLines call Next steps: replace our bespoke PNG decoder with something more usable, add other decoders, and make them stream.
* pager: send Accept: */* for viewImagebptato2024-06-081-1/+8
|
* pager, buffer: improve forms, protocol configbptato2024-06-081-0/+9
| | | | | | * refactor form submission * add options to specify form handling per protocol * block cross-protocol POST requests
* config.toml: update headersbptato2024-06-081-2/+2
| | | | | | | | | * prepend Mozilla/5.0 to User-Agent; an unfortunate fact is that even the G-lettered search engine breaks without it, and I've seen sites that refuse to serve pages at all. * Add */* to Accept, in the hope that we'll get images more often. (The ideal solution is to set it to "*/*" when fetching images, but the API format doesn't let us do this yet; TODO.)
* pager: rework D/discard bufferbptato2024-05-312-1/+8
| | | | | | | | | | | | | | | | | | | | | The previous solution had the issue that it switched between "delete buffer, then move back" and "delete buffer, then move forward" depending on whether the buffer was the root of the buffer tree, which made its behavior quite unpredictable. Now the pager (sort of) remembers the direction you are coming from, and D moves in that direction. So e.g.: * Enter, D just moves back to where you were coming from (as before) * Comma, D deletes the previous buffer, then returns to the current buffer If no buffer exists in the target direction, then we alert. Also, new commands are: `d,' `d.'. They do the same thing the non-d-prefixed variations do, but also delete the current buffer. Useful if you're no longer sure where you are coming from, but know where you want to go. (`d,' in particular is equivalent to w3m's `B'.)
* about: markdownify & update license.htmlbptato2024-05-281-41/+36
| | | | We have a markdown converter, so why not use it?
* Update docsbptato2024-05-161-2/+2
|
* config: separate tmp dir for sockets, usersbptato2024-05-161-1/+2
| | | | | | | * 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
* pager: editor command fixesbptato2024-05-121-1/+1
|
* Fix typobptato2024-05-111-1/+2
|
* pager: take $EDITOR from envbptato2024-05-111-1/+1
| | | | | | * use EDITOR environment variable in default config, fix line number ordering in fallback * autodetect vi-like editors and add line number
* term: optimize canvas redraw, remove emulate-overlinebptato2024-05-101-1/+0
| | | | | | | * Replaced the `pcanvas' comparison with a much simpler tracking of the first damaged cell in writeGrid, which is significantly faster. * Removed emulate-overline: it's of too little utility compared to the maintenance burden it caused.
* js: fix various leaks etc.bptato2024-05-032-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we didn't actually free the main JS runtime, probably because you can't do this without first waiting for JS to unwind the stack. (This has the unfortunate effect that code now *can* run after quit(). TODO: find a fix for this.) This isn't a huge problem per se, we only have one of these and the OS can clean it up. However, it also disabled the JS_FreeRuntime leak check, which resulted in sieve-like behavior (manual refcounting is a pain). So now we choose the other tradeoff: quit no longer runs exitnow, but it waits for the event loop to run to the end and only then exits the browser. Then, before exit we free the JS context & runtime, and also all JS values allocated by config. Fixes: * fix `ad' flag not being set for just one siteconf/omnirule * fix various leaks (since leak check is enabled now) * use ptr UncheckedArray[JSValue] for QJS bindings that take an array * allow JSAtom in jsgetprop etc., also disallow int types other than uint32 * do not set a destructor for globals