about summary refs log tree commit diff stats
path: root/src/config
Commit message (Collapse)AuthorAgeFilesLines
* config: fix compilation on older Nim versionsbptato2025-01-241-1/+2
|
* Add annotations for move semanticsbptato2025-01-222-3/+3
| | | | | | | | | Supposedly they aren't broken in refc after 2.0.0, so we can do this now that 1.6.14 is dropped. I've confirmed lent to work as advertised; it indeed reduces copies. sink doesn't seem to help much, but I guess it will be useful once we switch to ORC.
* config: expandTilde -> expandPathbptato2025-01-191-2/+2
|
* cookie: improve Expires parsingbptato2025-01-131-52/+32
|
* config: switch to camel casebptato2025-01-131-56/+56
| | | | | | We already need a camel -> kebab converter anyway. Unfortunately this also changes JS binding names, so it's a breaking change. Oh well.
* cssvalues: reduce CSSValues sizebptato2025-01-121-2/+2
| | | | | | | | | | | | | | | | * switch from float64 -> float32; other browsers use 32-bit floats too * specify integer size as 32-bit * use NetworkBitmap for background-image value (currently just an invalid dummy value) * remove "none" property & value types CSSValue's payload is always one word (plus another for the type tag). CSSValues keeps its size, but no longer has to heap-alloc + refcount word-sized CSSValues. (On 32-bit systems, CSSValues might actually be larger than before, but I expect it's still a net benefit with the removal of refcounting and the switch to 32-bit floats.)
* Fix some strict defsbptato2025-01-122-2/+3
|
* config: deprecate 8bit, 24bit color-mode aliasesbptato2025-01-011-0/+2
|
* cookie: add persistent cookies, misc refactoring/fixesbptato2024-12-292-3/+457
| | | | | | | | | | | | | 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.
* history: remove comment parsing, fix fd leakbptato2024-12-291-8/+7
|
* cookie: remove broken third-party-cookie optionbptato2024-12-271-1/+0
| | | | | | | | | 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.)
* CHA_CONFIG_DIR -> CHA_DIRbptato2024-12-271-1/+6
| | | | | | | It isn't really limited to config. It just happens to be in XDG_CONFIG_HOME because XDG basedirs suck. (W3M_DIR works similarly.)
* Optimize some Option[string] outbptato2024-12-261-3/+4
| | | | toJS is generally more efficient
* buffer: add "app" scripting modebptato2024-12-261-2/+16
| | | | | | | | | | For APIs that cannot be implemented in a privacy-friendly manner. As a start, I've added accurate screen size queries; getComputedStyle, getBoundingClientRect, etc. should follow. (We have a harmless getComputedStyle already, but it's broken.) Probably, things like JS-based scroll belong in here too, but I'm not sure yet. (Perhaps autofocus should be reused instead?)
* history: fix entry droppingbptato2024-12-221-0/+2
| | | | | next's pointer backwards must be updated too, or it the dropped ref will be erroneously displayed on the history screen.
* config: fix overriding substring bindingsbptato2024-12-222-10/+6
| | | | | | | | | | | | | | | | | It is unfortunately a breaking change, but the existing behavior was practically broken anyway. The only issue I can think of is that keybindings like `yy' now override `y', which previously worked because y (regrettably) calls feedNext. But those should be added to the default config anyway. (If a user really desires the old behavior, they can just re-bind y to cmd.buffer.copySelection after their own custom bindings. Config values are now stored in an ordered table, so this should work.) I've left the undocumented JS setter as it is, because the old behavior seems more useful there. (Perhaps there should be a separate function that behaves like toml?)
* Add historybptato2024-12-172-0/+131
| | | | | It's still missing a "color visited links" feature, but it's better than nothing.
* default(T) -> T.default, add some strict defsbptato2024-12-172-4/+4
|
* chabookmark fixes & improvementsbptato2024-12-152-24/+20
| | | | | | | | * correct action on M-b * add external.bookmark option * move openFileExpand functionality into unquote * add menu items * update docs
* mimetypes: use cmpIgnoreCase for JS typesbptato2024-12-121-1/+1
|
* mailcap: misc bugfixes & cleanupbptato2024-12-121-63/+43
| | | | | | | | | | | * fix broken newline skipping logic in consume * remove reconsume char buffer (it's not needed with mmap) * pass on backslash to unquote - this makes backslashes in unquoteCommand work as expected (since it parses the command again) * close ps on write failure * add entries even before parse error - this drops a pointless copy of mailcaps. (we could theoretically just use old behavior without the copy, but this feels more intuitive anyway)
* pager: do not prompt for text typesbptato2024-12-111-0/+3
| | | | we hadn't before, and it's annoying when using cha as a pager
* pager, mailcap: misc fixes, add prompt for global mailcapbptato2024-12-112-54/+111
| | | | | | | | | | | | | | | | | | | | | | | | In the past, Chawan would read global mailcap (/etc/mailcap, ...) too, but every now and then that would run entries that I didn't even know existed and definitely didn't intend to run. So I changed it to only use ~/.mailcap, but this meant users now had to add mailcap entries for every single mime type. At some point I also changed application/octet-stream to always save to disk, which is usually nice except when a text file is misrecognized as binary. Often times I just want to decide myself what to do. So now there are two layers. First, the global mailcap files (path as per RFC) prompt before executing. Then there is ~/.chawan/auto.mailcap (or ~/.config/chawan/auto.mailcap) which runs entries automatically. If you press shift before selecting an option in the prompt, the corresponding entry gets copied to auto.mailcap. It's also possible to type a new entry on the fly. Overall I think it's quite convenient. One unfortunate side effect is that existing users will have to migrate their entries to auto.mailcap, or redefine external.auto-mailcap to e.g. ~/.mailcap, but this seems acceptable.
* Fix casingbptato2024-12-051-3/+3
|
* config, mailcap: remove std/streams dependency, specialize mmapbptato2024-12-052-76/+74
| | | | | | | | | | * use PosixStream/mmap for mailcap reading too; this finally lets us get rid of std/streams in the entire codebase * split up recvDataLoopOrMmap into 3 functions: one that can fall back to recvAll, one that falls back to recvDataLoop, and one that does not fall back to anything * use MAP_PRIVATE in mmap for read (we don't care if changes are propagated, as we do no changes to cached files)
* mimetypes: refactor, use mime.types for inline image extensionsbptato2024-12-052-44/+94
| | | | | | | | | | | | * 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.
* toml, config: skip copying buf, use PosixStreambptato2024-12-032-115/+124
| | | | | | | one std/streams less I used mmap for reading the user config. It shouldn't matter in any realistically sized config, but who knows.
* config: add copy-cmd, paste-cmdbptato2024-12-011-0/+2
| | | | ref. https://todo.sr.ht/~bptato/chawan/29
* twtstr: add mypairsbptato2024-11-281-1/+1
| | | | | This couldn't get into system.nim for technical reasons, but it's still pretty useful when iterating over non-mutable openArrays.
* mailcap: add x-needsstyle extension fieldbptato2024-11-271-0/+1
| | | | | | | Useful when an x-htmloutput handler needs styling for the HTML output to be formatted correctly (as a sort of pseudo-ua style sheet). ref. https://todo.sr.ht/~bptato/chawan/28
* config.configdir -> config.dirbptato2024-11-261-1/+1
|
* loader/* -> serverbptato2024-11-241-1/+1
| | | | one less mystery
* Update monoucha, fix some JS testsbptato2024-11-181-1/+1
|
* js: reorganize modules, update docsbptato2024-11-152-2/+86
| | | | | | | most of it has already been moved to monoucha, and the rest fits better in other directories. also, move urimethodmap to config
* chapath: fix a few more bugs, simplifybptato2024-11-131-64/+30
| | | | | | | | | * fix incorrect :- behavior * merge non-standard '${%VARIABLE}' syntax with regular syntax; now all internal variables are exported to the environment, so the behavior should be equivalent. * handle terminal symbol appropriately in all states * deny numeric curly substitutions
* config: resolve download-dir as path, update docsbptato2024-11-131-1/+1
| | | | | | | Turns out it's more useful to have env vars in the variable than to allow incomplete path names. Also, fix the disappearing backslash issue in docs.
* config.toml: respect TMPDIRbptato2024-11-121-6/+10
| | | | | also, fix a bug in the chapath parser so that param expansion actually works
* utils, types: merge some modulesbptato2024-11-031-1/+0
| | | | | * line, vector, matrix -> path * twtuni, charcategory -> twtstr
* config: fix relative includes with -Cbptato2024-10-311-2/+3
|
* config: refactor, accept more possible config dirsbptato2024-10-281-71/+35
| | | | | | | | | | | | | | | | | | | | | 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.)
* pager: refactor mailcap, console; misc fixesbptato2024-10-141-8/+7
| | | | | | | | | * 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-131-5/+0
| | | | | * remove unused DateTime toml type * add parseIntP for pointer-size int parsing
* gmifetch: rewrite in Nimbptato2024-10-122-45/+32
| | | | | | | | | | 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.
* toml: fix casingbptato2024-09-211-12/+12
|
* dom: add forms, elements getter + misc fixesbptato2024-09-171-3/+0
| | | | | | | | | | | | * 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
* config: add display.sixel-colorsbptato2024-09-101-0/+1
|
* utils: add twtunibptato2024-09-081-4/+4
| | | | | | | | | | | | | | | | | | | 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.
* mailcap: fix weird error handlingbptato2024-08-131-19/+13
| | | | | | * don't accept flags specified as named fields * don't error out on named field specified as flag * allow trailing whitespace on named fields & flags
* mailcap: various fixesbptato2024-08-111-38/+27
| | | | | | * parse last line even if it doesn't end with LF * parse flags & named fields case-insensitively * update naming
* dom: remove generic JS bindingsbptato2024-08-111-2/+2
| | | | Dispatch manually with fromJS instead.