413 Commits

Author SHA1 Message Date
Bob Farrell
634ce40bb4 Fix GH workflow 2024-06-03 22:00:04 +01:00
bobf
072fc713c0
Merge pull request #83 from jetzig-framework/test-helpers
Test helpers
2024-06-03 21:58:20 +01:00
Bob Farrell
a46bc0ed19 Test helpers
Add `jetzig test` command which runs build step `jetzig:test`.

Add `jetzig.testing` namespace which provides test helpers and a test
app.

Add tests to view generator (i.e. include tests for generated routes).
2024-06-03 21:56:32 +01:00
Bob Farrell
b7af4a396e Fix missing public declaration 2024-06-01 18:11:44 +01:00
Bob Farrell
b304a3509b Windows compatibility fixes 2024-06-01 18:05:01 +01:00
bobf
a6c3e77ddc
Merge pull request #82 from drsneed/main
Added cookie options
2024-06-01 17:23:58 +01:00
bobf
2641c75f80
Merge pull request #80 from Froxcey/main
Add CompressionMiddleware
2024-06-01 17:20:29 +01:00
Bob Farrell
3875ffbdfb Remove allocs in Headers.getAll()
Provide `Headers.getAllIterator()` to iterate over matching headers, use
this to iterate through `Accept-Encoding` headers in
CompressionMiddleware.
2024-06-01 17:09:49 +01:00
Bob Farrell
7339641401 Refactoring 2024-06-01 16:20:16 +01:00
Froxcey
f538b0ddce Fix Compression Middleware
Checks "Accept-Encoding" header, add deflate encoding, rename the
middleware, and avoid unnecessary encoding.
2024-06-01 16:17:45 +01:00
Froxcey
4ea023ee5a Use gzip in demo 2024-06-01 16:17:45 +01:00
Froxcey
ae44b1b21a Add gzip middleware 2024-06-01 16:17:45 +01:00
Bob Farrell
35a2b8a006 Refactor to reduce allocs, add tests for cookie flags 2024-06-01 15:25:24 +01:00
Dustin
02fd62b415 Removed unnecessary allocation 2024-05-30 17:41:02 -06:00
Dustin
5a6ea71ab9 Added cookie options 2024-05-30 16:46:18 -06:00
Bob Farrell
a0faada748 Closes #79 - Use response arena for allocs 2024-05-28 18:06:06 +01:00
bobf
3cad3fddc0
Merge pull request #78 from jetzig-framework/middleware-request-resolution
Middleware request resolution
2024-05-27 16:52:50 +01:00
Bob Farrell
887e4e551b Middleware request resolution
Allow middleware to resolve a request by calling `request.redirect` or
`request.render` - after this point, the request stops processing and
renders immediately.
2024-05-27 16:38:11 +01:00
bobf
816367395b
Merge pull request #77 from jetzig-framework/arena-pool
Use http.zig arena pool
2024-05-26 22:05:08 +01:00
Bob Farrell
b6b67f8dd6 Use http.zig arena pool 2024-05-26 21:37:48 +01:00
bobf
4b93069daf
Merge pull request #76 from jetzig-framework/template-inheritance-and-dynamic-templates
Update Zmpl for template inheritance
2024-05-26 17:25:38 +01:00
Bob Farrell
80ca764c0f Update Zmpl for template inheritance
Permit setting template during view render with `request.setTemplate()`

Permit middleware to define custom routes to static content with
`pub const Routes` (implemented for something no longer needed but seems
useful anyway).

Implement globbing on custom routes, `/foo/:bar*` will glob all path
segments including and after `/foo/...`, e.g. `/foo/bar/baz/qux` will
pass invoke the custom view function with an array of `bar`, `baz`,
`qux` as first argument (instead of typical resource ID).
2024-05-26 17:20:21 +01:00
bobf
2ddeccdadb
Merge pull request #73 from jetzig-framework/custom-routes
Implement custom routes
2024-05-22 20:58:10 +01:00
Bob Farrell
77794cd34d Implement custom routes
In `main()`:

```zig
    app.route(.GET, "/custom/:id/foo/bar", @import("app/views/custom/foo.zig"), .bar);
```

Routes `GET` request with path (e.g.) `/custom/1234/foo/bar` to `bar()`
defined in `src/app/views/custom/foo.zig`.

Routes with an `:id` segment expect a function with three parameters,
routes without an `:id` segment expect a function with two parameters
(i.e. the same as `get` vs `index`).
2024-05-22 20:49:41 +01:00
bobf
9ad4ee87cb
Merge pull request #72 from Pismice/main
Fixed the command: "jetzig generate layout" to the new zmpl syntax
2024-05-22 18:12:27 +01:00
JSantoro
b7217593de Fixed jetzig generate layout from zmpl v1 syntax 2024-05-22 00:05:31 +02:00
bobf
86d697846e
Merge pull request #71 from jetzig-framework/0.13-build-changes
Update build.zig and deps for 0.13 build system
2024-05-21 19:50:35 +01:00
Bob Farrell
3b30ab4625 Update build.zig and deps for 0.13 build system 2024-05-21 19:42:56 +01:00
bobf
aec351664b
Merge pull request #70 from jetzig-framework/readme-typo-fix
Fix typo
2024-05-17 21:44:26 +01:00
Bob Farrell
4b4bd33503 Fix typo 2024-05-17 21:42:41 +01:00
bobf
3a46876aff
Merge pull request #69 from jetzig-framework/fix/build-zig-zon-path
Fixed zigargs reference
2024-05-17 06:59:14 +01:00
rimuspp
4952cae74d
Fixed zigargs reference
MasterQ32 changed his github name
2024-05-16 18:42:40 -05:00
bobf
7c35ae349e
Merge pull request #68 from jetzig-framework/copy-all-src-files
Remove check for .zig extension on copy src/
2024-05-13 18:21:27 +01:00
Bob Farrell
20167fc75a Remove check for .zig extension on copy src/
Allow things like `@embedFile` to work from copied src/ directory.
2024-05-13 18:11:02 +01:00
bobf
19cc2a1714
Merge pull request #67 from jetzig-framework/http.zig-and-misc-optimizations
Switch to http.zig
2024-05-12 21:38:31 +01:00
Bob Farrell
3519483f34 Switch to http.zig
Use Karl Seguin's http.zig as HTTP server backend:
https://github.com/karlseguin/http.zig

Update loggers to use new `jetzig.loggers.LogQueue` to offload logging
to a background thread.

Numerous other optimizations to remove unneeded allocs.

Performance jump on a simple request from approx. 2k requests/second to
approx. 40k requests/second (Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz).

Color support for Windows

Zmpl partial arg type coercion
2024-05-12 21:33:26 +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
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