2025-01-05 14:22:18 +00:00
|
|
|
import Config from "../objects/Config";
|
|
|
|
import HashFS from "../objects/HashFS";
|
2025-01-01 22:03:59 +00:00
|
|
|
import Controller from "./Controller";
|
2025-01-05 14:22:18 +00:00
|
|
|
import { randomBytes } from "crypto";
|
2025-01-01 22:03:59 +00:00
|
|
|
|
|
|
|
export default class HomeController extends Controller {
|
2025-01-03 03:11:00 +00:00
|
|
|
public Index_Get_AllowAnonymous() {
|
2025-01-01 22:03:59 +00:00
|
|
|
return this.view();
|
|
|
|
}
|
2025-01-03 03:11:00 +00:00
|
|
|
|
2025-01-05 14:22:18 +00:00
|
|
|
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);
|
|
|
|
}
|
2025-01-03 03:11:00 +00:00
|
|
|
|
2025-01-05 14:22:18 +00:00
|
|
|
return this.badRequest();
|
2025-01-03 03:11:00 +00:00
|
|
|
}
|
2025-01-01 22:03:59 +00:00
|
|
|
}
|