lesson 22 vocab
This commit is contained in:
1 parent
fe01d84777
commit
7a2571443c
2 files changed
+586
-131
No files matched your search
@@ -118,12 +118,17 @@ function audioProxyPlugin(): Plugin {
|
|||||||
name: "audio-proxy",
|
name: "audio-proxy",
|
||||||
configureServer(server: ViteDevServer) {
|
configureServer(server: ViteDevServer) {
|
||||||
// Vite dev server middlewares are connect-style: (req, res, next)
|
// Vite dev server middlewares are connect-style: (req, res, next)
|
||||||
server.middlewares.use((req, res, next) => {
|
server.middlewares.use(async (req, res, next) => {
|
||||||
const reqUrl = req.url;
|
const reqUrl = req.url;
|
||||||
if (!reqUrl || !reqUrl.startsWith("/uploads/")) return next();
|
if (!reqUrl || !reqUrl.startsWith("/uploads/")) return next();
|
||||||
if (!reqUrl.endsWith(".mp3")) return next();
|
if (!reqUrl.endsWith(".mp3")) return next();
|
||||||
|
|
||||||
proxyAudio(req, res, next);
|
try {
|
||||||
|
await proxyAudio(req, res, next);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e, reqUrl);
|
||||||
|
next();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user