import Config from "../objects/Config"; import HashFS from "../objects/HashFS"; import Controller from "./Controller"; import { randomBytes } from "crypto"; export default class HomeController extends Controller { public Index_Get_AllowAnonymous() { return this.view(); } public async Upload_Post_AllowAnonymous() { const data = await this.req.file(); if (data && data.type === "file") { let uploadKey: string = ""; if ("upload-key" in this.req.headers) { // @ts-ignore uploadKey = this.req.headers["upload-key"]; if (uploadKey !== Config.accounts.signup.key) { return this.unauthorised("Upload key invalid or missing."); } } //console.log(uploadKey); //console.log(data.mimetype); const hash = await HashFS.GetHashFSInstance("images").AddFromStream(data.file); } return this.badRequest(); } }