From e95cf5c7b6a08eb560763d5167fbddc1c2117bcc Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 17 Nov 2025 09:57:09 +0100 Subject: add file uploading and multi-threading --- src/routes/handler-info.zig | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/routes/handler-info.zig') diff --git a/src/routes/handler-info.zig b/src/routes/handler-info.zig index 7b744d2..94d0491 100644 --- a/src/routes/handler-info.zig +++ b/src/routes/handler-info.zig @@ -2,6 +2,8 @@ const std = @import("std"); const Context = @import("context.zig"); const Storage = @import("../storage/root.zig"); +const config = @import("config"); + const Access = @import("access.zig").Access; const log = std.log.scoped(.handler_info); @@ -71,22 +73,24 @@ pub fn handle( .fingerprint = get_fingerprint(cookie), }; - const allowed = switch (self.access) { - .everyone => true, - .users => storage.sessions.get(storage, context.fingerprint) != null, - .admins => admin: { - if (storage.sessions.get(storage, context.fingerprint)) |session| { - break :admin session.info.is_admin; - } - break :admin false; - }, - }; + if (!comptime config.disable_auth) { + const allowed = switch (self.access) { + .everyone => true, + .users => storage.sessions.get(storage, context.fingerprint) != null, + .admins => admin: { + if (storage.sessions.get(storage, context.fingerprint)) |session| { + break :admin session.info.is_admin; + } + break :admin false; + }, + }; - if (!allowed) { - return request.respond( - "{ \"error\": \"Forbidden\" }", - .{ .status = .forbidden } - ); + if (!allowed) { + return request.respond( + "{ \"error\": \"Forbidden\" }", + .{ .status = .forbidden } + ); + } } const response = handler(&context) catch |err| { -- cgit v1.2.3-70-g09d2