mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
refactor: ♻️ Use a typed wrapper for all API endpoints
This commit is contained in:
parent
b0e49855f5
commit
7e2f333945
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { errorResponse, redirect } from "@/response";
|
import { errorResponse, redirect } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq, or } from "drizzle-orm";
|
import { eq, or } from "drizzle-orm";
|
||||||
import { SignJWT } from "jose";
|
import { SignJWT } from "jose";
|
||||||
|
|
@ -81,7 +80,7 @@ const returnError = (query: object, error: string, description: string) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -193,4 +192,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { randomString } from "@/math";
|
import { randomString } from "@/math";
|
||||||
import { response } from "@/response";
|
import { response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -35,7 +34,7 @@ export const schemas = {
|
||||||
/**
|
/**
|
||||||
* Mastodon-FE login route
|
* Mastodon-FE login route
|
||||||
*/
|
*/
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -104,4 +103,5 @@ export default (app: Hono) =>
|
||||||
}; SameSite=Lax; Path=/; HttpOnly; Max-Age=${maxAge}`,
|
}; SameSite=Lax; Path=/; HttpOnly; Max-Age=${maxAge}`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -17,7 +16,7 @@ export const meta = applyConfig({
|
||||||
/**
|
/**
|
||||||
* Mastodon-FE logout route
|
* Mastodon-FE logout route
|
||||||
*/
|
*/
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, () => {
|
app.on(meta.allowedMethods, meta.route, () => {
|
||||||
return new Response(null, {
|
return new Response(null, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -28,4 +27,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
status: 303,
|
status: 303,
|
||||||
});
|
});
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq } from "drizzle-orm";
|
import { and, eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -30,7 +29,7 @@ export const schemas = {
|
||||||
/**
|
/**
|
||||||
* OAuth Code flow
|
* OAuth Code flow
|
||||||
*/
|
*/
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -70,4 +69,5 @@ export default (app: Hono) =>
|
||||||
// Redirect back to application
|
// Redirect back to application
|
||||||
return Response.redirect(`${redirect_uri}?code=${code}`, 302);
|
return Response.redirect(`${redirect_uri}?code=${code}`, 302);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { response } from "@/response";
|
import { response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -44,7 +43,7 @@ const returnError = (token: string, error: string, description: string) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -69,4 +68,5 @@ export default (app: Hono) =>
|
||||||
Location: `${config.frontend.routes.password_reset}?success=true`,
|
Location: `${config.frontend.routes.password_reset}?success=true`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -65,4 +64,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import ISO6391 from "iso-639-1";
|
import ISO6391 from "iso-639-1";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -43,7 +42,7 @@ export const schemas = {
|
||||||
.default({ reblogs: true, notify: false, languages: [] }),
|
.default({ reblogs: true, notify: false, languages: [] }),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -80,4 +79,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(relationship.toApi());
|
return jsonResponse(relationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -39,7 +44,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -78,4 +83,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -39,7 +44,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -77,4 +82,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -28,7 +27,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -46,4 +45,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundUser.toApi(user?.id === foundUser.id));
|
return jsonResponse(foundUser.toApi(user?.id === foundUser.id));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -41,7 +40,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -77,4 +76,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -35,7 +34,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -68,4 +67,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -63,4 +62,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -28,7 +27,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -52,4 +51,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(newUser.toApi(false));
|
return jsonResponse(newUser.toApi(false));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -70,4 +69,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, gt, gte, isNull, lt, sql } from "drizzle-orm";
|
import { and, eq, gt, gte, isNull, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -56,7 +61,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -112,4 +117,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -65,4 +64,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -63,4 +62,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -66,4 +65,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -65,4 +64,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError, qsQuery } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, qsQuery } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { inArray } from "drizzle-orm";
|
import { inArray } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -30,7 +29,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -95,4 +94,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(finalUsers.map((o) => o.toApi()));
|
return jsonResponse(finalUsers.map((o) => o.toApi()));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, isNull } from "drizzle-orm";
|
import { and, eq, isNull } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -29,7 +28,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -48,4 +47,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(user.toApi());
|
return jsonResponse(user.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { jsonResponse, response } from "@/response";
|
import { jsonResponse, response } from "@/response";
|
||||||
import { tempmailDomains } from "@/tempmail";
|
import { tempmailDomains } from "@/tempmail";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, isNull } from "drizzle-orm";
|
import { and, eq, isNull } from "drizzle-orm";
|
||||||
import ISO6391 from "iso-639-1";
|
import ISO6391 from "iso-639-1";
|
||||||
|
|
@ -40,7 +39,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -257,4 +256,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return response(null, 200);
|
return response(null, 200);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
|
|
@ -40,7 +39,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -109,4 +108,5 @@ export default (app: Hono) =>
|
||||||
404,
|
404,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError, qsQuery } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, qsQuery } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -28,7 +27,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -58,4 +57,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(relationships.map((r) => r.toApi()));
|
return jsonResponse(relationships.map((r) => r.toApi()));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq, ilike, not, or, sql } from "drizzle-orm";
|
import { eq, ilike, not, or, sql } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
|
|
@ -69,7 +68,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -129,4 +128,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(result.map((acct) => acct.toApi()));
|
return jsonResponse(result.map((acct) => acct.toApi()));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import { sanitizedHtmlStrip } from "@/sanitization";
|
import { sanitizedHtmlStrip } from "@/sanitization";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, isNull } from "drizzle-orm";
|
import { and, eq, isNull } from "drizzle-orm";
|
||||||
import ISO6391 from "iso-639-1";
|
import ISO6391 from "iso-639-1";
|
||||||
|
|
@ -127,7 +126,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -336,4 +335,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(output.toApi());
|
return jsonResponse(output.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
allowedMethods: ["GET"],
|
allowedMethods: ["GET"],
|
||||||
|
|
@ -15,7 +14,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -30,4 +29,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(user.toApi(true));
|
return jsonResponse(user.toApi(true));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { randomString } from "@/math";
|
import { randomString } from "@/math";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { db } from "~/drizzle/db";
|
import { db } from "~/drizzle/db";
|
||||||
|
|
@ -44,7 +43,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -78,4 +77,5 @@ export default (app: Hono) =>
|
||||||
vapid_link: app.vapidKey,
|
vapid_link: app.vapidKey,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { getFromToken } from "~/classes/functions/application";
|
import { getFromToken } from "~/classes/functions/application";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
||||||
|
|
@ -19,7 +18,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -48,4 +47,5 @@ export default (app: Hono) =>
|
||||||
scopes: application.scopes,
|
scopes: application.scopes,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -32,7 +37,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -67,4 +72,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { generateChallenge } from "@/challenges";
|
import { generateChallenge } from "@/challenges";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -19,7 +18,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -36,4 +35,5 @@ export default (app: Hono) =>
|
||||||
...result.challenge,
|
...result.challenge,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { and, eq, isNull, or } from "drizzle-orm";
|
import { and, eq, isNull, or } from "drizzle-orm";
|
||||||
import { Emojis, RolePermissions } from "~/drizzle/schema";
|
import { Emojis, RolePermissions } from "~/drizzle/schema";
|
||||||
import { Emoji } from "~/packages/database-interface/emoji";
|
import { Emoji } from "~/packages/database-interface/emoji";
|
||||||
|
|
@ -20,7 +19,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -40,4 +39,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(emojis.map((emoji) => emoji.toApi()));
|
return jsonResponse(emojis.map((emoji) => emoji.toApi()));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
apiRoute,
|
||||||
applyConfig,
|
applyConfig,
|
||||||
auth,
|
auth,
|
||||||
emojiValidator,
|
emojiValidator,
|
||||||
|
|
@ -7,7 +8,6 @@ import {
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import { mimeLookup } from "@/content_types";
|
import { mimeLookup } from "@/content_types";
|
||||||
import { errorResponse, jsonResponse, response } from "@/response";
|
import { errorResponse, jsonResponse, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -67,7 +67,7 @@ export const schemas = {
|
||||||
.optional(),
|
.optional(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -198,4 +198,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
apiRoute,
|
||||||
applyConfig,
|
applyConfig,
|
||||||
auth,
|
auth,
|
||||||
emojiValidator,
|
emojiValidator,
|
||||||
|
|
@ -7,7 +8,6 @@ import {
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import { mimeLookup } from "@/content_types";
|
import { mimeLookup } from "@/content_types";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, isNull, or } from "drizzle-orm";
|
import { and, eq, isNull, or } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -60,7 +60,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -137,4 +137,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(emoji.toApi());
|
return jsonResponse(emoji.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -31,7 +36,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -70,4 +75,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { sendFollowAccept } from "~/classes/functions/user";
|
import { sendFollowAccept } from "~/classes/functions/user";
|
||||||
|
|
@ -29,7 +28,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -73,4 +72,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { sendFollowReject } from "~/classes/functions/user";
|
import { sendFollowReject } from "~/classes/functions/user";
|
||||||
|
|
@ -29,7 +28,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -73,4 +72,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(foundRelationship.toApi());
|
return jsonResponse(foundRelationship.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -31,7 +36,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -67,4 +72,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -15,7 +14,8 @@ export const meta = applyConfig({
|
||||||
route: "/api/v1/frontend/config",
|
route: "/api/v1/frontend/config",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, () => {
|
app.on(meta.allowedMethods, meta.route, () => {
|
||||||
return jsonResponse(config.frontend.settings);
|
return jsonResponse(config.frontend.settings);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { renderMarkdownInPath } from "@/markdown";
|
import { renderMarkdownInPath } from "@/markdown";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -16,7 +15,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -32,4 +31,5 @@ export default (app: Hono) =>
|
||||||
content,
|
content,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { jsonResponse, proxyUrl } from "@/response";
|
import { jsonResponse, proxyUrl } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { and, eq, isNull } from "drizzle-orm";
|
import { and, eq, isNull } from "drizzle-orm";
|
||||||
import { Users } from "~/drizzle/schema";
|
import { Users } from "~/drizzle/schema";
|
||||||
import manifest from "~/package.json";
|
import manifest from "~/package.json";
|
||||||
|
|
@ -21,7 +20,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -103,4 +102,5 @@ export default (app: Hono) =>
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { renderMarkdownInPath } from "@/markdown";
|
import { renderMarkdownInPath } from "@/markdown";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -16,7 +15,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -32,4 +31,5 @@ export default (app: Hono) =>
|
||||||
content,
|
content,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -15,12 +14,12 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
auth(meta.auth, meta.permissions),
|
auth(meta.auth, meta.permissions),
|
||||||
async (_context) => {
|
async () => {
|
||||||
return jsonResponse(
|
return jsonResponse(
|
||||||
config.signups.rules.map((rule, index) => ({
|
config.signups.rules.map((rule, index) => ({
|
||||||
id: String(index),
|
id: String(index),
|
||||||
|
|
@ -29,4 +28,5 @@ export default (app: Hono) =>
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { renderMarkdownInPath } from "@/markdown";
|
import { renderMarkdownInPath } from "@/markdown";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -16,7 +15,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -32,4 +31,5 @@ export default (app: Hono) =>
|
||||||
content,
|
content,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import type { Marker as ApiMarker } from "@lysand-org/client/types";
|
import type { Marker as ApiMarker } from "@lysand-org/client/types";
|
||||||
import { and, count, eq } from "drizzle-orm";
|
import { and, count, eq } from "drizzle-orm";
|
||||||
|
|
@ -36,7 +41,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -211,4 +216,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse, response } from "@/response";
|
import { errorResponse, jsonResponse, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { MediaManager } from "~/classes/media/media-manager";
|
import { MediaManager } from "~/classes/media/media-manager";
|
||||||
|
|
@ -38,7 +43,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -99,4 +104,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return errorResponse("Method not allowed", 405);
|
return errorResponse("Method not allowed", 405);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -37,7 +36,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -98,4 +97,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(newAttachment.toApi());
|
return jsonResponse(newAttachment.toApi());
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -32,7 +37,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -66,4 +71,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -29,7 +28,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -52,4 +51,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse({});
|
return jsonResponse({});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { findManyNotifications } from "~/classes/functions/notification";
|
import { findManyNotifications } from "~/classes/functions/notification";
|
||||||
|
|
@ -28,7 +27,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -59,4 +58,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(notification);
|
return jsonResponse(notification);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { db } from "~/drizzle/db";
|
import { db } from "~/drizzle/db";
|
||||||
import { Notifications, RolePermissions } from "~/drizzle/schema";
|
import { Notifications, RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -21,7 +20,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -41,4 +40,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse({});
|
return jsonResponse({});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, inArray } from "drizzle-orm";
|
import { and, eq, inArray } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -29,7 +28,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -58,4 +57,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse({});
|
return jsonResponse({});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import { fetchTimeline } from "@/timelines";
|
import { fetchTimeline } from "@/timelines";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { sql } from "drizzle-orm";
|
import { sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -91,7 +96,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -194,4 +199,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -18,7 +17,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -36,4 +35,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(self.toApi(true));
|
return jsonResponse(self.toApi(true));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -18,7 +17,7 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -36,4 +35,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(self.toApi(true));
|
return jsonResponse(self.toApi(true));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse, response } from "@/response";
|
import { errorResponse, jsonResponse, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -30,7 +29,7 @@ export const schemas = {
|
||||||
id: z.string().uuid(),
|
id: z.string().uuid(),
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -109,4 +108,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth } from "@/api";
|
import { apiRoute, applyConfig, auth } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { Role } from "~/packages/database-interface/role";
|
import { Role } from "~/packages/database-interface/role";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -15,7 +14,7 @@ export const meta = applyConfig({
|
||||||
route: "/api/v1/roles",
|
route: "/api/v1/roles",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -34,4 +33,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(userRoles.map((r) => r.toApi()));
|
return jsonResponse(userRoles.map((r) => r.toApi()));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse, proxyUrl, response } from "@/response";
|
import { errorResponse, jsonResponse, proxyUrl, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -34,7 +33,7 @@ export const schemas = {
|
||||||
* A GET request allows the user to list all their linked accounts
|
* A GET request allows the user to list all their linked accounts
|
||||||
* A POST request allows the user to link a new account
|
* A POST request allows the user to link a new account
|
||||||
*/
|
*/
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -104,4 +103,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { oauthRedirectUri } from "@/constants";
|
import { oauthRedirectUri } from "@/constants";
|
||||||
import { randomString } from "@/math";
|
import { randomString } from "@/math";
|
||||||
import { errorResponse, jsonResponse, proxyUrl } from "@/response";
|
import { errorResponse, jsonResponse, proxyUrl } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import {
|
import {
|
||||||
calculatePKCECodeChallenge,
|
calculatePKCECodeChallenge,
|
||||||
|
|
@ -47,7 +46,7 @@ export const schemas = {
|
||||||
* A GET request allows the user to list all their linked accounts
|
* A GET request allows the user to list all their linked accounts
|
||||||
* A POST request allows the user to link a new account, and returns a link
|
* A POST request allows the user to link a new account, and returns a link
|
||||||
*/
|
*/
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -180,4 +179,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -27,7 +26,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -57,4 +56,5 @@ export default (app: Hono) =>
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { createLike } from "~/classes/functions/like";
|
import { createLike } from "~/classes/functions/like";
|
||||||
|
|
@ -29,7 +28,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -70,4 +69,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(await newNote.toApi(user));
|
return jsonResponse(await newNote.toApi(user));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -35,7 +40,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -78,4 +83,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
apiRoute,
|
||||||
applyConfig,
|
applyConfig,
|
||||||
auth,
|
auth,
|
||||||
handleZodError,
|
handleZodError,
|
||||||
|
|
@ -6,7 +7,6 @@ import {
|
||||||
jsonOrForm,
|
jsonOrForm,
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import ISO6391 from "iso-639-1";
|
import ISO6391 from "iso-639-1";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -97,7 +97,7 @@ export const schemas = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -179,4 +179,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { db } from "~/drizzle/db";
|
import { db } from "~/drizzle/db";
|
||||||
|
|
@ -28,7 +33,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -68,4 +73,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(await foundStatus.toApi(user));
|
return jsonResponse(await foundStatus.toApi(user));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq } from "drizzle-orm";
|
import { and, eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -32,7 +31,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -96,4 +95,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(await finalNewReblog.toApi(user));
|
return jsonResponse(await finalNewReblog.toApi(user));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -35,7 +34,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -77,4 +76,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import type { StatusSource as ApiStatusSource } from "@lysand-org/client/types";
|
import type { StatusSource as ApiStatusSource } from "@lysand-org/client/types";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -28,7 +27,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -55,4 +54,5 @@ export default (app: Hono) =>
|
||||||
text: status.data.contentSource,
|
text: status.data.contentSource,
|
||||||
} as ApiStatusSource);
|
} as ApiStatusSource);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { deleteLike } from "~/classes/functions/like";
|
import { deleteLike } from "~/classes/functions/like";
|
||||||
|
|
@ -28,7 +27,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -58,4 +57,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(await newNote.toApi(user));
|
return jsonResponse(await newNote.toApi(user));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { RolePermissions } from "~/drizzle/schema";
|
import { RolePermissions } from "~/drizzle/schema";
|
||||||
|
|
@ -27,7 +26,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -59,4 +58,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(await status.toApi(user));
|
return jsonResponse(await status.toApi(user));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq } from "drizzle-orm";
|
import { and, eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -29,7 +28,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -77,4 +76,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(await newNote.toApi(user));
|
return jsonResponse(await newNote.toApi(user));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import ISO6391 from "iso-639-1";
|
import ISO6391 from "iso-639-1";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -102,7 +101,7 @@ export const schemas = {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -168,4 +167,5 @@ export default (app: Hono) =>
|
||||||
|
|
||||||
return jsonResponse(await newNote.toApi(user));
|
return jsonResponse(await newNote.toApi(user));
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, gt, gte, lt, or, sql } from "drizzle-orm";
|
import { and, eq, gt, gte, lt, or, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -36,7 +41,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -81,4 +86,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { applyConfig, auth, handleZodError, idValidator } from "@/api";
|
import {
|
||||||
|
apiRoute,
|
||||||
|
applyConfig,
|
||||||
|
auth,
|
||||||
|
handleZodError,
|
||||||
|
idValidator,
|
||||||
|
} from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
import { and, gt, gte, lt, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -47,7 +52,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -99,4 +104,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, inArray } from "drizzle-orm";
|
import { and, eq, inArray } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -70,7 +69,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -221,4 +220,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { db } from "~/drizzle/db";
|
import { db } from "~/drizzle/db";
|
||||||
|
|
@ -59,7 +58,7 @@ export const schemas = {
|
||||||
.optional(),
|
.optional(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -189,4 +188,5 @@ export default (app: Hono) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { jsonResponse, proxyUrl } from "@/response";
|
import { jsonResponse, proxyUrl } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import type { Instance as ApiInstance } from "@lysand-org/client/types";
|
import type { Instance as ApiInstance } from "@lysand-org/client/types";
|
||||||
import { and, eq, isNull } from "drizzle-orm";
|
import { and, eq, isNull } from "drizzle-orm";
|
||||||
import { Users } from "~/drizzle/schema";
|
import { Users } from "~/drizzle/schema";
|
||||||
|
|
@ -20,8 +19,8 @@ export const meta = applyConfig({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, async (_context) => {
|
app.on(meta.allowedMethods, meta.route, async () => {
|
||||||
// Get software version from package.json
|
// Get software version from package.json
|
||||||
const version = manifest.version;
|
const version = manifest.version;
|
||||||
|
|
||||||
|
|
@ -125,4 +124,5 @@ export default (app: Hono) =>
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
} satisfies ApiInstance);
|
} satisfies ApiInstance);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, auth, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, auth, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -37,7 +36,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -108,4 +107,5 @@ export default (app: Hono) =>
|
||||||
202,
|
202,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
apiRoute,
|
||||||
applyConfig,
|
applyConfig,
|
||||||
auth,
|
auth,
|
||||||
handleZodError,
|
handleZodError,
|
||||||
|
|
@ -6,7 +7,6 @@ import {
|
||||||
userAddressValidator,
|
userAddressValidator,
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, inArray, sql } from "drizzle-orm";
|
import { and, eq, inArray, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -51,7 +51,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -218,4 +218,5 @@ export default (app: Hono) =>
|
||||||
hashtags: [],
|
hashtags: [],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { errorResponse, response } from "@/response";
|
import { errorResponse, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
|
@ -26,7 +25,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -61,4 +60,5 @@ export default (app: Hono) =>
|
||||||
"Content-Range": `bytes ${start}-${end}/${file.size}`,
|
"Content-Range": `bytes ${start}-${end}/${file.size}`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { errorResponse, response } from "@/response";
|
import { errorResponse, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
@ -25,7 +24,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -73,4 +72,5 @@ export default (app: Hono) =>
|
||||||
"Content-Disposition": `inline; filename="${realFilename}"`,
|
"Content-Disposition": `inline; filename="${realFilename}"`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import { applyConfig, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { randomString } from "@/math";
|
import { randomString } from "@/math";
|
||||||
import { response } from "@/response";
|
import { response } from "@/response";
|
||||||
import { sentry } from "@/sentry";
|
import { sentry } from "@/sentry";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { SignJWT, jwtVerify } from "jose";
|
import { SignJWT, jwtVerify } from "jose";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -78,7 +77,7 @@ const returnError = (query: object, error: string, description: string) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -330,4 +329,5 @@ export default (app: Hono) =>
|
||||||
Pragma: "no-cache",
|
Pragma: "no-cache",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { randomString } from "@/math";
|
import { randomString } from "@/math";
|
||||||
import { errorResponse, response } from "@/response";
|
import { errorResponse, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, eq, isNull } from "drizzle-orm";
|
import { and, eq, isNull } from "drizzle-orm";
|
||||||
import { SignJWT } from "jose";
|
import { SignJWT } from "jose";
|
||||||
|
|
@ -63,7 +62,7 @@ const returnError = (query: object, error: string, description: string) => {
|
||||||
* After the user has authenticated to an external OpenID provider,
|
* After the user has authenticated to an external OpenID provider,
|
||||||
* they are redirected here to complete the OAuth flow and get a code
|
* they are redirected here to complete the OAuth flow and get a code
|
||||||
*/
|
*/
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -288,4 +287,5 @@ export default (app: Hono) =>
|
||||||
}`,
|
}`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { oauthRedirectUri } from "@/constants";
|
import { oauthRedirectUri } from "@/constants";
|
||||||
import { redirect, response } from "@/response";
|
import { redirect, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import {
|
import {
|
||||||
calculatePKCECodeChallenge,
|
calculatePKCECodeChallenge,
|
||||||
|
|
@ -54,7 +53,7 @@ const returnError = (query: object, error: string, description: string) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -135,4 +134,5 @@ export default (app: Hono) =>
|
||||||
302,
|
302,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError, jsonOrForm } from "@/api";
|
import { apiRoute, applyConfig, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -61,7 +60,7 @@ const returnError = (error: string, description: string) =>
|
||||||
401,
|
401,
|
||||||
);
|
);
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -151,4 +150,5 @@ export default (app: Hono) =>
|
||||||
"Unsupported grant type",
|
"Unsupported grant type",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { errorResponse, response } from "@/response";
|
import { errorResponse, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import type { Entity } from "@lysand-org/federation/types";
|
import type { Entity } from "@lysand-org/federation/types";
|
||||||
import { and, eq, inArray, sql } from "drizzle-orm";
|
import { and, eq, inArray, sql } from "drizzle-orm";
|
||||||
|
|
@ -36,7 +35,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -116,4 +115,5 @@ export default (app: Hono) =>
|
||||||
...headers.toJSON(),
|
...headers.toJSON(),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig, debugRequest, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, debugRequest, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse, response } from "@/response";
|
import { errorResponse, jsonResponse, response } from "@/response";
|
||||||
import { sentry } from "@/sentry";
|
import { sentry } from "@/sentry";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { getLogger } from "@logtape/logtape";
|
import { getLogger } from "@logtape/logtape";
|
||||||
import {
|
import {
|
||||||
|
|
@ -47,7 +46,7 @@ export const schemas = {
|
||||||
body: z.any(),
|
body: z.any(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -402,4 +401,5 @@ export default (app: Hono) =>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { errorResponse, redirect, response } from "@/response";
|
import { errorResponse, redirect, response } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
@ -30,7 +29,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -89,4 +88,5 @@ export default (app: Hono) =>
|
||||||
...headers.toJSON(),
|
...headers.toJSON(),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig, handleZodError } from "@/api";
|
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { and, count, eq, inArray } from "drizzle-orm";
|
import { and, count, eq, inArray } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
@ -33,7 +32,7 @@ export const schemas = {
|
||||||
|
|
||||||
const NOTES_PER_PAGE = 20;
|
const NOTES_PER_PAGE = 20;
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -112,4 +111,5 @@ export default (app: Hono) =>
|
||||||
items: notes.map((note) => note.toVersia()),
|
items: notes.map((note) => note.toVersia()),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { xmlResponse } from "@/response";
|
import { xmlResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -15,7 +14,7 @@ export const meta = applyConfig({
|
||||||
route: "/.well-known/host-meta",
|
route: "/.well-known/host-meta",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, () => {
|
app.on(meta.allowedMethods, meta.route, () => {
|
||||||
return xmlResponse(
|
return xmlResponse(
|
||||||
`<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="${new URL(
|
`<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="${new URL(
|
||||||
|
|
@ -23,4 +22,5 @@ export default (app: Hono) =>
|
||||||
config.http.base_url,
|
config.http.base_url,
|
||||||
).toString()}?resource={uri}"/></XRD>`,
|
).toString()}?resource={uri}"/></XRD>`,
|
||||||
);
|
);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { exportJWK } from "jose";
|
import { exportJWK } from "jose";
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
|
|
@ -16,7 +15,7 @@ export const meta = applyConfig({
|
||||||
route: "/.well-known/jwks",
|
route: "/.well-known/jwks",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, async () => {
|
app.on(meta.allowedMethods, meta.route, async () => {
|
||||||
const publicKey = await crypto.subtle.importKey(
|
const publicKey = await crypto.subtle.importKey(
|
||||||
"spki",
|
"spki",
|
||||||
|
|
@ -41,4 +40,5 @@ export default (app: Hono) =>
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import manifest from "~/package.json";
|
import manifest from "~/package.json";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -15,7 +14,7 @@ export const meta = applyConfig({
|
||||||
route: "/.well-known/nodeinfo/2.0",
|
route: "/.well-known/nodeinfo/2.0",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, () => {
|
app.on(meta.allowedMethods, meta.route, () => {
|
||||||
return jsonResponse({
|
return jsonResponse({
|
||||||
version: "2.0",
|
version: "2.0",
|
||||||
|
|
@ -29,4 +28,5 @@ export default (app: Hono) =>
|
||||||
openRegistrations: false,
|
openRegistrations: false,
|
||||||
metadata: {},
|
metadata: {},
|
||||||
});
|
});
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { redirect } from "@/response";
|
import { redirect } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -15,10 +14,11 @@ export const meta = applyConfig({
|
||||||
route: "/.well-known/nodeinfo",
|
route: "/.well-known/nodeinfo",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, () => {
|
app.on(meta.allowedMethods, meta.route, () => {
|
||||||
return redirect(
|
return redirect(
|
||||||
new URL("/.well-known/nodeinfo/2.0", config.http.base_url),
|
new URL("/.well-known/nodeinfo/2.0", config.http.base_url),
|
||||||
301,
|
301,
|
||||||
);
|
);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
|
|
@ -15,7 +14,7 @@ export const meta = applyConfig({
|
||||||
route: "/.well-known/openid-configuration",
|
route: "/.well-known/openid-configuration",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, () => {
|
app.on(meta.allowedMethods, meta.route, () => {
|
||||||
const baseUrl = new URL(config.http.base_url);
|
const baseUrl = new URL(config.http.base_url);
|
||||||
return jsonResponse({
|
return jsonResponse({
|
||||||
|
|
@ -31,4 +30,5 @@ export default (app: Hono) =>
|
||||||
token_endpoint_auth_methods_supported: ["client_secret_basic"],
|
token_endpoint_auth_methods_supported: ["client_secret_basic"],
|
||||||
claims_supported: ["sub"],
|
claims_supported: ["sub"],
|
||||||
});
|
});
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { applyConfig } from "@/api";
|
import { apiRoute, applyConfig } from "@/api";
|
||||||
import { urlToContentFormat } from "@/content_types";
|
import { urlToContentFormat } from "@/content_types";
|
||||||
import { jsonResponse } from "@/response";
|
import { jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import type { ServerMetadata } from "@lysand-org/federation/types";
|
import type { ServerMetadata } from "@lysand-org/federation/types";
|
||||||
import pkg from "~/package.json";
|
import pkg from "~/package.json";
|
||||||
import { config } from "~/packages/config-manager";
|
import { config } from "~/packages/config-manager";
|
||||||
|
|
@ -18,7 +17,7 @@ export const meta = applyConfig({
|
||||||
route: "/.well-known/versia",
|
route: "/.well-known/versia",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(meta.allowedMethods, meta.route, () => {
|
app.on(meta.allowedMethods, meta.route, () => {
|
||||||
return jsonResponse({
|
return jsonResponse({
|
||||||
type: "ServerMetadata",
|
type: "ServerMetadata",
|
||||||
|
|
@ -30,4 +29,5 @@ export default (app: Hono) =>
|
||||||
supported_extensions: ["org.lysand:custom_emojis"],
|
supported_extensions: ["org.lysand:custom_emojis"],
|
||||||
website: "https://versia.pub",
|
website: "https://versia.pub",
|
||||||
} satisfies ServerMetadata);
|
} satisfies ServerMetadata);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import {
|
import {
|
||||||
|
apiRoute,
|
||||||
applyConfig,
|
applyConfig,
|
||||||
handleZodError,
|
handleZodError,
|
||||||
idValidator,
|
idValidator,
|
||||||
webfingerMention,
|
webfingerMention,
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import { errorResponse, jsonResponse } from "@/response";
|
import { errorResponse, jsonResponse } from "@/response";
|
||||||
import type { Hono } from "@hono/hono";
|
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { getLogger } from "@logtape/logtape";
|
import { getLogger } from "@logtape/logtape";
|
||||||
import type { ResponseError } from "@lysand-org/federation";
|
import type { ResponseError } from "@lysand-org/federation";
|
||||||
|
|
@ -34,7 +34,7 @@ export const schemas = {
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (app: Hono) =>
|
export default apiRoute((app) =>
|
||||||
app.on(
|
app.on(
|
||||||
meta.allowedMethods,
|
meta.allowedMethods,
|
||||||
meta.route,
|
meta.route,
|
||||||
|
|
@ -126,4 +126,5 @@ export default (app: Hono) =>
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
10
utils/api.ts
10
utils/api.ts
|
|
@ -1,5 +1,5 @@
|
||||||
import { errorResponse } from "@/response";
|
import { errorResponse } from "@/response";
|
||||||
import type { Context } from "@hono/hono";
|
import type { Context, Hono } from "@hono/hono";
|
||||||
import { createMiddleware } from "@hono/hono/factory";
|
import { createMiddleware } from "@hono/hono/factory";
|
||||||
import type { StatusCode } from "@hono/hono/utils/http-status";
|
import type { StatusCode } from "@hono/hono/utils/http-status";
|
||||||
import { validator } from "@hono/hono/validator";
|
import { validator } from "@hono/hono/validator";
|
||||||
|
|
@ -44,6 +44,14 @@ export const applyConfig = (routeMeta: ApiRouteMetadata) => {
|
||||||
return newMeta;
|
return newMeta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const apiRoute = (
|
||||||
|
fn: (
|
||||||
|
app: Hono /* <{
|
||||||
|
Bindings: {};
|
||||||
|
}> */,
|
||||||
|
) => void,
|
||||||
|
) => fn;
|
||||||
|
|
||||||
export const idValidator = createRegExp(
|
export const idValidator = createRegExp(
|
||||||
anyOf(digit, charIn("ABCDEF")).times(8),
|
anyOf(digit, charIn("ABCDEF")).times(8),
|
||||||
exactly("-"),
|
exactly("-"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue