mirror of https://github.com/AlphaNecron/Void.git
fix(api): allow uploading without private token
This commit is contained in:
parent
bfa86e9249
commit
6f513265aa
|
@ -13,9 +13,10 @@ const uploader = multer({
|
|||
});
|
||||
|
||||
async function handler(req: NextApiReq, res: NextApiRes) {
|
||||
const usr = await req.user();
|
||||
if (req.method !== 'POST') return res.forbid('Invalid method');
|
||||
if (!req.headers.authorization) return res.forbid('Unauthorized');
|
||||
const user = await prisma.user.findFirst({
|
||||
if (!(req.headers.authorization || usr)) return res.forbid('Unauthorized');
|
||||
const user = usr || await prisma.user.findFirst({
|
||||
where: {
|
||||
token: req.headers.authorization
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue