Sửa lỗi tạo liên kết chia sẻ của người dùng
This commit is contained in:
@@ -254,7 +254,8 @@ router.get('/share/:sceneId', optionalAuth, async (req, res) => {
|
|||||||
const host = req.get('host');
|
const host = req.get('host');
|
||||||
const siteUrl = `${protocol}://${host}`;
|
const siteUrl = `${protocol}://${host}`;
|
||||||
const assetId = scene.assetId?._id || scene.assetId;
|
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
|
// Trả về HTML chứa Meta Tags và Script chuyển hướng
|
||||||
const html = `
|
const html = `
|
||||||
@@ -266,14 +267,16 @@ router.get('/share/:sceneId', optionalAuth, async (req, res) => {
|
|||||||
<meta property="og:title" content="${scene.name}" />
|
<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: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" 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:image:type" content="image/jpeg" />
|
||||||
<meta property="og:url" content="${siteUrl}${req.originalUrl}" />
|
<meta property="og:url" content="${siteUrl}${req.originalUrl}" />
|
||||||
<meta property="og:type" content="website" />
|
<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: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}" />
|
<meta name="twitter:image" content="${thumbUrl}" />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Tự động chuyển hướng người dùng về ứng dụng chính (SPA) kèm tham số
|
// 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);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
|||||||
@@ -355,6 +355,9 @@
|
|||||||
<h2 id="action-modal-title">Tùy chọn Scene</h2>
|
<h2 id="action-modal-title">Tùy chọn Scene</h2>
|
||||||
<p id="action-modal-desc">Bạn muốn thực hiện thao tác gì với scene này?</p>
|
<p id="action-modal-desc">Bạn muốn thực hiện thao tác gì với scene này?</p>
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
|
<button id="btn-share-action" class="edit-btn-large" style="background: #28a745;">
|
||||||
|
<span class="icon">🔗</span> Lấy link chia sẻ
|
||||||
|
</button>
|
||||||
<button id="btn-edit-privacy-action" class="edit-btn-large" style="background: #6f42c1;">
|
<button id="btn-edit-privacy-action" class="edit-btn-large" style="background: #6f42c1;">
|
||||||
<span class="icon">🔒</span> Chỉnh sửa privacy
|
<span class="icon">🔒</span> Chỉnh sửa privacy
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -749,10 +749,17 @@ async function handleEditDeleteScene(scene) {
|
|||||||
const editBtn = document.getElementById('btn-edit-action');
|
const editBtn = document.getElementById('btn-edit-action');
|
||||||
const editPrivacyBtn = document.getElementById('btn-edit-privacy-action');
|
const editPrivacyBtn = document.getElementById('btn-edit-privacy-action');
|
||||||
const deleteBtn = document.getElementById('btn-delete-action');
|
const deleteBtn = document.getElementById('btn-delete-action');
|
||||||
|
const shareBtn = document.getElementById('btn-share-action');
|
||||||
|
|
||||||
title.innerText = `Scene: ${scene.title}`;
|
title.innerText = `Scene: ${scene.title}`;
|
||||||
modal.style.display = 'flex';
|
modal.style.display = 'flex';
|
||||||
|
|
||||||
|
// Hành động Lấy link chia sẻ trực tiếp
|
||||||
|
shareBtn.onclick = () => {
|
||||||
|
closeActionModal();
|
||||||
|
showShareLink(scene);
|
||||||
|
};
|
||||||
|
|
||||||
// Hành động Chỉnh sửa privacy
|
// Hành động Chỉnh sửa privacy
|
||||||
editPrivacyBtn.onclick = () => {
|
editPrivacyBtn.onclick = () => {
|
||||||
returnToDashboardAfterEdit = false;
|
returnToDashboardAfterEdit = false;
|
||||||
@@ -1759,7 +1766,7 @@ window.handleEditPrivacyChange = function() {
|
|||||||
const settingsBtn = document.getElementById('btn-edit-privacy-settings');
|
const settingsBtn = document.getElementById('btn-edit-privacy-settings');
|
||||||
const isChild = document.getElementById('edit-modal-privacy').disabled;
|
const isChild = document.getElementById('edit-modal-privacy').disabled;
|
||||||
|
|
||||||
if (!isChild && (privacy === 'member' || privacy === 'shared')) {
|
if (!isChild && (privacy === 'member' || privacy === 'shared' || privacy === 'public')) {
|
||||||
settingsBtn.style.display = 'block';
|
settingsBtn.style.display = 'block';
|
||||||
} else {
|
} else {
|
||||||
settingsBtn.style.display = 'none';
|
settingsBtn.style.display = 'none';
|
||||||
|
|||||||
Reference in New Issue
Block a user