Repository navigation
Conversation
|
Hi @Dx-Alz-xD nice work on this! It now conflicts with #574 (the repeated-download guard) in Card.tsx and newPdfViewer.tsx. Could you rebase and keep the guard, with the count call inside the try? Also, it might be worth adding /api/paper-counts to the middleware rate limits, since it shares Upstash with uploads, and adding an anonymous visitor ID to the dedupe key so campus WiFi users sharing one IP still get counted. Thanks! |
each paper now stores how often it was viewed and downloaded. opening the paper page or the card preview counts a view, and a download that worked counts a download, from the card, the viewer or the zip. one visitor counts once an hour per paper, and the counts show on the cards and under the paper title
… one ip /api/paper-counts now goes through the middleware like the other routes that use upstash, at 120 requests a minute per ip the browser keeps a random visitor id in localStorage and sends it with each count, so people on the same campus wifi are counted separately instead of as one ip. each visitor counts once an hour per paper, and one ip can add at most 50 views or downloads of a paper an hour, so made up visitor ids cannot inflate a count. a request without a visitor id is counted once an hour per ip, as before
97b35d0 to
c8dff8d
Compare
|
rebased on staging and kept the #574 guard, with the count call inside its try (the card, the viewer and download all). also in c8dff8d: /api/paper-counts goes through the middleware now, at 120 requests a minute per ip |
📌 Purpose
Show how many times each paper was viewed and downloaded, as asked in #551. This covers the counters; likes and comments need decisions on accounts and moderation first.
Corresponding issue: part of #551
🖼️ Showcase
🔧 Changes
viewsanddownloadson each paper (default 0)POST /api/paper-countswith{ kind: "view" | "download", paperIds }(up to 100, so a zip is one request); it returns the updated counts➕ Additional Notes
/api/papersis cached for 60 seconds