about summary refs log tree commit diff stats
path: root/src/server
Commit message (Collapse)AuthorAgeFilesLines
...
* pager: do not make pointless requests in viewImage, add saveImagebptato2024-11-303-30/+39
| | | | | | | with buffer.images enabled, we already cache them, so we can skip the additional request also, add saveImage, bound to sI
* twtstr: add mypairsbptato2024-11-282-3/+3
| | | | | This couldn't get into system.nim for technical reasons, but it's still pretty useful when iterating over non-mutable openArrays.
* buffer: optimize hover switchingbptato2024-11-261-2/+9
| | | | | Fixed a bug that would lead to styles unnecessarily being recalculated if the root element had a :hover dependency.
* config.configdir -> config.dirbptato2024-11-261-1/+1
|
* pager, select: add more items, misc fixesbptato2024-11-251-9/+12
| | | | | | eh probably have to move the event loop to pager...
* loader/* -> serverbptato2024-11-249-5/+2896
| | | | one less mystery
* buffer: slightly improve markURLbptato2024-11-241-49/+69
| | | | merge text nodes, eat nobr, wbr
* container: add Lynx-style navigation commandscommodorian2024-11-231-1/+5
|
* buffer: proper toggleImages implementationbptato2024-11-211-1/+21
| | | | | | | It necessarily removes the config.images check from codec access, which I'm not quite happy about, so I've added a check to the DOM instead. (TODO: maybe pager should just dynamically grant codec access as a capability instead? but maybe that's even more error prone...)
* buffer: fix hover text not showing up with pseudo elementsbptato2024-11-171-78/+61
| | | | | | | | | | | | | | | | | | This was a bit annoying because it triggered the popup warning on cursorNextLink -> click with form buttons (as the square brackets around [button] are implemented with ::before/::after.) Notably, this also removes the visibility check from isClickable. I suspect there was a good reason why I added it, but I can't remember why, and it's incompatible with what desktop browsers do on: <a href="https://asdf.com" style="visibility: hidden"> <div style="visibility: visible"> test </div> </div> So if it's ever added back, then this case should be respected too.
* buffer: clean up findPrevLink, findNextLinkbptato2024-11-171-82/+57
| | | | | findPrevLink is still an unreadable mess, but at least findNextLink looks alright now.
* url: fix serializeFormURLEncoded, refactorbptato2024-11-151-5/+5
| | | | kill qmark hack, plus refactor the form data parser/serializer
* formdata: eliminate a global varbptato2024-11-152-9/+10
|
* js: reorganize modules, update docsbptato2024-11-152-3/+3
| | | | | | | most of it has already been moved to monoucha, and the rest fits better in other directories. also, move urimethodmap to config
* buffer: skip unnecessary reshape in some casesbptato2024-11-141-25/+26
|
* buffer: fix broken gotoAnchor behaviorbptato2024-11-121-41/+68
| | | | | | | | | | | | | | | | | 23beebe6 introduced a regression that broke gotoAnchor. This fixes that, plus a couple other long-standing gotoAnchor bugs: * If no anchor is found, do not dupe the buffer. Desktop browsers still add a history entry, while w3m prints an error. I've copied the latter because it makes more sense as a user, but this will have to be refined for the navigation API at some point. * If the anchor *is* found, then always jump to it, even if it's not visible. This was a limitation of relying on the line array, so now we rely on the box tree instead. (Sooner or later, the former must go anyway.) Also, fix `U' reload not restoring the position (hopefully this time for good).
* url: reduce URL object size, simplifybptato2024-11-111-11/+11
| | | | | | | * query, fragment are now strings, not options * get rid of Host, Path types, now hostname/pathname are strings * fix ipv4 parsing error case * in file protocol, fix URL for dirlist without slash with a redirection
* layout -> cssbptato2024-11-101-1/+1
| | | | as much as I wish it weren't, layout *is* css.
* dom: support all HTMLHyperlinkElementUtils gettersbptato2024-11-091-3/+5
|
* poll: fix clear()bptato2024-11-071-2/+1
| | | | | setLen(0) inside the events iterator was wrong; it should have just set all items to -1.
* url: fix compilation on Nim 1.6.14bptato2024-11-071-4/+5
| | | | it handles side effects differently
* utils, types: merge some modulesbptato2024-11-031-1/+0
| | | | | * line, vector, matrix -> path * twtuni, charcategory -> twtstr
* dynstream: refactorbptato2024-10-202-9/+7
| | | | | | | | | | * consistently use cint instead of FileHandle - this was another remnant of winapi support; on posix, they are the same. * move "blocking" field to PosixStream * recvFileHandle -> recvFd, sendFileHandle -> sendFd * merge serversocket into dynstream * merge auxiliary C functions into dynstream_aux
* dynstream, serversocket: use posix instead of nativesocketsbptato2024-10-202-5/+3
| | | | | | | | | | | nativesockets is a wrapper over posix and winapi, but we don't support winapi, so we can just fall back to PosixStream instead. SocketStream remains as a constraint over PosixStream to allow sendFileHandle/recvFileHandle. As a nice side effect, we can drop some allowed syscalls from the seccomp filter.
* pager: refactor mailcap, console; misc fixesbptato2024-10-141-1/+0
| | | | | | | | | * use more PosixStream (because it has double-close checking) * factor out some common mailcap operations * move console from client to pager * fix case-insensitive mime type matching * replace convoluted fdin/fdout comparison logic (that only accidentally worked) with a boolean flag
* 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.
* Fix compilation on Nim 2.2.0bptato2024-10-101-11/+16
|
* timeout: accept err stream as parambptato2024-09-301-1/+1
| | | | | gets rid of a todo. (not sure why I thought this was important, but it sure looks nicer)
* buffer: un-extern some procsbptato2024-09-291-2/+2
|
* promise: move PromiseMap to bufferbptato2024-09-291-27/+46
| | | | | It's only used there, and there's no reason for every single promise to carry two pointers to support it.
* 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
|