diff --git a/.gitignore b/.gitignore index a388f31..c32f2f8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,32 +3,9 @@ # Node node_modules -package-lock.json # macOS .DS_Store # Windows -System Volume Information - -# Database Files -cooldown.json -banned.json -users.json -usermessages.json -userdata.json -userfeed.json -following.json -hadfollowing.json - -userreports.json -projectreports.json - -# Extra -blockedips.json -globalsettings.json -illegalwords.js -cache/* - -# Projects -api/db/projects/* \ No newline at end of file +System Volume Information \ No newline at end of file diff --git a/api/db/UMTests.js b/api/v1/db/UMTests.js similarity index 100% rename from api/db/UMTests.js rename to api/v1/db/UMTests.js diff --git a/api/db/UserManager.js b/api/v1/db/UserManager.js similarity index 100% rename from api/db/UserManager.js rename to api/v1/db/UserManager.js diff --git a/index.js b/index.js index b9ecace..ac6a008 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const cors = require('cors'); const rateLimit = require('express-rate-limit'); const express = require("express"); const endpointLoader = require("./api/endpointLoader"); -const um = require('./api/db/UserManager'); +const um = require('./api/v1/db/UserManager'); const cast = require("./utils/Cast"); const path = require('path'); const functions = require('./utils/functions'); @@ -13,7 +13,7 @@ const app = express(); const PORT = process.env.PORT || 3000; const MAXVIEWS = process.env.MAXVIEWS || 10000; // it will take up to 10000 views then reset after const VIEWRESETRATE = process.env.VIEWRESETRATE || 1000 * 60 * 60; // reset every hour -const upload = multer({ dest: 'uploads/' }); +const upload = multer({ dest: 'tmp/uploads/' }); app.use(cors({ origin: '*', @@ -38,12 +38,6 @@ app.use(rateLimit({ legacyHeaders: false, })); -function error(res, code, message) { - res.status(code); - res.header("Content-Type", 'application/json'); - res.json({ "error": message }); -} - const Cast = new cast(); const UserManager = new um(); @@ -59,8 +53,9 @@ const UserManager = new um(); homeDir: path.join(__dirname, "./"), Cast: Cast, escapeXML: functions.escapeXML, - error: error, - env: process.env + error: functions.error, + env: process.env, + upload: upload }); app.listen(PORT, () => { diff --git a/package.json b/package.json index 9709f64..da28773 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,6 @@ "scripts": { "dev": "nodemon index.js", "reset": "node reset.js", - "test": "node api/db/UMTests.js" + "test": "node api/v1/db/UMTests.js" } } diff --git a/reset.js b/reset.js index 7d8f30d..e701c75 100644 --- a/reset.js +++ b/reset.js @@ -1,4 +1,4 @@ -const um = require('./api/db/UserManager'); +const um = require('./api/v1/db/UserManager'); const UserManager = new um();