this is super cursed
This commit is contained in:
parent
f2b014b4a8
commit
838ca1841a
|
@ -12,6 +12,7 @@ import { Instances, AccessTokens, Users } from "@/models/index.js";
|
||||||
import config from "@/config/index.js";
|
import config from "@/config/index.js";
|
||||||
import endpoints from "./endpoints.js";
|
import endpoints from "./endpoints.js";
|
||||||
import compatibility from "./compatibility.js";
|
import compatibility from "./compatibility.js";
|
||||||
|
import {koaBody} from "koa-body";
|
||||||
import handler from "./api-handler.js";
|
import handler from "./api-handler.js";
|
||||||
import signup from "./private/signup.js";
|
import signup from "./private/signup.js";
|
||||||
import signin from "./private/signin.js";
|
import signin from "./private/signin.js";
|
||||||
|
@ -35,6 +36,13 @@ app.use(async (ctx, next) => {
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
koaBody({
|
||||||
|
json: false,
|
||||||
|
multipart: true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
bodyParser({
|
bodyParser({
|
||||||
// リクエストが multipart/form-data でない限りはJSONだと見なす
|
// リクエストが multipart/form-data でない限りはJSONだと見なす
|
||||||
|
|
|
@ -146,8 +146,7 @@ router.post("/oauth/token", koaBody({
|
||||||
multipart: true
|
multipart: true
|
||||||
}), async (ctx) => {
|
}), async (ctx) => {
|
||||||
const body: any = ctx.request.body;
|
const body: any = ctx.request.body;
|
||||||
//const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
|
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
|
||||||
const BASE_URL = "http://localhost:3000";
|
|
||||||
const generator = (megalodon as any).default;
|
const generator = (megalodon as any).default;
|
||||||
const client = generator('misskey', BASE_URL, null) as MegalodonInterface;
|
const client = generator('misskey', BASE_URL, null) as MegalodonInterface;
|
||||||
const m = body.code.match(/^[a-zA-Z0-9-]+/);
|
const m = body.code.match(/^[a-zA-Z0-9-]+/);
|
||||||
|
|
Loading…
Reference in New Issue