fyp-scamsword / scam-chat Goto Github PK
View Code? Open in Web Editor NEWPrototype web service to facilitate anonymous online chats with scammers
License: GNU General Public License v3.0
Prototype web service to facilitate anonymous online chats with scammers
License: GNU General Public License v3.0
To avoid dealing with complex race conditions, assignment of new sessions will be performed by the SessionController
object, instead of allowing users to choose or input handles for initiating chats
Routing issue in scam_chat/app/routes/tele_user.route.js
// Retrieve a single user with number
router.get('/:user_id', getUserByNum);
According to the code in scam_chat/app/controllers/tele_user.controller.js
it should be
// Retrieve a single user with number
router.get('/:phone_num', getUserByNum);
Additionally, able to refactor to not use in
for a single user in scam_chat/app/controllers/tele_user.controller.js
.
Original Code:
// Find a single User by phone_num
export const getUserByNum = async (req, res) => {
try {
const user = await UserModel.find({
members: { $in: [req.params.phone_num] }
});
res.status(200).json(user);
} catch (error) {
res.status(500).json(error);
}
};
Refactored Code:
// Find a single User by phone_num
export const getUserByNum = async (req, res) => {
try {
const user = await UserModel.find({
phone_num: req.params.phone_num
});
res.status(200).json(user);
} catch (error) {
res.status(500).json(error);
}
};
A new session should be created whenever a new chatId is identified within a canary account's list of chats
TODO modify updateChatList()
in chat_list.controller.js
try {
const chatDetails = await ChatModel.find({
phone_num: req.params.phone_num
}).sort({updatedAt: -1});
}
res.status(200).json(chatDetails);
} catch (error) {
res.status(500).json(error);
}
If the canary account is the last to send a message, the the senderId will be the canary account's ID instead of the contact's ID.
const totalMsgs = msgs.total;
const sender = await msgs[0].getSender();
const contactName = sender.firstName;
const chat = new ChatModel({
phone_num: req.params.phone_num,
contact_name: contactName,
total_msgs: totalMsgs,
chat_id: chatId
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.