193 Commits

Author SHA1 Message Date
Bob Farrell
2a955de4b3 WIP 2024-05-12 17:55:36 +01:00
Bob Farrell
2fbd2f2f6a WIP 2024-05-12 17:02:45 +01:00
Bob Farrell
bd02977600 WIP 2024-05-12 13:01:04 +01:00
Bob Farrell
91e0b44404 WIP 2024-05-11 20:52:56 +01:00
Bob Farrell
055da0f85a WIP 2024-05-11 18:50:16 +01:00
Bob Farrell
997ac4ec50 WIP 2024-05-10 19:42:26 +01:00
Bob Farrell
a155e33121 WIP 2024-05-10 18:28:01 +01:00
Bob Farrell
b39653b90f WIP 2024-05-09 21:30:11 +01:00
Bob Farrell
63b4265131 Merge branch 'http.zig' into tmp-merge 2024-05-09 19:57:14 +01:00
Bob Farrell
0ff19d5d26 WIP 2024-05-09 19:53:29 +01:00
Bob Farrell
35c5f26de9 WIP 2024-05-08 17:53:48 +01:00
Bob Farrell
1693f24ce2 WIP 2024-05-07 21:30:53 +01:00
Bob Farrell
6e4048a318 WIP 2024-05-07 21:17:41 +01:00
Bob Farrell
458ea252e7 WIP 2024-05-07 20:22:30 +01:00
bobf
6575add452
Merge pull request #65 from jetzig-framework/smtp-windows
Windows SMTP compatibility
2024-05-06 15:37:41 +01:00
Bob Farrell
e4bd14e80d Windows SMTP compatibility 2024-05-06 14:55:53 +01:00
Bob Farrell
c84d2fcd71 WIP 2024-05-06 13:58:30 +01:00
Bob Farrell
d8b8ffd1d4 WIP 2024-05-06 12:55:51 +01:00
Bob Farrell
deb6f9604b Update JetKV - bugfix 2024-05-06 10:43:49 +01:00
Bob Farrell
8dd09a8399 Update checklist 2024-05-05 20:47:00 +01:00
bobf
bd62f75cb8
Merge pull request #64 from jetzig-framework/mailer-improvements
Allow mailers to modify mail template params
2024-05-05 20:11:50 +01:00
Bob Farrell
65edd20092 Allow mailers to modify mail template params
Remove need to add all mail template params to view response data. This
was originally intended functionality but the wrong value was passed to
the `deliver` function, and no `data` argument was given, making it
cumbersome to create new values.
2024-05-05 20:04:57 +01:00
bobf
40093f3ec2
Merge pull request #63 from jetzig-framework/jetkv-persistence
Formalise JetKV interface for store, cache, jobs
2024-05-05 13:31:43 +01:00
Bob Farrell
b7d750c54f Formalise JetKV interface for store, cache, jobs
Provide configuration for JetKV backend (memory or file allocator).
2024-05-05 12:27:59 +01:00
Bob Farrell
19da5362cf Merge branch 'fix-session-nonce-re-use' 2024-05-02 18:50:52 +01:00
Bob Farrell
439a0c1206 Add bounds check for session decrypt data 2024-05-02 18:48:47 +01:00
Bob Farrell
33a1596238 Remove debug print 2024-05-01 21:30:53 +01:00
bobf
06675dccb8
Merge pull request #62 from jetzig-framework/fix-session-nonce-re-use
Fix session nonce re-use
2024-05-01 21:16:30 +01:00
Bob Farrell
1ea3f6c4ff Fix session nonce re-use
Use a new secure-random nonce for each session encryption.

Many thanks to @Trundle for writing [this gist](https://gist.github.com/Trundle/76c0d8f80999617f4d8373c03f86391a)
highlighting the severity of this issue.
2024-05-01 20:51:39 +01:00
Bob Farrell
3c88d845a8 Catch error.BrokenPipe and close connection
Users have reported this error occurring occasionally, close connection
and continue processing requests when it occurs.
2024-04-29 18:58:07 +01:00
Bob Farrell
ca153eb82c Initialize request with default status code .not_found
Avoid loading an undefined error code if `/errors` view is requested
directly.
2024-04-28 15:13:57 +01:00
bobf
f55a3278ce
Merge pull request #60 from jetzig-framework/custom-error-pages
Custom error pages
2024-04-28 12:01:29 +01:00
Bob Farrell
1c7df8a91d Custom error pages
Render `src/app/views/errors.zig` view (`index` action) when an
unexpected error occurs. If the view does not exist, try rendering
`public/404.html`, `public/500.html` (etc.), finally falling back to a
standard basic HTML/JSON response.
2024-04-28 11:54:05 +01:00
bobf
0c450ff9b0
Merge pull request #59 from jetzig-framework/zmpl-markdown-mode-formatters
Update Zmpl, adds Markdown mode formatters
2024-04-27 23:37:05 +01:00
Bob Farrell
6b940e8a53 0.13 support
Add support for 0.13. For now, we can be compatible with both 0.12 and
0.13. We will drop 0.12 after a while.
2024-04-27 23:03:53 +01:00
Bob Farrell
9d12b5c717 Update Zmpl, adds Markdown mode formatters
Also adds support for `.md.zmpl` templates - root node is Markdown.
2024-04-27 22:22:30 +01:00
bobf
3c47435fd6
Merge pull request #58 from jetzig-framework/email
Email framework
2024-04-21 21:14:44 +01:00
Bob Farrell
47c35632b5 Email framework
Create mailers with `jetzig generate mailer <name>`. Mailers define
default values for email fields (e.g. subject, from address, etc.).
Mailers use Zmpl for rendering text/HTML parts.

Send an email from a request with `request.mail()`. Call
`deliver(.background, .{})` on the return value to use the built-in
mail job to send the email asynchronously.

Improve query/HTTP request body param parsing - unescape `+` and `%XX`
characters.
2024-04-21 21:00:03 +01:00
Bob Farrell
3f6c1a4919 Remove temporary test file 2024-04-15 21:16:02 +01:00
bobf
ba0e488894
Merge pull request #56 from jetzig-framework/background-jobs
Background jobs
2024-04-15 21:06:48 +01:00
Bob Farrell
0c7a11497f Background jobs
Use in-memory KV store (JetKV) for simple job queue.

Build script generates an array of Zig modules in `src/app/jobs/` and
stores their name + run function (`run(allocator, params, logger)`).

View functions schedule jobs with arbitrary params.

Thread pool spawns a (configurable) number of workers and pops jobs from
the queue, then invokes the appropriate run function.
2024-04-15 18:12:40 +01:00
Bob Farrell
25587d4258 Update Zmpl - add support for one-liner slots rendering
```
{{slots}}
```
will render all slots `\n`-separated.
2024-04-13 20:11:44 +01:00
Bob Farrell
0b968c3b44 Minor improvements to request params and headers
Fully disambiguate request params from body and query string and clean
up convoluted code, reduce allocs. Implement
`jetzig.http.Request.queryParams` which always returns only the parsed
query string, never the request body.

Deprecate `headers.getFirstValue` in favour of `headers.get`, implement
`headers.getAll`.
2024-04-13 19:24:40 +01:00
Bob Farrell
4de9f4d248 Update zmpl/zmd - code/block bugfixes 2024-04-13 11:22:02 +01:00
Bob Farrell
b42d0411c1 Update Zmpl and zmd - misc zmd bugfixes 2024-04-12 21:54:41 +01:00
Bob Farrell
2c81c64c93 Update Zmpl - sync zmd versions 2024-04-11 20:50:06 +01:00
Bob Farrell
d5c7f97036 Update zmd - fixes parenthesis parsing 2024-04-11 20:47:38 +01:00
Bob Farrell
88abe2243d Update Zmpl
Numerous fixes and improvements to v2 parser.
2024-04-10 22:06:11 +01:00
Bob Farrell
1cf3dcc106 Update zmpl and zmd - misc. markdown fixes 2024-04-07 21:54:25 +01:00
Bob Farrell
68ca4d3bba jetzig bundle improvements
Generate a bundle that includes markdown files (needed for dynamic
markdown rendering). In future these will be compiled into static
outputs by the bundle command but for now we copy them into the source
tree. `bundle.tar.gz` includes one directory which is named after the
compiled exe, containing a `server` executable, `public` and `static`
directories, and any markdown files.

Windows support removed for now - will re-add when we overhaul all of
this to no longer do command line invocation of `tar` (we will build
tarball/Zip file ourselves).
2024-04-07 15:47:15 +01:00