about summary refs log tree commit diff stats
path: root/src/local
Commit message (Collapse)AuthorAgeFilesLines
* opt: remove value.ok, value.err overloads, use lentbptato2025-01-141-1/+1
| | | | | | largely unused lent idea from nim-results
* container: use linked list instead of dequebptato2025-01-132-6/+19
|
* config: switch to camel casebptato2025-01-132-88/+88
| | | | | | We already need a camel -> kebab converter anyway. Unfortunately this also changes JS binding names, so it's a breaking change. Oh well.
* loader: fix memory leak on x-saveoutput + various fd leaksbptato2025-01-111-8/+15
|
* bufreader, bufwriter: send all fds in one messagebptato2025-01-112-30/+34
| | | | | | | | Moves sendfd/recvfd out of C, and fixes some of its flaws too. The main one is that now all file descriptors are sent together. Also, I've decided to remove the ServerSocket after all; it's easy to add it back if it's ever needed again.
* pager: add some option wrappersbptato2025-01-101-4/+4
| | | | to mark nilable ref objects
* buffer, ua.css, dom: more select adjustmentsbptato2025-01-103-69/+22
| | | | | | | ok, now it works like in w3m. (mostly, barring CSS limitations...) we'll see how this works out Also adds/fixes some select and option DOM APIs.
* ua.css: improve select renderingbptato2025-01-091-2/+2
| | | | | | | | | Regular select is now rendered as flex, and does not wrap. This gets rid of the pointless whitespace before/after options. multiple still looks weird, but maybe a bit less? Probably we should just render it with pseudo-checkboxes, and drop the special mode from select.nim.
* buffer: remove server socketbptato2025-01-093-128/+81
| | | | | | | | | | | Now we just pass through a socket created in pager. This removes the need for a socket directory, and strengthens the buffer sandbox slightly. I've kept the ServerSocket code, because I want to add some form of RPC and communication between separate instances in the future. However, I don't expect this to be handled outside the main process, so I've removed the Capsicum-specific connectat/bindat code.
* dynstream: remove safeClose, add moveFdbptato2025-01-091-14/+10
| | | | | | | | | | | | | | | | | | | safeClose was originally added to prevent this bug: let fd = doSomething() # allocates fd on 0, e.g. by opening a socket let ps = newPosixStream(fd) ... discard dup2(ps.fd, STDIN_FILENO) ps.sclose() # stdin is now closed, despite the opposite intention. With safeClose called on fds that could be stdin, the goal was that stdin/stdout/stderr would never be allocated as a different file, but it was still error-prone. Enter moveFd: ps.moveFd(STDIN_FILENO) If ps is already stdin, this does nothing. If not, it dup2's ps to stdin, closes ps.fd, and sets it to stdin.
* bufstream: allow 0-width packetsbptato2025-01-091-1/+0
|
* buffer: fix crash on clonebptato2025-01-081-0/+1
| | | | welp. bufreader chokes on 0-sized packets...
* lineedit: skip last history entry if identical to inputbptato2025-01-081-6/+14
|
* pager: add omni-rewrites to URL historybptato2025-01-081-0/+1
| | | | | | | This way, you can C-p and edit searches again. It is somewhat unfortunate that two entries are saved too, but the alternatives are more complex and not necessarily better.
* loader: use per-process control socketsbptato2025-01-083-26/+20
| | | | | | | | | | | | | | | | | | | | | | | | Previously, each message (load, resume, passFd, etc.) would open a new connection to loader's UNIX socket, and assumed the loader was dead when the loader did not respond (ECONNREFUSED). As it turns out, this model was hopelessly broken: POSIX does not specify when a UNIX socket can refuse connections, so while it happened to work on Linux (which just blocks if it can't accept right now), FreeBSD would randomly refuse connections whenever its listen queue was full. Instead, we now take a socketpair() from the loader in addClient, and pass on one half to the client (the other half stays in loader); this is the control stream, and all messages from the specific client are sent through it. If a message includes a new stream (e.g. lcLoad), then it sends a new socketpair through the control stream. Aside from not being completely broken (and being marginally more efficient), this arrangement has several other benefits: it removes the need for authentication, almost removes the need for sockdir (now only buffers use it), and will make it easier to add async message processing in the future.
* dom: add document.referrerbptato2025-01-061-2/+3
| | | | Only works if referer-from is enabled.
* container: remove locationbptato2025-01-061-3/+0
| | | | undocumented alias for url; just use the latter.
* loaderiface: fix race in poll registerbptato2025-01-061-2/+6
| | | | | | | handleRead can register through fetch, so this doesn't work out as nicely as in loader (where we control all register/unregister calls). So now we queue up register events first, and only process them after the "events" iterator exits.
* pager: skip a pointless zero fillbptato2025-01-041-1/+1
|
* Try to set close-on-exec, misc cleanupbptato2025-01-041-2/+1
| | | | | | | | | | FD_CLOEXEC should hopefully get rid of bugs where buffers outlived the main process because of some stray child process keeping the canary pipe alive. It's not perfect because of the runMailcapWriteFile/runMailcapReadFile double-forks. Ideally they should be replaced with an implementation that tracks temporary files in the main process.
* env, buffer: restyle on getComputedStylebptato2025-01-031-1/+1
| | | | | | style/layout invalidation is a mess :( Fixes acid3 test00
* loader: add proper HTTP auth handlingbptato2025-01-031-2/+11
| | | | | | | | | | | | | Until now, we just stuffed it into the URL, which was somewhat problematic. Mainstream browsers like to hide the username from the user, but I've decided to follow w3m: buffers do not receive auth info, but the pager itself displays the username. As for the origin: I wanted to use the regular origin, but that does not work with any custom URL. So instead of changing the regular origin function, I've added another.
* pager: history fixesbptato2025-01-011-2/+9
| | | | | | | | | * add failed buffers to history too * make buffer.history and siteconf history actually do something * prevent history in dump mode after retry too * disable history in test configs ref. https://todo.sr.ht/~bptato/chawan/39
* buffer: make video, audio clickablebptato2024-12-302-5/+13
| | | | | more intuitive than shoehorning it into "view image" (also makes it easier to apply the content type)
* pager: misc improvementsbptato2024-12-301-44/+44
| | | | ok I'll use result, whatever
* cookie: add persistent cookies, misc refactoring/fixesbptato2024-12-292-23/+39
| | | | | | | | | | | | | Mostly compatible with other browsers/tools that follow the Netscape/curl format. Cookie jars are represented by prepending "jar@" to the host part, but *only* if the target jar is different than the domain. Hopefully, other software at least does not choke on this convention. (At least curl seems to simply ignore the entries.) Also, I've moved cookies.nim to config so that code for local files parsed at startup remains in one place.
* pager: small cleanupbptato2024-12-291-2/+1
|
* history: remove comment parsing, fix fd leakbptato2024-12-291-0/+2
|
* env: do not copy attrs, fix screen on clientbptato2024-12-281-1/+4
| | | | Now screen.width etc. works in the pager too.
* cookie: remove broken third-party-cookie optionbptato2024-12-271-2/+1
| | | | | | | | | Looking at it closer, this never actually did what it advertised to do. It only affected first-party cookies from subdomains, but that has been fixed; third-party cookies were never supported in the first place. (In fact, even first-party cookies are still skipped unless directly received on navigation. This should probably be fixed.)
* term: fix in-cell offset bug on kitty image scrollbptato2024-12-271-0/+5
| | | | | If the image has an offx or offy, then it means it is partially outside the screen, so its offx2/offy2 is already accounted for.
* term: fix display-charset not being interpretedbptato2024-12-261-5/+5
| | | | Also fixes the -O option.
* Optimize some Option[string] outbptato2024-12-261-4/+5
| | | | toJS is generally more efficient
* env: reflect user agent header in userAgentbptato2024-12-261-0/+1
|
* Misc character display fixesbptato2024-12-225-21/+11
| | | | | | | | | | | | | | | | | | * fix luwrap comparison function * strip high unicode controls in term/pager * use wcwidth in dirlist2html * remove combining category from strwidth * remove unused "disallowed" field from lineedit My initial goal with switching to wcwidth in dirlist2html was just to get rid of the outdated combining map in charwidth_gen. Then I realized that layout will normalize those out anyway, so we don't actually have to deal with them anywhere. Also, I found a few bugs in the process; high unicode control chars not being stripped out was a particularly bad one, as it allows for pages to mess up the terminal output. (Easiest way to replicate: just open a random binary file without this patch.)
* Add historybptato2024-12-173-43/+73
| | | | | It's still missing a "color visited links" feature, but it's better than nothing.
* buffer: only set new buffer's target on clonebptato2024-12-202-6/+8
|
* response: automatically resume before closebptato2024-12-191-3/+0
| | | | doing it manually is too error prone
* pager: fix short error messages not being printedbptato2024-12-191-1/+1
|
* pager: fix crash on gotoURL with save + mailcapbptato2024-12-191-1/+2
| | | | this broke saveImage
* pager: do not crash browser when deleting a crashed bufferbptato2024-12-181-1/+5
|
* pager, select: hide menu if right click ends outsidebptato2024-12-182-45/+60
| | | | | | | | Inspired by Dillo. (Just the movement mechanism; Dillo doesn't hide the context menu on double click, but we still do.) Also, we now disable highlighting of menu items when the mouse is hovering outside.
* cookie: small bugfix, misc refactoringbptato2024-12-171-9/+2
| | | | | Always override Expires with Max-Age, but never the other way (as per spec.)
* default(T) -> T.default, add some strict defsbptato2024-12-171-2/+2
|
* pager: try to always display the error messagebptato2024-12-171-1/+11
| | | | | Whether this works or not still depends on many variables, but it should be enough in most cases.
* select: fix height definitionbptato2024-12-151-13/+10
| | | | | now I sort of understand how it works. basically maxh and maxw represent the inner area occupied by the widget at any time.
* chabookmark fixes & improvementsbptato2024-12-151-1/+4
| | | | | | | | * correct action on M-b * add external.bookmark option * move openFileExpand functionality into unquote * add menu items * update docs
* client: document readFile, writeFile; add getenv, setenvbptato2024-12-141-7/+32
| | | | | | | | Both are quite useful. readFile and writeFile got a small makeover in error handling; in particular, readFile now returns null instead of the empty string when the file is missing and writeFile throws a TypeError on I/O errors.
* term: allow ANSI fgcolor + bgcolorbptato2024-12-131-6/+2
| | | | | | | | Not quite sure why I had assumed that this is broken. At least on XTerm, the previous behavior definitely was, e.g. with a white-ish background and white foreground it would end up correcting the contrast to purple even with black CSS color (thus breaking the "no fgcolor with bgcolor" assumption anyway.)
* container, cookie: simplify extractCookies, cookieJar.addbptato2024-12-131-4/+3
|