diff --git a/server.js b/server.js index 92356fb..bf891c2 100644 --- a/server.js +++ b/server.js @@ -1068,7 +1068,7 @@ async function handleApi(req,res,pathname){ // // Range support is not optional here: without it the browser cannot seek, so // the scrub bar looks present but does nothing. - if(req.method==='GET'&&/^\/tv\/[a-z0-9-]{1,60}\.mp4$/.test(pathname)){ + if((req.method==='GET'||req.method==='HEAD')&&/^\/tv\/[a-z0-9-]{1,60}\.mp4$/.test(pathname)){ const slug=pathname.slice(4).replace(/\.mp4$/,''); const vfile=path.join(DATA_DIR,'tool-videos',slug+'.mp4'); let st=null; @@ -1088,6 +1088,7 @@ async function handleApi(req,res,pathname){ return fs.createReadStream(vfile,{start,end}).pipe(res); } res.writeHead(200,securityHeaders(Object.assign({},base,{'Content-Length':st.size}))); + if(req.method==='HEAD')return res.end(); return fs.createReadStream(vfile).pipe(res); }