diff --git a/.gitignore b/.gitignore index ba9e398..5b7147b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -EUS/ \ No newline at end of file +testing/ \ No newline at end of file diff --git a/EUS.js b/EUS.js index a1cd072..344116a 100644 --- a/EUS.js +++ b/EUS.js @@ -76,7 +76,7 @@ class Database { let dbConnection; function init() { // Require node modules - node_modules["chalk"] = require("chalk"); + node_modules["dyetty"] = require("dyetty"); node_modules["busboy"] = require("connect-busboy"); node_modules["randomstring"] = require("randomstring"); node_modules["streamMeter"] = require("stream-meter"); @@ -249,7 +249,7 @@ function fileExists(file) { function sendFile(req, res, path, startTime) { // File does exist, send it back to the client. res.sendFile(path); - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} ${req.url} ${Date.now() - startTime}ms`); } async function regularFile(req, res, urs = "", startTime) { @@ -275,14 +275,14 @@ async function regularFile(req, res, urs = "", startTime) { if (!isSuccess) { // Doesn't exist, send a 404 to the client. await error404Page(res); - global.modules.consoleHelper.printInfo(emoji.cross, `${req.method}: ${node_modules.chalk.red("[404]")} ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.cross, `${req.method}: ${node_modules.dyetty.red("[404]")} ${req.url} ${Date.now() - startTime}ms`); } } } function imageFile(req, res, file, startTime = 0) { res.sendFile(`${__dirname}${BASE_PATH}/i/${file}`); - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} (ImageReq) ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} (ImageReq) ${req.url} ${Date.now() - startTime}ms`); } async function doImageLookup(req, res, urs, startTime) { @@ -471,7 +471,7 @@ async function handleAPI(req, res) { // Status check to see the online status of EUS // Used by ESL to make sure EUS is online case "/api/get-server-status": - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); return res.end('{"status":1,"version":"'+global.internals.version+'"}'); /* Stats api endpoint @@ -488,34 +488,34 @@ async function handleAPI(req, res) { if (filesaa == 1) { // If getting the space used on the server isn't required send the json if (spaceaa != 1) { - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); delete jsonaa["space"]; return res.end(JSON.stringify(jsonaa)); } } // Getting space is required if (spaceaa == 1) { - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); if (filesaa != 1) delete jsonaa["files"]; return res.end(JSON.stringify(jsonaa)); } if (filesaa != 1 && spaceaa != 1) { - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); return res.end("Please add f and or s to your queries to get the files and space"); } break; // Information API case "/api/get-info": - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); return res.end(JSON.stringify({ version: global.internals.version, instance: config["server"]["instance_type"] })); default: - global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.chalk.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); + global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: ${node_modules.dyetty.green("[200]")} (APIReq) ${req.url} ${Date.now() - startTime}ms`); return res.send(`

All currently avaliable api endpoints

/api/get-server-status @@ -545,6 +545,6 @@ async function spaceToLowest(spaceValue, includeStringValue) { module.exports.MOD_FUNC = MODULE_FUNCTION; module.exports.REQUIRED_NODE_MODULES = [ - "chalk", "connect-busboy", "randomstring", + "dyetty", "connect-busboy", "randomstring", "stream-meter", "mysql2" ];