GetByDotKey("Instance.DebugMode")) return; response()->redirect("https://" . Hajeebtok::$Config->GetByDotKey("Instance.URL")); } public static function contact(): string { $signed_in = signed_in(request()); if(!$signed_in) throw new UnauthenticatedException(0, 401); $message = input("message"); $email = input("email"); $name = input("name"); $webhook = new WebhookMessage(); $webhook->SetContent("this is ground control to major tom"); $webhook->AddEmbed([ "description" => $message, "fields" => [], "title" => "New message from $name", "footer" => [ "text" => $email, ], "color" => 16711680 // red ]); $webhook->Send(); CORSHelper(); return api_json([ "message" => "sent successfully. we will try to answer in less than 15 days." ]); } public static function RegisterRoutes(): void { SimpleRouter::group([ "prefix" => "/", ], function () { SimpleRouter::get("/", [HomeController::class, "redirect"]); SimpleRouter::post("/contact", [HomeController::class, "contact"]); }); } }