about summary refs log tree commit diff stats
path: root/src/config/toml.nim
Commit message (Collapse)AuthorAgeFilesLines
* js: fix various leaks etc.bptato2024-05-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we didn't actually free the main JS runtime, probably because you can't do this without first waiting for JS to unwind the stack. (This has the unfortunate effect that code now *can* run after quit(). TODO: find a fix for this.) This isn't a huge problem per se, we only have one of these and the OS can clean it up. However, it also disabled the JS_FreeRuntime leak check, which resulted in sieve-like behavior (manual refcounting is a pain). So now we choose the other tradeoff: quit no longer runs exitnow, but it waits for the event loop to run to the end and only then exits the browser. Then, before exit we free the JS context & runtime, and also all JS values allocated by config. Fixes: * fix `ad' flag not being set for just one siteconf/omnirule * fix various leaks (since leak check is enabled now) * use ptr UncheckedArray[JSValue] for QJS bindings that take an array * allow JSAtom in jsgetprop etc., also disallow int types other than uint32 * do not set a destructor for globals
* url, twtstr: correct number parsingbptato2024-04-181-10/+7
| | | | | | | | | * do not use std's parse*Int; they accept weird stuff that we do not want to accept in any case * fix bug in parseHost where a parseIpv4 failure would result in an empty host * do not use isDigit, isAlphaAscii * improve parse*IntImpl error handling
* Update code stylebptato2024-04-171-12/+11
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* config: improve input systembptato2024-03-261-0/+3
| | | | as described in <https://todo.sr.ht/~bptato/chawan/6>
* config, toml: rename enumsbptato2024-03-261-54/+54
|
* config: clean up/simplifybptato2024-03-171-1/+1
| | | | | | | | | * Parse the default config at runtime. There's no significant performance difference, but this makes it much less painful to write config code. * Add better error reporting * Make fromJS2 easier to use * Unquote ChaPaths while parsing config
* loader: rework process modelbptato2024-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally we had several loader processes so that the loader did not need asynchronity for loading several buffers at once. Since then, the scope of what loader does has been reduced significantly, and with that loader has become mostly asynchronous. This patch finishes the above work as follows: * We only fork a single loader process for the browser. It is a waste of resources to do otherwise, and would have made future work on a download manager very difficult. * loader becomes (almost) fully async. Now the only sync part is a) processing commands and b) waiting for clients to consume responses. b) is a bit more problematic than a), but should not cause problems unless some other horrible bug exists in a client. (TODO: make it fully async.) This gives us a noticable improvement in CSS loading speed, since all resources can now be queried at once (even before the previous ones are connected). * Buffers now only get processes when the *connection* is finished. So headers, status code, etc. are handled by the client, and the buffer is forked when the loader starts streaming the response body. As a result, mailcap entries can simply dup2 the first UNIX domain socket connection as their stdin. This allows us to remove the ugly (and slow) `canredir' hack, which required us to send file handles on a tour accross the entire codebase. * The "cache" has been reworked somewhat: - Since canredir is gone, buffer-level requests usually start in a suspended state, and are explicitly resumed only after the client could decide whether it wants to cache the response. - Instead of a flag on Request and the URL as the cache key, we now use a global counter and the special `cache:' scheme. * misc fixes: referer_from is now actually respected by buffers (not just the pager), load info display should work slightly better, etc.
* toml: misc refactoringsbptato2024-01-301-71/+40
|
* toml: allow EOF in values with laxnamesbptato2024-01-301-0/+2
| | | | Useful for clearing settings with -o
* Use std/* imports everywherebptato2024-01-071-5/+5
|
* 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: better path handling; fix array parsing bugbptato2023-12-101-0/+1
| | | | | | | | | * 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.
* toml: fix dquote escapingbptato2023-10-261-1/+1
|
* Use twtstr.join everywherebptato2023-10-011-2/+2
|
* toml: fix bug in multiline string parsingbptato2023-09-251-0/+5
|
* Accept bare strings in -o, fix -o with missing newlinebptato2023-09-201-6/+64
| | | | | | | | * 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.)
* move around more modulesbptato2023-09-141-1/+1
| | | | | | | | | | * 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.
* fix compile errorbptato2023-09-131-1/+1
| | | | aaaaaa
* toml: simplifybptato2023-09-131-4/+2
| | | | I meant to put this in the previous commit
* toml: fix bugs in parseNumberbptato2023-09-131-12/+15
| | | | | The input c was not considered, so positive/negative/non-decimal number parsing was incorrect.
* toml: do not stream inputbptato2023-09-131-4/+1
| | | | | | | | | It is more efficient to just read the whole file into memory than to... read the whole file into memory, but one piece at a time, while calling the rather slow readLine function for each chunk. (Also, configuration files are rather small, so even a proper streaming implementation would be pointless.)
* toml: add support for hex/octal numbersbptato2023-09-131-9/+45
|
* toml: complain more on unexpected EOFbptato2023-09-071-2/+3
|
* toml: remove unused importbptato2023-09-071-1/+0
|
* toml: fix newline counting in multiline stringsbptato2023-09-071-2/+4
| | | | also, replace the todo comment
* config: fix overriding default headersbptato2023-08-261-0/+2
| | | | | * simplify ActionMap reading * introduce separate case for Table
* toml: various fixesbptato2023-08-261-8/+11
| | | | | * Increase line counter on newline in array & inline table parsing * Fix broken inline table parsing
* toml: fix quotation chars in multiline stringsbptato2023-08-191-7/+9
|
* Fixes & workarounds to compile on Nim 2.0.0bptato2023-08-011-1/+1
| | | | | | | | | | | | | | * Import punycode, as it has been removed from stdlib. * Fix some syntax errors * Apparently you can no longer compare distinct pointers with nil. Add explicit comparisons with typeof(nil) instead. * htmlparser: rename _ to other, as semantics of _ have changed. (Quite a shame, it looked better with _. Oh well.) * Explicitly specify mm:refc, as the browser OOMs with orc for some reason. Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8. (<1.6.8 it's broken & wontfix.)
* Use utils/opt in toml parserbptato2023-06-181-135/+138
|
* Add support for canvas and multipartbptato2023-06-051-1/+3
| | | | | | | | | | | | | | | Quite incomplete canvas implementation. Crucially, the layout engine can't do much with whatever is drawn because it doesn't support images yet. I've re-introduced multipart as well, with the FormData API. For the append function I've also introduced a hack to the JS binding generator that allows requesting the JSContext pointer in nim procs. Really I should just fix the union generator thing and add support for overloading. In conclusion, for now the only thing canvas can be used for is exporting it as PNG and uploading it somewhere. Also, we now have PNG encoding and decoding too. (Now if only we had sixels as well...)
* Refactor config, add charset optsbptato2023-05-161-21/+25
| | | | Only document-charset supported for now.
* Update config and config docsbptato2022-12-131-2/+55
|
* Add all sorts of config options and cookiesbptato2022-12-131-0/+1
|
* Add siteconf, fix lineedit bugsbptato2022-11-291-9/+52
| | | | | | This enables rule-based dynamic url rewriting. Also, lineedit is a bit less broken now (though it's still less than ideal.)
* Improve status messages, fix regressions, etcbptato2022-11-251-1/+0
|
* Fix user style regression, add minimum-contrastbptato2022-11-251-3/+4
|
* More configuration optionsbptato2021-12-191-3/+5
|
* Change configuration format to tomlbptato2021-12-051-0/+406