Sửa lỗi tạo liên kết chia sẻ của người dùng

This commit is contained in:
2026-06-09 08:45:39 +07:00
parent e6071a050d
commit 826344eea1
3 changed files with 18 additions and 5 deletions
+7 -4
View File
@@ -254,7 +254,8 @@ router.get('/share/:sceneId', optionalAuth, async (req, res) => {
const host = req.get('host');
const siteUrl = `${protocol}://${host}`;
const assetId = scene.assetId?._id || scene.assetId;
const thumbUrl = `${siteUrl}/api/assets/view/${assetId}${req.query.token ? '?token=' + req.query.token : ''}`;
// Thêm tham số watermark=true để ép hệ thống vẽ thêm icon cho mạng xã hội
const thumbUrl = `${siteUrl}/api/assets/view/${assetId}?watermark=true${req.query.token ? '&token=' + req.query.token : ''}`;
// Trả về HTML chứa Meta Tags và Script chuyển hướng
const html = `
@@ -266,14 +267,16 @@ router.get('/share/:sceneId', optionalAuth, async (req, res) => {
<meta property="og:title" content="${scene.name}" />
<meta property="og:description" content="${scene.description || 'Khám phá tour 3D thực tế ảo sinh động'}" />
<meta property="og:image" content="${thumbUrl}" />
<meta property="og:image:secure_url" content="${thumbUrl}" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:url" content="${siteUrl}${req.originalUrl}" />
<meta property="og:type" content="website" />
<meta property="fb:app_id" content="your_facebook_app_id_if_any" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="${scene.name}" />
<meta name="twitter:description" content="${scene.description || 'Khám phá tour 3D thực tế ảo sinh động'}" />
<meta name="twitter:image" content="${thumbUrl}" />
<script>
// Tự động chuyển hướng người dùng về ứng dụng chính (SPA) kèm tham số
const urlParams = new URLSearchParams(window.location.search);