about summary refs log tree commit diff stats
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* img: add nanosvgbptato2024-12-191-2/+3
| | | | | | | | | | | | | | | | | | Only for SVG in image tags for now. Plus it comes with NanoSVG's limitations, i.e. no text. Still, better than nothing. I've gone through open tickets and PRs at upstream to check for known security issues. As a recurring theme I found that parseTransform fails to check the result of parseTransformArgs, so I fixed and refactored that part. (Probably not a security issue, but still UB.) Also, I've added a fix for an OOB read in parseColorRGB. Future directions: * replace nanosvgrast with our own rasterizer in canvas (will have to be extended somewhat...) * add text rendering (with unifont, which canvas already includes)
* Add chabookmark scriptbptato2024-12-141-1/+2
| | | | | | | | | | Finally it's done. It's basically w3mbookmark, but using Markdown instead of HTML and in POSIX shell instead of C. As a bonus, it can also (sort of) import w3mbookmark's output. Well, at least it worked on my bookmark file, but there is a known issue with bracket escaping... if it goes wrong, it's simple enough to edit it manually :P
* md2html: another list bugfix, add a testbptato2024-12-041-3/+7
|
* chapath: fix a few more bugs, simplifybptato2024-11-131-2/+2
| | | | | | | | | * 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
* res: remove unicode tablesbptato2024-11-131-11/+11
| | | | | mainly to avoid licensing issues and to skip an unnecessary build step when the git repo is cloned
* Fix some C warnings, more makefile vars, etc.bptato2024-11-081-2/+11
| | | | | | | * add some more env vars to makefile * remove fpermissive from GCC builds * update Monoucha * fix borked seccomp filter length safety check (ugh)
* gopher: rewrite in shellbptato2024-11-051-3/+2
| | | | | | also, make gopher2html more lenient, and add some functioning error handling in our nc clone. (other scripts still have to be updated to benefit from this)
* utils, types: merge some modulesbptato2024-11-031-4/+2
| | | | | * line, vector, matrix -> path * twtuni, charcategory -> twtstr
* protocol: sandbox more network processes + fix some gemini bugsbptato2024-11-021-4/+4
|
* Makefile: check for cd return statusbptato2024-11-011-7/+7
|
* sftp: switch to libssh2bptato2024-10-261-3/+2
| | | | | | | | | | | | | | | | | | | Just to remove a level of indirection; the libcurl API is annoying to deal with when you don't even need asynchrony. It doesn't change anything in actual dependencies, because libcurl uses libssh2 too - however, now only http depends on libcurl, which makes reducing it to an optional module feasible. Still, I've listed libssh2 (along with OpenSSL - long overdue) in the readme just in case some OS doesn't pull in the headers by default as a libcurl dependency. Also, fix some bugs: * fix missing CWD command in FTP * resolve directories even if they don't end in / * allow links without -> in dirlist
* sandbox: replace libseccomp with chaseccompbptato2024-10-231-7/+15
| | | | | | | | | | | | | | | 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.
* dynstream: refactorbptato2024-10-201-1/+1
| | | | | | | | | | * 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
* lcgi: support HTTP proxybptato2024-10-131-0/+1
| | | | | | | not quite sure this approach is right, because it still won't work with HTTPS without linking everything with OpenSSL... maybe a socks5 bridge through a UNIX socket would work better?
* Add `nc' tool & adjust finger/spartan to use itbptato2024-10-121-7/+10
| | | | | | | | | Simple netcat clone, useful for portable scripts. Especially because some netcats will close the connection as soon as I close stdin... this one only quits when either stdout or the socket refuses new data. Also, it uses our standard TCP connection routine, meaning it respects ALL_PROXY. (i.e. now spartan works with socks5 too)
* dirlist: separate out into dirlist2htmlbptato2024-10-121-4/+7
| | | | | Now the dirlist parser lives inside dirlist2html, and the file protocol just emulates FTP LIST.
* gmifetch: rewrite in Nimbptato2024-10-121-8/+6
| | | | | | | | | | 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.
* http: remove twtstr dependencybptato2024-10-011-8/+8
|
* ftp: remove libcurl dependencybptato2024-10-011-2/+3
| | | | | | | | | | | | | This splits out sftp into a separate binary that *does* depend on libcurl. However, ftp now uses the same socket code as gopher. ftps is dropped, because I've never even tested it. Maybe I'll add it back when we have working OpenSSL bindings. This is still "doing the easy part first", now I have no clue how to handle sftp because my initial plan ("just use the sftp binary") doesn't work - sftp batch mode doesn't accept passwords. libssh2 remains the sole candidate, but that's what libcurl wraps anyway.
* gopher: do not depend on libcurlbptato2024-09-281-3/+2
| | | | | | | | I'm thinking of making libcurl entirely optional; let's start with the easiest part. I've added a SOCKS5 client for ALL_PROXY support; I know curl supported others too, but whatever.
* loader: clean up connecterrorbptato2024-09-281-6/+4
| | | | | | * allow string values for public errors * remove unused errors * update naming
* Replace std/selectors with pollbptato2024-09-231-1/+1
| | | | | | | | | | | | std/selectors uses OS-specific selector APIs, which sounds good in theory (faster than poll!), but sucks for portability in practice. Sure, you can fix portability bugs, but who knows how many there are on untested platforms... poll is standard, so if it works on one computer it should work on all other ones. (I hope.) As a bonus, I rewrote the timeout API for poll, which incidentally fixes setTimeout across forks. Also, SIGWINCH should now work on all platforms (as we self-pipe instead of signalfd/kqueue magic).
* loader: mmap intermediate image files, misc refactoringbptato2024-09-221-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | * refactor parseHeader * optimize response blob() * add direct "to cache" mode for loader requests which sets stdout to a file, and use it for image processing * move image resizing into a separate process * mmap cache files in between processing steps when possible At last, resize is no longer a part of image decoding. Also, it feels much nicer to keep encoded image data in the same cache as everything else. The mmap operations *should* be more efficient than copying the whole RGBA data through a pipe. In practice, it only makes a difference for loading (well, now just mmapping) the encoded image into the pager, where it singlehandedly speeds up image display by 10x on my test image. For the other steps, the unfortunate fact that "tocache" must delay the next fork/exec in the pipeline until the entire image is processed seems to equal out any wins we might have gotten from skipping a single raw RGBA copy. I have tried moving the delay before the exec (it's possible with yet another pipe), but it didn't help much and made the code much uglier. (Not that tocache didn't, but I can live with this...)
* Refactor img/*bptato2024-09-151-3/+3
| | | | | I've moved most image logic to adapter, so it doesn't really make sense to have this subdir anymore.
* Update to Unicode 16.0.0bptato2024-09-141-1/+1
|
* utils: add twtunibptato2024-09-081-1/+1
| | | | | | | | | | | | | | | | | | | 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.
* md2html: code, pre, inline fixesbptato2024-09-071-0/+1
|
* sixel, stbi, sandbox: fix fstat sandbox violationbptato2024-09-041-2/+2
| | | | | | | Until recently, glibc used to implement it as fstatat. So don't trap for fstatat (and for consistency, fstat), but return EPERM. Just to be sure, rewrite sixel & stbi to never call fread.
* doc: update manpagesbptato2024-09-021-1/+2
|
* canvas: make sure we don't link to QJSbptato2024-09-011-4/+3
|
* canvas: move to separate CGI scriptbptato2024-09-011-2/+9
| | | | | | | | | | * stream: and passFd is now client-based, and accessible for buffers * Bitmap's width & height is now int, not uint64 * no more non-network Bitmap special case in the pager for canvas I just shoehorned it into the static image model, so it still doesn't render changes after page load. But at least now it doesn't crash the browser.
* makefile: misc fixesbptato2024-08-241-0/+4
|
* sixel: break out into a separate cgi scriptbptato2024-08-241-2/+2
| | | | | | | | This caches sixel output. Works best when the line height is a multiple of 6px, but should still be faster than the previous solution everywhere else too (simply by virtue of encoding separate images in parallel). Next step: actual color quantization
* xhr: more progressbptato2024-08-151-2/+13
| | | | | | | | | | * add responseText, response * add net tests -> currently sync XHR only; should find a way to do async tests... * update monoucha -> simplified & updated some related code that no longer worked properly
* urldec: merge into urlencbptato2024-08-111-6/+12
| | | | also, move the ln command to make all
* loader: move back data URL handlingbptato2024-08-031-8/+7
| | | | | | | data URIs can get megabytes long; however, you can only stuff so many bytes into the envp. (This was thwarting my efforts to view pandoc- generated standalone HTML in Chawan.) So put `data:' back into the loader process.
* Update submodulesbptato2024-07-281-1/+1
|
* img: add webp decoder (jebp)bptato2024-07-201-2/+5
| | | | | | | | | | It works fine AFAICT, just missing VP8 deblocking filters, so lossy WebP images don't look great. I have extended the API a bit to allow reading from stdin, not just paths. Otherwise, it's the same as matanui159/jebp. TODO: add loop filters
* Makefile: add distcleanbptato2024-07-191-0/+4
|
* fix compilation on 2.0.8bptato2024-07-101-1/+0
|
* makefile: clean upbptato2024-07-051-135/+56
|
* img, makefile: remove png, update uninstall targetbptato2024-07-031-8/+5
|
* img: use stb_image, drop zlib as dependencybptato2024-06-201-3/+10
| | | | | | | Now we have decoders for gif, jpeg, bmp. Also, the in-house PNG decoder has been replaced in favor of the stbi implementation; this means we no longer depend on zlib, since stbi comes with a built in inflate implementation.
* img, loader: separate out png codec into cgi, misc improvementsbptato2024-06-201-0/+8
| | | | | | | | | | | | | | | * multi-processed and sandboxed PNG decoding & encoding (through local CGI) * improved request body passing (including support for output id as response body) * simplified & faster blob()/text() - now every request starts suspended, and OngoingData.buf has been replaced with loader's buffering capability * image caching: we no longer pull bitmaps from the container after every single getLines call Next steps: replace our bespoke PNG decoder with something more usable, add other decoders, and make them stream.
* Move JS wrapper into Monouchabptato2024-06-031-32/+5
| | | | Operation "modularize Chawan somewhat" part 3
* about: markdownify & update license.htmlbptato2024-05-281-1/+1
| | | | We have a markdown converter, so why not use it?
* js: refactorbptato2024-05-081-1/+1
| | | | | | | * prefix to-be-separated modules with js * remove dynstreams dependency * untangle from EmptyPromise * move typeptr into tojs
* Makefile: fix missing mkdir calls in installbptato2024-05-051-0/+2
| | | | Thanks @onemoresuza for noticing.
* doc: include auto-generated manpages in repositorybptato2024-04-261-29/+9
| | | | | The 100kb or so doesn't hurt as much as not having manual pages at all without pandoc (+ not auto-updating them through make all) does.
* data: replace std/base64 with atobbptato2024-04-251-1/+3
| | | | | | | | | | std's version is known to be broken on versions we still support, and it makes no sense to use different decoders anyway. (This does introduce a bit of a dependency hell, because js/base64 depends on js/javascript which tries to bring in the entire QuickJS runtime. So we move that out into twtstr, and manually convert a Result[string, string] to DOMException in js/base64.)