about summary refs log tree commit diff stats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* chaseccomp: fix compilation with newest dash, misc changesbptato2024-10-311-3/+0
| | | | | | | | | | | | | | * fix matching on unstripped whitespace: caught after upgrading to upstream dash & chaseccomp wouldn't compile * add defines to ensure that we computed the filter length correctly * inline cut_label * EPERM on sigaction, sigprocmask, gettid, and kill on tgkill (so a crash doesn't trigger sandbox violations) * move SIGSYS handler to C and add one for the network The last change removes the stack trace from SIGSYS, but gives us the syscall number which is probably more useful. (Indeed, we don't even have a stack trace in release builds.)
* container: fix peekCursor showing hover texts in the wrong orderbptato2024-10-291-4/+5
|
* timeout: fix crash on clearTimeout inside setTimeoutbptato2024-10-281-9/+16
|
* Update monouchabptato2024-10-281-1/+1
|
* url: small cleanupbptato2024-10-281-11/+9
|
* config: refactor, accept more possible config dirsbptato2024-10-284-90/+69
| | | | | | | | | | | | | | | | | | | | | 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.)
* layout: fix margin resolution for absolutely positioned boxesbptato2024-10-281-6/+10
|
* layout: implement position: fixedbptato2024-10-282-16/+18
| | | | just a special case of position: absolute
* url: add searchParams.hasbptato2024-10-281-0/+8
|
* xhr: fix onReadXHR EAGAIN handlingbptato2024-10-281-4/+4
| | | | now it loads invidious comments. wow
* pager: misc extern fixesbptato2024-10-271-80/+109
| | | | | * fix externFilterSource ignoring content types other than html * refactor runProcess to use a custom fork/exec instead of system(3)
* Clean up forward declarations a bitbptato2024-10-279-68/+72
|
* container: fix crash on isearch between redirectsbptato2024-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | Sadly, pushCursorPos may not be paired with a popCursorPos in case the container in question is replaced during the isearch. The easiest way to reproduce this is: * start request to a page that redirects * start isearch * redirection happens, now the old container is gone * type something Then, popCursorPos would try to pop the cursor position from the new container. An alternative (and better) solution would be to add a weak ref to the container as the line edit data. Sadly, we don't have weak refs, and I don't want to hack them in with finalizers. (But maybe I should. Hmm.)
* selectorparser: fix parsing of invalid pseudo elementsbptato2024-10-261-16/+35
| | | | | Found this because the 5th largest tech company on Earth cannot bother itself with trivial matters such as "writing valid CSS".
* cssparser: do not accept invalid rulesbptato2024-10-251-2/+3
| | | | | | This isn't exactly clear from the standard's wording, but e.g. *display: inline must be discarded (because it incorrectly starts with a delim token).
* layout: fix nested absolute positioning, refactor initial size resolutionbptato2024-10-252-109/+113
| | | | | | | | | | Nested position: absolute was broken, so fix it. Also, it makes no sense to dispatch inside layoutBlockChild when we know the expected resolution algorithm upon calling it anyway, so now we do that statically. Finally, fix some bugs in position: absolute size resolution.
* sandbox: use relative path to the object filebptato2024-10-231-1/+6
|
* termcap: merge into termbptato2024-10-233-35/+29
| | | | | again, not that useful to put it in a separate module if only term uses it
* sandbox: replace libseccomp with chaseccompbptato2024-10-234-240/+29
| | | | | | | | | | | | | | | 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.
* color: use 64-bit SWARbptato2024-10-221-34/+15
| | | | | I originally left this at 32-bits because I was on a 32-bit arch, but that is no longer the case.
* layout: remove questionable use of newSeqUninitializedbptato2024-10-211-5/+2
|
* poll: nimifybptato2024-10-201-8/+22
| | | | until it's fixed upstream...
* dynstream: refactorbptato2024-10-2018-255/+224
| | | | | | | | | | * 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-2010-106/+56
| | | | | | | | | | | 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.
* sandbox: do not ask for signal permissionsbptato2024-10-171-3/+0
| | | | | On a second thought, no timeouts for name resolution is fine - and even if it weren't, it's better implemented in the loader.
* layout: fix inline float + position: absolute bugbptato2024-10-161-5/+6
| | | | | As per standard, float "only applies to elements that [...] are not absolutely positioned."
* css: add reverse video extensionbptato2024-10-152-0/+3
| | | | | | | | | | | | 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.
* layout: fix float positioning in inline contextsbptato2024-10-151-60/+120
| | | | | | also fixes a bug in the previous commit where whitespacenum would be reset on absolute positioning + missing absolute margin handling without top/left/etc.
* layout: correct `position: absolute' (FINALLY)bptato2024-10-152-157/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a) resolution of `position: absolute' percentage sizes with an indefinite containing block size (wait what?), and b) positioning of `position: absolute' inner block boxes inside inline boxes. a) is possible because `position: absolute' does not affect its parent's layout. I would love to have a long talk with whoever thought that specifying it like this is a good idea. You know, just because you can... anyways, shockingly enough, this was still the more straightforward part. b) forced me to change the box tree to allow blocks inside inlines, which is ugly, but no big deal. Two questions then remained: 1. *where* to put such boxes, and 2. *how large* these boxes should be; this is hardly obvious since an inline box does not have an unambiguous width or height. Of course the CSS standard, never too eager to fulfill my basic expectations, says nothing about this (other than "it's not defined"). So I first tried to reverse engineer what Gecko does, and after hours of pain and suffering I realized... that it's broken LOL https://bugzilla.mozilla.org/show_bug.cgi?id=489100 Therefore I ended up (partially) copying Blink behavior, which, while equally nonsensical as Gecko (and of course divergent), at least does not change after a partial layout. Thank you LayoutNG for saving my sanity. As for the practical benefits: this fixes the bug where Invidious [video] tags wouldn't show up. Hey, it's something! Still left to-do: `position: absolute' for `display: inline' boxes.
* pager: refactor mailcap, console; misc fixesbptato2024-10-147-280/+262
| | | | | | | | | * 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
* twtstr, toml: misc cleanupbptato2024-10-134-13/+9
| | | | | * remove unused DateTime toml type * add parseIntP for pointer-size int parsing
* base64: merge into twtstr/envbptato2024-10-135-82/+67
|
* loader: improve CGI header parsingbptato2024-10-121-32/+39
| | | | | | * accept HTTP status line * reject status codes with >3 length * reduce pointless copying
* loader: fix potential nil derefbptato2024-10-121-1/+1
| | | | rare, but possible
* Update monouchabptato2024-10-121-3/+3
|
* dom: prevent leaking window size through media queriesbptato2024-10-121-3/+4
|
* gmifetch: rewrite in Nimbptato2024-10-125-47/+39
| | | | | | | | | | 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.
* dom: html -> documentElementbptato2024-10-103-9/+6
| | | | it's effectively a dupe, except html wouldn't work in XML
* env: fix getComputedStyle arg2bptato2024-10-101-1/+1
|
* promise: remove newPromisebptato2024-10-103-17/+6
| | | | normal construction is enough (and it wasn't really used anyway)
* layout, pager: preserve tabs on display, selection & outputbptato2024-10-104-29/+101
| | | | | | | | | | | | Substitute tabs with one of eight PUA characters based on their width, and convert them back in the pager: * TUI mode always prints spaces, but now handles tabs appropriately on cursor movement * dump mode tries to preserve hard tabs, but uses soft tabs when that is not possible (e.g. tabs after a margin, tab with background color, etc) * selection mode always outputs hard tabs.
* Fix compilation on Nim 2.2.0bptato2024-10-101-11/+16
|
* loader: fix fd leakbptato2024-10-081-0/+1
|
* twtstr: fix stripAndCollapsebptato2024-10-081-11/+9
|
* client: fix redirected buffers jumping back to parent on reloadbptato2024-10-071-0/+5
| | | | | replaceBackup was not being cleared, so the next gotoURL with a replace pointing to such buffers wouldn't work.
* pager: do not choke on empty editor commandbptato2024-10-071-2/+4
|
* layout: small cleanupbptato2024-10-071-14/+11
| | | | the length check is not needed, we do that outside the loop already
* color: reduce CellColor size, misc color refactoringbptato2024-10-0610-128/+148
| | | | | | * split out CSSColor from CellColor; now CellColor is just 4 bytes (which helps reduce FormatCell size) * unify color function naming (still not perfect)
* pager: add missing int conversionbptato2024-10-061-1/+1
|
* url: fix IDNA bugsbptato2024-10-061-2/+2
|