Update server.js
Browse files
server.js
CHANGED
|
@@ -23,6 +23,17 @@ app.use(bodyParser.urlencoded({ extended: true }));
|
|
| 23 |
const storage = multer.memoryStorage();
|
| 24 |
const upload = multer({ storage: storage });
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
// Define routes
|
| 27 |
app.post('/upload', upload.single('file'), async (req, res) => {
|
| 28 |
try {
|
|
|
|
| 23 |
const storage = multer.memoryStorage();
|
| 24 |
const upload = multer({ storage: storage });
|
| 25 |
|
| 26 |
+
|
| 27 |
+
function authenticateProxyKey(req, res, next) {
|
| 28 |
+
const providedKey = req.headers['auro'];
|
| 29 |
+
|
| 30 |
+
if (providedKey && providedKey === proxyKey) {
|
| 31 |
+
next();
|
| 32 |
+
} else {
|
| 33 |
+
res.status(401).json({ error: 'Unauthorized' });
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
// Define routes
|
| 38 |
app.post('/upload', upload.single('file'), async (req, res) => {
|
| 39 |
try {
|