diff --git a/config.js b/config.js index dda06cef..73b0ccaa 100644 --- a/config.js +++ b/config.js @@ -10,12 +10,14 @@ if (exports.NODE_ENV === "production") { exports.MONGO_URI = process.env.STUDY_BUDDY_MLAB_MONGO_URI; exports.BASE_URL = "https://cards.c13u.com"; } else if (exports.NODE_ENV === "development") { - exports.MONGO_URI = process.env.STUDY_BUDDY_MLAB_TEST_DB_URI; + exports.MONGO_URI = "invalid://use-memory-db"; exports.BASE_URL = `http://localhost:${exports.PORT}`; } else { throw Error("Please set the NODE_ENV environment variable."); } +exports.IS_DEV = exports.NODE_ENV === "development"; + exports.EMAIL_ADDRESS = process.env.STUDY_BUDDY_DEFAULT_EMAIL_ADDRESS; exports.MAILGUN_LOGIN = process.env.STUDY_BUDDY_MAILGUN_LOGIN; exports.MAILGUN_PASSWORD = process.env.STUDY_BUDDY_MAILGUN_PASSWORD; @@ -23,7 +25,7 @@ exports.MAILGUN_PASSWORD = process.env.STUDY_BUDDY_MAILGUN_PASSWORD; exports.DEBUG_EMAIL_ADDRESS = process.env.STUDY_BUDDY_EMAIL_ADDRESS; exports.DEBUG_USERNAME = "test-study-buddy-user"; exports.DEBUG_PASSWORD = "i_know_how_to_keep_passwords_safe_amirite?"; -exports.DEBUG_OPERATION_TIMEOUT_MS = 3000; +exports.DEBUG_OPERATION_TIMEOUT_MS = 3000; exports.PUBLIC_USER_USERNAME = "c13u"; exports.PUBLIC_USER_EMAIL = process.env.STUDY_BUDDY_DEFAULT_EMAIL_ADDRESS; diff --git a/package-lock.json b/package-lock.json index 7c6a9201..015bd719 100644 --- a/package-lock.json +++ b/package-lock.json @@ -178,6 +178,32 @@ "to-fast-properties": "^2.0.0" } }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@types/bson": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.5.tgz", @@ -436,6 +462,37 @@ "acorn": "^5.0.0" } }, + "acorn-node": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", + "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", + "dev": true, + "requires": { + "acorn": "^7.0.0", + "acorn-walk": "^7.0.0", + "xtend": "^4.0.2" + }, + "dependencies": { + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + } + } + }, + "acorn-walk": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", + "dev": true + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -2069,6 +2126,23 @@ "randombytes": "^2.0.0" } }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + }, + "dependencies": { + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + } + } + }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", @@ -2100,6 +2174,156 @@ "jake": "^10.8.5" } }, + "ejs-include-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ejs-include-regex/-/ejs-include-regex-1.0.0.tgz", + "integrity": "sha512-OTkvS8Dm8XhaE/+EKIjYjInRkNahQwkUUacAZXvA8Gqr5KEZrOsgFk8AkKYSnoTcdvKV0wnoG7YHWb4gkZFu8Q==", + "dev": true + }, + "ejs-lint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-2.0.0.tgz", + "integrity": "sha512-zt3E6MWLBYpWuUEOFRRqzB74gxCOZJAzoKmJR810U2mIrLnP1v6Xyk8tc6tl4pbT63cFoEqELPx9K8URjmpyZg==", + "dev": true, + "requires": { + "chalk": "^5.0.0", + "ejs": "3.1.8", + "ejs-include-regex": "^1.0.0", + "globby": "^13.0.0", + "read-input": "^0.3.1", + "slash": "^5.0.0", + "syntax-error": "^1.1.6", + "yargs": "^17.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.1.2.tgz", + "integrity": "sha512-E5CkT4jWURs1Vy5qGJye+XwCkNj7Od3Af7CP6SujMetSMkLs8Do2RWJK5yx1wamHV/op8Rz+9rltjaTQWDnEFQ==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "ejs": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", + "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", + "dev": true, + "requires": { + "jake": "^10.8.5" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "17.6.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.0.tgz", + "integrity": "sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.0.0" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + } + } + }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -2219,6 +2443,12 @@ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -2476,12 +2706,97 @@ } } }, + "fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -2775,6 +3090,27 @@ "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", "dev": true }, + "globby": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", + "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", + "dev": true, + "requires": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.11", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "dependencies": { + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + } + } + }, "graceful-fs": { "version": "4.1.15", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", @@ -2974,6 +3310,12 @@ "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", "dev": true }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, "ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -4008,6 +4350,12 @@ } } }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -5149,7 +5497,7 @@ "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "path-parse": { @@ -5322,6 +5670,12 @@ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", "dev": true }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "random-bytes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", @@ -5385,6 +5739,12 @@ } } }, + "read-input": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/read-input/-/read-input-0.3.1.tgz", + "integrity": "sha512-J1ZkWCnB4altU7RTe+62PSfa21FrEtfKyO9fuqR3yP8kZku3nIwaw2Krj383JC7egAIl5Zyz2w+EOu9uXH5HZw==", + "dev": true + }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -5558,7 +5918,7 @@ "resolve-cwd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha512-ccu8zQTrzVr954472aUVPLEcB3YpKSYR3cg/3lo1okzobPBM+1INXBbBZlDbnI/hbEocnf8j0QVo43hQKrbchg==", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", "dev": true, "requires": { "resolve-from": "^3.0.0" @@ -5605,6 +5965,12 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -5624,6 +5990,15 @@ "inherits": "^2.0.1" } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -5790,7 +6165,7 @@ "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { "shebang-regex": "^1.0.0" @@ -5799,7 +6174,7 @@ "shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "showdown": { @@ -5969,6 +6344,12 @@ "resolved": "https://registry.npmjs.org/sjcl/-/sjcl-1.0.7.tgz", "integrity": "sha1-MrNlpQ3Ju6JriLo8nfjqNCF9n0U=" }, + "slash": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.0.0.tgz", + "integrity": "sha512-n6KkmvKS0623igEVj3FF0OZs1gYYJ0o0Hj939yc1fyxl2xt+xYpLnzJB6xBSqOfV9ZFLEWodBBN/heZJahuIJQ==", + "dev": true + }, "sliced": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", @@ -6344,6 +6725,15 @@ "has-flag": "^3.0.0" } }, + "syntax-error": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", + "dev": true, + "requires": { + "acorn-node": "^1.2.0" + } + }, "taffydb": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", diff --git a/package.json b/package.json index cf425fc2..d27ef715 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "babel-loader": "^8.0.4", "circular-dependency-plugin": "^5.0.2", "clean-webpack-plugin": "^0.1.19", + "ejs-lint": "^2.0.0", "highlightjs": "^9.12.0", "jsdoc": "~3.6.11", "mathjax": "^2.7.5", diff --git a/server.js b/server.js index b6506999..acff49ec 100644 --- a/server.js +++ b/server.js @@ -39,7 +39,7 @@ app.use(session({ httpOnly: false, resave: false, name: "c13u-study-buddy", - store: MongoStore.create({ + store: config.IS_DEV ? session.MemoryStore() : MongoStore.create({ mongoUrl: config.MONGO_URI, touchAfter: 24 * 3600 }), @@ -62,7 +62,8 @@ app.use(function (err, req, res, next) { "pages/5xx_error_page.ejs", { response_JSON: {status: 500, message: "Internal Server Error"}, - APP_NAME: config.APP_NAME + APP_NAME: config.APP_NAME, + LOGGED_IN: false, } ); }); @@ -73,7 +74,8 @@ app.use(function (req, res, next) { "pages/4xx_error_page.ejs", { response_JSON: {status: 404, message: "Page Not Found"}, - APP_NAME: config.APP_NAME + APP_NAME: config.APP_NAME, + LOGGED_IN: false, } ); }); diff --git a/views/pages/4xx_error_page.ejs b/views/pages/4xx_error_page.ejs index 6bbb8751..e1814fc9 100644 --- a/views/pages/4xx_error_page.ejs +++ b/views/pages/4xx_error_page.ejs @@ -3,12 +3,12 @@ <%= APP_NAME %>: 4xx Page - <% include ../partials/header.ejs %> + <%- include('../partials/header.ejs'); %> - <% include ../partials/navbar.ejs %> + <%- include('../partials/navbar.ejs'); %>
@@ -17,7 +17,7 @@

<%= response_JSON.status %>


- +

<%= response_JSON.message %>

@@ -25,8 +25,8 @@ - <% include ../partials/footer.ejs %> + <%- include('../partials/footer.ejs'); %> - \ No newline at end of file + diff --git a/views/pages/5xx_error_page.ejs b/views/pages/5xx_error_page.ejs index 3336217b..d929ac76 100644 --- a/views/pages/5xx_error_page.ejs +++ b/views/pages/5xx_error_page.ejs @@ -3,17 +3,17 @@ <%= APP_NAME %>: 5xx Page - <% include ../partials/header.ejs %> + <%- include('../partials/header.ejs'); %> - <% include ../partials/navbar.ejs %> + <%- include('../partials/navbar.ejs'); %>
- +
- +

<%= response_JSON.status %>

@@ -23,12 +23,12 @@

- +
- <% include ../partials/footer.ejs %> + <%- include('../partials/footer.ejs'); %> - \ No newline at end of file + diff --git a/views/pages/account_page.ejs b/views/pages/account_page.ejs index 56fab110..49d91cb4 100644 --- a/views/pages/account_page.ejs +++ b/views/pages/account_page.ejs @@ -3,8 +3,8 @@ <%= APP_NAME %>: Account Page - <% include ../partials/header.ejs %> - <% include ../partials/syntax_highlighting_and_latex.ejs %> + <%- include('../partials/header.ejs'); %> + <%- include('../partials/syntax_highlighting_and_latex.ejs'); %> @@ -34,7 +34,7 @@ - <% include ../partials/navbar.ejs %> + <%- include('../partials/navbar.ejs'); %>
@@ -53,7 +53,7 @@

- + <% if (account_info.cardsAreByDefaultPrivate) { %> <% } else { %> @@ -61,14 +61,14 @@ <% } %> - +

- +

@@ -80,8 +80,8 @@

Restore/Delete Cards from Trash

- The trash only holds a card for 30 days, after which the - card will be permanently deleted. Use this option to either + The trash only holds a card for 30 days, after which the + card will be permanently deleted. Use this option to either delete cards permanently, or restore them to your active cards.

@@ -90,17 +90,17 @@ View Trashed Cards - +

- - <% include ../partials/trashed_card_template.ejs %> - + + <%- include('../partials/trashed_card_template.ejs'); %> +
- +
@@ -132,7 +132,7 @@

- +
@@ -140,7 +140,7 @@

Delete account

- Careful now. Once you delete your account, there is no going back. + Careful now. Once you delete your account, there is no going back. Please be sure. You might want to download your data first.

@@ -149,9 +149,9 @@ Delete Account - +

- +
@@ -159,7 +159,7 @@ - <% include ../partials/footer.ejs %> + <%- include('../partials/footer.ejs'); %> @@ -192,7 +192,7 @@ ); document.getElementById("trash_button_text").innerHTML = ` View ${Object.keys(state.trashed_cards).length} Trashed Cards`; - + }) .catch((err) => { console.error(err); }); } @@ -224,7 +224,7 @@ .then(() => { return cardsManager.next(); }) .then((card) => { renderTrashedCard(card); }) .catch((err) => { console.error(err); }); - + } } @@ -259,14 +259,14 @@ PrettifyCards.renderLatex(["card_title", "card_description"]); } - + } function modifyTrash(endpoint) { AppUtilities .sendHTTPRequest( - "POST", endpoint, - { + "POST", endpoint, + { cardID: state.current_card_id, createdById: state.metadata.createdById } @@ -288,9 +288,9 @@ function updateAccountSettings() { AppUtilities .sendForm("accountSettingsForm", "/account/update-settings") - .then((confirmation) => { + .then((confirmation) => { confirmation = JSON.parse(confirmation); - alert(confirmation.message); + alert(confirmation.message); }) .catch((err) => { console.error(err); }); @@ -298,4 +298,4 @@ } - \ No newline at end of file + diff --git a/views/pages/browse_cards_page.ejs b/views/pages/browse_cards_page.ejs index a602869b..0d51d180 100644 --- a/views/pages/browse_cards_page.ejs +++ b/views/pages/browse_cards_page.ejs @@ -1,23 +1,23 @@ - <% include ../partials/header.ejs %> + <%- include('../partials/header.ejs'); %> <%= APP_NAME %>: Browse/Search - <% include ../partials/syntax_highlighting_and_latex.ejs %> + <%- include('../partials/syntax_highlighting_and_latex.ejs'); %> - <% include ../partials/navbar.ejs %> + <%- include('../partials/navbar.ejs'); %>
- <% include ../partials/search_bar_dropdown.ejs %> + <%- include('../partials/search_bar_dropdown.ejs'); %>
@@ -27,7 +27,7 @@
- <% include ../partials/tags_bar_template.ejs %> + <%- include('../partials/tags_bar_template.ejs'); %>

@@ -49,10 +49,10 @@
- <% include ../partials/search_result_card_template.ejs %> + <%- include('../partials/search_result_card_template.ejs'); %>
- +
@@ -68,7 +68,7 @@ currentCardID: null, currentTagSelectionElement: document.getElementById("current_tag_selection"), searchResultsElement: document.getElementById("minicards_search_results") - }; + }; AppUtilities .sendHTTPRequest("POST", "/read-public-metadata", {}) @@ -92,7 +92,7 @@ cardTagsElement: document.getElementById("card_tags"), cardPopularityElement: document.getElementById("card_popularity") }; - + function handleSearchInputChange() { state.queryString = elementRefs.searchInputElement.value; } @@ -106,7 +106,7 @@ } else { currentTagsString = Array.from(TagsBarUtilities.getSelectedTags()).join(", "); payload = {cardIDs: Array.from(selectedIDs)}; - } + } AppUtilities .sendHTTPRequest("POST", "/browse", payload) @@ -140,11 +140,11 @@ [{ _id: cardID, urgency: Number.POSITIVE_INFINITY, tags: document.getElementById(`tags${cardID}`).innerText.split(", ") - }], + }], includeTagNeighbors=true ) .then(() => { return cardsManager.next(); }) - .then((card) => { + .then((card) => { // 2x so that the spoiler box can have positive dimensions renderCard(card); renderCard(card); elementRefs.cardContainerHolderElement.style.display = "block"; @@ -175,7 +175,7 @@ } return; } - + let flagObject = { cardID: state.currentCardID }; flagObject[reason] = true; AppUtilities @@ -198,8 +198,8 @@ } AppUtilities .sendHTTPRequest( - "POST", "/duplicate-card", - { + "POST", "/duplicate-card", + { cardID: state.currentCardID, newCardIsPrivate: USER_INFO.cardsAreByDefaultPrivate }) @@ -220,21 +220,21 @@ CardTemplateUtilities.displayPopUp("Out of cards!", 1500); return; } - + elementRefs.cardTitleElement.innerHTML = card.title; elementRefs.cardDescriptionElement.innerHTML = card.descriptionHTML; - + elementRefs.cardTagsElement.innerText = card.tags.trim().replace(/\s/g, ", "); elementRefs.cardPopularityElement.innerText = card.idsOfUsersWithCopy.split(", ").length; state.currentCardID = card._id; - + PrettifyCards.addSyntaxHighlighting(); PrettifyCards.renderLatex(["card_description"]); CardTemplateUtilities.syncSpoilerBox(); - + }; - \ No newline at end of file + diff --git a/views/pages/home.ejs b/views/pages/home.ejs index 9fc5f425..a7a2d3dd 100644 --- a/views/pages/home.ejs +++ b/views/pages/home.ejs @@ -3,8 +3,8 @@ <%= APP_NAME %>: Home - <% include ../partials/header.ejs %> - <% include ../partials/syntax_highlighting_and_latex.ejs %> + <%- include('../partials/header.ejs'); %> + <%- include('../partials/syntax_highlighting_and_latex.ejs'); %> @@ -16,19 +16,19 @@ background-image: linear-gradient(45deg, #ffc719 100%, #bf033b 0%); } - + - <% include ../partials/navbar.ejs %> + <%- include('../partials/navbar.ejs'); %>
- <% include ../partials/search_bar_dropdown.ejs %> + <%- include('../partials/search_bar_dropdown.ejs'); %>
@@ -38,29 +38,29 @@
- +
- +

The Tagging and Urgency System - The tags with the most urgent cards appear earlier on the list. - "#probability (7)" means that there are 7 cards that have 'probability' as one of their tags. + The tags with the most urgent cards appear earlier on the list. + "#probability (7)" means that there are 7 cards that have 'probability' as one of their tags. Read more

@@ -69,28 +69,28 @@
- <% include ../partials/tags_bar_template.ejs %> + <%- include('../partials/tags_bar_template.ejs'); %>
- +
- <% include ../partials/card_template.ejs %> + <%- include('../partials/card_template.ejs'); %>
- <% include ../partials/footer.ejs %> + <%- include('../partials/footer.ejs'); %> - \ No newline at end of file + diff --git a/views/pages/welcome_page.ejs b/views/pages/welcome_page.ejs index d9c17422..a2f30800 100644 --- a/views/pages/welcome_page.ejs +++ b/views/pages/welcome_page.ejs @@ -2,7 +2,7 @@ <%= APP_NAME %>: Login - <% include ../partials/header.ejs %> + <%- include('../partials/header.ejs'); %> @@ -15,34 +15,34 @@ - <% include ../partials/navbar.ejs %> + <%- include('../partials/navbar.ejs'); %>
- +
- + - +

- + - - +

- - - +

- @@ -55,33 +55,33 @@ -

- + - - +

- + - - +

- - - +

-
@@ -91,16 +91,16 @@
- - - <% include ../partials/footer.ejs %> + + + <%- include('../partials/footer.ejs'); %> - - \ No newline at end of file + + diff --git a/views/pages/wiki_page.ejs b/views/pages/wiki_page.ejs index d9553453..1eca2ffd 100644 --- a/views/pages/wiki_page.ejs +++ b/views/pages/wiki_page.ejs @@ -1,5 +1,5 @@ @@ -9,7 +9,7 @@ <%= APP_NAME %>: Wiki - <% include ../partials/syntax_highlighting_and_latex.ejs %> + <%- include('../partials/syntax_highlighting_and_latex.ejs'); %> - <% include ../partials/header.ejs %> + <%- include('../partials/header.ejs'); %>