about summary refs log tree commit diff stats
path: root/src/server
Commit message (Collapse)AuthorAgeFilesLines
* css: add :target pseudo classbptato2024-12-171-0/+7
|
* default(T) -> T.default, add some strict defsbptato2024-12-173-6/+6
|
* css: resolve units to px before layoutbptato2024-12-161-3/+5
| | | | Lets us skip a couple pointless multiplications/divisions during layout.
* chabookmark fixes & improvementsbptato2024-12-152-1/+4
| | | | | | | | * correct action on M-b * add external.bookmark option * move openFileExpand functionality into unquote * add menu items * update docs
* twtstr: reduce copying in atobbptato2024-12-121-3/+3
|
* buffer: skip a copybptato2024-12-091-3/+3
|
* response: simplify text()bptato2024-12-081-42/+7
| | | | | | | | | | | | | It gets copied once anyway, so just use a blob. I guess I could skip the copy with some effort, but the 4 lines implementation is too attractive :P This is still an improvement, as it doesn't needlessly zero-fill the buffer on realloc. (I've also removed the final realloc from blob, as it seemed quite pointless. Using Content-Length could help... except it doesn't, because it refers to the encoded length. Ugh.)
* loader: fix heisenbugbptato2024-12-051-1/+6
| | | | | | | | | | | | | | | | | | Unconditionally registering output handles on resume could result in a failed assertion on double-register. The bug would appear like: resume (register) -> handleRead -> pushBuffer -> currentBuffer is nil -> register again handleWrite had a very high likelihood of occurring between resume and handleRead, and that hid the bug by immediately unregistering the handle after resume. In fact, I haven't been able to reproduce the bug at all today, and only found it after poring over the source... Fix this by not registering output handles that are empty (except if the istream is already finished, in which case it will just be unregistered).
* mimetypes: refactor, use mime.types for inline image extensionsbptato2024-12-052-6/+16
| | | | | | | | | | | | * 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.
* dom: add support for @importbptato2024-12-011-6/+10
| | | | only the most basic form; no media queries yet
* buffer: fix nil derefbptato2024-11-301-1/+1
| | | | whoops
* 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".