about summary refs log tree commit diff stats
path: root/src/config
Commit message (Collapse)AuthorAgeFilesLines
...
* regex: re-work compileSearchRegexbptato2024-02-171-5/+29
| | | | | | | I've gotten tired of not being able to search for forward slashes. Now it works like in vim, and you can also set default ignore case in the config.
* term: fix coloring messbptato2024-02-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Until now, the config file required manual adjustment for the output to look bearable on terminals colored differently than {bgcolor: black, fgcolor: white}. Also, it only detected RGB when COLORTERM was set, but this is not done by most (any?) terminal emulators (sad). To improve upon the situation, we now query the terminal for some attributes on startup: * OSC(10/11, ?) -> get the terminal's bg/fgcolor * DCS(+, q, 524742) -> XTGETTCAP for the "RGB" capability (only supported by a few terminals, but better than nothing) * Primary device attributes -> check if ANSI colors are supported, also make sure we don't block indefinitely even if the previous queries fail If primary device attributes does not return anything, we hang until the user types something, then notify the user that something went wrong, and tell them how to fix it. Seems like an OK fallback. (The DA1 idea comes from notcurses; since this is implemented by pretty much every terminal emulator, we don't have to rely on slow timing hacks to skip non-supported queries.)
* Various refactorings & fixesbptato2024-02-141-4/+3
| | | | | | | | * disallow Stream interface usage on non-blocking PosixStreams * do not read estream of forkserver byte-by-byte (it's slow) * do not call writeData with a zero len in formdata * do not quote numbers in mailcap quoteFile * remove some unused stuff
* Remove CLONE BufferSource; cache document sources in tmpdirbptato2024-02-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | At last all BufferSources are unified. To achieve the same effect as the previous CLONE source type, we now use the "fromcache" flag in Request. This *forces* the document to be streamed from the disk; if the file no longer exists for some reason, an error is returned (i.e. the document is not re-downloaded). For a document to be cached, it has to be the main document of the buffer (i.e. no additional resources requested with fetch()), and also not an x-htmloutput HTML file (for those, the original source is saved). The result is that toggleSource now always returns the actual source for e.g. markdown files, not the HTML-transformed version. Also, it is now possible to view the source of a document that is still being downloaded. buffer.sstream has almost been eliminated; it still exists, but only as a pseudo-buffer to interface with EncoderStream and DecoderStream. It no longer holds the entire source of a buffer at any point, and is cleared as soon as the buffer is completely loaded.
* fix rejection of readFromFd urlsbptato2024-02-111-1/+1
|
* toml: misc refactoringsbptato2024-01-301-71/+40
|
* toml: allow EOF in values with laxnamesbptato2024-01-301-0/+2
| | | | Useful for clearing settings with -o
* config: append */* rule instead of prependingbptato2024-01-302-11/+3
| | | | | | + actually use the result. Fixes default converters when no external mailcap exists.
* Add default md2html converterbptato2024-01-301-14/+21
|
* mimetypes: simplify parseMimeTypesbptato2024-01-271-16/+9
| | | | | * use functions like until * do not call atEnd for every line, use boolean readLine instead
* cgi: fix broken libexec path env variablebptato2024-01-262-2/+3
|
* Add urlenc, urldec; fix a URL encoding bug; improve trans.cgibptato2024-01-081-1/+1
| | | | | | | | | | * Fix incorrect internal definition of the fragment percent-encode set * urlenc, urldec: these are simple utility programs mainly for use with shell local CGI scripts. (Sadly the printf + xargs solution is not portable.) * Pass libexec directory as an env var to local CGI scripts * Update trans.cgi to use urldec and add an example for combining it with selections
* Use std/* imports everywherebptato2024-01-074-15/+15
|
* config/toml: fix consumeComment overriding nodesbptato2023-12-151-1/+2
| | | | | We must first check if there is really no node to attach the comment to...
* config: allow overriding default prepended schemebptato2023-12-151-0/+1
|
* config: do not override user-defined urimethodmapbptato2023-12-141-1/+2
| | | | UMM resolution takes the first entry.
* chapath: add missing returnbptato2023-12-141-1/+2
|
* Various fixesbptato2023-12-131-1/+1
| | | | | | | * Makefile: fix parallel build, add new binaries to install target * twtstr: split out libunicode-related stuff to luwrap * config: quote default gopher2html URL env var for unquote * adapter/: get rid of types/url dependency, use CURL url in all cases
* Move gopher to adapter/bptato2023-12-121-10/+1
| | | | Also, move default urimethodmap config to res.
* Move out ftp: protocol; fix some local CGI bugsbptato2023-12-121-0/+3
|
* Move out file: protocol handling to adapter/bptato2023-12-121-1/+2
|
* local CGI improvements, move data: to cgi-binbptato2023-12-121-0/+1
| | | | error codes are WIP, not final yet...
* local CGI: add mapped URI env vars; move about: to adaptersbptato2023-12-121-0/+1
| | | | | | | | | | | | | | | * Add MAPPED_URI_* as environment variables when a request is coming from urimethodmap It costs us compatibility with w3m, but it seems to be a massive improvement over smuggling in the URL as a query string and then writing an ad-hoc parser for every single urimethodmap script. The variables are set for every urimethodmap request, to avoid accidental leaking of global environment variables. * Move about: to adapters (an obvious improvement over the previous solution)
* Add support for gemini by default, update readmebptato2023-12-101-6/+17
| | | | | No need to leave gemini support in the bonus folder. Still TODO: proxy support.
* mailcap: add $MAILCAP_URLbptato2023-12-101-1/+1
| | | | | | This is better than %u as it is backwards compatible (i.e. does not rely on other user agents doing whatever upon encountering an unknown substitution template.)
* Separate gopher conversion from main binarybptato2023-12-102-1/+18
| | | | | | | | | | | | | | | | | | | | | Now we use a (much simplified) gopher2html binary in libexec, instead of converting gopher directories to HTML in loader/gopher. This has two advantages: * Less ugly conversion logic in the loader module; we can just convert the file line by line. (The previous converter also had some correctness issues, that is fixed now as well.) * If the user desires, they can replace the gopher converter with another binary using the mailcap mechanism. The disadvantages are: * For now, source display is broken. This is a problem with all mailcap filters in general, and should be fixed in the future. (That said, the previous version also only displayed the converted HTML source, which was not really useful anyway.) * The proper directory structure is required for this to work; OTOH plenty of work has been done so that this is as frictionless as possible, so it should not really be a problem.
* Enable finger protocol by defaultbptato2023-12-101-1/+5
| | | | | | * Add a default urimethodmap that points finger: to cha-finger * Install cha-finger to /usr/local/libexec/cha/cgi-bin by default * cha-finger: use ALL_PROXY if given, die if curl is not installed
* config: better path handling; fix array parsing bugbptato2023-12-103-17/+320
| | | | | | | | | * Paths are now parsed through an unified code path with some useful additions like environment variable substitution. * Fix a bug in parseConfigValue where strings would be appended to existing arrays (and not override them). * Fix beforeLast calling afterLast for some reason. * Add a default CGI directory.
* pager: add marksbptato2023-12-091-0/+1
| | | | | Default is vi-style, but w3m-style marks work as well; see bonus/w3m.toml.
* pager, container: add text selection/copyingbptato2023-12-031-0/+2
| | | | | | | | | | * Add select & copy selection functionality to container * Fix bug in generateSwapOutput where output could be misplaced because of zero-width cells * Add fromJSPromise, call runJSJobs in every iteration of the headed event loop * "await" pager actions that output a promise * Change default view source keybinding to `\'
* config: add bare aliases for "8bit", "24bit"bptato2023-11-261-2/+2
| | | | | | | | | | | Without this, setting color-mode using -o required quoting the values, and then shell-quoting the quotes themselves (cha -o 'display-color-mode="24bit"'). Instead of more special casing in the TOML parser, we just add aliases for these enum values that can be parsed using TOML bare string rules. So now this works: cha -o display.color-mode=true-color
* twtstr: remove tolower, isWhitespacebptato2023-11-202-5/+6
| | | | | | | | * tolower: strutils toLowerAscii is good enough for the cases where we need it. Also, it's easy to confuse with unicode toLower and vice versa. * isWhitespace: in AsciiWhitespace is more idiomatic. Also has a naming collision with unicode toLower.
* Add -C optionbptato2023-10-271-6/+9
|
* toml: fix dquote escapingbptato2023-10-261-1/+1
|
* reduce new() usagebptato2023-10-251-2/+2
|
* Add jspropnames, CSSStyleDeclaration stubbptato2023-10-251-1/+10
|
* container: add cursorNthLink, cursorRevNthLinkbptato2023-10-141-1/+1
|
* config: fix `include` namingbptato2023-10-091-4/+4
| | | | use what is documented
* Add w3m-cgi-compat optionbptato2023-10-011-1/+3
|
* Use twtstr.join everywherebptato2023-10-011-2/+2
|
* Add urimethodmap supportbptato2023-09-301-19/+31
| | | | yay
* loader: add local-cgibptato2023-09-301-1/+4
| | | | | | | | | | | Add w3m-style local CGI support. It is not quite as powerful as w3m's local CGI, because it lacks an equivalent to W3m-control. Not sure if it's worth adding; we certainly shouldn't allow passing JS in headers, but a custom language for headers does not sound like a great idea either... eh, idk. also, TODO add multipart
* toml: fix bug in multiline string parsingbptato2023-09-251-0/+5
|
* config: add missing \nbptato2023-09-201-1/+1
|
* Accept bare strings in -o, fix -o with missing newlinebptato2023-09-202-14/+80
| | | | | | | | * Bare strings are now allowed when specifying config options through -o. * Fix a bug where options specified with -o would be disregarded unless a newline was included. * (Also, add a TOML stringifier routine for debugging.)
* mailcap: fix regressionbptato2023-09-161-1/+1
| | | | not that this code path is ever executed
* mailcap: unquoteCommand improvements/fixesbptato2023-09-161-34/+57
| | | | | | | | * quote substituted URLs, mime types and named attributes too * change quote state: now we use a stack of quote states, new states are pushed/popped when a process substitution is encountered * fix named attribute state (it was incomplete) * remove superfluous tolower statements
* mailcap: allow whitespace after subtypebptato2023-09-161-1/+1
|
* move around more modulesbptato2023-09-143-5/+5
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* toml: fix underscore number separatorbptato2023-09-131-1/+1
| | | | | | Underscores should not be added to repr. Also, was_num should only start as true if the first character is a number, and must be true after the while loop.