Compare commits
3 commits
fdf0a84593
...
6748f065ef
Author | SHA1 | Date | |
---|---|---|---|
6748f065ef | |||
37ee6f9593 | |||
ea837f78bd |
10 changed files with 16 additions and 18 deletions
|
@ -205,7 +205,7 @@ pub fn Context(comptime Route: type) type {
|
|||
if (try req.headers.getCookie(cookie_name)) |token_hdr| {
|
||||
break :conn try api_source.connectToken(host, token_hdr, alloc);
|
||||
}
|
||||
} else return error.InvalidToken;
|
||||
} else return error.InvalidCookie;
|
||||
}
|
||||
|
||||
break :conn try api_source.connectUnauthorized(host, alloc);
|
||||
|
|
|
@ -3,7 +3,7 @@ const std = @import("std");
|
|||
|
||||
pub const login = struct {
|
||||
pub const method = .POST;
|
||||
pub const path = "/auth/login";
|
||||
pub const path = "/api/v0/auth/login";
|
||||
|
||||
pub const Body = struct {
|
||||
username: []const u8,
|
||||
|
@ -21,7 +21,7 @@ pub const login = struct {
|
|||
|
||||
pub const verify_login = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/auth/login";
|
||||
pub const path = "/api/v0/auth/login";
|
||||
|
||||
pub fn handler(_: anytype, res: anytype, srv: anytype) !void {
|
||||
const info = try srv.verifyAuthorization();
|
||||
|
|
|
@ -5,7 +5,7 @@ const QueryArgs = api.CommunityQueryArgs;
|
|||
|
||||
pub const create = struct {
|
||||
pub const method = .POST;
|
||||
pub const path = "/communities";
|
||||
pub const path = "/api/v0/communities";
|
||||
|
||||
pub const Body = struct {
|
||||
origin: []const u8,
|
||||
|
@ -20,7 +20,7 @@ pub const create = struct {
|
|||
|
||||
pub const query = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/communities";
|
||||
pub const path = "/api/v0/communities";
|
||||
|
||||
pub const Query = QueryArgs;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const api = @import("api");
|
|||
|
||||
pub const create = struct {
|
||||
pub const method = .POST;
|
||||
pub const path = "/invites";
|
||||
pub const path = "/api/v0/invites";
|
||||
|
||||
pub const Body = api.InviteOptions;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const util = @import("util");
|
|||
|
||||
pub const create = struct {
|
||||
pub const method = .POST;
|
||||
pub const path = "/notes";
|
||||
pub const path = "/api/v0/notes";
|
||||
|
||||
pub const Body = struct {
|
||||
content: []const u8,
|
||||
|
@ -18,7 +18,7 @@ pub const create = struct {
|
|||
|
||||
pub const get = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/notes/:id";
|
||||
pub const path = "/api/v0/notes/:id";
|
||||
|
||||
pub const Args = struct {
|
||||
id: util.Uuid,
|
||||
|
|
|
@ -3,7 +3,7 @@ const std = @import("std");
|
|||
|
||||
pub const streaming = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/streaming";
|
||||
pub const path = "/api/v0/streaming";
|
||||
|
||||
pub fn handler(req: anytype, response: anytype, _: anytype) !void {
|
||||
var iter = req.headers.iterator();
|
||||
|
|
|
@ -4,7 +4,7 @@ const controller_utils = @import("../../controllers.zig").helpers;
|
|||
|
||||
pub const global = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/timelines/global";
|
||||
pub const path = "/api/v0/timelines/global";
|
||||
|
||||
pub const Query = api.TimelineArgs;
|
||||
|
||||
|
@ -16,7 +16,7 @@ pub const global = struct {
|
|||
|
||||
pub const local = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/timelines/local";
|
||||
pub const path = "/api/v0/timelines/local";
|
||||
|
||||
pub const Query = api.TimelineArgs;
|
||||
|
||||
|
@ -28,7 +28,7 @@ pub const local = struct {
|
|||
|
||||
pub const home = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/timelines/home";
|
||||
pub const path = "/api/v0/timelines/home";
|
||||
|
||||
pub const Query = api.TimelineArgs;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const api = @import("api");
|
|||
|
||||
pub const create = struct {
|
||||
pub const method = .POST;
|
||||
pub const path = "/users";
|
||||
pub const path = "/api/v0/users";
|
||||
|
||||
pub const Body = struct {
|
||||
username: []const u8,
|
||||
|
|
|
@ -6,7 +6,7 @@ const Uuid = util.Uuid;
|
|||
|
||||
pub const create = struct {
|
||||
pub const method = .POST;
|
||||
pub const path = "/users/:id/follow";
|
||||
pub const path = "/api/v0/users/:id/follow";
|
||||
|
||||
pub const Args = struct {
|
||||
id: Uuid,
|
||||
|
@ -21,7 +21,7 @@ pub const create = struct {
|
|||
|
||||
pub const query_followers = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/users/:id/followers";
|
||||
pub const path = "/api/v0/users/:id/followers";
|
||||
|
||||
pub const Args = struct {
|
||||
id: Uuid,
|
||||
|
@ -38,7 +38,7 @@ pub const query_followers = struct {
|
|||
|
||||
pub const query_following = struct {
|
||||
pub const method = .GET;
|
||||
pub const path = "/users/:id/following";
|
||||
pub const path = "/api/v0/users/:id/following";
|
||||
|
||||
pub const Args = struct {
|
||||
id: Uuid,
|
||||
|
|
|
@ -25,8 +25,6 @@ const about = struct {
|
|||
pub const method = .GET;
|
||||
|
||||
pub fn handler(_: anytype, res: anytype, srv: anytype) !void {
|
||||
try res.headers.put("Content-Type", "text/html");
|
||||
|
||||
try res.template(.ok, tmpl, .{
|
||||
.community = srv.community,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue