|
@@ -41,22 +41,7 @@ function extractFileId(referer) {
|
|
}
|
|
}
|
|
|
|
|
|
// middleware that is specific to this router
|
|
// middleware that is specific to this router
|
|
-// app.use(async function timeLog(req, res, next) {
|
|
|
|
-// if (isValidReferer(req.url)) {
|
|
|
|
-// const fileId = extractFileId(req.url);
|
|
|
|
-// if (fileId) {
|
|
|
|
-// return res.redirect(`/api/v1/files/${fileId}`);
|
|
|
|
-// } else {
|
|
|
|
-// console.error("File ID not found in referer");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// next();
|
|
|
|
-// });
|
|
|
|
-
|
|
|
|
-// 静态文件目录,添加前缀路径 /static
|
|
|
|
-app.use("/static", express.static("public"));
|
|
|
|
-
|
|
|
|
-app.get("/", (req, res) => {
|
|
|
|
|
|
+app.use(async function timeLog(req, res, next) {
|
|
if (isValidReferer(req.url)) {
|
|
if (isValidReferer(req.url)) {
|
|
const fileId = extractFileId(req.url);
|
|
const fileId = extractFileId(req.url);
|
|
if (fileId) {
|
|
if (fileId) {
|
|
@@ -65,6 +50,13 @@ app.get("/", (req, res) => {
|
|
console.error("File ID not found in referer");
|
|
console.error("File ID not found in referer");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ next();
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+// 静态文件目录,添加前缀路径 /static
|
|
|
|
+app.use("/static", express.static("public"));
|
|
|
|
+
|
|
|
|
+app.get("/", (req, res) => {
|
|
res.send("Hello World! " + req.url);
|
|
res.send("Hello World! " + req.url);
|
|
});
|
|
});
|
|
|
|
|