minor tweaks

This commit is contained in:
yuzu 2025-05-06 00:17:10 -05:00
parent f9e148f9ee
commit 281043f96f
3 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,6 @@
FROM alpine:latest AS build FROM alpine:latest AS build
RUN apk add jq curl tar xz git vim RUN apk add jq curl tar xz git vim
RUN curl --output /zig.tar.xz "$(curl -s 'https://ziglang.org/download/index.json' | jq -r '.master."x86_64-linux".tarball')" RUN curl --output /zig.tar.xz "$(curl -s 'https://ziglang.org/download/index.json' | jq -r '.master."aarch64-linux".tarball')"
RUN mkdir /zig RUN mkdir /zig
WORKDIR /zig WORKDIR /zig
@ -13,7 +13,7 @@ RUN /zig/zig-*/zig build -Denvironment=production install
run mkdir /jetzig run mkdir /jetzig
WORKDIR /jetzig WORKDIR /jetzig
RUN git clone https://github.com/jetzig-framework/jetzig . RUN git clone https://github.com/yuzudev/jetzig .
WORKDIR ./cli WORKDIR ./cli
RUN /zig/zig-*/zig build install RUN /zig/zig-*/zig build install

View File

@ -3,17 +3,21 @@ const jetzig = @import("jetzig");
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = .ReleaseSafe;
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "yuzucchiidotxyz", .name = "yuzucchiidotxyz",
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path("src/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.use_llvm = true // fix for my arm machine
}); });
const options = b.addOptions(); const options = b.addOptions();
options.addOption([]const u8, "BLOGS_PASSWORD", "admin");
options.addOption([]const u8, "BLOGS_PASSWORD", std.posix.getenv("BLOGS_PASSWORD") orelse "admin");
options.addOption([]const u8, "DOMAIN", std.posix.getenv("DOMAIN") orelse "localhost");
exe.root_module.addOptions("dev", options); exe.root_module.addOptions("dev", options);
@ -26,7 +30,9 @@ pub fn build(b: *std.Build) !void {
exe.root_module.addImport("uuid", uuid.module("uuid")); exe.root_module.addImport("uuid", uuid.module("uuid"));
// ^ Add all dependencies before `jetzig.jetzigInit()` ^ // ^ Add all dependencies before `jetzig.jetzigInit()` ^
try jetzig.jetzigInit(b, exe, .{}); try jetzig.jetzigInit(b, exe, .{
.zmpl_version = .v2
});
b.installArtifact(exe); b.installArtifact(exe);

View File

@ -42,6 +42,7 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
.name = "session", .name = "session",
.value = uuid, .value = uuid,
.path = "/", .path = "/",
.domain = @import("dev").DOMAIN,
.http_only = true, .http_only = true,
.secure = false, .secure = false,
.max_age = 60 * 60 * 24 * 7, // 1 week .max_age = 60 * 60 * 24 * 7, // 1 week