\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82
| Path : /var/www/html/ekd/TrendyLanding/dist/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/ekd/TrendyLanding/dist/index.js |
// server/index.ts
import express2 from "express";
// server/routes.ts
import { createServer } from "http";
import nodemailer from "nodemailer";
import axios from "axios";
async function registerRoutes(app2) {
const port = Number(process.env.SMTP_PORT);
const useSSL = port === 465;
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port,
secure: useSSL,
// Port 465 için SSL aktif, diğerleri için pasif
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD
},
...!useSSL && {
tls: {
rejectUnauthorized: false
}
}
});
app2.post("/api/contact", async (req, res) => {
try {
const { name, email, phone, message, recaptchaToken } = req.body;
if (!recaptchaToken) {
throw new Error("ReCAPTCHA do\u011Frulamas\u0131 gerekli");
}
try {
const verifyUrl = "https://www.google.com/recaptcha/api/siteverify";
const recaptchaResponse = await axios.post(
verifyUrl,
null,
{
params: {
secret: process.env.RECAPTCHA_SECRET_KEY,
response: recaptchaToken
}
}
);
if (!recaptchaResponse.data.success) {
throw new Error("ReCAPTCHA do\u011Frulamas\u0131 ba\u015Far\u0131s\u0131z");
}
} catch (recaptchaError) {
console.error("ReCAPTCHA do\u011Frulama hatas\u0131:", recaptchaError);
throw new Error("ReCAPTCHA do\u011Frulamas\u0131 ba\u015Far\u0131s\u0131z");
}
if (!process.env.SMTP_HOST || !process.env.SMTP_PORT || !process.env.SMTP_USER || !process.env.SMTP_PASSWORD || !process.env.SMTP_TO_EMAIL) {
console.error("SMTP yap\u0131land\u0131rma eksik:", {
host: process.env.SMTP_HOST ? "\u2713" : "\u2717",
port: process.env.SMTP_PORT ? "\u2713" : "\u2717",
user: process.env.SMTP_USER ? "\u2713" : "\u2717",
pass: process.env.SMTP_PASSWORD ? "\u2713" : "\u2717",
toEmail: process.env.SMTP_TO_EMAIL ? "\u2713" : "\u2717"
});
throw new Error("SMTP yap\u0131land\u0131rmas\u0131 eksik");
}
console.log("Mail g\xF6nderimi ba\u015Flat\u0131l\u0131yor...");
console.log("SMTP Ayarlar\u0131:", {
host: process.env.SMTP_HOST,
port,
secure: useSSL,
user: process.env.SMTP_USER?.substring(0, 3) + "***",
to: process.env.SMTP_TO_EMAIL?.substring(0, 3) + "***"
});
const mailOptions = {
from: `"EK Dan\u0131\u015Fmanl\u0131k" <${process.env.SMTP_USER}>`,
to: process.env.SMTP_TO_EMAIL,
subject: "EK Dan\u0131\u015Fmanl\u0131k - Yeni \u0130leti\u015Fim Formu",
html: `
<h2>Yeni \u0130leti\u015Fim Formu Mesaj\u0131</h2>
<p><strong>\u0130sim:</strong> ${name}</p>
<p><strong>Email:</strong> ${email}</p>
<p><strong>Telefon:</strong> ${phone}</p>
<p><strong>Mesaj:</strong></p>
<p>${message}</p>
`
};
try {
console.log("SMTP ba\u011Flant\u0131s\u0131 test ediliyor...");
await transporter.verify();
console.log("SMTP ba\u011Flant\u0131s\u0131 ba\u015Far\u0131l\u0131");
console.log("Mail g\xF6nderiliyor...");
const info = await transporter.sendMail(mailOptions);
console.log("Mail ba\u015Far\u0131yla g\xF6nderildi:", info.messageId);
res.json({
success: true,
message: "Mail ba\u015Far\u0131yla g\xF6nderildi",
messageId: info.messageId
});
} catch (smtpError) {
console.error("SMTP Hatas\u0131:", smtpError);
if (!useSSL) {
console.log("Alternative SMTP configuration deneniyor...");
const altTransporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port,
secure: true,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD
}
});
try {
await altTransporter.verify();
const info = await altTransporter.sendMail(mailOptions);
console.log("Alternative configuration ile mail g\xF6nderildi:", info.messageId);
res.json({
success: true,
message: "Mail ba\u015Far\u0131yla g\xF6nderildi",
messageId: info.messageId
});
return;
} catch (altError) {
console.error("Alternative SMTP configuration hatas\u0131:", altError);
}
}
throw new Error(`SMTP Hatas\u0131: ${smtpError instanceof Error ? smtpError.message : "Bilinmeyen SMTP hatas\u0131"}`);
}
} catch (error) {
console.error("Mail g\xF6nderimi hatas\u0131:", error);
let errorMessage = "Mail g\xF6nderilemedi";
if (error instanceof Error) {
errorMessage = `Mail g\xF6nderimi ba\u015Far\u0131s\u0131z: ${error.message}`;
console.error("Hata detay\u0131:", error.stack);
}
res.status(500).json({
success: false,
message: errorMessage,
error: error instanceof Error ? error.message : "Bilinmeyen hata"
});
}
});
const httpServer = createServer(app2);
return httpServer;
}
// server/vite.ts
import express from "express";
import fs from "fs";
import path2, { dirname as dirname2 } from "path";
import { fileURLToPath as fileURLToPath2 } from "url";
import { createServer as createViteServer, createLogger } from "vite";
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import themePlugin from "@replit/vite-plugin-shadcn-theme-json";
import path, { dirname } from "path";
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
import { fileURLToPath } from "url";
var __filename = fileURLToPath(import.meta.url);
var __dirname = dirname(__filename);
var vite_config_default = defineConfig({
plugins: [
react(),
runtimeErrorOverlay(),
themePlugin(),
...process.env.NODE_ENV !== "production" && process.env.REPL_ID !== void 0 ? [
await import("@replit/vite-plugin-cartographer").then(
(m) => m.cartographer()
)
] : []
],
resolve: {
alias: {
"@": path.resolve(__dirname, "client", "src"),
"@shared": path.resolve(__dirname, "shared")
}
},
root: path.resolve(__dirname, "client"),
build: {
outDir: path.resolve(__dirname, "dist/public"),
emptyOutDir: true
}
});
// server/vite.ts
import { nanoid } from "nanoid";
var __filename2 = fileURLToPath2(import.meta.url);
var __dirname2 = dirname2(__filename2);
var viteLogger = createLogger();
function log(message, source = "express") {
const formattedTime = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
second: "2-digit",
hour12: true
});
console.log(`${formattedTime} [${source}] ${message}`);
}
async function setupVite(app2, server) {
const serverOptions = {
middlewareMode: true,
hmr: { server },
allowedHosts: true
};
const vite = await createViteServer({
...vite_config_default,
configFile: false,
customLogger: {
...viteLogger,
error: (msg, options) => {
viteLogger.error(msg, options);
process.exit(1);
}
},
server: serverOptions,
appType: "custom"
});
app2.use(vite.middlewares);
app2.use("*", async (req, res, next) => {
const url = req.originalUrl;
try {
const clientTemplate = path2.resolve(
__dirname2,
"..",
"client",
"index.html"
);
let template = await fs.promises.readFile(clientTemplate, "utf-8");
template = template.replace(
`src="/src/main.tsx"`,
`src="/src/main.tsx?v=${nanoid()}"`
);
const page = await vite.transformIndexHtml(url, template);
res.status(200).set({ "Content-Type": "text/html" }).end(page);
} catch (e) {
vite.ssrFixStacktrace(e);
next(e);
}
});
}
function serveStatic(app2) {
const distPath = path2.resolve(__dirname2, "public");
if (!fs.existsSync(distPath)) {
throw new Error(
`Could not find the build directory: ${distPath}, make sure to build the client first`
);
}
app2.use(express.static(distPath));
app2.use("*", (_req, res) => {
res.sendFile(path2.resolve(distPath, "index.html"));
});
}
// server/index.ts
var app = express2();
app.use(express2.json());
app.use(express2.urlencoded({ extended: false }));
app.use((req, res, next) => {
const start = Date.now();
const path3 = req.path;
let capturedJsonResponse = void 0;
const originalResJson = res.json;
res.json = function(bodyJson, ...args) {
capturedJsonResponse = bodyJson;
return originalResJson.apply(res, [bodyJson, ...args]);
};
res.on("finish", () => {
const duration = Date.now() - start;
if (path3.startsWith("/api")) {
let logLine = `${req.method} ${path3} ${res.statusCode} in ${duration}ms`;
if (capturedJsonResponse) {
logLine += ` :: ${JSON.stringify(capturedJsonResponse)}`;
}
if (logLine.length > 80) {
logLine = logLine.slice(0, 79) + "\u2026";
}
log(logLine);
}
});
next();
});
(async () => {
const server = await registerRoutes(app);
app.use((err, _req, res, _next) => {
const status = err.status || err.statusCode || 500;
const message = err.message || "Internal Server Error";
res.status(status).json({ message });
throw err;
});
if (app.get("env") === "development") {
await setupVite(app, server);
} else {
serveStatic(app);
}
const port = 5011;
server.listen({
port,
host: "0.0.0.0",
reusePort: true
}, () => {
log(`serving on port ${port}`);
});
})();