Add Last-Modified/ETag and 304 responses for static files and media
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, node.js
- Domain
- backend, performance
Research direction
Read server.js:51-66, media.js:21-36, and the existing request tests in test/server.test.js; trace how static files and showcase videos are served. Add the shared validators(stats) helper described in the issue and cover conditional and range requests. Done when tests show 304 responses for repeated requests to /demo.html and a showcase .mp4, and a stale If-Range gets 200.
Written by the indexing model from the issue text.
Description
serveFile() (server.js:51-66) sends no caching headers and ignores conditional requests. So every visit re-downloads public/_vendor/gsap.min.js, mp4-muxer.js, the reference JPEGs and the JSON files in full.
streamVideo() (media.js:21-36) has the opposite problem. It sets Cache-Control: private, max-age=3600 but no validator, so after you re-import or run npm run showcase the browser can play the old video for up to an hour.
Expected: both paths send Last-Modified (from the stat mtime) and a weak ETag (size plus mtime). A matching If-None-Match or If-Modified-Since returns 304 with no body. For media, use Cache-Control: no-cache so the browser checks again on every load and then gets a cheap 304. Handle If-Range so a range request on a changed file gets the full 200.
Fix direction: add a small validators(stats) helper in media.js, use it in both functions, and keep serveFile's path checks as they are.
Done when new tests in test/server.test.js show a 304 for a repeated request with If-None-Match to /demo.html and to a showcase .mp4. A stale If-Range should get a 200.
- Dominant language
- HTML
- Stars
- 1.2k
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from blixvip/NullMotion
-
accessibility help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
blixvip/NullMotion#47 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
blixvip/NullMotion#43 ·
-
accessibility good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
blixvip/NullMotion#42 ·
-
accessibility good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
blixvip/NullMotion#41 ·
-
accessibility good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
blixvip/NullMotion#40 ·
All issues in blixvip/NullMotion
Similar issues
-
area:models enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
RedisStorage writes can persist a key without its sliding TTLPossibly taken @lianbie claimed this today. Opentriage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agentscope-ai/agentscope#3878 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DarkCastleMUD/DarkCastle#283 ·
-
core
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
vectorize-io/hindsight#6458 ·
Maintainers usually reply within 1 day