fix(api): 🐛 Fix missing FormData acceptance for registration route

This commit is contained in:
Jesse Wierzbinski 2024-10-24 18:48:11 +02:00
parent 3b704b4c8c
commit df84572148
No known key found for this signature in database
3 changed files with 11 additions and 9 deletions

View file

@ -1,4 +1,4 @@
import { apiRoute, applyConfig, auth } from "@/api"; import { apiRoute, applyConfig, auth, jsonOrForm } from "@/api";
import { tempmailDomains } from "@/tempmail"; import { tempmailDomains } from "@/tempmail";
import { createRoute } from "@hono/zod-openapi"; import { createRoute } from "@hono/zod-openapi";
import { and, eq, isNull } from "drizzle-orm"; import { and, eq, isNull } from "drizzle-orm";
@ -42,7 +42,10 @@ const route = createRoute({
path: "/api/v1/accounts", path: "/api/v1/accounts",
summary: "Create account", summary: "Create account",
description: "Register a new account", description: "Register a new account",
middleware: [auth(meta.auth, meta.permissions, meta.challenge)], middleware: [
auth(meta.auth, meta.permissions, meta.challenge),
jsonOrForm(),
],
request: { request: {
body: { body: {
content: { content: {

View file

@ -314,8 +314,7 @@ description = "A Versia Server instance"
# URL to your instance banner # URL to your instance banner
# banner = "" # banner = ""
# Used for federation. # Used for federation. If left empty or missing, the server will generate one for you.
# Use the "generate-keys" CLI command to generate these keys
[instance.keys] [instance.keys]
public = "" public = ""
private = "" private = ""
@ -414,10 +413,10 @@ forced = false
# Overriden by the signups.registration setting # Overriden by the signups.registration setting
allow_registration = true allow_registration = true
[plugins.config."@versia/openid".keys] # [plugins.config."@versia/openid".keys]
# Use the "generate-keys" CLI command to generate these keys # Run Versia Server with those values missing to generate a new key
public = "" # public = ""
private = "" # private = ""
# The provider MUST support OpenID Connect with .well-known discovery # The provider MUST support OpenID Connect with .well-known discovery
# Most notably, GitHub does not support this # Most notably, GitHub does not support this

View file

@ -1,7 +1,7 @@
import { Hooks, Plugin } from "@versia/kit"; import { Hooks, Plugin } from "@versia/kit";
import { User } from "@versia/kit/db";
import chalk from "chalk"; import chalk from "chalk";
import { z } from "zod"; import { z } from "zod";
import { User } from "@versia/kit/db";
import authorizeRoute from "./routes/authorize.ts"; import authorizeRoute from "./routes/authorize.ts";
import jwksRoute from "./routes/jwks.ts"; import jwksRoute from "./routes/jwks.ts";
import ssoLoginCallbackRoute from "./routes/oauth/callback.ts"; import ssoLoginCallbackRoute from "./routes/oauth/callback.ts";