Tạo liên kết chia sẻ lên social

This commit is contained in:
2026-06-09 08:24:21 +07:00
parent fadfb6ba09
commit e6071a050d
4 changed files with 115 additions and 10 deletions
@@ -5,6 +5,14 @@ const { URL } = require('url');
* from the official app domain (SYSTEM_HOST). Blocks direct URL access.
*/
const verifyReferer = (req, res, next) => {
// Cho phép các Bot của mạng xã hội truy cập để lấy ảnh thumbnail
const userAgent = req.headers['user-agent'] || '';
const isSocialBot = /facebookexternalhit|Facebot|ZaloBot|Twitterbot|Slackbot|LinkedInBot|Embedly/i.test(userAgent);
if (isSocialBot) {
return next();
}
const referer = req.headers.referer;
const origin = req.headers.origin;
const systemHost = process.env.SYSTEM_HOST || 'http://localhost:5000';