Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
big cock committed Aug 20, 2023
2 parents 3c3aa4f + c73ff94 commit 1eb5a52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/routes/api/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import path from "path";
import config from "../../config";
import fs from "fs";

interface UploadedFile {
interface IUploadedFile {
name: string;
mv: (path: string, callback?: (err: Error | null) => void) => void;
}

interface Keys {
interface IKeys {
key: string;
ip: any;
created_at: string;
Expand All @@ -24,14 +24,14 @@ router.post("/", (req: Request, res: Response) => {

const keys = JSON.parse(fs.readFileSync("keys.json", "utf8"));

if (!keys.some((k: Keys) => k.key === key)) {
if (!keys.some((k: IKeys) => k.key === key)) {
return res.status(403).send({
status: 403,
message: "Invalid key retard.",
});
}

const { sharex } = req.files as { sharex?: UploadedFile | UploadedFile[] };
const { sharex } = req.files as { sharex?: IUploadedFile | IUploadedFile[] };

if (!sharex || (Array.isArray(sharex) && sharex.length === 0)) {
return res.status(404).send({
Expand Down

0 comments on commit 1eb5a52

Please sign in to comment.