about summary refs log tree commit diff stats
path: root/src/server
Commit message (Collapse)AuthorAgeFilesLines
* container: fix control char displaybptato2024-09-281-1/+1
| | | | | | Also, kill twidth and its friends; we haven't been using it for a while now. (In the future, a solution with PUA chars might be worth exploring.)
* Fixes for FreeBSDbptato2024-09-261-4/+0
|
* buffer: make non-button form-associated elems clickablebptato2024-09-251-3/+2
| | | | | d7085253b7 was too strict; in particular, it broke cases where copyable text is placed in text areas.
* sixel: support transparencybptato2024-09-241-1/+3
| | | | | | | | | | | | | | | | | | Sixel can only represent transparency for fully transparent (alpha = 0) and fully opaque (alpha = 255) pixels, i.e. we would have to do blending ourselves to do this "properly". But what do you even blend? Background color? Images? Clearly you can't do text... So instead of going down the blending route, we now just approximate the 8-bit channel with Sixel's 1-bit channel and then patch it up with dither. It does look a bit weird, but it's not *that* bad, especially compared to the previous strategy of "blend with some color which hopefully happens to be the background color" (it rarely was). Note that this requires us to handle transparent images specially in term. That is, for opaque ones, we can leave out the "clear cells affected by image" part, but for transparent ones, we must clear the entire image every time.
* buffer: allow button nested in abptato2024-09-241-0/+4
| | | | for compatibility with other browsers...
* Replace std/selectors with pollbptato2024-09-232-104/+64
| | | | | | | | | | | | std/selectors uses OS-specific selector APIs, which sounds good in theory (faster than poll!), but sucks for portability in practice. Sure, you can fix portability bugs, but who knows how many there are on untested platforms... poll is standard, so if it works on one computer it should work on all other ones. (I hope.) As a bonus, I rewrote the timeout API for poll, which incidentally fixes setTimeout across forks. Also, SIGWINCH should now work on all platforms (as we self-pipe instead of signalfd/kqueue magic).
* client, forkserver, dynstream: misc refactorings, fixesbptato2024-09-231-1/+3
| | | | | | * fix broken int conversion in dynstream * fix EPIPE handling in forkserver * merge fdmap and connectingContainers into loader map
* dom: add forms, elements getter + misc fixesbptato2024-09-171-4/+8
| | | | | | | | | | | | * add document.forms * add form.elements * remove redundant jshasprop functions * use mpairs for attribute iteration (mpairs use pointers, but pairs copies) * fix remove() crash * fix remove() collection invalidation for children (if parent is not in the collection) * update monoucha
* loader: refactor/move around some procsbptato2024-09-152-1/+3
| | | | | | | | | | | | | | Module boundaries didn't make much sense here either. Specifically: * loader/cgi was originally just one of the many "real" protocols supported by loader, so it was in a separate module (like the other ones). Now it's mostly an "internal" protocol, and it was getting cumbersome to pass all required loader state to loadCGI. * The loader interface has grown quite large, but there is no need for (or advantage in) putting it in the same module as the implementation. Now CGI is handled by loader, and the interface is in the new module "loaderiface".
* loader: improve map interfacebptato2024-09-141-18/+16
| | | | directly accessing map was a bit too error prone
* loader: refactor, misc optimizations & fixesbptato2024-09-141-41/+37
| | | | | | | | * factor out input/output handle tables; use a seq instead * add possibility to directly open cached items onto stdin (mainly an optimization for reading images, which are always cached) * close used handles on local CGI execution * make clone during load work again
* utils: add twtunibptato2024-09-081-4/+3
| | | | | | | | | | | | | | | | | | | std/unicode has the following issues: * Rune is an int32, which implies overflow checking. Also, it is distinct, so you have to convert it manually to do arithmetic. * QJS libunicode and Chagashi work with uint32, interfacing with these required pointless type conversions. * fastRuneAt is a template, meaning it's pasted into every call site. Also, it decodes to UCS-4, so it generates two branches that aren't even used. Overall this lead to quite some code bloat. * fastRuneAt and lastRune have frustratingly different interfaces. Writing code to handle both cases is error prone. * On older Nim versions which we still support, std/unicode takes strings, not openArray[char]'s. Replace it with "twtuni", which includes some improved versions of the few procedures from std/unicode that we actually use.
* loader, client, buffer: use selectInto (not select)bptato2024-09-031-2/+3
| | | | select allocates. (makes sense, but I never realized...)
* canvas: move to separate CGI scriptbptato2024-09-011-0/+4
| | | | | | | | | | * 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.
* buffer: fix some hover weirdnessbptato2024-08-151-7/+7
| | | | | | | | Setting the new hover value before unsetting the previous one would unset the new hover value for nodes in the same branch. In particular, this broke hover when moving the cursor from a pseudo element (e.g. ::before) to its parent.
* dom: remove generic JS bindingsbptato2024-08-111-8/+3
| | | | Dispatch manually with fromJS instead.
* Update monouchabptato2024-08-091-2/+3
|
* Fixes for Nim 2.2bptato2024-07-292-6/+0
| | | | | | | | | * xmlhttprequest: fix missing import * painter: generic tuple workaround * dynstream: merge module with implementations (so it will work with vtables) Not enabling vtables yet since it doesn't work with refc.
* twtstr: fix startsWithIgnoreCasebptato2024-07-291-1/+1
|
* buffer, layout: small refactoringbptato2024-07-291-24/+22
|
* buffer, pager, config: add meta-refresh + misc fixesbptato2024-07-281-3/+51
| | | | | | | | | * 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
* buffer, dom, event: JS binding for dispatchEventbptato2024-07-221-21/+27
| | | | | | * move dispatchEvent to event, add a JS binding * only reshape if the document was actually invalidated after event dispatch/interval call/etc.
* buffer: replace dispatchEvent procs with that in dombptato2024-07-211-33/+4
|
* loader: copy cached items on buffer cloningbptato2024-07-201-2/+1
| | | | | This fixes a bug where cloning buffers with images would crash the browser.
* buffer: fix nil deref on click without clickable elementbptato2024-07-191-4/+5
|
* html: event cleanup, XHR progressbptato2024-07-181-89/+39
|
* 32-bit compilation fixesbptato2024-07-131-3/+3
| | | | | | | | It seems registerHandle/unregister doesn't accept cint as handles. Not sure why it even works on 64-bit targets... (maybe some converter weirdness?) Seems best to explicitly cast it away.
* main, forkserver: optimize startupbptato2024-07-061-24/+24
| | | | | Merge "load config" with "fork loader", so that the loader process gets forked one packet earlier.
* css, html: fix CSS dependency invalidationbptato2024-07-031-7/+7
|
* dom, pager: cache images from networkbptato2024-06-292-4/+2
| | | | | | | | | | | With many limitations: * slightly randomized expiry, so it's harder to fingerprint * only images. so e.g. CSS is still left uncached * it's per-buffer and non-persistent, so images are still redownloaded for every new page load so it's more of an image sharing between placements than true caching.
* config: add various missing optionsbptato2024-06-291-0/+2
| | | | | | | 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-0/+1
| | | | | | | | | | | | | | | * 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.
* Update monouchabptato2024-06-221-1/+1
|
* misc cleanupsbptato2024-06-221-6/+4
|
* forkserver: add missing exitnowbptato2024-06-221-0/+1
|
* term, pager: improve image displaybptato2024-06-211-2/+1
| | | | | | * basic repaint algorithm for sixel (instead of brute force "clear the whole screen") * do not re-send kitty images already on the screen
* img, loader: separate out png codec into cgi, misc improvementsbptato2024-06-201-41/+41
| | | | | | | | | | | | | | | * 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.
* buffer: copy lessbptato2024-06-141-8/+10
|
* buffer: decoding fixesbptato2024-06-141-44/+44
| | | | | | * simplify processData * set document charset on creation * update chagashi
* Update Chame, Chagashibptato2024-06-131-66/+14
|
* buffer: add autofocusbptato2024-06-081-38/+58
| | | | naturally, it's opt-in
* pager, buffer: improve forms, protocol configbptato2024-06-081-138/+116
| | | | | | * refactor form submission * add options to specify form handling per protocol * block cross-protocol POST requests
* Move JS wrapper into Monouchabptato2024-06-031-6/+6
| | | | Operation "modularize Chawan somewhat" part 3
* js: improve jsregex interfacebptato2024-06-031-14/+12
| | | | | | | It's easier to just use nested seqs here. (This also fixes reverse-search highlighting the last capture group instead of the whole match.)
* buffer: fix ampersand escaping in markURLbptato2024-05-281-0/+4
|
* forkserver: also skip SIGTERM socket unlinkbptato2024-05-201-5/+1
| | | | rationale: see previous commit
* buffer: never unlink controlling socket in cleanupbptato2024-05-201-5/+2
| | | | | | | | The pager already unlinks it, so ideally this should change nothing. (This was causing buffer processes to core dump on OpenBSD, because I forgot that I removed unlink promise. Better keep code paths the same when possible...)
* html: improve Request, derive Client from Windowbptato2024-05-201-5/+6
| | | | | | | * make Client an instance of Window (for less special casing) * misc work on Request & fetch * improve origin comparison (opaque origins of same URLs are now considered the same)
* forkserver: simplify fcLoadConfigbptato2024-05-181-12/+4
|
* config: separate tmp dir for sockets, usersbptato2024-05-161-2/+9
| | | | | | | * 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