feat: implement loading of ability videos
This commit is contained in:
		
							parent
							
								
									cfcdaae668
								
							
						
					
					
						commit
						afee26aad3
					
				@ -1,5 +1,6 @@
 | 
				
			|||||||
import express from "express";
 | 
					import express from "express";
 | 
				
			||||||
import buildConfig from "@/static/data/buildConfig.json";
 | 
					import buildConfig from "@/static/data/buildConfig.json";
 | 
				
			||||||
 | 
					import fs from "fs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const cacheRouter = express.Router();
 | 
					const cacheRouter = express.Router();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -15,4 +16,18 @@ cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/[0-9]+\/H\.Cache\.bin.*$/, (_req, res)
 | 
				
			|||||||
    res.sendFile(`static/data/H.Cache_${buildConfig.version}.bin`, { root: "./" });
 | 
					    res.sendFile(`static/data/H.Cache_${buildConfig.version}.bin`, { root: "./" });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cacheRouter.get(/\.bk2!/, async (req, res) => {
 | 
				
			||||||
 | 
					    const dir = req.path.substr(0, req.path.lastIndexOf("/"));
 | 
				
			||||||
 | 
					    const file = req.path.substr(dir.length + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Return file if we have it
 | 
				
			||||||
 | 
					    if (fs.existsSync(`static/data${dir}/${file}`)) {
 | 
				
			||||||
 | 
					        res.send(fs.readFileSync(`static/data${dir}/${file}`, null));
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 404 if we don't
 | 
				
			||||||
 | 
					    res.status(404).end();
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export { cacheRouter };
 | 
					export { cacheRouter };
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user