Updating LiveTracker

This commit is contained in:
=bhagwanSingh 2025-11-18 11:16:58 +05:30
parent 8254fab09a
commit e9ff5ec612
2 changed files with 44 additions and 29 deletions

View File

@ -22,6 +22,18 @@ const app = express();
const server = new createServer(app); const server = new createServer(app);
const io = new Server(server); const io = new Server(server);
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
console.log("⚠️ Certificate error:", url);
// Allow for ngrok only
if (url.includes("ngrok")) {
event.preventDefault();
callback(true); // approve the certificate
} else {
callback(false); // reject others
}
});
app.set("view engine", "ejs"); app.set("view engine", "ejs");
const PORT = process.env.PORT || 8000; const PORT = process.env.PORT || 8000;
@ -115,9 +127,14 @@ app.get('/client/virtual-assistants', async (req, res) => {
// } // }
// }); // });
app.get("/live/:projectId/:vaId", (req, res) => { app.get("/live/:projectId/:clientId", (req, res) => {
const { projectId } = req.params; const { projectId, clientId } = req.params;
res.render("va_live_tracker", { title: "VA Live Tracker", projectId })
if(!projectId || !clientId){
return res.status(400).send({"message": "Page not found"});
}
res.render("va_live_tracker", { title: "VA Live Tracker", projectId, clientId })
}) })
// Handling Socket // Handling Socket
@ -342,11 +359,6 @@ app.get("/client/forgot-password", (req, res) => {
res.render("forgot_password") res.render("forgot_password")
}) })
app.get("/live/:projectId", (req, res) => {
const { projectId } = req.params;
res.render("va_live_tracker", { title: "VA Live Tracker", projectId })
})
// Handling Socket // Handling Socket
import jwt from "jsonwebtoken"; import jwt from "jsonwebtoken";

View File

@ -89,10 +89,13 @@
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<script> <script>
const clientId = "691311fece83c986eb8a4e89";
const clientId = "<%= clientId %>";
const token = window.localStorage.getItem("knoptpq");
const socket = io({ const socket = io({
auth: { auth: {
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5MTQ2NTFkODM2NDZhOTAwN2EzNDI4MCIsImVtYWlsIjoiYmhhZ3dhbi5yQGhpY2dsb2JhbHNvbHV0aW9ucy5jb20iLCJuYW1lIjoiYmhhZ3dhbiIsImlhdCI6MTc2Mjk0ODk3NSwiZXhwIjoxNzYzMDM1Mzc1fQ.WvmTvfOf8DvbqKsbvfyzda1ClP8qfllKFeJINtU6mnE", token: token,
userType: "client", userType: "client",
projectId: "<%= projectId %>" projectId: "<%= projectId %>"
}, },