pax_global_header 0000666 0000000 0000000 00000000064 15267422532 0014522 g ustar 00root root 0000000 0000000 52 comment=6dcdc9fdaa55bcd4abc5d38869c458373f2981af chawan-v0.5.1/ 0000775 0000000 0000000 00000000000 15267422532 0013154 5 ustar 00root root 0000000 0000000 chawan-v0.5.1/.build.yml 0000664 0000000 0000000 00000001247 15267422532 0015060 0 ustar 00root root 0000000 0000000 image: alpine/edge packages: - nim - brotli-dev - brotli-static - libssh2-dev - libssh2-static - openssl-dev - openssl-libs-static - zlib-dev - zlib-static - build-base - xz sources: - "https://git.sr.ht/~bptato/chawan" artifacts: - chawan/chawan-linux-amd64.tar.xz tasks: - linux-amd64: | cd chawan # Set flags sed -i '/^STATIC_LINK ?=/s/0/1/' Makefile export LDFLAGS="-lz" export CFLAGS="-ffile-prefix-map=$(pwd)/=" # Build make -j$(nproc) # Prepare archive dir=chawan-linux-amd64 mkdir "$dir" cp -rP target/ doc/ Makefile cha "$dir" # Create archive tar caf "$dir".tar "$dir" --owner=root --group=root xz "$dir".tar chawan-v0.5.1/.gitignore 0000664 0000000 0000000 00000000046 15267422532 0015144 0 ustar 00root root 0000000 0000000 /a /cha /target/ /.obj/ /test/net/run chawan-v0.5.1/Makefile 0000664 0000000 0000000 00000035544 15267422532 0014627 0 ustar 00root root 0000000 0000000 # Public variables. NIM ?= nim NIMC ?= $(NIM) c OBJDIR ?= .obj OUTDIR ?= target # These paths are quoted in recipes. PREFIX ?= /usr/local MANPREFIX ?= $(PREFIX)/share/man MANPREFIX1 ?= $(MANPREFIX)/man1 MANPREFIX5 ?= $(MANPREFIX)/man5 MANPREFIX7 ?= $(MANPREFIX)/man7 TARGET ?= release PANDOC ?= pandoc PKG_CONFIG ?= pkg-config # Note: this is not a real shell substitution. # The default setting is at {the binary's path}/../libexec/chawan. # You may override it with any path if your system does not have a libexec # directory. # (This way, `cha' can be directly executed without installation.) LIBEXECDIR ?= \$$CHA_BIN_DIR/../libexec/chawan # I won't take this from the environment for obvious reasons. Please override it # in the make command if you must, or (preferably) fix your environment so it's # not needed. DANGER_DISABLE_SANDBOX = 0 # Private variables. # If overridden, take libexecdir that was specified. # Otherwise, just install to libexec/chawan. ifeq ($(LIBEXECDIR),\$$CHA_BIN_DIR/../libexec/chawan) LIBEXECDIR_CHAWAN = "$(DESTDIR)$(PREFIX)/libexec/chawan" else LIBEXECDIR_CHAWAN = $(LIBEXECDIR) endif # Static linking. STATIC_LINK ?= 0 # These paths are quoted in recipes. OUTDIR_TARGET = $(OUTDIR)/$(TARGET) OUTDIR_BIN = $(OUTDIR_TARGET)/bin OUTDIR_LIBEXEC = $(OUTDIR_TARGET)/libexec/chawan OUTDIR_CGI_BIN = $(OUTDIR_LIBEXEC)/cgi-bin OUTDIR_MAN = $(OUTDIR_TARGET)/share/man # Force a poll implementation. 0 - do not force, 1 - poll, 2 - select. # This is an intentionally undocumented debugging flag; open a ticket if # you need it on a certain system, because it has subtle issues without # platform-specific adjustments. FORCE_POLL_MODE ?= 0 chac_flags = embed_startup = 0 # Nim compiler flags ifeq ($(TARGET),debug) FLAGS += -d:debug --debugger:native CFLAGS += -DDUMP_LEAKS=1 else ifeq ($(TARGET),release) embed_startup = 1 chac_flags = -s FLAGS += -d:release -d:strip -d:lto else ifeq ($(TARGET),release-nolto) embed_startup = 1 chac_flags = -s FLAGS += -d:release -d:strip else ifeq ($(TARGET),release0) FLAGS += -d:release --stacktrace:on else ifeq ($(TARGET),release1) FLAGS += -d:release --debugger:native else ifeq ($(TARGET),asan) CFLAGS += -fsanitize=address -DDUMP_LEAKS=1 LDFLAGS += -fsanitize=address FLAGS += -d:debug --debugger:native -d:useMalloc DANGER_DISABLE_SANDBOX = 1 endif ifeq ($(embed_startup),1) embed_script = $(OBJDIR)/init.jsb scripts = FLAGS += -d:embedStartup script_target = $(OBJDIR)/%.jsb else embed_script = scripts = init.jsb script_target = $(OUTDIR_LIBEXEC)/%.jsb endif # used because past versions installed init.jsb for release builds too scripts_uninstall = init.jsb ssl_link = http https gemini sftp tohtml_link = gopher2html md2html ansi2html gmi2html dirlist2html img2html protocols_bin = file ftp gopher finger man spartan chabookmark stbi jebp sixel \ canvas resize nanosvg ssl converters_bin = uri2html tohtml tools_bin = urlenc nc protocols = $(protocols_bin) $(ssl_link) converters = $(converters_bin) $(tohtml_link) tools = $(tools_bin) urldec ifeq ($(STATIC_LINK),1) LDFLAGS += -static endif ifeq ($(FORCE_POLL_MODE),2) # for seccomp CFLAGS += -DCHA_FORCE_SELECT endif FLAGS += $(foreach flag,$(CFLAGS),-t:$(flag)) FLAGS += $(foreach flag,$(LDFLAGS),-l:$(flag)) FLAGS += -d:disableSandbox=$(DANGER_DISABLE_SANDBOX) FLAGS += -d:forcePollMode=$(FORCE_POLL_MODE) ssl_libs = libssl libcrypto libbrotlidec libbrotlicommon libssh2 ssl_flags = $(FLAGS) ssl_cflags := $(shell $(PKG_CONFIG) --cflags $(ssl_libs) || echo _cha_error) ifeq ($(ssl_cflags),_cha_error) $(error failed to find some dependencies) endif ssl_ldflags := $(shell $(PKG_CONFIG) --libs $(ssl_libs) || echo _cha_error) ifeq ($(ssl_ldflags),_cha_error) $(error failed to find some dependencies) endif ssl_flags += $(foreach flag,$(ssl_cflags),-t:$(flag)) ssl_flags += $(foreach flag,$(ssl_ldflags),-l:$(flag)) export CC CFLAGS LDFLAGS PANDOC binaries = $(OUTDIR_BIN)/cha $(OUTDIR_BIN)/mancha binaries += $(foreach bin,$(protocols),$(OUTDIR_CGI_BIN)/$(bin)) binaries += $(foreach bin,$(converters),$(OUTDIR_LIBEXEC)/$(bin)) binaries += $(foreach bin,$(tools),$(OUTDIR_LIBEXEC)/$(bin)) binaries += $(foreach bin,$(scripts),$(OUTDIR_LIBEXEC)/$(bin)) .PHONY: all all: $(binaries) ln -sf "$(OUTDIR)/$(TARGET)/bin/cha" cha ifeq ($(shell uname), Linux) chaseccomp = lib/chaseccomp/chaseccomp.o lib/chaseccomp/chaseccomp.o: .FORCE (cd lib/chaseccomp && $(MAKE)) .FORCE: endif twtstr = src/utils/twtstr.nim src/utils/opt.nim dynstream = src/io/dynstream.nim chafile = src/io/chafile.nim $(dynstream) chaos = src/utils/chaos.nim $(twtstr) connectionerror = src/server/connectionerror.nim lcgi = $(chaos) $(chafile) $(twtstr) $(sandbox) $(connectionerror) \ adapter/protocol/lcgi.nim lcgi_ssl = $(lcgi) adapter/protocol/lcgi_ssl.nim sandbox = src/utils/sandbox.nim $(chaseccomp) tinfl = adapter/protocol/tinfl.h # lib/*0 has a 0 so that it doesn't conflict with the old submodules. # git can't deal with this, it seems. $(OUTDIR_BIN)/cha: src/*.nim src/*/*.nim src/*/*.c res/chawan.html res/license.md \ res/quirk.css res/ua.css res/*.tab res/version lib/chame0/chame/* \ lib/quickjs/* $(chaseccomp) res/charwidth_gen.nim nim.cfg \ $(embed_script) @mkdir -p "$(OUTDIR_BIN)" $(NIMC) --nimcache:"$(OBJDIR)/$(TARGET)/cha" -d:libexecPath=$(LIBEXECDIR) \ $(FLAGS) -o:"$(OUTDIR_BIN)/cha" src/main.nim $(OUTDIR_BIN)/mancha: adapter/tools/mancha @mkdir -p "$(OUTDIR_BIN)" install -m755 $< "$(OUTDIR_BIN)" res/chawan.html: res/chawan.html.in res/version sed "s/%CHA_VERSION%/$$(cat res/version)/g" $< > $@~ mv $@~ $@ unicode_version = 17.0.0 .PHONY: unicode_gen unicode_gen: @printf 'Download EastAsianWidth.txt from www.unicode.org? (y/n) ' @read res; if test "$$res" = "y"; then \ cha -d 'https://www.unicode.org/Public/$(unicode_version)/ucd/EastAsianWidth.txt' >res/EastAsianWidth.txt; \ fi $(NIMC) --nimcache:"$(OBJDIR)/charwidth_gen_cache" -d:danger -o:"$(OBJDIR)/gencharwidth" res/gencharwidth.nim $(OBJDIR)/gencharwidth > res/charwidth_gen.nim~ mv res/charwidth_gen.nim~ res/charwidth_gen.nim $(OUTDIR_CGI_BIN)/man: $(lcgi) src/utils/lrewrap.nim src/js/libregexp.nim \ lib/quickjs/libregexp.* lib/quickjs/libunicode.* lib/quickjs/cutils.* $(OUTDIR_CGI_BIN)/file: $(lcgi) $(OUTDIR_CGI_BIN)/ftp: $(lcgi) $(OUTDIR_CGI_BIN)/ssl: adapter/protocol/http.nim adapter/protocol/gemini.nim \ adapter/protocol/sftp.nim $(lcgi_ssl) $(sandbox) $(tinfl) $(OUTDIR_CGI_BIN)/stbi: adapter/img/stbi.nim adapter/img/stb_image.h \ adapter/img/stb_image_write.h $(lcgi) $(OUTDIR_CGI_BIN)/jebp: adapter/img/jebp.h $(lcgi) $(OUTDIR_CGI_BIN)/sixel: src/css/color.nim $(lcgi) $(OUTDIR_CGI_BIN)/canvas: src/html/path.nim src/io/packetreader.nim \ src/css/color.nim adapter/img/stb_image.h $(lcgi) $(OUTDIR_CGI_BIN)/resize: adapter/img/stb_image_resize.h $(lcgi) $(OUTDIR_CGI_BIN)/nanosvg: adapter/img/nanosvg.nim adapter/img/nanosvg.h \ adapter/img/nanosvgrast.h $(lcgi) $(OUTDIR_LIBEXEC)/urlenc: $(twtstr) $(chafile) $(chaos) $(OUTDIR_LIBEXEC)/nc: $(lcgi) $(OUTDIR_LIBEXEC)/tohtml: adapter/format/ansi2html.nim adapter/format/dirlist2html.nim \ adapter/format/gmi2html.nim adapter/format/gopher2html.nim \ adapter/format/md2html.nim adapter/format/img2html.nim \ $(twtstr) $(chafile) $(dynstream) $(chaos) src/css/color.nim $(foreach it,$(ssl_link),$(OUTDIR_CGI_BIN)/$(it)): $(OUTDIR_CGI_BIN)/ssl (cd "$(OUTDIR_CGI_BIN)" && ln -sf ssl $(notdir $@)) $(foreach it,$(tohtml_link),$(OUTDIR_LIBEXEC)/$(it)): $(OUTDIR_LIBEXEC)/tohtml (cd "$(OUTDIR_LIBEXEC)" && ln -sf tohtml $(notdir $@)) $(OUTDIR_CGI_BIN)/%: adapter/protocol/%.nim adapter/nim.cfg @mkdir -p "$(OUTDIR_CGI_BIN)" $(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(notdir $@)" -o:"$@" $< $(OUTDIR_CGI_BIN)/ssl: adapter/protocol/ssl.nim adapter/nim.cfg @mkdir -p "$(OUTDIR_CGI_BIN)" $(NIMC) $(ssl_flags) --nimcache:"$(OBJDIR)/$(TARGET)/$(notdir $@)" -o:"$@" $< $(OUTDIR_CGI_BIN)/%: adapter/protocol/% @mkdir -p "$(OUTDIR_CGI_BIN)" install -m755 $< "$(OUTDIR_CGI_BIN)" $(OUTDIR_LIBEXEC)/%: adapter/format/% @mkdir -p "$(OUTDIR_LIBEXEC)" install -m755 $< "$(OUTDIR_LIBEXEC)" $(OUTDIR_CGI_BIN)/%: adapter/img/%.nim adapter/nim.cfg @mkdir -p "$(OUTDIR_CGI_BIN)" rm -rf "$(OBJDIR)/$(TARGET)/$(notdir $@)" $(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(notdir $@)" -o:"$@" $< $(OUTDIR_LIBEXEC)/%: adapter/format/%.nim adapter/nim.cfg @mkdir -p "$(OUTDIR_LIBEXEC)" $(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(notdir $@)" -o:"$@" $< $(OUTDIR_LIBEXEC)/%: adapter/tools/%.nim adapter/nim.cfg @mkdir -p "$(OUTDIR_LIBEXEC)" $(NIMC) $(FLAGS) --nimcache:"$(OBJDIR)/$(TARGET)/$(notdir $@)" -o:"$@" $< $(OUTDIR_LIBEXEC)/urldec: $(OUTDIR_LIBEXEC)/urlenc (cd "$(OUTDIR_LIBEXEC)" && ln -sf urlenc urldec) # A separate variable so that cross-compilation works in the common case. # Use this if for some reason `nim c` doesn't work at all without passing # some flags. FLAGS_FOR_BUILD += $(foreach flag,$(HOSTCFLAGS),-t:$(flag)) FLAGS_FOR_BUILD += $(foreach flag,$(HOSTLDFLAGS),-l:$(flag)) $(OBJDIR)/chac: src/chac.nim src/js/* lib/quickjs/* $(NIMC) $(FLAGS_FOR_BUILD) --nimcache:"$(OBJDIR)/chac_cache" -o:$@ $< $(script_target): src/%.js $(OBJDIR)/chac $(OBJDIR)/chac $(chac_flags) $< $@ doc/%.1: doc/%.md md2man ./md2man $< > $@~ mv $@~ $@ doc/cha-%.5: doc/%.md md2man ./md2man $< > $@~ mv $@~ $@ doc/cha-%.7: doc/%.md md2man ./md2man $< > $@~ mv $@~ $@ .PHONY: clean clean: rm -rf "$(OBJDIR)/$(TARGET)" "$(OBJDIR)/chac_cache" "$(OBJDIR)/chagashi_test" for name in $(test_names); do rm -rf "$(OBJDIR)/test_$$name"; rm -f test/nim/$$name; done rm -f "$(OBJDIR)/chac" test/nim/toklab test/charset/basic test/charset/data test/net/run (cd lib/chaseccomp && $(MAKE) clean) .PHONY: distclean distclean: clean rm -rf "$(OUTDIR)" manpages1 = cha.1 mancha.1 manpages5 = cha-config.5 cha-mailcap.5 cha-mime.types.5 cha-cgi.5 \ cha-urimethodmap.5 manpages7 = cha-protocols.7 cha-api.7 cha-troubleshooting.7 cha-image.7 cha-css.7 cha-terminal.7 manpages = $(manpages1) $(manpages5) $(manpages7) .PHONY: manpage manpage: $(manpages:%=doc/%) .PHONY: install install: mkdir -p "$(DESTDIR)$(PREFIX)/bin" install -m755 "$(OUTDIR_BIN)/cha" "$(DESTDIR)$(PREFIX)/bin" install -m755 "$(OUTDIR_BIN)/mancha" "$(DESTDIR)$(PREFIX)/bin" # intentionally not quoted mkdir -p $(LIBEXECDIR_CHAWAN)/cgi-bin for f in $(protocols_bin); do \ install -m755 "$(OUTDIR_CGI_BIN)/$$f" $(LIBEXECDIR_CHAWAN)/cgi-bin; \ done for f in $(converters_bin) $(tools_bin) $(scripts); \ do install -m755 "$(OUTDIR_LIBEXEC)/$$f" $(LIBEXECDIR_CHAWAN); \ done (cd $(LIBEXECDIR_CHAWAN) && ln -sf urlenc urldec) for f in $(ssl_link); do (cd $(LIBEXECDIR_CHAWAN)/cgi-bin && ln -sf ssl "$$f"); done for f in $(tohtml_link); do (cd $(LIBEXECDIR_CHAWAN) && ln -sf tohtml "$$f"); done mkdir -p "$(DESTDIR)$(MANPREFIX1)" for f in $(manpages1); do install -m644 "doc/$$f" "$(DESTDIR)$(MANPREFIX1)"; done mkdir -p "$(DESTDIR)$(MANPREFIX5)" for f in $(manpages5); do install -m644 "doc/$$f" "$(DESTDIR)$(MANPREFIX5)"; done mkdir -p "$(DESTDIR)$(MANPREFIX7)" for f in $(manpages7); do install -m644 "doc/$$f" "$(DESTDIR)$(MANPREFIX7)"; done .PHONY: uninstall uninstall: rm -f "$(DESTDIR)$(PREFIX)/bin/cha" rm -f "$(DESTDIR)$(PREFIX)/bin/mancha" # intentionally not quoted for f in $(protocols); do rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/$$f; done for f in $(converters) $(tools) $(scripts_uninstall); do rm -f $(LIBEXECDIR_CHAWAN)/$$f; done # We only want to uninstall binaries that the main distribution # includes or has ever included, but not those that the user might have # added. Some of these cannot be directly derived from our variables: # * png has been removed in favor of stbi # * data, about have been moved back into the main binary # * gmifetch has been replaced by gemini # * cha-finger has been renamed to finger rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/about rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/cha-finger rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/data rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/gmifetch rm -f $(LIBEXECDIR_CHAWAN)/cgi-bin/png rmdir $(LIBEXECDIR_CHAWAN)/cgi-bin || true rmdir $(LIBEXECDIR_CHAWAN) || true for f in $(manpages7); do rm -f "$(DESTDIR)$(MANPREFIX7)/$$f"; done for f in $(manpages5); do rm -f "$(DESTDIR)$(MANPREFIX5)/$$f"; done # moved to section 7 (and localcgi renamed to just cgi) for f in cha-protocols.5 cha-api.5 cha-troubleshooting.5 cha-image.5 cha-localcgi.5; do rm -f "$(DESTDIR)$(MANPREFIX5)/$$f"; done for f in $(manpages1); do rm -f "$(DESTDIR)$(MANPREFIX1)/$$f"; done test/net/run: src/io/chafile.nim src/utils/opt.nim src/utils/twtstr.nim test/net/run: test/net/run.nim $(NIMC) --nimcache:"$(OBJDIR)/test_net" test/net/run.nim .PHONY: map map: $(NIM) $(FLAGS) r res/createmap.nim > src/encoding/charset_map.nim .PHONY: test_js test_js: (cd test/js && ./run.sh) .PHONY: test_layout test_layout: (cd test/layout && ./run.sh) .PHONY: test_dhtml test_dhtml: (cd test/dhtml && ./run.sh) .PHONY: test_md test_md: (cd test/md && ./run.sh) .PHONY: test_net test_net: test/net/run (cd test/net && ./run.sh) .PHONY: test_pager test_pager: test/pager/run.sh (cd test/pager && ./run.sh) $(OBJDIR)/chagashi_test: mkdir -p $(OBJDIR)/chagashi_test cp test/charset/data.tar.xz $(OBJDIR)/chagashi_test unxz $(OBJDIR)/chagashi_test/data.tar.xz tar xf $(OBJDIR)/chagashi_test/data.tar -C $(OBJDIR)/chagashi_test test_flags = --verbosity:0 -d:test -t:-DDUMP_LEAKS=1 test/charset/%: test/charset/%.nim $(NIMC) $(test_flags) --nimcache:"$(OBJDIR)/test_$(notdir $@)" -o:$@ $< test/charset/basic: src/encoding/charset.nim src/encoding/decoder.nim \ src/encoding/decodercore.nim src/encoding/encoder.nim \ src/encoding/charset.nim test/charset/data: src/encoding/decoder.nim src/encoding/encoder.nim \ src/encoding/decodercore.nim src/encoding/encodercore.nim \ src/encoding/charset.nim .PHONY: test_charset test_charset: test/charset/run.sh $(OBJDIR)/chagashi_test test/charset/basic test/charset/data (cd test/charset && ./run.sh) test/charset/basic CGS_TESTDIR=$(OBJDIR)/chagashi_test test/charset/data test/nim/%: test/nim/%.nim $(NIMC) $(test_flags) --nimcache:"$(OBJDIR)/test_$(notdir $@)" -o:$@ $< test_names = ttwtstr tcatom tjsref tjsbind tlibregexp tchahash tchaos tcookie tlcgi test_bin += $(foreach name,$(test_names),test/nim/$(name)) test/nim/ttwtstr: $(twtstr) test/nim/tcatom: src/html/catom.nim test/nim/tjsref: src/js/jsref.nim src/js/jsbind.nim src/js/jsutils.nim \ src/js/quickjs.nim test/nim/tjsbind: src/js/fromjs.nim src/js/jsbind.nim src/js/jsnull.nim \ src/js/jspropenumlist.nim src/js/jsref.nim src/js/jstypes.nim \ src/js/jsutils.nim src/js/quickjs.nim src/js/tojs.nim src/utils/opt.nim test/nim/tlibregexp: src/js/libregexp.nim test/nim/tchahash: src/utils/chahash.nim test/nim/tchaos: $(chaos) test/nim/tcookie: src/config/cookie.nim $(chafile) $(chaos) $(dynstream) test/nim/tlcgi: $(lcgi) .PHONY: test_nim test_nim: $(test_bin) for f in $(test_names); do test/nim/$$f; done # slow, for manual use only .PHONY: test_oklab test_oklab: test/nim/toklab test/nim/toklab .PHONY: test test: test_js test_layout test_dhtml test_net test_md test_pager test_charset \ test_nim chawan-v0.5.1/NEWS 0000664 0000000 0000000 00000025227 15267422532 0013663 0 ustar 00root root 0000000 0000000 0.5.1 (2026.10.25) * remove non-functional btoa symlink * fix broken subnet classification procedure * fix all history entries being truncated in some cases * fix crash on invoking functions on detached SelectBuilder * fix chahash on big-endian platforms * fix calls to invalidated SelectBuilder crashing the browser * fix select being incorrectly positioned at the screen's edge * fix crashed buffers crashing the pager too in some cases * report invalid match/nc-match regexes in mailcap 0.5.0 (2026.10.16) * rework handling of Referer header * rework NodeIterator, add TreeWalker * optimize some inefficient descendant CSS selectors * optimize getElementById * optimize HTML parser & tokenizer * switch to ARC for memory management * support multi-keyword CSS display values * support oklab(), oklch(), relative color syntax (e.g. hsl(from ...)) * support "hidden" global attribute * emulate logical properties (always interpreted in horizontal-tb writing-mode) * support `justify-content`, `align-content`, `align-self` properties * support `:empty` pseudo-class * improve BFC placement logic with floats * support accessing elements by id on Window object * support MutationObserver * support FileReader * support Delete key, add default aliases for alternate Home/End * support browsecap for external URI handlers (based on w3mmee) * support menu customization * add external.ask-download-dir option (can be overridden in siteconf) * allow CORS requests * block requests to private networks from public Internet * rework keybinding API for select widget (there is a [select] section now) * retry connections with ipv6 if ipv4 resolves but connect() fails * reduce copying of strings between Nim <-> JS * reduce memory usage of CSS values & variables * more lenient CR parsing in HTTP (for compatibility) * fix some bugs in the config parser * fix seccomp on LoongArch64 * fix missing pager.findPrevMark function * fix incorrect positioning of `position: absolute' in some cases * don't try to render canvas elements without a rendering context * fix menu not being dismissed on mouse click in some cases * fix unintended scroll on thumb tip mouse button * fix display of some dynamically inserted SVGs * fix form owner not being reset on control removal * fix tracking of owner document for collections * fix outerHTML, HTMLOptionsCollection setters * fix crash on some Window functions when called from pager * fix incorrect positioning of absolute boxes with bottom/right borders * fix an OOB in nanosvg * fix parsing of var() nested into another var()'s fallback * fix CDATASection not being derived from Text * fix exceptions being swallowed for JS getters called on the wrong interface * fix selector case-sensitivity * fix crash on td with rowspan=0 * fix green component calculation in VP8 YUV image conversion * fix QJS cycle collector not running at all * fix broken radio button checkedness with the `checked' attribute specified * fix charset override not working on piped documents * fix CSSStyleDeclaration#removeProperty not updating the style attribute * fix closed menu not being hidden when the first buffer is still being loaded * fix regression where URLs were not being added to the history in some cases * fix dropping of cookies with tab and ignore empty Domain in Set-Cookie * fix min-width/max-width not being accounted for in table cells * fix input handling with encoding.display-charset='ISO-2022-JP' * fix svg width/height attributes not being respected * fix some flex sizing bugs * fix ISO-2022-JP terminal input handling * fix underscore not being treated as vi word char * fix bytecode functions being returned from `config.page` etc. sometimes * fix table borders overprinting content in some cases * fix findPrevMark/findNextMark actions * fix leaks from interned strings * fix module scripts being fetched multiple times on import 0.4.0 (2026.05.17) * dupeBuffer/anchor navigation no longer forks buffer process * support VT420 * support DEC special graphics in ASCII mode * support all VP8L indexed color transforms * support pandoc-style definition list in markdown * support color, width, align, noshade properties on HR element * support Element#getAttributeNames * add status.format-mode (sets formatting of status bar) * add toggleLinkHintsAutoClick command (by Arthur Jacquin) * add saveScreen, editScreen commands; rename sourceEdit to editSource * add x-type, x-match, x-nc-match mailcap extensions (from w3mmee) * add mouse support to the line editor * improve keybinding format (mostly backwards-compatible; see cha-config(5)) * remove display.force-clear (shouldn't have ever been needed) * remove display.query-da1 (no longer needed) * remove deprecated special case in pager.load() with trailing newline * remove deprecated parentBuffer, prevSiblingBuffer, nextSiblingBuffer actions * remove MAILCAP_URL env var when executing mailcap entries (use %u instead) * make terminal querying asynchronous * work around FreeBSD vt(4) freezing on startup * work around a bug in URL standard that made us reject ed2k URLs * optimize out Sixel repaints when scrolling * drop excessive frames when the terminal/link cannot keep up * rework seccomp handling to support cross-compilation to incompatible archs * fix cached images not being cleared when a buffer is deleted * fix a NULL deref in jebp * fix y/n being truncated out of long ask() prompts * fix media queries not being re-evaluated on windowChange * fix load info not being set on cycling between buffers * fix color blending over body bgcolor * fix matching of nested subsequent sibling combinator * fix various CSS image sizing bugs * fix table row rendering order with multiple thead/tfoot children * fix absolutely positioned boxes not respecting min/max size constraints * fix percentage calc() output in color values * fix inline pre/nowrap not being flushed to the next line on overflow * fix bugs in our libregexp UTF-8 patch * fix various proxy authentication bugs * fix [attr|=value] and :lang() pseudo-class bugs * fix localStorage.key function * fix gotoLine malfunctioning in select menu * fix bug in negation of the minimum layout unit value * fix crash on Storage#key overflow on 32-bit targets * fix crash on calling status getter for unsent XHR * fix various charset decoder bugs * fix TypedArray handling * fix suspend() not suspending all processes * fix JS bindings having incorrect property descriptions * fix user/pass in Basic auth not being percent-decoded * fix decoding of data URLs that include a question mark 0.3.0 (2025.11.21) UI additions * wheel-scroll, side-wheel-scroll config options (by Tim Culverhouse) * new API functions Pager#traverse, Pager#navDirection, Pager#revDirection, Buffer#find * bracketed paste - pasting a URL now opens the URL bar automatically * "copy URL", "copy selection" now works over SSH when OSC 52 is supported * "hints mode" for jumping to specific links on the page (default keybinding is `f`, configurable using `input.link-hint-chars`) * added loaded stylesheet/image counters --- CSS additions * monochrome, color, color-index media queries * implement
\n")
let ps = newPosixStream(STDIN_FILENO)
var buffer {.noinit.}: array[4096, char]
while true:
state.flushOutbuf()
let n = ps.read(buffer)
if n <= 0:
break
state.processData(buffer.toOpenArray(0, n - 1))
if standalone:
state.puts("")
state.flushOutbuf()
{.pop.} # raises: []
chawan-v0.5.1/adapter/format/dirlist2html.nim 0000664 0000000 0000000 00000010475 15267422532 0021221 0 ustar 00root root 0000000 0000000 {.push raises: [].}
import std/algorithm
import io/chafile
import utils/chaos
import utils/opt
import utils/twtstr
type DirlistItemType = enum
ditFile, ditLink, ditDir
type DirlistItem = ref object
name: string # real name
dname: string # display name
modified: string # date last modified
case t: DirlistItemType
of ditLink:
linkto: string
of ditFile:
nsize: int64
of ditDir:
discard
proc printDirlist(f: ChaFile; items: openArray[DirlistItem]): Opt[void] =
?f.writeLine("[Upper Directory]" line &= "" & htmlEscape(item.dname) & "" line &= " | " line &= htmlEscape(item.modified) if item.t == ditFile: line &= ' ' & convertSize(uint64(max(item.nsize, 0))) elif item.t == ditLink: line &= " -> " & htmlEscape(item.linkto) line &= " |