this repo has no description
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

bug: fix undefined var

+6 -5
+6 -5
src/index.ts
··· 133 133 by: true, 134 134 enteredLeaderboardAt: true, 135 135 firstSeenAt: true, 136 - lastSeenOnLeaderboardAt: true, 136 + isOnLeaderboard: true, 137 137 isFromMonitoredUser: true, 138 138 }, 139 139 where: (stories, { eq }) => eq(stories.id, storyId), ··· 145 145 146 146 // Calculate time on front page if available 147 147 let timeOnFrontPage = null; 148 - if (story.enteredLeaderboardAt && story.lastSeenOnLeaderboardAt) { 149 - timeOnFrontPage = 150 - story.lastSeenOnLeaderboardAt - story.enteredLeaderboardAt; 148 + if (story.enteredLeaderboardAt) { 149 + // Use current time as end time if the story is still on the leaderboard 150 + const endTime = story.isOnLeaderboard ? Math.floor(Date.now() / 1000) : story.enteredLeaderboardAt + 3600; 151 + timeOnFrontPage = endTime - story.enteredLeaderboardAt; 151 152 } 152 153 153 154 // Format the response ··· 332 333 333 334 "/api/story/:id/snapshots": handleCORS(async (req) => { 334 335 try { 335 - // Extract the story ID from the URL path using faster string operations 336 + // Extract the story ID from the URL path 336 337 const url = new URL(req.url); 337 338 const pathParts = url.pathname.split("/"); 338 339 const storyIdStr = pathParts[3]; // Get ID from path parts directly