From e43ff158a1830987e46a49786437869d8fae049d Mon Sep 17 00:00:00 2001
From: Max <73736326+Max2408@users.noreply.github.com>
Date: Mon, 24 May 2021 09:32:24 +0530
Subject: [PATCH] Add files via upload
---
README.md | 18 +++
Src/Controllers/Admin.js | 22 +--
Src/Controllers/Animals.js | 2 +-
Src/Controllers/Games.js | 95 ++++++++++++-
Src/Controllers/Others.js | 68 ++++-----
Src/Controllers/Text.js | 156 +--------------------
Src/Controllers/View.js | 11 ++
Src/Controllers/urlshortner.js | 17 +--
Src/Router/Animals.js | 2 +-
Src/Router/Games.js | 10 +-
Src/Router/Meme.js | 2 +-
Src/Router/Others.js | 6 +-
Src/Router/Text.js | 2 +-
Src/Router/View.js | 8 ++
Src/Router/admin.js | 2 +-
Src/Router/fake.js | 2 +-
Src/Router/urlshort.js | 2 +-
Src/Utilities/auth.js | 62 +++++++++
Src/Utilities/functions.js | 182 ++++++++++++++++++++++++
assets/css/styles.css | 32 +++++
assets/css/tos.css | 243 +++++++++++++++++++++++++++++++++
blocked/blockedExtensions.md | 9 ++
models/facts.js | 19 +++
models/neverhaveiever.js | 19 +++
models/trivia.js | 27 ++++
models/wouldyourather.js | 19 +++
views/termsofservice.ejs | 77 +++++++++++
27 files changed, 871 insertions(+), 243 deletions(-)
create mode 100644 Src/Utilities/auth.js
create mode 100644 Src/Utilities/functions.js
create mode 100644 assets/css/tos.css
create mode 100644 blocked/blockedExtensions.md
create mode 100644 models/facts.js
create mode 100644 models/neverhaveiever.js
create mode 100644 models/trivia.js
create mode 100644 models/wouldyourather.js
create mode 100644 views/termsofservice.ejs
diff --git a/README.md b/README.md
index 796b547..7403afd 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,16 @@ We have a new system in our api which will block the use of some emails, domains
Mostly the temp mail service will be blocked, but if someone else doesn't follow our T&S their email or domain can be banned.
- [List of Blocked Domains](./blocked/blockeddomains.md)
+- [List of Blocked Domain Extensions](./blocked/blockedExtensions.md)
+
+## Versions
+
+| beCoditive Versions | Status | Support |
+|---------------------|------------------|-----------------------------|
+| v2.1.x | In development | Code Only |
+| v2.0.0 | Current | Both(API and Code) |
+| v1.0.0 | Depreciated | Code Only (Not Recommended) |
+
## Nodejs Module
If you are using nodejs and want to use our api it will be more easier to use it by your [NPM Package](https://www.npmjs.com/package/becoditive).
@@ -40,6 +50,14 @@ This Project already has a .replit file configured!
you can change all the files and use it for your projects also.
But you have to give credits to `beCoditive`.
+## Contributors
+
+
+
+
+
+
+
> Made By beCoditive ©2021
> Front End Made by [Aditya Jha](https://github.com/AdityaXJha)
diff --git a/Src/Controllers/Admin.js b/Src/Controllers/Admin.js
index b20ff05..3219db5 100644
--- a/Src/Controllers/Admin.js
+++ b/Src/Controllers/Admin.js
@@ -1,24 +1,6 @@
const APIKEYS = require('../../models/apikeys')
-function uuid() {
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
-
- const randomChoice = function(container) {
- return Math.floor(Math.random() * container.length)
- }
- const randomCharacterFrom = function(length) {
- return characters.charAt(randomChoice(characters))
- }
-
- const makeKeyPart = function(length) {
- return Array(length).fill().map(function() {
- return randomCharacterFrom(length)
- }).join('')
- }
-
- return `${makeKeyPart(8)}-${makeKeyPart(4)}-${makeKeyPart(4)}-${makeKeyPart(4)}-${makeKeyPart(12)}`
-}
-
+const uuid = require('../Utilities/functions').uuid
exports.newAPIKEY = async(req, res, next) => {
try{
@@ -59,4 +41,4 @@ exports.newAPIKEY = async(req, res, next) => {
})
}
}
-}
+}
\ No newline at end of file
diff --git a/Src/Controllers/Animals.js b/Src/Controllers/Animals.js
index ce59c3a..b6a08d0 100644
--- a/Src/Controllers/Animals.js
+++ b/Src/Controllers/Animals.js
@@ -1,5 +1,5 @@
const Animals = require('../../models/animals')
-const Auth = require('./auth')
+
exports.cat = async(req, res, next) => {
try{
diff --git a/Src/Controllers/Games.js b/Src/Controllers/Games.js
index bdcb8af..795fc5d 100644
--- a/Src/Controllers/Games.js
+++ b/Src/Controllers/Games.js
@@ -1,3 +1,8 @@
+const neverhaveiever = require('../../models/neverhaveiever')
+const trivia = require('../../models/trivia')
+const wouldyourather = require('../../models/wouldyourather')
+
+
exports.guess = async(req, res, next) => {
try{
const data = require('../Data/Games/Guess.json')
@@ -15,15 +20,43 @@ exports.guess = async(req, res, next) => {
exports.trivia = async(req, res, next) => {
try{
- const data = require('../Data/Games/trivia.json')
+ const data = await trivia.find()
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
question : randomData.question,
category : randomData.category,
- options : randomData.options,
+ options : randomData.option,
answer : randomData.answer,
- difficulty : randomData.difficulty,
- correct_option : randomData.correct_option
+ })
+ }catch(error){
+ res.status(500).json({
+ "error": error
+ })
+ }
+}
+
+exports.never = async(req, res, next) => {
+ try{
+ const data = await neverhaveiever.find()
+ let randomData = data[Math.floor(Math.random() * data.length)]
+ res.status(200).json({
+ question : randomData.question,
+ nsfw : randomData.nsfw
+ })
+ }catch(error){
+ res.status(500).json({
+ "error": error
+ })
+ }
+}
+
+exports.would = async(req, res, next) => {
+ try{
+ const data = await wouldyourather.find()
+ let randomData = data[Math.floor(Math.random() * data.length)]
+ res.status(200).json({
+ question : randomData.question,
+ nsfw : randomData.nsfw
})
}catch(error){
res.status(500).json({
@@ -108,6 +141,60 @@ exports.rockpaper = async(req, res, next) => {
"output": ans
})
+ }catch(error){
+ res.status(500).json({
+ "error": error
+ })
+ }
+}
+
+exports.eightball = async(req, res, next) => {
+ try{
+
+ let question = req.query.question
+
+ if(!question){
+ res.status(500).json({
+ "error": "no question was asked!",
+ "code" : 500
+ })
+ }
+
+ let ans = [
+ "Yes",
+ "No",
+ "Never",
+ "Of Course",
+ "Of Course Not",
+ "Once in a Million Years",
+ 'It is certain',
+ 'It is decidedly so',
+ 'Without a doubt',
+ 'Yes – definitely',
+ 'You may rely on it',
+ 'As I see it, yes',
+ 'Most likely',
+ 'Outlook good',
+ 'Signs point to yes',
+ 'Reply hazy, try again',
+ 'Ask again later',
+ 'Better not tell you now',
+ 'Cannot predict now',
+ 'Concentrate and ask again',
+ 'My reply is no',
+ 'My sources say no',
+ 'Outlook not so good',
+ 'Very doubtful',
+ "Don't count on it",
+ ]
+
+ let randomAnswer = ans[Math.floor(Math.random() * ans.length)]
+
+ res.status(200).json({
+ "question": question,
+ "answer" : randomAnswer
+ })
+
}catch(error){
res.status(500).json({
"error": error
diff --git a/Src/Controllers/Others.js b/Src/Controllers/Others.js
index a602341..5ac1ae1 100644
--- a/Src/Controllers/Others.js
+++ b/Src/Controllers/Others.js
@@ -4,47 +4,12 @@ const Jokes = require('../../models/jokes')
const Insults = require('../../models/insults')
const Flirts = require('../../models/flirt')
const Uselessweb = require('../../models/Uselessweb')
+const stories = require('../../models/letsnotmeet')
+const truthAndDare = require('../../models/truthordare')
-function randomStr(length) {
- var result = '';
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- var charactersLength = characters.length;
- for ( var i = 0; i < length; i++ ) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- return result;
-}
-
-function uuid() {
- var result1 = '';
- var result2 = '';
- var result3 = '';
- var result4 = '';
- var result5 = '';
+let randomStr = require('../Utilities/functions').randomStr
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
- var charactersLength = characters.length;
-
- for ( var i = 0; i < 8; i++ ) {
- result1 += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- for ( var i = 0; i < 4; i++ ) {
- result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- for ( var i = 0; i < 4; i++ ) {
- result3 += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- for ( var i = 0; i < 4; i++ ) {
- result4 += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- for ( var i = 0; i < 12; i++ ) {
- result5 += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
-
- let final = `${result1}-${result2}-${result3}-${result4}-${result5}`
-
- return final
-}
+let uuid = require('../Utilities/functions').uuid
exports.joke = async(req, res, next) => {
try{
@@ -61,6 +26,23 @@ exports.joke = async(req, res, next) => {
}
}
+exports.letsnotmeet = async(req, res, next) => {
+ try{
+ let data = await stories.find()
+ let randomData = data[Math.floor(Math.random() * data.length)]
+ res.status(200).json({
+ title : randomData.title,
+ story: randomData.story,
+ author : randomData.author,
+ url : randomData.url
+ })
+ }catch(error){
+ res.status(500).json({
+ "error": error
+ })
+ }
+}
+
exports.puns = async(req, res, next) => {
try{
@@ -283,10 +265,10 @@ exports.doesnotexists = async(req, res, next) => {
exports.truth = async(req, res, next) => {
try{
- const data = require('../Data/Truth.json')
+ const data = await truthAndDare.find({category : "truth"})
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
- truth : randomData.truth,
+ truth : randomData.question,
})
}catch(error){
res.status(500).json({
@@ -297,10 +279,10 @@ exports.truth = async(req, res, next) => {
exports.dare = async(req, res, next) => {
try{
- const data = require('../Data/Dare.json')
+ const data = await truthAndDare.find({category : "dare"})
let randomData = data[Math.floor(Math.random() * data.length)]
res.status(200).json({
- dare : randomData.dare,
+ dare : randomData.question,
})
}catch(error){
res.status(500).json({
diff --git a/Src/Controllers/Text.js b/Src/Controllers/Text.js
index b8b67f4..ee25175 100644
--- a/Src/Controllers/Text.js
+++ b/Src/Controllers/Text.js
@@ -1,158 +1,10 @@
-function reverseString(str) {
- let newString = "";
- for (let i = str.length - 1; i >= 0; i--) {
- newString += str[i];
- }
- return newString;
-}
-
-function textToMorse(str) {
-
- let arr = str.toLowerCase().split(/(?!$)/u);
-
- let encodedText = ""
-
- for(let i = 0; i < arr.length; i++){
- let char = arr[i].toLowerCase()
- if(char === "a"){
- char = char.replace("a" , ".-")
- }else if(char === "b"){
- char = char.replace("b" , "-...")
- }else if(char === "c"){
- char = char.replace("c" , "-.-.")
- }else if(char === "d"){
- char = char.replace("d" , "-..")
- }else if(char === "e"){
- char = char.replace("e" , ".")
- }else if(char === "f"){
- char = char.replace("f" , "..-.")
- }else if(char === "g"){
- char = char.replace("g" , "--.")
- }else if(char === "h"){
- char = char.replace("h" , "....")
- }else if(char === "i"){
- char = char.replace("i" , "..")
- }else if(char === "j"){
- char = char.replace("j" , ".---")
- }else if(char === "k"){
- char = char.replace("k" , "-.-")
- }else if(char === "l"){
- char = char.replace("l" , ".-..")
- }else if(char === "m"){
- char = char.replace('m' , "--")
- }else if(char === "n"){
- char = char.replace("n" , "-.")
- }else if(char === "o"){
- char = char.replace("o" , "---")
- }else if(char === "p"){
- char = char.replace("p" , ".--.")
- }else if(char === "q"){
- char = char.replace("q" , "--.-")
- }else if(char === "r"){
- char = char.replace("r" , ".-.")
- }else if(char === "s"){
- char = char.replace("s" , "...")
- }else if(char === "t"){
- char = char.replace("t" , "-")
- }else if(char === "u"){
- char = char.replace("u" , "..-")
- }else if(char === "v"){
- char = char.replace("v" , "...-")
- }else if(char === "w"){
- char = char.replace("w" , ".--")
- }else if(char === "x"){
- char = char.replace("x" , "-..-")
- }else if(char === "y"){
- char = char.replace("y" , "-.--")
- }else if(char === "z"){
- char = char.replace("z" , "--..")
- }else if(char === "1"){
- char = char.replace("1" , ".----")
- }else if(char === "2"){
- char = char.replace("2" , "..---")
- }else if(char === "3"){
- char = char.replace("3" , "...--")
- }else if(char === "4"){
- char = char.replace("4" , "....-")
- }else if(char === "5"){
- char = char.replace("5" , ".....")
- }else if(char === "6"){
- char = char.replace("6" , "-....")
- }else if(char === "7"){
- char = char.replace("7" , "--...")
- }else if(char === "8"){
- char = char.replace("8" , "---..")
- }else if(char === "9"){
- char = char.replace("9" , "----.")
- }else if(char === "0"){
- char = char.replace("0" , "-----")
- }else if(char === "."){
- char = char.replace("." , ".-.-.-")
- }else if(char === ","){
- char = char.replace("," , "--..--")
- }else if(char === ":"){
- char = char.replace(":" , "---...")
- }else if(char === "?"){
- char = char.replace("?" , "..--..")
- }else if(char === "\'"){
- char = char.replace("\'" , ".----.")
- }else if(char === "-"){
- char = char.replace("-" , "-....-")
- }else if(char === "/"){
- char = char.replace("/" , "-..-.")
- }else if(char === ")"){
- char = char.replace(")" , "-.--.-")
- }else if(char === "("){
- char = char.replace("(" , "-.--.")
- }else if(char === "\""){
- char = char.replace("\"" , ".-..-.")
- }else if(char === "@"){
- char = char.replace("@" , ".--.-.")
- }else if(char === "="){
- char = char.replace("=" , "-...-")
- }else if(char === " "){
- char = char.replace(" " , "/")
- }
-
- let lastChar = arr[arr.length - 1]
-
- if(arr[i] === lastChar){
- encodedText += `${char}`
- }else{
- encodedText += `${char} `
- }
- }
-
- return encodedText
-}
-
-function text2Binary(string) {
- return string.split('').map(function (char) {
- return char.charCodeAt(0).toString(2);
- }).join(' ');
-}
-
-function sarcasticConverter(text) {
- let output = ""
-
- for (var i = 0; i < text.length; i++) {
- let char = text.charAt(i);
+let reverseString = require('../Utilities/functions').reverseString
- let possibleOutcomes = ['low' , 'high'];
+let text2Binary = require('../Utilities/functions').text2Binary
- let randomOutcomes = possibleOutcomes[Math.floor(Math.random() * possibleOutcomes.length)]
+let sarcasticConverter = require('../Utilities/functions').sarcasticConverter
- if(randomOutcomes === 'low'){
- char = char.toLowerCase()
- }else if(randomOutcomes === 'high'){
- char = char.toUpperCase()
- }
-
- output += char
- }
-
- return output
-}
+let textToMorse = require('../Utilities/functions').textToMorse
exports.shuffle = async(req, res, next) => {
try{
diff --git a/Src/Controllers/View.js b/Src/Controllers/View.js
index ef0b8f1..2203e5f 100644
--- a/Src/Controllers/View.js
+++ b/Src/Controllers/View.js
@@ -20,3 +20,14 @@ exports.v2 = async(req, res, next) => {
})
}
}
+
+exports.tos = async(req, res, next) => {
+ try{
+ res.status(200).render('termsofservice')
+
+ }catch(error){
+ res.status(500).json({
+ "error": error
+ })
+ }
+}
diff --git a/Src/Controllers/urlshortner.js b/Src/Controllers/urlshortner.js
index e72d299..b221378 100644
--- a/Src/Controllers/urlshortner.js
+++ b/Src/Controllers/urlshortner.js
@@ -1,20 +1,7 @@
const apikeys = require('../../models/apikeys');
const Url = require('../../models/url-shortner')
-function shortid() {
- var result1 = '';
-
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
- var charactersLength = characters.length;
-
- for ( var i = 0; i < 8; i++ ) {
- result1 += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
-
- let final = `${result1}`
-
- return final
-}
+let shortid = require('../Utilities/functions').randomStr
exports.create = async(req, res, next) => {
try{
@@ -58,7 +45,7 @@ exports.create = async(req, res, next) => {
url,
logo,
description,
- shortId : shortid(),
+ shortId : shortid(8),
owner : apikey.apikey,
domain : domain
})
diff --git a/Src/Router/Animals.js b/Src/Router/Animals.js
index e61c18e..d864edc 100644
--- a/Src/Router/Animals.js
+++ b/Src/Router/Animals.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').auth
+const auth = require('../Utilities/auth').auth
const animalController = require('../Controllers/Animals')
diff --git a/Src/Router/Games.js b/Src/Router/Games.js
index 4e19d99..41ca4a8 100644
--- a/Src/Router/Games.js
+++ b/Src/Router/Games.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').auth
+const auth = require('../Utilities/auth').auth
const gamesController = require('../Controllers/Games')
@@ -12,6 +12,14 @@ route
.route('/trivia')
.get(auth , gamesController.trivia)
+route
+ .route('/neverhaveiever')
+ .get(auth , gamesController.never)
+
+route
+ .route('/wouldyourather')
+ .get(auth , gamesController.would)
+
route
.route('/rpc')
.get(auth , gamesController.rockpaper)
diff --git a/Src/Router/Meme.js b/Src/Router/Meme.js
index f5dcf7a..d028714 100644
--- a/Src/Router/Meme.js
+++ b/Src/Router/Meme.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').auth
+const auth = require('../Utilities/auth').auth
const memeController = require('../Controllers/Meme')
diff --git a/Src/Router/Others.js b/Src/Router/Others.js
index ce25c5a..73c3537 100644
--- a/Src/Router/Others.js
+++ b/Src/Router/Others.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').auth
+const auth = require('../Utilities/auth').auth
const otherController = require('../Controllers/Others')
@@ -37,6 +37,10 @@ route
.route('/uselessweb')
.get(auth , otherController.uselessweb)
+route
+ .route('/letsnotmeet')
+ .get(auth , otherController.letsnotmeet)
+
route
.route('/truth')
.get(auth , otherController.truth)
diff --git a/Src/Router/Text.js b/Src/Router/Text.js
index bbb2c12..e9a4244 100644
--- a/Src/Router/Text.js
+++ b/Src/Router/Text.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').auth
+const auth = require('../Utilities/auth').auth
const textController = require('../Controllers/Text')
diff --git a/Src/Router/View.js b/Src/Router/View.js
index 9a58d9c..13719c2 100644
--- a/Src/Router/View.js
+++ b/Src/Router/View.js
@@ -7,6 +7,14 @@ route
.route('/')
.get(viewController.home)
+route
+ .route('/tos')
+ .get(viewController.tos)
+
+route
+ .route('/termsofservice')
+ .get(viewController.tos)
+
route
.route('/sitemap.xml')
.get(function(req, res) {
diff --git a/Src/Router/admin.js b/Src/Router/admin.js
index a06ebe2..8b84f66 100644
--- a/Src/Router/admin.js
+++ b/Src/Router/admin.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').adminAuth
+const auth = require('../Utilities/auth').adminAuth
const adminController = require('../Controllers/Admin')
diff --git a/Src/Router/fake.js b/Src/Router/fake.js
index 839f9cb..1298943 100644
--- a/Src/Router/fake.js
+++ b/Src/Router/fake.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').auth
+const auth = require('../Utilities/auth').auth
const fakeController = require('../Controllers/fake')
diff --git a/Src/Router/urlshort.js b/Src/Router/urlshort.js
index 2584276..64e46f9 100644
--- a/Src/Router/urlshort.js
+++ b/Src/Router/urlshort.js
@@ -1,6 +1,6 @@
const express = require('express')
const route = express.Router()
-const auth = require('../Controllers/auth').auth
+const auth = require('../Utilities/auth').auth
const urlController = require('../Controllers/urlshortner')
diff --git a/Src/Utilities/auth.js b/Src/Utilities/auth.js
new file mode 100644
index 0000000..030be29
--- /dev/null
+++ b/Src/Utilities/auth.js
@@ -0,0 +1,62 @@
+let apikeys = require('../../models/apikeys')
+
+exports.auth = async(req, res , next ) => {
+ let Auth = req.headers['authorization'];
+ if(!Auth) {
+ Auth = req.query.apikey
+ }
+
+ if(!Auth) {
+ res.status(401).json({
+ "message": "Unauthorized",
+ code : 401
+ })
+ return
+ }
+
+ let apikey = await apikeys.findOne({apikey : Auth})
+ if(!apikey) {
+ res.status(401).json({
+ "message": "Invalid API Key Provided.",
+ code : 401
+ })
+ return
+ }
+
+ await apikeys.findByIdAndUpdate(apikey , {uses : +apikey.uses + +1})
+ next();
+}
+
+exports.adminAuth = async(req, res , next ) => {
+ let Auth = req.headers['authorization'];
+ if(!Auth) {
+ Auth = req.query.apikey
+ }
+
+ if(!Auth) {
+ res.status(401).json({
+ "message": "Unauthorized",
+ code : 401
+ })
+ return
+ }
+
+ let apikey = await apikeys.findOne({apikey : Auth})
+ if(!apikey) {
+ res.status(401).json({
+ "message": "Invalid API Key Provided.",
+ code : 401
+ })
+ return
+ }
+ if(apikey.type != 'admin'){
+ res.status(401).json({
+ "message": "Not Authorized to use this endpoint",
+ code : 401
+ })
+ return
+ }
+
+ await apikeys.findByIdAndUpdate(apikey , {uses : +apikey.uses + +1})
+ next();
+}
diff --git a/Src/Utilities/functions.js b/Src/Utilities/functions.js
new file mode 100644
index 0000000..a5a3768
--- /dev/null
+++ b/Src/Utilities/functions.js
@@ -0,0 +1,182 @@
+module.exports = {
+ uuid : function(){
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
+
+ const randomChoice = function(container) {
+ return Math.floor(Math.random() * container.length)
+ }
+ const randomCharacterFrom = function(length) {
+ return characters.charAt(randomChoice(characters))
+ }
+
+ const makeKeyPart = function(length) {
+ return Array(length).fill().map(function() {
+ return randomCharacterFrom(length)
+ }).join('')
+ }
+
+ return `${makeKeyPart(8)}-${makeKeyPart(4)}-${makeKeyPart(4)}-${makeKeyPart(4)}-${makeKeyPart(12)}`
+ },
+ randomStr : function(length){
+ var result = '';
+ var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+ var charactersLength = characters.length;
+ for ( var i = 0; i < length; i++ ) {
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
+ }
+ return result;
+ },
+ textToMorse : function(str) {
+
+ let arr = str.toLowerCase().split(/(?!$)/u);
+
+ let encodedText = ""
+
+ for(let i = 0; i < arr.length; i++){
+ let char = arr[i].toLowerCase()
+ if(char === "a"){
+ char = char.replace("a" , ".-")
+ }else if(char === "b"){
+ char = char.replace("b" , "-...")
+ }else if(char === "c"){
+ char = char.replace("c" , "-.-.")
+ }else if(char === "d"){
+ char = char.replace("d" , "-..")
+ }else if(char === "e"){
+ char = char.replace("e" , ".")
+ }else if(char === "f"){
+ char = char.replace("f" , "..-.")
+ }else if(char === "g"){
+ char = char.replace("g" , "--.")
+ }else if(char === "h"){
+ char = char.replace("h" , "....")
+ }else if(char === "i"){
+ char = char.replace("i" , "..")
+ }else if(char === "j"){
+ char = char.replace("j" , ".---")
+ }else if(char === "k"){
+ char = char.replace("k" , "-.-")
+ }else if(char === "l"){
+ char = char.replace("l" , ".-..")
+ }else if(char === "m"){
+ char = char.replace('m' , "--")
+ }else if(char === "n"){
+ char = char.replace("n" , "-.")
+ }else if(char === "o"){
+ char = char.replace("o" , "---")
+ }else if(char === "p"){
+ char = char.replace("p" , ".--.")
+ }else if(char === "q"){
+ char = char.replace("q" , "--.-")
+ }else if(char === "r"){
+ char = char.replace("r" , ".-.")
+ }else if(char === "s"){
+ char = char.replace("s" , "...")
+ }else if(char === "t"){
+ char = char.replace("t" , "-")
+ }else if(char === "u"){
+ char = char.replace("u" , "..-")
+ }else if(char === "v"){
+ char = char.replace("v" , "...-")
+ }else if(char === "w"){
+ char = char.replace("w" , ".--")
+ }else if(char === "x"){
+ char = char.replace("x" , "-..-")
+ }else if(char === "y"){
+ char = char.replace("y" , "-.--")
+ }else if(char === "z"){
+ char = char.replace("z" , "--..")
+ }else if(char === "1"){
+ char = char.replace("1" , ".----")
+ }else if(char === "2"){
+ char = char.replace("2" , "..---")
+ }else if(char === "3"){
+ char = char.replace("3" , "...--")
+ }else if(char === "4"){
+ char = char.replace("4" , "....-")
+ }else if(char === "5"){
+ char = char.replace("5" , ".....")
+ }else if(char === "6"){
+ char = char.replace("6" , "-....")
+ }else if(char === "7"){
+ char = char.replace("7" , "--...")
+ }else if(char === "8"){
+ char = char.replace("8" , "---..")
+ }else if(char === "9"){
+ char = char.replace("9" , "----.")
+ }else if(char === "0"){
+ char = char.replace("0" , "-----")
+ }else if(char === "."){
+ char = char.replace("." , ".-.-.-")
+ }else if(char === ","){
+ char = char.replace("," , "--..--")
+ }else if(char === ":"){
+ char = char.replace(":" , "---...")
+ }else if(char === "?"){
+ char = char.replace("?" , "..--..")
+ }else if(char === "\'"){
+ char = char.replace("\'" , ".----.")
+ }else if(char === "-"){
+ char = char.replace("-" , "-....-")
+ }else if(char === "/"){
+ char = char.replace("/" , "-..-.")
+ }else if(char === ")"){
+ char = char.replace(")" , "-.--.-")
+ }else if(char === "("){
+ char = char.replace("(" , "-.--.")
+ }else if(char === "\""){
+ char = char.replace("\"" , ".-..-.")
+ }else if(char === "@"){
+ char = char.replace("@" , ".--.-.")
+ }else if(char === "="){
+ char = char.replace("=" , "-...-")
+ }else if(char === " "){
+ char = char.replace(" " , "/")
+ }
+
+ let lastChar = arr[arr.length - 1]
+
+ if(arr[i] === lastChar){
+ encodedText += `${char}`
+ }else{
+ encodedText += `${char} `
+ }
+ }
+
+ return encodedText
+ },
+ sarcasticConverter : function(text) {
+ let output = ""
+
+ for (var i = 0; i < text.length; i++) {
+ let char = text.charAt(i);
+
+ let possibleOutcomes = ['low' , 'high'];
+
+ let randomOutcomes = possibleOutcomes[Math.floor(Math.random() * possibleOutcomes.length)]
+
+ if(randomOutcomes === 'low'){
+ char = char.toLowerCase()
+ }else if(randomOutcomes === 'high'){
+ char = char.toUpperCase()
+ }
+
+ output += char
+ }
+
+ return output
+ },
+ text2Binary : function(string) {
+ return string.split('').map(function (char) {
+ return char.charCodeAt(0).toString(2);
+ }).join(' ');
+ },
+ reverseString : function(str) {
+ let newString = "";
+ for (let i = str.length - 1; i >= 0; i--) {
+ newString += str[i];
+ }
+ return newString;
+ }
+
+}
\ No newline at end of file
diff --git a/assets/css/styles.css b/assets/css/styles.css
index f0dbcd5..5406499 100644
--- a/assets/css/styles.css
+++ b/assets/css/styles.css
@@ -22,6 +22,38 @@
background: var(--main-color);
}
+.alert {
+ position: fixed;
+ top: 0;
+ left: 50%;
+ -webkit-transform: translateX(-50%);
+ transform: translateX(-50%);
+ z-index: 9999;
+ color: #fff;
+ font-size: 1rem;
+ font-weight: 400;
+ text-align: center;
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+ padding: 1.6rem 10rem;
+ -webkit-box-shadow: 0 2rem 4rem rgba(0, 0, 0, 0.25);
+ box-shadow: 0 2rem 4rem rgba(0, 0, 0, 0.25);
+ }
+ .alert--success {
+ background-color: #20bf6b;
+ }
+ .alert--error {
+ background-color: #eb4d4b;
+ }
+
+.hidden {
+ display: none;
+}
+
+.show {
+ display: block;
+}
+
.Signup {
margin-top: 150px;
}
diff --git a/assets/css/tos.css b/assets/css/tos.css
new file mode 100644
index 0000000..d63db4c
--- /dev/null
+++ b/assets/css/tos.css
@@ -0,0 +1,243 @@
+@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@500;700&display=swap');
+
+::-webkit-scrollbar {
+ width: 8px;
+}
+
+::-webkit-scrollbar-track {
+ background: #242836;
+}
+
+::-webkit-scrollbar-thumb {
+ background: #333541;
+}
+
+* {
+
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+
+}
+
+body,html {
+
+ width: 100%;
+ min-height: 100%;
+ background-color: #242836;
+
+}
+
+.main-header {
+
+ width: 100%;
+ height: 75px;
+ background-color: #181A24;
+ display: block;
+
+}
+
+.main-header ul.header-options {
+
+ width: 100%;
+ height: 100%;
+ list-style: none;
+ display: flex;
+ align-items: center;
+ justify-content: space-around;
+ padding-right: 100px;
+
+}
+
+.main-header ul.header-options li {
+ display: inline-block;
+}
+
+.main-header ul.header-options li.title {
+
+ font-size: 18px;
+ color: #fff;
+ font-family: Arial;
+ cursor: pointer;
+
+}
+
+.header-mobile {
+
+ width: 100%;
+ height: 75px;
+ background-color: #181A24;
+ text-align: center;
+ display: none;
+}
+
+.title-mobile {
+ font-size: 18px;
+ color: #fff;
+ font-family: Arial;
+ cursor: pointer;
+ padding-top: 30px;
+}
+
+a {
+ text-decoration: none;
+ font-size: 16px;
+ color: #6D6F79;
+ font-family: Arial;
+ cursor: pointer;
+}
+
+a:hover {
+ font-size: 16px;
+ color: #9598a7;
+}
+
+
+.card {
+ margin-top: 100px;
+ margin-bottom: 100px;
+ height : 1950px;
+ width: 1200px;
+ border-radius: 30px;
+ background-color: #333541;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.card .primary-heading {
+ text-align: center;
+ font-family: josefin sans;
+ color: white;
+ padding-top: 50px ;
+ font-size: 4em;
+}
+
+.paragraph {
+ font-family: josefin sans;
+ color: rgb(179, 179, 179);
+ margin-left: 50px;
+ margin-right: 25px;
+ padding-top: 50px;
+ font-size: 1.5em;
+ line-height: 1.3em;
+ font-weight: 500;
+}
+
+.bold {
+ font-weight: 700;
+ color: white;
+}
+
+.footer-heading {
+ text-align: center;
+ font-family: josefin sans;
+ color: white;
+ margin-bottom: 50px;
+ font-size: 2em;
+ line-height: 35px;
+}
+
+@media only screen and (max-width: 1218px) {
+ .card {
+ margin-top: 100px;
+ margin-bottom: 100px;
+ height : 2050px;
+ width: 1000px;
+ border-radius: 30px;
+ background-color: #333541;
+ margin-left: auto;
+ margin-right: auto;
+ }
+}
+
+@media only screen and (max-width: 1012px) {
+ .card {
+ margin-top: 100px;
+ margin-bottom: 100px;
+ height : 2350px;
+ width: 800px;
+ border-radius: 30px;
+ background-color: #333541;
+ margin-left: auto;
+ margin-right: auto;
+ }
+}
+
+@media only screen and (max-width: 832px) {
+ .card {
+ margin-top: 100px;
+ margin-bottom: 100px;
+ height : 2950px;
+ width: 600px;
+ border-radius: 30px;
+ background-color: #333541;
+ margin-left: auto;
+ margin-right: auto;
+ }
+ .card .primary-heading {
+ font-size: 3.5em;
+ }
+
+ .footer-heading {
+ font-size: 1.5em;
+ }
+}
+
+@media only screen and (max-width: 626px) {
+ .card {
+ margin-top: 100px;
+ margin-bottom: 100px;
+ height : 3850px;
+ width: 450px;
+ border-radius: 30px;
+ background-color: #333541;
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ .header-mobile {
+ display: block;
+ }
+
+ .main-header {
+ display: none;
+ }
+
+ .card .primary-heading {
+ font-size: 3em;
+ }
+}
+
+@media only screen and (max-width: 480px) {
+ .card {
+ margin-top: 100px;
+ margin-bottom: 100px;
+ height : 5050px;
+ width: 350px;
+ border-radius: 30px;
+ background-color: #333541;
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ .card .primary-heading {
+ font-size: 2em;
+ }
+}
+
+@media only screen and (max-width: 365px) {
+ .card {
+ margin-top: 100px;
+ margin-bottom: 100px;
+ height : 6300px;
+ width: 290px;
+ border-radius: 30px;
+ background-color: #333541;
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ .card .primary-heading {
+ font-size: 2em;
+ }
+}
\ No newline at end of file
diff --git a/blocked/blockedExtensions.md b/blocked/blockedExtensions.md
new file mode 100644
index 0000000..c6f6cf9
--- /dev/null
+++ b/blocked/blockedExtensions.md
@@ -0,0 +1,9 @@
+# The list of domains extensions which are Banned by us.
+
+- `.me`
+- `.ml`
+- `.tk`
+- `.xyz`
+- `.email`
+- `.online`
+
diff --git a/models/facts.js b/models/facts.js
new file mode 100644
index 0000000..25e7da5
--- /dev/null
+++ b/models/facts.js
@@ -0,0 +1,19 @@
+const mongoose = require('mongoose')
+
+const factSchema = mongoose.Schema({
+ fact : {
+ type : String,
+ required : true,
+ unique : true
+ },
+ category : {
+ type : String,
+ required : true
+ }
+},
+{
+ versionKey: false
+}
+)
+
+module.exports = mongoose.model('facts', factSchema);
\ No newline at end of file
diff --git a/models/neverhaveiever.js b/models/neverhaveiever.js
new file mode 100644
index 0000000..c216e5b
--- /dev/null
+++ b/models/neverhaveiever.js
@@ -0,0 +1,19 @@
+const mongoose = require('mongoose')
+
+const neverSchema = mongoose.Schema({
+ question : {
+ type : String,
+ required : true,
+ unique : true
+ },
+ nsfw : {
+ type : Boolean,
+ required : true,
+ }
+},
+{
+ versionKey: false
+}
+)
+
+module.exports = mongoose.model('neverhaveiever', neverSchema);
\ No newline at end of file
diff --git a/models/trivia.js b/models/trivia.js
new file mode 100644
index 0000000..305f6c1
--- /dev/null
+++ b/models/trivia.js
@@ -0,0 +1,27 @@
+const mongoose = require('mongoose')
+
+const triviaSchema = mongoose.Schema({
+ question : {
+ type : String,
+ required : true,
+ unique : true
+ },
+ answer : {
+ type : String,
+ required : true
+ },
+ category : {
+ type : String,
+ required : true
+ },
+ option : {
+ type : Array,
+ required : true
+ }
+},
+{
+ versionKey: false
+}
+)
+
+module.exports = mongoose.model('quiz', triviaSchema);
\ No newline at end of file
diff --git a/models/wouldyourather.js b/models/wouldyourather.js
new file mode 100644
index 0000000..86e429c
--- /dev/null
+++ b/models/wouldyourather.js
@@ -0,0 +1,19 @@
+const mongoose = require('mongoose')
+
+const wouldSchema = mongoose.Schema({
+ question : {
+ type : String,
+ required : true,
+ unique : true
+ },
+ nsfw : {
+ type : Boolean,
+ required : true,
+ }
+},
+{
+ versionKey: false
+}
+)
+
+module.exports = mongoose.model('wouldyourather', wouldSchema);
\ No newline at end of file
diff --git a/views/termsofservice.ejs b/views/termsofservice.ejs
new file mode 100644
index 0000000..1dd2c48
--- /dev/null
+++ b/views/termsofservice.ejs
@@ -0,0 +1,77 @@
+
+
+
+ 1) In consideration of your use of the beCoditive API, you represent that you are of legal age to form a binding contract and are not a person barred from receiving services under the laws of the Indian Constitution or other applicable jurisdiction. You also agree to:
+ • provide true, accurate, current and complete information about yourself as prompted by beCoditive API's registration form and;
+ • maintain and promptly update the Registration Data to keep it true, accurate, current and complete. If you provide any information that is untrue, inaccurate, not current or incomplete, or beCoditive has reasonable grounds to suspect that such information is untrue, inaccurate, not current or incomplete, beCoditive has the right to suspend or terminate your account and refuse any and all current or future use of the beCoditive API (or any portion thereof).
+
+ 2) Any kind of abusing, harassment using beCoditive API is strictly prohibited. If anyone is found conducting such acts, they will be banned from the beCoditive API and legal action will be taken against them.
+
+ 3) beCoditive API provides ONE API key to each person. Trying to generate fakes API keys is strictly prohibited and this act will result in banning of the person.
+
+ 4) beCoditive API is copyrighted and if any acts of plagiarism are discovered, legal action will be taken against the offender.
+
+ 5) Flooding beCoditive API with false requests and false complains is strictly prohibited
+
+ 6) Registration Data and certain other information about you is subject to our Privacy Policy.
+
+ 7) You expressly understand and agree that beCoditive and its subsidiaries, affiliates, officers, employees, agents, partners and licensors shall not be liable to you for any direct, indirect, incidental, special, consequential or exemplary damages, including, but not limited to, damages for loss of profits, goodwill, use, data or other intangible losses (even if beCoditive has been advised of the possibility of such damages), resulting from the use or the inability to use beCoditive API.
+
+ 8) You agree that beCoditive may terminate your access to beCoditive API for violations of the TOS and/or requests by authorized law enforcement or other government agencies.
+
+ 9) You acknowledge that beCoditive may establish general practices and limits concerning use of beCoditive API, including without limitation the maximum number of days that email messages, message board postings or other uploaded Content will be retained by beCoditive API. You further acknowledge that beCoditive reserves the right to modify these general practices and limits from time to time. beCoditive reserves the right at any time and from time to time to modify or discontinue, temporarily or permanently, beCoditive API (or any part thereof) with or without notice. You agree that beCoditive shall not be liable to you or to any third party for any modification, suspension or discontinuance of beCoditive API.
+