mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
Added 404 and 403 status on routes
This commit is contained in:
parent
5467e6da8d
commit
f5010af4f1
3 changed files with 14 additions and 2 deletions
8
app.js
8
app.js
|
@ -141,6 +141,14 @@ app.set('views', __dirname + '/public');
|
|||
app.engine('html', ejs.renderFile);
|
||||
//get index
|
||||
app.get("/", response.showIndex);
|
||||
//get 403 forbidden
|
||||
app.get("/403", function(req, res) {
|
||||
response.errorForbidden(res);
|
||||
});
|
||||
//get 404 not found
|
||||
app.get("/404", function(req, res) {
|
||||
response.errorNotFound(res);
|
||||
});
|
||||
//get status
|
||||
app.get("/status", function (req, res, next) {
|
||||
realtime.getStatus(function (data) {
|
||||
|
|
|
@ -36,7 +36,7 @@ var opts = {
|
|||
//public
|
||||
var response = {
|
||||
errorForbidden: function (res) {
|
||||
res.status(403).send("Forbidden, oh no.");
|
||||
responseError(res, "403", "Forbidden", "oh no.");
|
||||
},
|
||||
errorNotFound: function (res) {
|
||||
responseError(res, "404", "Not Found", "oops.");
|
||||
|
|
|
@ -1133,7 +1133,11 @@ socket.emit = function () {
|
|||
};
|
||||
socket.on('info', function (data) {
|
||||
console.error(data);
|
||||
location.href = "./404.html";
|
||||
location.href = "./404";
|
||||
});
|
||||
socket.on('error', function (data) {
|
||||
console.error(data);
|
||||
location.href = "./403";
|
||||
});
|
||||
socket.on('disconnect', function (data) {
|
||||
showStatus(statusType.offline);
|
||||
|
|
Loading…
Reference in a new issue