diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | res/license.md | 2 | ||||
-rw-r--r-- | src/config/mimetypes.nim | 11 | ||||
-rw-r--r-- | src/utils/mimeguess.nim | 1 |
6 files changed, 11 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore index 6617e060..070630d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ a cha target/ -.test/ -profile_results.txt .obj/ -lib/*.a diff --git a/Makefile b/Makefile index 552bf9d6..f0297dca 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,6 @@ doc/cha-%.5: $(OBJDIR)/man/cha-%.md .PHONY: clean clean: rm -rf "$(OBJDIR)/$(TARGET)" - rm -f lib/libquickjs.a manpages1 = cha.1 mancha.1 manpages5 = cha-config.5 cha-mailcap.5 cha-mime.types.5 cha-localcgi.5 \ diff --git a/README.md b/README.md index 706df706..68e5ed57 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Note: a POSIX-compliant operating system is required. 1. Clone the Chawan repository: `git clone https://git.sr.ht/~bptato/chawan && cd chawan` 2. Install the Nim compiler: <https://nim-lang.org/install.html> - * Please use 1.6.14 or newer, ideally 2.0.6. Versions older than 1.6.14 + * Please use 1.6.14 or newer, ideally 2.0.8. Versions older than 1.6.14 will not work. (You can check your Nim compiler's version using `nim -v`.) 3. Install the following dependencies: diff --git a/res/license.md b/res/license.md index 55c0d25c..64a86961 100644 --- a/res/license.md +++ b/res/license.md @@ -12,7 +12,7 @@ library. For licensing terms of these, please consult the appropriate library's documentation. Also, Chawan is statically linked to the Nim standard library. At the time -of writing, (i.e. as of Nim 2.0.4) this is the MIT license (same terms as +of writing, (i.e. as of Nim 2.0.8) this is the MIT license (same terms as the vendored Punycode library). Table of contents: diff --git a/src/config/mimetypes.nim b/src/config/mimetypes.nim index f247822e..9beb42c7 100644 --- a/src/config/mimetypes.nim +++ b/src/config/mimetypes.nim @@ -6,9 +6,14 @@ import utils/twtstr # extension -> type type MimeTypes* = distinct Table[string, string] -proc `[]`*(mimeTypes: MimeTypes; k: string): string {.borrow.} -proc contains*(mimeTypes: MimeTypes; k: string): bool {.borrow.} -proc hasKeyOrPut*(mimeTypes: var MimeTypes; k, v: string): bool {.borrow.} +template `[]`*(mimeTypes: MimeTypes; k: string): string = + Table[string, string](mimeTypes)[k] + +template contains*(mimeTypes: MimeTypes; k: string): bool = + k in Table[string, string](mimeTypes) + +template hasKeyOrPut*(mimeTypes: var MimeTypes; k, v: string): bool = + Table[string, string](mimeTypes).hasKeyOrPut(k, v) # Add mime types found in stream to mimeTypes. # No error handling for now. diff --git a/src/utils/mimeguess.nim b/src/utils/mimeguess.nim index 5bbabcc1..f13eaf89 100644 --- a/src/utils/mimeguess.nim +++ b/src/utils/mimeguess.nim @@ -1,5 +1,6 @@ import std/algorithm import std/streams +import std/tables import config/mimetypes |