Compare commits
2 Commits
a4e44fe884
...
847950c726
Author | SHA1 | Date | |
---|---|---|---|
847950c726 | |||
6da1f4d556 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
!/package-lock.json
|
||||
!/README.md
|
||||
!/files/www/qonq.js
|
||||
!/favicon.ico
|
||||
|
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 734 B |
50
package-lock.json
generated
50
package-lock.json
generated
@ -9,6 +9,7 @@
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"formidable": "^1.2.2",
|
||||
"serve-favicon": "^2.5.0",
|
||||
"serve-index": "^1.9.1"
|
||||
}
|
||||
},
|
||||
@ -445,6 +446,31 @@
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
||||
},
|
||||
"node_modules/serve-favicon": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz",
|
||||
"integrity": "sha1-k10kDN/g9YBTB/3+ln2IlCosvPA=",
|
||||
"dependencies": {
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"ms": "2.1.1",
|
||||
"parseurl": "~1.3.2",
|
||||
"safe-buffer": "5.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-favicon/node_modules/ms": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
||||
},
|
||||
"node_modules/serve-favicon/node_modules/safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||
},
|
||||
"node_modules/serve-index": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
|
||||
@ -890,6 +916,30 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve-favicon": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz",
|
||||
"integrity": "sha1-k10kDN/g9YBTB/3+ln2IlCosvPA=",
|
||||
"requires": {
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"ms": "2.1.1",
|
||||
"parseurl": "~1.3.2",
|
||||
"safe-buffer": "5.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve-index": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
|
||||
|
@ -4,6 +4,7 @@
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"formidable": "^1.2.2",
|
||||
"serve-favicon": "^2.5.0",
|
||||
"serve-index": "^1.9.1"
|
||||
}
|
||||
}
|
||||
|
8
qonq.js
8
qonq.js
@ -3,6 +3,7 @@ var colors = require("colors");
|
||||
var express = require("express");
|
||||
var formidable = require("formidable");
|
||||
var serveIndex = require("serve-index");
|
||||
var serveFavicon = require("serve-favicon");
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
|
||||
@ -27,6 +28,8 @@ app.use((req, res, next)=>{
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(serveFavicon("favicon.ico"));
|
||||
|
||||
|
||||
app.post("*", (req, res, next) => {
|
||||
if (req.headers.authentication != process.env.AUTH_TOKEN) return void res.status(403).send("Unauthorized");
|
||||
@ -82,3 +85,8 @@ app.get(['/', '/:code/', '/:code/*'], function(req, res, next){
|
||||
});
|
||||
}, express.static(FILES_DIR), serveIndex(FILES_DIR, {icons: true}));
|
||||
|
||||
|
||||
app.use((req, res) => {
|
||||
if (req.method == "GET") res.status(404).send("This resource does not exist.");
|
||||
else res.sendStatus(405);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user