Skip to content

Commit

Permalink
Misc. Zig updates
Browse files Browse the repository at this point in the history
Changes to latest Zig nightly build required several minor fixes across
multiple dependencies.
  • Loading branch information
bobf committed Jan 25, 2025
1 parent 5ebb60d commit 87668c9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
15 changes: 7 additions & 8 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,27 @@
.hash = "1220d0e8734628fd910a73146e804d10a3269e3e7d065de6bb0e3e88d5ba234eb163",
},
.zmpl = .{
.url = "https://github.com/jetzig-framework/zmpl/archive/f9a3c602d060d6b337312b820c852376cd111766.tar.gz",
.hash = "1220f61c70456b8bb7f407ff539d1d8569acea64f68db12f9245f1d4113495c33907",
.url = "https://github.com/jetzig-framework/zmpl/archive/fb58c2d793576407a8a78942cc9e5a177c75d0b1.tar.gz",
.hash = "1220cf76b9c5209fa6e6a6b894dad95cfa5c226445d6b31dd4cf0a72507ca27b4cd6",
},
.jetkv = .{
.url = "https://github.com/jetzig-framework/jetkv/archive/acaa30db281f1c331d20c48cfe6539186549ad45.tar.gz",
.hash = "1220b260b20cb65d801a00a39dc6506387f5faa1a225f85160e011bd2aabd2ce6e0b",
},
.jetquery = .{
.url = "https://github.com/jetzig-framework/jetquery/archive/387ad885bb29a16d38dbb71f5b4b5b083fa320e3.tar.gz",
.hash = "12206089a3d9de179a0d40cf35c48786eb4525a203ebf8cc131e23e430625713c402",
.path = "https://github.com/jetzig-framework/jetquery/archive/ec99c0accedbf783c9836f096e2381e4d8b396eb.tar.gz",
},
.jetcommon = .{
.url = "https://github.com/jetzig-framework/jetcommon/archive/86f24cfdf2aaa0e8ada4539a6edef882708ced2b.tar.gz",
.hash = "12200439fc28aa7fa08f0e8fea100f6724c34c9dbfaaae4feec482c80e5ac08ea4f6",
},
.args = .{
.url = "https://github.com/ikskuh/zig-args/archive/0abdd6947a70e6d8cc83b66228cea614aa856206.tar.gz",
.hash = "1220411a8c46d95bbf3b6e2059854bcb3c5159d428814099df5294232b9980517e9c",
.url = "https://github.com/ikskuh/zig-args/archive/968258dc1b1230493d8f1677097c832a3d7e0bd8.tar.gz",
.hash = "1220bdedf1a993d852d8aebcd63922a8fb163fac37b9c6ff72d187b2847a4a3a4248",
},
.pg = .{
.url = "https://github.com/karlseguin/pg.zig/archive/a03737e8c9404d1642e9b2fdea8e719dfae5cda8.tar.gz",
.hash = "1220eff52824f32e7ab225cd50bf962324ca14c498c7c197a554dc55e5bb612f119f",
.url = "https://github.com/karlseguin/pg.zig/archive/4ddae09948cb1563b394cd724b95de14cc88fc12.tar.gz",
.hash = "1220779868e6a2f387addec799f176342f5d9a0277139cdb51336e0c1c1b904fcffa",
},
.smtp_client = .{
.url = "https://github.com/karlseguin/smtp_client.zig/archive/3cbe8f269e4c3a6bce407e7ae48b2c76307c559f.tar.gz",
Expand Down
8 changes: 4 additions & 4 deletions cli/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

.dependencies = .{
.args = .{
.url = "https://github.com/ikskuh/zig-args/archive/0abdd6947a70e6d8cc83b66228cea614aa856206.tar.gz",
.hash = "1220411a8c46d95bbf3b6e2059854bcb3c5159d428814099df5294232b9980517e9c",
.url = "https://github.com/ikskuh/zig-args/archive/968258dc1b1230493d8f1677097c832a3d7e0bd8.tar.gz",
.hash = "1220bdedf1a993d852d8aebcd63922a8fb163fac37b9c6ff72d187b2847a4a3a4248",
},
.jetquery = .{
.url = "https://github.com/jetzig-framework/jetquery/archive/387ad885bb29a16d38dbb71f5b4b5b083fa320e3.tar.gz",
.hash = "12206089a3d9de179a0d40cf35c48786eb4525a203ebf8cc131e23e430625713c402",
.url = "https://github.com/jetzig-framework/jetquery/archive/ec99c0accedbf783c9836f096e2381e4d8b396eb.tar.gz",
.hash = "1220d03534fb9e30dbe46d9450e4a8a9530cd0cc76b88ba37f3e44337c017943b859",
},
},
.paths = .{
Expand Down
1 change: 1 addition & 0 deletions src/Routes.zig
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ fn parseArray(self: *Routes, node: std.zig.Ast.Node.Index, params: *jetzig.data.
try params_array.append(try parseNumber(number_value, self.data));
},
inline else => {
@setEvalBranchQuota(10_000);
const tag = self.ast.nodes.items(.tag)[element];
std.debug.print("Unexpected token: {}\n", .{tag});
return error.JetzigStaticParamsParseError;
Expand Down
8 changes: 4 additions & 4 deletions src/jetzig/Environment.zig
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pub fn init(parent_allocator: std.mem.Allocator, env_options: EnvironmentOptions
}

const secret_len = jetzig.http.Session.Cipher.key_length;
const secret_value = try getSecret(allocator, launch_logger, secret_len, jetzig.environment);
const secret_value = try getSecret(allocator, launch_logger, jetzig.environment);
const secret = if (secret_value.len > secret_len) secret_value[0..secret_len] else secret_value;

if (secret.len != secret_len) {
Expand Down Expand Up @@ -326,7 +326,6 @@ fn getLogFile(stream: enum { stdout, stderr }, options: Options) !std.fs.File {
fn getSecret(
allocator: std.mem.Allocator,
logger: LaunchLogger,
comptime len: u10,
environment: EnvironmentName,
) ![]const u8 {
const env_var = "JETZIG_SECRET";
Expand All @@ -348,10 +347,11 @@ fn getSecret(
std.process.exit(1);
}

const secret = try jetzig.util.generateSecret(allocator, len);
const secret = "jetzig-development-cookie-secret";

try logger.log(
.WARN,
"Running in {s} mode, using auto-generated cookie encryption key: {s}",
"Running in {s} mode, using default development cookie encryption key: `{s}`",
.{ @tagName(environment), secret },
);
try logger.log(
Expand Down
4 changes: 2 additions & 2 deletions src/jetzig/http/params.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ pub fn expectParams(request: *jetzig.http.Request, T: type) !?T {
} else if (@typeInfo(field.type) == .optional) {
// if no matching param found and params struct provides a default value, use it,
// otherwise set value to null
@field(t, field.name) = if (field.default_value) |default_value|
@as(*field.type, @ptrCast(@alignCast(@constCast(default_value)))).*
@field(t, field.name) = if (field.default_value_ptr) |default_value_ptr|
@as(*field.type, @ptrCast(@alignCast(@constCast(default_value_ptr)))).*
else
null;
statuses[index] = .blank;
Expand Down
2 changes: 1 addition & 1 deletion src/jetzig/middleware/AntiCsrfMiddleware.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const TokenParams = @Type(.{
.name = jetzig.authenticity_token_name ++ "",
.type = []const u8,
.is_comptime = false,
.default_value = null,
.default_value_ptr = null,
.alignment = @alignOf([]const u8),
}},
},
Expand Down

0 comments on commit 87668c9

Please sign in to comment.