From 1e50f5ba673a505cf9d2eedf39dd7abf0372a259 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Wed, 3 Sep 2025 12:12:05 +0000 Subject: [PATCH] Improve video view tracking by using a shortened identifier Update the video view tracking API calls to use a truncated version of the video ID (first 8 characters after removing hyphens) in `bunny-video-modal.tsx`, `video-modal.tsx`, and `VideoPage.tsx`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/gueMD9C --- client/src/components/bunny-video-modal.tsx | 4 +++- client/src/components/video-modal.tsx | 4 +++- client/src/pages/VideoPage.tsx | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/components/bunny-video-modal.tsx b/client/src/components/bunny-video-modal.tsx index 4957de0..e577968 100644 --- a/client/src/components/bunny-video-modal.tsx +++ b/client/src/components/bunny-video-modal.tsx @@ -102,7 +102,9 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos const handleVideoPlay = async () => { if (video) { try { - await apiRequest("POST", `/api/videos/${video.id}/view`); + // Use short ID for view tracking + const shortId = video.id.replace(/-/g, '').substring(0, 8); + await apiRequest("POST", `/api/videos/${shortId}/view`); } catch (error) { console.error("Failed to track video view:", error); } diff --git a/client/src/components/video-modal.tsx b/client/src/components/video-modal.tsx index f77d4f3..8bebcc3 100644 --- a/client/src/components/video-modal.tsx +++ b/client/src/components/video-modal.tsx @@ -315,7 +315,9 @@ export default function VideoModal({ video, isOpen, onClose, enableAds = true }: const handleVideoPlay = async () => { if (video) { try { - await apiRequest("POST", `/api/videos/${video.id}/view`); + // Use short ID for view tracking + const shortId = video.id.replace(/-/g, '').substring(0, 8); + await apiRequest("POST", `/api/videos/${shortId}/view`); } catch (error) { console.error("Failed to track video view:", error); } diff --git a/client/src/pages/VideoPage.tsx b/client/src/pages/VideoPage.tsx index 0d411ab..899f9c1 100644 --- a/client/src/pages/VideoPage.tsx +++ b/client/src/pages/VideoPage.tsx @@ -261,7 +261,9 @@ export default function VideoPage() { const handleVideoPlay = async () => { if (currentVideo) { try { - await apiRequest("POST", `/api/videos/${currentVideo.id}/view`); + // Use short ID for view tracking + const shortId = currentVideo.id.replace(/-/g, '').substring(0, 8); + await apiRequest("POST", `/api/videos/${shortId}/view`); } catch (error) { console.error("Failed to track video view:", error); }