make secure check
This commit is contained in:
parent
817c1d2e4b
commit
a6fdb28560
|
@ -151,10 +151,13 @@ mastoRouter.post("/oauth/token", async (ctx) => {
|
||||||
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
|
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
|
||||||
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-]+/);
|
let m = null;
|
||||||
if (!m.length) {
|
if (body.code) {
|
||||||
ctx.body = { error: "Invalid code" };
|
m = body.code.match(/^[a-zA-Z0-9-]+/);
|
||||||
return;
|
if (!m.length) {
|
||||||
|
ctx.body = { error: "Invalid code" };
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const atData = await client.fetchAccessToken(
|
const atData = await client.fetchAccessToken(
|
||||||
|
|
Loading…
Reference in New Issue