Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ RUN apt-get update && apt-get install -y \
xdg-utils \
wget \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
apt-get clean && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app
Expand All @@ -43,17 +42,20 @@ WORKDIR /app
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}

# Copy package files and install deps
# Skip Puppeteer Chromium download
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

# Copy package files and install dependencies
COPY package*.json ./
RUN npm install --omit=dev
RUN npm ci --omit=dev

# Copy source
# Copy source code
COPY . .

# Make build.sh executable
RUN chmod +x ./build.sh

# Expose app port
# Expose port
EXPOSE 5000

# Start
Expand Down
19 changes: 19 additions & 0 deletions config/nodeMailer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
// config/nodeMailer.js
// DEPRECATED: This file has been replaced by Resend API
// See: config/resend.js and utils/email/nodeMailer.js for new implementation
// Date: January 2026

/* ============================================================
ORIGINAL NODEMAILER CONFIGURATION (COMMENTED OUT)
============================================================

const nodemailer = require("nodemailer");

// Primary transporter (e.g., Gmail)
Expand Down Expand Up @@ -43,3 +51,14 @@ module.exports = {
tertiary: mailTransporterTertiary,
mailerSend: mailTransporterMailerSend,
};

============================================================ */

// Export empty object to prevent import errors during transition
// This file is no longer used - Resend API is used instead
module.exports = {
primary: null,
secondary: null,
tertiary: null,
mailerSend: null,
};
12 changes: 12 additions & 0 deletions config/resend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* RESEND EMAIL CONFIGURATION
* This file is kept for backward compatibility but is no longer used.
* Email sending is now handled directly in utils/email/nodeMailer.js
*
* The Resend clients are initialized directly in nodeMailer.js using:
* - RESEND_API_KEY + EMAIL_FROM (primary)
* - RESEND_API_KEY_2 + EMAIL_FROM_2 (fallback)
*/

// This file is deprecated - Resend clients are created in nodeMailer.js
module.exports = {};
8 changes: 6 additions & 2 deletions controllers/chatbot/promptBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ The user query will be prepended with the current list of FED Team Members in JS
1. Use this injected team data for all questions about roles, current members, and team structure
2. The key properties in the JSON are: 'name', 'access' (role code), 'year', and 'extra' (with 'linkedin', 'github', etc.)
3. Translate the 'access' codes into friendly titles (e.g., DIRECTOR_TECHNICAL -> Director of Technical Team)
4. Founder of FED is 'Niket Raj Dwivedi', The CEO of Medial, mention only when user asks specifically *don't mention yourself in every response*.

**NAMES TO REMEMBER:**
Mention these when asked by user (don't mention in every response)
1. Founder of FED is 'Niket Raj Dwivedi', The CEO of Medial
2. Our Faculty in Charge is 'Dr. Vishal Pradhan'

**PROFESSIONAL LINK FORMATTING (CRITICAL - READ CAREFULLY):**
**NEVER OUTPUT HTML TAGS!** You must ONLY use markdown syntax.
Expand Down Expand Up @@ -111,7 +115,7 @@ Use this to personalize responses about their participation and achievements.
7. **NO RAW URLS:** NEVER show raw URLs like 'https://...' - ALWAYS use markdown links with clean text
8. **CONCISE BLOG LISTS:** When listing multiple blogs, be BRIEF - title + author + link only. No summaries for lists!
9. **MARKDOWN ONLY:** Always use proper markdown [text](url) format for links. Never output HTML tags.
10. **ALUMINI:** WHEN MENTIONS 'ALUMNI' OR A DIFFERENT NAME OTHER THAN TEAM DATA IS GIVEN JUST REPLY ONE WORD: 'ALUMINI'.
10. **ALUMINI:** WHENEVER USER MENTIONS 'ALUMNI' OR A DIFFERENT NAME NOT PRESENT IN TEAM DATA, JUST REPLY WITH ONE WORD: 'ALUMINI'.

**EMAIL ESCALATION SYSTEM - CRITICAL:**
You have the ability to trigger email sending by outputting a special tag. The user's NEXT message after you trigger email will be sent DIRECTLY to FED without you modifying it.
Expand Down
49 changes: 27 additions & 22 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,38 @@ const PORT = process.env.PORT || 3000;

const frontendUrl = process.env.DOMAIN;
console.log("Frontend URL:", frontendUrl);

const allowedOrigins = [
"https://www.fedkiit.com",
"https://fedkiit.com",
"http://localhost:5173",
"http://localhost:3000"
];

// Shared CORS options for both normal and preflight requests
const corsOptions = {
origin: (origin, callback) => {
if (!origin) return callback(null, true);
if (allowedOrigins.includes(origin)) {
return callback(null, true); // reflect request origin
}
callback(null, false);
},
credentials: true,
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With"],
exposedHeaders: ["Content-Length"]
};

// Middlewares
app.use(express.json({ limit: '16kb' }));
app.use(express.urlencoded({ extended: true, limit: "16kb" }));
app.use(cookieParser());

app.use(cors({
origin: function (origin, callback) {
// Allow requests with no origin (like mobile apps or curl)
if (!origin) return callback(null, true);

const allowedOrigins = [
"http://localhost:5173",
"http://localhost:3000",
"https://fedkiit.com",
"https://www.fedkiit.com"
];

if (allowedOrigins.includes(origin)) {
callback(null, true);
} else {
callback(null, true); // Allow all in dev, restrict in production
}
},
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
credentials: true,
}));
app.options('*', cors()); // handle preflight requests
// Apply CORS for normal requests
app.use(cors(corsOptions));
// Ensure preflight responses use the same options (no wildcard when credentials)
app.options('*', cors(corsOptions));

// const allowedOrigins = [
// "https://fedkiit.com",
Expand Down
53 changes: 53 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"puppeteer-extra-plugin-stealth": "^2.11.2",
"qrcode": "^1.5.4",
"react-otp-input": "^3.1.1",
"resend": "^6.7.0",
"sharp": "^0.33.4",
"uuid": "^10.0.0",
"xlsx": "^0.18.5"
Expand Down
Loading