diff --git a/models/Message.js b/models/Message.js index 2510d9a..9fe8ac6 100644 --- a/models/Message.js +++ b/models/Message.js @@ -1,11 +1,13 @@ -const mongoose = require("mongoose") -const cache = require("./cache") +const mongoose = require("mongoose"); +const cache = require("./cache"); +const { limits } = require("../config.json"); + const schema = new mongoose.Schema({ id: { type: String, unique: true }, author: Object, threadID: String, authorID: String, - content: { type: String, maxlength: 1024 }, + content: { type: String, maxlength: limits.message }, time: { type: Date, default: Date.now }, deleted: { type: Boolean, default: false }, edited: { type: Boolean, default: false }, diff --git a/models/Secret.js b/models/Secret.js index 63e6c6d..6482408 100644 --- a/models/Secret.js +++ b/models/Secret.js @@ -1,7 +1,8 @@ const mongoose = require("mongoose") +const { limits } = require("../config.json"); const schema = new mongoose.Schema({ - username: { type: String, unique: true, maxlength: 25 }, + username: { type: String, unique: true, maxlength: limits.names }, password: String, id: { type: String, unique: true } }); diff --git a/models/Thread.js b/models/Thread.js index 7eb0261..3319c0f 100644 --- a/models/Thread.js +++ b/models/Thread.js @@ -1,6 +1,8 @@ const mongoose = require("mongoose"); const cache = require("./cache") const MessageModel = require("./Message"); +const { limits } = require("../config.json"); + const schema = new mongoose.Schema({ id: { type: String, unique: true }, @@ -8,7 +10,7 @@ const schema = new mongoose.Schema({ authorID: String, author: Object, - title: { type: String, maxlength: 128 }, + title: { type: String, maxlength: limits.title }, time: { type: Date, default: Date.now }, deleted: { type: Boolean, default: false }, edited: { type: Boolean, default: false }, diff --git a/models/User.js b/models/User.js index e573646..912b1b9 100644 --- a/models/User.js +++ b/models/User.js @@ -1,14 +1,14 @@ const mongoose = require("mongoose") -const { def_theme } = require("../config.json"); +const { def_theme, limits } = require("../config.json"); const schema = new mongoose.Schema({ id: { type: String, unique: true }, discordID: { type: String, unique: true }, - name: { type: String, maxlength: 25 }, + name: { type: String, maxlength: limits.names }, avatar: { type: String, default: "/images/avatars/default.jpg" }, time: { type: Date, default: Date.now }, deleted: { type: Boolean, default: false }, edited: { type: Boolean, default: false }, - about: { type: String, default: "", maxlength: 256 }, + about: { type: String, default: "", maxlength: limits.desp }, admin: { type: Boolean, default: false }, theme: { type: String, default: def_theme }, lastSeen: { type: Date, default: Date.now, select: false }, diff --git a/views/create_category.ejs b/views/create_category.ejs index 9f2b36c..9439fd0 100644 --- a/views/create_category.ejs +++ b/views/create_category.ejs @@ -9,9 +9,9 @@

Name:

- +

Description:

- +
diff --git a/views/create_thread.ejs b/views/create_thread.ejs index 954bf71..81e4954 100644 --- a/views/create_thread.ejs +++ b/views/create_thread.ejs @@ -11,9 +11,9 @@

Title:

- +

Content:

- +

Category:

- - + + +
diff --git a/views/thread.ejs b/views/thread.ejs index c6a3cea..571c648 100644 --- a/views/thread.ejs +++ b/views/thread.ejs @@ -109,7 +109,7 @@
- + diff --git a/views/user.ejs b/views/user.ejs index 239e53e..4708f74 100644 --- a/views/user.ejs +++ b/views/user.ejs @@ -30,9 +30,9 @@

Edit <%= member.name %>

- + - + <% if (user?.admin){ %> Is Admin? >