Added 404 page + Improvements.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body style="text-align: center; background-color: rgb(0, 51, 78); color:white;">
|
||||
<h1>404: NOT FOUND</h1>
|
||||
<h3>If you are trying to access a recently added Screenshot/PDF, just wait a bit more for it to be uploaded.</h3>
|
||||
<h3>If the problem persists, looks like the file wasn't created...</h3>
|
||||
<h1>¯\_(ツ)_/¯</h1>
|
||||
</body>
|
||||
</html>
|
||||
+11
-2
@@ -6,6 +6,7 @@ const config = require('../src/config.js');
|
||||
const getData = require('./modules/getData.js');
|
||||
const fs = require('fs');
|
||||
const fetch = require('cross-fetch');
|
||||
const { dirname } = require('path');
|
||||
|
||||
const port = config.API.PORT;
|
||||
|
||||
@@ -27,11 +28,19 @@ app.get('/api', async (req, res) => {
|
||||
});
|
||||
|
||||
app.get('/screenshots/:id', async (req, res) => {
|
||||
res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/screenshot\'s/' + req.params.id);
|
||||
res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/screenshot\'s/' + req.params.id, (err) => {
|
||||
if (err) {
|
||||
res.sendFile(__dirname +'/pages/404.html');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/pdfs/:id', async (req, res) => {
|
||||
res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/pdf\'s/' + req.params.id);
|
||||
res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/pdf\'s/' + req.params.id, (err) => {
|
||||
if (err) {
|
||||
res.sendFile(__dirname +'/pages/404.html');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api', async (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user