diff --git a/index.js b/index.js index 40683c0..4ce25e7 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,17 @@ -const express = require('express') -const db = require('quick.db') -const flash = require('connect-flash') -const cookieParser = require('cookie-parser') -const bodyParser = require('body-parser') -const passport = require('passport') -const session = require('express-session') -const uuidv4 = require('uuid/v4') -const date = require('date-and-time') -const bcrypt = require('bcrypt') -const https = require('https') +const express = require('express'); +const db = require('quick.db'); +const flash = require('connect-flash'); +const cookieParser = require('cookie-parser'); +const bodyParser = require('body-parser'); +const passport = require('passport'); +const session = require('express-session'); +const uuidv4 = require('uuid/v4'); +const date = require('date-and-time'); +const bcrypt = require('bcrypt'); +const https = require('https'); +const http = require('http'); const fs = require('fs'); +const open = require('opn'); const app = express(); const markdown = require('markdown') const xss = require('xss') @@ -27,6 +29,9 @@ var discord = { "clientId": "645366454618816522", "clientSecret": "d2Hfn0cHpPPwoRKtpnuyM8amIxluwxF9" }, + scopes: [ + 'identify', + 'email' "bot": { "token": "NjQ1MzY2NDU0NjE4ODE2NTIy.XdBkSQ.xl9NqXwKhTtToT8uFd_G2zHTdSg" }, @@ -715,6 +720,11 @@ app.get('/api/v1/get-avatar/:userId', (req, res) => { } }); +// Serve +app.get('/cdn/serve/:path', (req, res) => { + res.sendFile(__dirname + '/public/' + req.params.path); +}) + app.get('/logout', (req, res) => { var user = getUser(req.cookies) if (!user) { @@ -901,6 +911,13 @@ app.post('/settings/submit-changes', (req, res) => { return }); +app.get('/components/notifications', (req, res) => { + var username = getUser(req.cookies); + var dark = users.get(`${username}.dark`); + + res.render('notifications', { user: username, dark: dark ? true : false }) +}) + app.post('/users/login', (req, res) => { var username = req.body.username; var password = req.body.password; @@ -964,16 +981,30 @@ app.use((req, res, next) => { }); // Start listener -const privateKey = fs.readFileSync('/etc/letsencrypt/live/sketchel.art/privkey.pem', 'utf8'); -const certificate = fs.readFileSync('/etc/letsencrypt/live/sketchel.art/cert.pem', 'utf8'); -const ca = fs.readFileSync('/etc/letsencrypt/live/sketchel.art/chain.pem', 'utf8'); - -const credentials = { - key: privateKey, - cert: certificate, - ca: ca -}; -const httpsServer = https.createServer(credentials, app); -httpsServer.listen(443, () => { - console.log('Server started listening on port 443!'); -}); \ No newline at end of file +if(!process.env.HTTPS) { + if(!fs.existsSync('/etc/letsencrypt/live/sketchel.art/privkey.pem')) { + return console.log("I recommend using `npm run dev` if you are running this locally.") + } + + const privateKey = fs.readFileSync('/etc/letsencrypt/live/sketchel.art/privkey.pem', 'utf8') + const certificate = fs.readFileSync('/etc/letsencrypt/live/sketchel.art/cert.pem', 'utf8') + const ca = fs.readFileSync('/etc/letsencrypt/live/sketchel.art/chain.pem', 'utf8') + + const credentials = { + key: privateKey, + cert: certificate, + ca: ca + } + const httpsServer = https.createServer(credentials, app) + httpsServer.listen(443, () => { + console.log('Server started listening on port 443!'); + open(`http://localhost:443`); + + }) +} else { + const httpServer = http.createServer(app) + httpServer.listen(80, () => { + console.log('Server started listening on port 80!') + open(`http://localhost:80`); + }) +} diff --git a/package-lock.json b/package-lock.json index 7f755e5..0330309 100644 --- a/package-lock.json +++ b/package-lock.json @@ -108,8 +108,7 @@ "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "accepts": { "version": "1.3.7", @@ -201,8 +200,7 @@ "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" }, "ansi-styles": { "version": "3.2.1", @@ -237,14 +235,12 @@ "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "dev": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -478,6 +474,15 @@ "safe-buffer": "5.1.2" } }, + "bcrypt": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-3.0.7.tgz", + "integrity": "sha512-K5UglF9VQvBMHl/1elNyyFvAfOY9Bj+rpKrCSR9sFwcW8FywAYJSRwTURNej5TaAK2TEJkcJ6r6lh1YPmspx5Q==", + "requires": { + "nan": "2.14.0", + "node-pre-gyp": "0.13.0" + } + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -607,6 +612,11 @@ "resolved": "https://registry.npmjs.org/bulma-divider/-/bulma-divider-0.2.0.tgz", "integrity": "sha512-REe3k56GECRfDaqFjC8cwLhV4RxXmV0RubuzDJqwior9wlJcdHlN0qfW0tvUX+qphikaTQegIeRuhjRIAqkjkw==" }, + "bulma-switch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bulma-switch/-/bulma-switch-2.0.0.tgz", + "integrity": "sha512-myD38zeUfjmdduq+pXabhJEe3x2hQP48l/OI+Y0fO3HdDynZUY/VJygucvEAJKRjr4HxD5DnEm4yx+oDOBXpAA==" + }, "bulma-tooltip": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/bulma-tooltip/-/bulma-tooltip-3.0.2.tgz", @@ -733,8 +743,7 @@ "chownr": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", - "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", - "dev": true + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==" }, "ci-info": { "version": "1.6.0", @@ -807,8 +816,7 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "collection-visit": { "version": "1.0.0", @@ -877,8 +885,7 @@ "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "constantinople": { "version": "3.1.2", @@ -954,8 +961,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "create-error-class": { "version": "3.0.2", @@ -966,6 +972,52 @@ "capture-stack-trace": "^1.0.0" } }, + "cross-env": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-6.0.3.tgz", + "integrity": "sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==", + "requires": { + "cross-spawn": "^7.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", + "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.0.tgz", + "integrity": "sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==" + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "which": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.1.tgz", + "integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -1044,8 +1096,7 @@ "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" }, "deep-is": { "version": "0.1.3", @@ -1140,8 +1191,7 @@ "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" }, "depd": { "version": "1.1.2", @@ -1155,6 +1205,11 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "dev": true }, + "detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + }, "diff": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", @@ -2097,7 +2152,6 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "dev": true, "requires": { "minipass": "^2.6.0" } @@ -2682,7 +2736,6 @@ "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dev": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -2697,14 +2750,12 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2713,7 +2764,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2724,7 +2774,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2914,8 +2963,7 @@ "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, "has-value": { "version": "1.0.0", @@ -3007,7 +3055,6 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -3024,6 +3071,14 @@ "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", "dev": true }, + "ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "requires": { + "minimatch": "^3.0.4" + } + }, "image-size": { "version": "0.7.5", "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz", @@ -3083,8 +3138,7 @@ "ini": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, "inquirer": { "version": "6.5.2", @@ -3260,8 +3314,7 @@ "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-glob": { "version": "4.0.1", @@ -3379,17 +3432,20 @@ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, "isobject": { "version": "3.0.1", @@ -3799,14 +3855,12 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minipass": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "dev": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3816,7 +3870,6 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", - "dev": true, "requires": { "minipass": "^2.9.0" } @@ -3846,7 +3899,6 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, "requires": { "minimist": "0.0.8" } @@ -3878,8 +3930,7 @@ "nan": { "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" }, "nanomatch": { "version": "1.2.13", @@ -3908,6 +3959,30 @@ } } }, + "needle": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz", + "integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==", + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3974,6 +4049,34 @@ } } }, + "node-pre-gyp": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.13.0.tgz", + "integrity": "sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==", + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + }, + "dependencies": { + "nopt": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + } + } + }, "node-sass": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz", @@ -4113,6 +4216,20 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "npm-bundled": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", + "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==" + }, + "npm-packlist": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.6.tgz", + "integrity": "sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg==", + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -4126,7 +4243,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dev": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -4137,8 +4253,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "oauth-sign": { "version": "0.9.0", @@ -4273,6 +4388,14 @@ "wrappy": "1" } }, + "opn": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/opn/-/opn-6.0.0.tgz", + "integrity": "sha512-I9PKfIZC+e4RXZ/qr1RhgyCnGgYX0UEIlXgWnCOVACIvFgaC9rz6Won7xbdhoHrd8IIhV7YEpHjreNUNkqCGkQ==", + "requires": { + "is-wsl": "^1.1.0" + } + }, "onetime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", @@ -4299,8 +4422,7 @@ "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" }, "os-locale": { "version": "1.4.0", @@ -4314,14 +4436,12 @@ "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "osenv": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dev": true, "requires": { "os-homedir": "^1.0.0", "os-tmpdir": "^1.0.0" @@ -4670,8 +4790,7 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "progress": { "version": "2.0.3", @@ -4891,7 +5010,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, "requires": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -4902,8 +5020,7 @@ "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } }, @@ -4938,7 +5055,6 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -5132,7 +5248,6 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -5164,8 +5279,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-regex": { "version": "1.1.0", @@ -5179,8 +5293,7 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sass-graph": { "version": "2.2.4", @@ -5269,6 +5382,11 @@ } } }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, "scss-tokenizer": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", @@ -5293,8 +5411,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" }, "semver-diff": { "version": "2.1.0", @@ -5357,8 +5474,7 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { "version": "2.0.1", @@ -5407,8 +5523,7 @@ "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "slice-ansi": { "version": "2.1.0", @@ -5700,7 +5815,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" @@ -5730,7 +5844,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -5739,7 +5852,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, "requires": { "ansi-regex": "^3.0.0" } @@ -5771,8 +5883,7 @@ "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "supports-color": { "version": "5.5.0", @@ -5827,7 +5938,6 @@ "version": "4.4.13", "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", - "dev": true, "requires": { "chownr": "^1.1.1", "fs-minipass": "^1.2.5", @@ -6193,8 +6303,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "utils-merge": { "version": "1.0.1", @@ -6274,7 +6383,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, "requires": { "string-width": "^1.0.2 || 2" } @@ -6406,8 +6514,7 @@ "yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "yargs": { "version": "3.10.0", diff --git a/package.json b/package.json index 7846667..82c4b5e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "A modern, community-driven, social drawing website.", "main": "server.js", "scripts": { - "start": "nodemon index.js", + "start": "npm run css-build && npm run dark-build && nodemon index.js", + "dev": "npm run css-build && npm run dark-build && cross-env HTTPS=false npm run start", "css-build": "node-sass --omit-source-map-url public/scss/style.scss public/css/style.css", "css-watch": "npm run css-build -- --watch", "dark-build": "node-sass --omit-source-map-url public/scss/dark.scss public/css/dark.css", @@ -40,14 +41,18 @@ "standard": "^14.3.1" }, "dependencies": { + "bcrypt": "^3.0.7", "@sentry/node": "^5.9.0", "base64-to-image": "^1.0.2", "bulma-checkradio": "^1.1.1", "bulma-divider": "^0.2.0", + "bulma-switch": "^2.0.0", "bulma-tooltip": "^3.0.2", "connect-flash": "^0.1.1", + "cross-env": "^6.0.3", "datauri": "^2.0.0", "express-session": "^1.17.0", + "opn": "^6.0.0", "passport": "^0.4.0", "pug": "^2.0.4", "session": "^0.1.0", diff --git a/public/js/app.js b/public/js/app.js new file mode 100644 index 0000000..c61ea76 --- /dev/null +++ b/public/js/app.js @@ -0,0 +1,26 @@ +const sketchelapp = { + panels: { + notifications: { + visible: false, + open() { + if(this.visible == false) { + this.visible = true; + document.getElementById("notification-panel").style.opacity = 1; + document.getElementById("notification-panel").style.marginTop = '0px'; + document.getElementById("notification-panel").style.pointerEvents = 'all'; + } else { + this.visible = false; + document.getElementById("notification-panel").style.opacity = 0; + document.getElementById("notification-panel").style.marginTop = '5px'; + document.getElementById("notification-panel").style.pointerEvents = 'none'; + } + }, + close() { + this.visible = false; + document.getElementById("notification-panel").style.opacity = 0; + document.getElementById("notification-panel").style.marginTop = '5px'; + document.getElementById("notification-panel").style.pointerEvents = 'none'; + } + } + } +}; \ No newline at end of file diff --git a/public/scss/dark.scss b/public/scss/dark.scss index 3dc163f..4513a83 100644 --- a/public/scss/dark.scss +++ b/public/scss/dark.scss @@ -62,4 +62,42 @@ $input-icon-color: $white-bis; @import '../../node_modules/bulma-checkradio/dist/css/bulma-checkradio.sass'; @import '../../node_modules/bulma-divider/dist/css/bulma-divider.sass'; -@import '../../node_modules/bulma-switch/dist/css/bulma-switch.sass'; \ No newline at end of file +@import '../../node_modules/bulma-switch/dist/css/bulma-switch.sass'; + +// Classes +body { + font-size: 18px; +} + +panel { + position: absolute; + top: 45px; + left: 525px; + opacity: 0; + pointer-events: none; + background-color: white; + z-index: 999; + width: 460px; + height: 600px; + transform: scale(0.9); + border-radius: 10px; + box-shadow: 2px 1px 8px 1px #00000047; + padding: 25px 0; + margin-top: 5px; + transition: 0.1s opacity, 0.2s margin-top; +} + +.navbar-dropdown a.navbar-item:hover, .navbar-dropdown a.navbar-item { + background-color: transparent !important; + color: black !important; +} + +.navbar-link:hover { + color: black !important; +} + +.navbar-dropdown:hover { + .navbar-link { + color: black !important; + } +} diff --git a/public/scss/style.scss b/public/scss/style.scss index a58b330..9cffa1b 100644 --- a/public/scss/style.scss +++ b/public/scss/style.scss @@ -54,4 +54,42 @@ $has-text-black: $black-bis; @import '../../node_modules/bulma-checkradio/dist/css/bulma-checkradio.sass'; @import '../../node_modules/bulma-divider/dist/css/bulma-divider.sass'; -@import '../../node_modules/bulma-switch/dist/css/bulma-switch.sass'; \ No newline at end of file +@import '../../node_modules/bulma-switch/dist/css/bulma-switch.sass'; + +// Classes +body { + font-size: 18px; +} + +panel { + position: absolute; + top: 45px; + left: 525px; + opacity: 0; + pointer-events: none; + background-color: white; + z-index: 999; + width: 460px; + height: 600px; + transform: scale(0.9); + border-radius: 10px; + box-shadow: 2px 1px 8px 1px #00000047; + padding: 25px 0; + margin-top: 5px; + transition: 0.1s opacity, 0.2s margin-top; +} + +.navbar-dropdown a.navbar-item:hover, .navbar-dropdown a.navbar-item { + background-color: transparent !important; + color: black !important; +} + +.navbar-link:hover { + color: black !important; +} + +.navbar-dropdown:hover { + .navbar-link { + color: black !important; + } +} \ No newline at end of file diff --git a/views/404.pug b/views/404.pug index 43443bf..ffd5ea3 100644 --- a/views/404.pug +++ b/views/404.pug @@ -2,13 +2,13 @@ doctype html html include includes/head.pug body - if authorized - include includes/navbar-2.pug - if !authorized - include includes/navbar-1.pug - section.hero.is-medium.is-primary.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title 404, h2.subtitle The page you were looking for was not found, how sad. @@ -17,4 +17,8 @@ html a(href="/") button.button.is-primary.is-rounded Try going home. - include includes/footer + footer.footer.has-text-centered + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} diff --git a/views/home.pug b/views/home.pug index 4f6d0b8..62c2bf3 100644 --- a/views/home.pug +++ b/views/home.pug @@ -1,41 +1,43 @@ doctype html html include includes/head.pug - body - if authorized - include includes/navbar-2 - if !authorized - include includes/navbar-1 - + body section.hero.is-medium.is-primary.is-bold - div.container.is-fluid - div.hero-body + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 + div.hero-body.has-text-centered if authorized - h1.title.is-2 Welcome back, #{username} + h1.title.is-2 + h1.title Welcome back, #{username} h2.subtitle We've missed you. if !authorized - h1.title.is-1 Sketchel + h1.title.is-2 + h1.title Sketchel h2.subtitle The newest platform to upload drawings/animations. if !authorized - div.field - p.control - a(href="/signup") - button.button.is-link.is-rounded Register for Sketchel here. - - a(href="/login") - button.button.is-primary.is-rounded Or, you can login here. + div.field.has-text-centered + p.control.has-text-centered + a.button.is-light.is-rounded.is-outlined(href="/signup") Register for Sketchel here. + span    + a.button.is-light.is-rounded.is-outlined(href="/login") Or, you can login here. if authorized - div.field - p.control - a(href="/hot") - button.button.is-primary.is-rounded See the most popular posts. - - a(href="/feed") - button.button.is-primary.is-rounded See your feed. - + div.field.has-text-centered + p.control.has-text-centered + a.button.is-light.is-rounded.is-outlined(href="/hot") What's hot? + span    + a.button.is-light.is-rounded.is-outlined(href="/feed") Feed + + footer.footer.has-text-centered + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} + - - - include includes/footer.pug + \ No newline at end of file diff --git a/views/includes/head.pug b/views/includes/head.pug index 0a82835..b7e644a 100644 --- a/views/includes/head.pug +++ b/views/includes/head.pug @@ -23,10 +23,12 @@ head link(rel='stylesheet', type="text/css", href='/css/dark.css') link(rel='stylesheet', href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css") script(src="https://kit.fontawesome.com/9558a49d61.js", crossorigin="anonymous") + script(src="/js/app.js") link(rel="apple-touch-icon", sizes="180x180", href="/assets/apple-touch-icon.png") link(rel="icon", type="image/png", sizes="32x32", href="/assets/favicon-32x32.png") link(rel="icon", type="image/png", sizes="16x16", href="/assets/favicon-16x16.png") link(rel="shortcut icon", type="image/png", href="/assets/sketchel.png") link(href="https://emoji-css.afeld.me/emoji.css", rel="stylesheet") - \ No newline at end of file + +include notif-panel \ No newline at end of file diff --git a/views/includes/navbar-1.pug b/views/includes/navbar-1.pug index ca64f13..677a3f1 100644 --- a/views/includes/navbar-1.pug +++ b/views/includes/navbar-1.pug @@ -1,6 +1,6 @@ script(src="/js/navbar.js", crossorigin="anonymous") nav.navbar.is-spaced(role="navigation", aria-label="main navigation") - div.navbar-brand + a.navbar-brand(href="/") figure(class="image is-48x48") img(class="image is-48x48", src="/assets/sketchel-small.png") a.navbar-burger(role="button", data-target="navbar", aria-label="menu", aria-expanded="false") @@ -9,12 +9,11 @@ nav.navbar.is-spaced(role="navigation", aria-label="main navigation") span(aria-hidden="true") div.navbar-menu.is-active(id="navbar") div.navbar-start - a.navbar-item(href="/")  Home a.navbar-item(href="https://discord.gg/sG7KSbW")  Discord a.navbar-item(href="/welcome")  Features div.navbar-end - a.navbar-item + a.navbar-button(style="margin-right: 6px") div.field p.control.has-icons-left input.input.is-rounded(type="text", placeholder="Search") diff --git a/views/includes/navbar-2.pug b/views/includes/navbar-2.pug index 661b354..0fafc6d 100644 --- a/views/includes/navbar-2.pug +++ b/views/includes/navbar-2.pug @@ -1,6 +1,6 @@ script(src="/js/navbar.js", crossorigin="anonymous") nav.navbar.is-spaced(role="navigation", aria-label="main navigation") - div.navbar-brand + a.navbar-brand(href="/") figure(class="image is-48x48") img(class="image is-48x48", src="/assets/sketchel-small.png") a.navbar-burger(role="button", data-target="navbar", aria-label="menu", aria-expanded="false") @@ -9,21 +9,19 @@ nav.navbar.is-spaced(role="navigation", aria-label="main navigation") span(aria-hidden="true") div.navbar-menu(id="navbar") div.navbar-start - a.navbar-item(href="/")  Home a.navbar-item(href="/feed")  Feed - a.navbar-item(href="/hot")  Popular + a.navbar-item(href="/hot")  Hot div.navbar-end - - a.navbar-item + a.navbar-button(style="margin-right: 6px") div.field p.control.has-icons-left input.input.is-rounded(type="text", placeholder="Search") span.icon.is-small.is-left i.fas.fa-search - a.navbar-item(href="/notifications")  Notifications - a.navbar-item(href="/create")  Create + a.navbar-item(onclick="sketchelapp.panels.notifications.open()") + a.navbar-item(href="/create") div.navbar-item.has-dropdown.is-hoverable a.navbar-link #{username} diff --git a/views/includes/notif-panel.pug b/views/includes/notif-panel.pug new file mode 100644 index 0000000..93b4791 --- /dev/null +++ b/views/includes/notif-panel.pug @@ -0,0 +1,7 @@ +panel(id="notification-panel") + script. + fetch('/components/notifications') + .then(async function(response) { + document.getElementById("notification-panel").innerHTML = await response.text() + } + ) \ No newline at end of file diff --git a/views/login.pug b/views/login.pug index 7266d44..d008cdc 100644 --- a/views/login.pug +++ b/views/login.pug @@ -12,25 +12,25 @@ html .gcode { display: none; } - if authorized - include includes/navbar-2.pug - if !authorized - include includes/navbar-1.pug - section.hero.is-primary.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title Login to Sketchel h2.subtitle If you don't have an account, look a lil bit down. br if error_messages != "" - div.container.is-fluid + div.container div.notification.is-danger p Error: #{error_messages} br - div.container.is-fluid + div.container div(align="center") div(class="container") div.container @@ -55,4 +55,8 @@ html br - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered(style="background-color: white") + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} diff --git a/views/not-logged-in.pug b/views/not-logged-in.pug index 3321ea3..d0856e8 100644 --- a/views/not-logged-in.pug +++ b/views/not-logged-in.pug @@ -2,12 +2,14 @@ doctype html html include includes/head.pug body - if !authorized - include includes/navbar-1.pug - if !authorized section.hero.is-large.is-danger.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title You need to be logged in to use this page. h2.subtitle You're trying to visit a page you need to be logged into to use. @@ -19,4 +21,8 @@ html a(href="/login") button.button.is-primary.is-rounded Or, you can login here. - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} diff --git a/views/notifications.pug b/views/notifications.pug new file mode 100644 index 0000000..29f9d95 --- /dev/null +++ b/views/notifications.pug @@ -0,0 +1,19 @@ +include includes/head + +section.hero.has-text-centered + .card-header.has-text-centered(style='\ + box-shadow: none;\ + ') + .container + h1.title.has-text-right(style='\ + position: absolute;\ + right: 25px;\ + top: -2px;\ + opacity: 0.8;\ + ') + a(onclick='sketchelapp.panels.notifications.close()', style="filter: grayscale(1)") + i.fas.fa-times(aria-hidden='true', style="font-size: 23px;") + + h1.title.has-text-centered Notifications + .card-content + h2.subtitle Nothing yet! \ No newline at end of file diff --git a/views/profile.pug b/views/profile.pug index 4bb0676..37f3677 100644 --- a/views/profile.pug +++ b/views/profile.pug @@ -2,14 +2,14 @@ doctype html html include includes/head.pug body - if authorized - include includes/navbar-2 - if !authorized - include includes/navbar-1 - if !authorized section.hero.is-medium.is-danger.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title You need to be logged in to use this page. h2.subtitle You're trying to visit a page you need to be logged into to use. @@ -88,9 +88,14 @@ html - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.columns.is-multiline - .column.is-one-quarter + .column.is-two-fifths div.card div.card-image figure.image.is-4by3 @@ -99,7 +104,7 @@ html .media .media-left figure.image.is-64x64 - img(src=avatar) + img(src=avatar, style="border-radius: 50px;box-shadow: 0 0 2px black;") .media-content p.title.is-4 #{username} p.subtitle.is-6 Joined at #{joindate} @@ -152,4 +157,8 @@ html br - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered(style="background-color: white") + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} diff --git a/views/rules.pug b/views/rules.pug index 81cef99..27991bb 100644 --- a/views/rules.pug +++ b/views/rules.pug @@ -2,25 +2,33 @@ doctype html html include includes/head.pug body - if authorized - include includes/navbar-2.pug - if !authorized - include includes/navbar-1.pug section.hero.is-primary.is-bold - div.hero-body - div.container.is-fluid - h1.title Rules for Sketchel - h2.subtitle Guidelines on what not to do. - div.field - p.control - a(href="/signup") - button.button.is-primary.is-rounded Register for Sketchel here. + div.container + div.hero-head + if !authorized + include includes/navbar-1.pug + if authorized + include includes/navbar-2.pug + div.hero-body + div.container + h1.title Rules for Sketchel + h2.subtitle Guidelines on what not to do. + div.columns.is-multiline + div.column.is-one-third + div.box + article(class="notification has-background-white media") + figure(class="media-left") + a(href="/") + span(class="icon") + i(class="animated pulse fas fa-home fa-2x") + div(class="media-content") + a.button.is-white(href="/") Wanna go home? br div.container div.box - div.container.is-fluid + div.container h1.title.is-size-3 Rule #1 h2.subtitle You must be at least 13 years of age or older to use this site. br @@ -49,4 +57,8 @@ html h2.subtitle These rules are regularly enforced and the breaking of them is punished harshly. If required, authorities may be informed in some cases. Be wary. br - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} \ No newline at end of file diff --git a/views/settings.pug b/views/settings.pug index 2bfc536..6a66c58 100644 --- a/views/settings.pug +++ b/views/settings.pug @@ -3,14 +3,14 @@ html include includes/head.pug body - if authorized - include includes/navbar-2.pug - if !authorized - include includes/navbar-1.pug - if !authorized section.hero.is-large.is-danger.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title You need to be logged in to use this page. h2.subtitle This is the settings page, you need an account to use this after all. @@ -23,7 +23,12 @@ html button.button.is-danger.is-rounded Or, you can login here. if authorized section.hero.is-primary.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title #{username}'s Settings h2.subtitle P.S. That's you! @@ -32,17 +37,17 @@ html a(href="/profile/" + username) button.button.is-primary.is-rounded There's an escape hatch here. br - div.container.is-fluid - div.container.is-fluid + div.container + div.container form(method="POST", action="/settings/submit-changes") section.has-text-centered br if error_messages != "" - div.container.is-fluid + div.container div.notification.is-danger p Error: #{error_messages} if success_messages != "" - div.container.is-fluid + div.container div.notification.is-success p Success: #{success_messages} br @@ -71,5 +76,8 @@ html input(class="button is-success is-medium is-rounded", type="submit", value="Save Changes") br - - include includes/footer.pug + footer.footer.has-text-centered + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} diff --git a/views/signup.pug b/views/signup.pug index 5e30010..2051867 100644 --- a/views/signup.pug +++ b/views/signup.pug @@ -8,13 +8,13 @@ html function submitForm(response) { document.getElementById("loginForm").submit(); } - if authorized - include includes/navbar-2.pug - if !authorized - include includes/navbar-1.pug - section.hero.is-primary.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title Signup to Sketchel h2.subtitle If you have an account, look a lil bit down. @@ -22,13 +22,13 @@ html br if error_messages != "" - div.container.is-fluid + div.container div.notification.is-danger p Error: #{error_messages} br - div.container.is-fluid + div.container div(align="center") div(class="container") div.container @@ -56,8 +56,13 @@ html br div(align="center") - h2.subtitle Have an account already? Login here. + h2.subtitle Have an account already? Login here. br - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered(style="background-color: white") + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} + diff --git a/views/terms.pug b/views/terms.pug index 1d36b56..6a6ebd6 100644 --- a/views/terms.pug +++ b/views/terms.pug @@ -2,22 +2,23 @@ doctype html html include includes/head.pug body - if authorized - include includes/navbar-2.pug - if !authorized - include includes/navbar-1.pug - section.hero.is-primary.is-bold - div.hero-body - h1.title Here are the terms of service for Sketchel - h2.subtitle Basically, what that means is that you agree to this while using the site. - br - a.button.is-white(href="/") Wanna go home? + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 + div.hero-body + h1.title Here are the terms of service for Sketchel + h2.subtitle Basically, what that means is that you agree to this while using the site. + br + a.button.is-white(href="/") Wanna go home? br div.container div.box - div.container.is-fluid + div.container p Unfortunately, no one at Sketchel is a lawyer, so no one knows how to make a terms of a service, however, let's make one that's clear and easy to use. hr p By using Sketchel, you agree to the rules and the privacy policy. @@ -26,4 +27,8 @@ html hr p Have fun. br - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} diff --git a/views/user-profile.pug b/views/user-profile.pug index 53909ac..3df9aa6 100644 --- a/views/user-profile.pug +++ b/views/user-profile.pug @@ -2,14 +2,14 @@ doctype html html include includes/head.pug body - if authorized - include includes/navbar-2 - if !authorized - include includes/navbar-1 - if !authorized section.hero.is-medium.is-danger.is-bold - div.container.is-fluid + div.container + div.hero-head + if authorized + include includes/navbar-2 + if !authorized + include includes/navbar-1 div.hero-body h1.title You need to be logged in to use this page. h2.subtitle You're trying to visit a page you need to be logged into to use. @@ -69,7 +69,7 @@ html p.title.is-4 #{val} - div.container.is-fluid + div.container div.columns.is-multiline .column.is-one-quarter div.card @@ -80,7 +80,7 @@ html .media .media-left figure.image.is-64x64 - img(src=avatar) + img(src=avatar, style="border-radius: 50px;box-shadow: 0 0 2px black;")) .media-content if rank = "owner" p.title.is-4 #{user} @@ -140,4 +140,9 @@ html br - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote} + diff --git a/views/welcome.pug b/views/welcome.pug index c5475dc..388944b 100644 --- a/views/welcome.pug +++ b/views/welcome.pug @@ -2,66 +2,74 @@ doctype html html include includes/head.pug body - if authorized - include includes/navbar-2.pug - if !authorized - include includes/navbar-1.pug section.hero.is-primary.is-bold - div.hero-body - div.container.is-fluid - h1.title Welcome to Sketchel! - h2.subtitle Here's what we got to offer! - a.button.is-white(href="/") Wanna go home? + .container + .hero-head + if authorized + include includes/navbar-2.pug + if !authorized + include includes/navbar-1.pug + div.hero-body + div.container + h1.title Welcome to Sketchel! + h2.subtitle Here's what we got to offer! + div.field + p.control + a(href="/") + button.button.is-primary.is-rounded Wanna go home? br - div.container.is-fluid - div.box - section.section.has-text-centered - div.container.is-fluid - div(class="columns is-multiline") - div(class="column is-one-third") - article(class="notification has-background-white media") - figure(class="media-left") - span(class="icon has-text-danger") - i(class="fas fa-gavel fa-2x") - div(class="media-content") - h1.title.is-size-5 Moderation - p.subtitle.is-size-5 Keep bad users out of your posts using easy to use advanced moderation tools. - div(class="column is-one-third") - article(class="notification has-background-white media") - figure(class="media-left") - span(class="icon has-text-info") - i(class="has-text-info fas fa-cog fa-2x") - div(class="media-content") - h1.title.is-size-5 Advanced Development - p.subtitle.is-size-5 Sketchel uses modern libraries/resources such as Express and Pug to make sure the website looks sleek and modern. - div(class="column is-one-third") - article(class="notification has-background-white media") - figure(class="media-left") - span(class="icon has-text-primary") - i(class="has-text-primary fab fa-discord fa-2x") - div(class="media-content") - h1.title.is-size-5 Discord Support - p.subtitle.is-size-5 Have you heard? Sketchel will have discord support, this will include rank-sync in the server and having discord in your profile card, many more features will be disclosed later. - div(class="column is-one-third") - article(class="notification has-background-white media") - figure(class="media-left") - span(class="icon has-text-warning") - i(class="has-text-warning fas fa-paint-brush fa-2x") - div(class="media-content") - h1.title.is-size-5 Advanced Canvas - p.subtitle.is-size-5 Sketchel will have a modern canvas using the best resources that will save for you to continue your work later, being the most useful to you. - div(class="column is-one-third") - article(class="notification has-background-white media") - figure(class="media-left") - span(class="icon has-text-success") - i(class="has-text-success fas fa-gavel fa-2x") - div(class="media-content") - h1.title.is-size-5 Moderation v2 - p.subtitle.is-size-5 If the moderation fails, you may report your issue to the moderation team. + div.container + section.section.has-text-centered + div.container + div(class="columns is-multiline") + div(class="column is-one-third") + article(class="notification has-background-white media") + figure(class="media-left") + span(class="icon has-text-danger") + i(class="fas fa-gavel fa-2x") + div(class="media-content") + h1.title.is-size-5 Moderation + p.subtitle.is-size-5 Keep bad users out of your posts using easy to use advanced moderation tools. + div(class="column is-one-third") + article(class="notification has-background-white media") + figure(class="media-left") + span(class="icon has-text-info") + i(class="has-text-info fas fa-cog fa-2x") + div(class="media-content") + h1.title.is-size-5 Advanced Development + p.subtitle.is-size-5 Sketchel uses modern libraries/resources such as Express and Pug to make sure the website looks sleek and modern. + div(class="column is-one-third") + article(class="notification has-background-white media") + figure(class="media-left") + span(class="icon has-text-primary") + i(class="has-text-primary fab fa-discord fa-2x") + div(class="media-content") + h1.title.is-size-5 Discord Support + p.subtitle.is-size-5 Have you heard? Sketchel will have discord support, this will include rank-sync in the server and having discord in your profile card, many more features will be disclosed later. + div(class="column is-one-third") + article(class="notification has-background-white media") + figure(class="media-left") + span(class="icon has-text-warning") + i(class="has-text-warning fas fa-paint-brush fa-2x") + div(class="media-content") + h1.title.is-size-5 Advanced Canvas + p.subtitle.is-size-5 Sketchel will have a modern canvas using the best resources that will save for you to continue your work later, being the most useful to you. + div(class="column is-one-third") + article(class="notification has-background-white media") + figure(class="media-left") + span(class="icon has-text-success") + i(class="has-text-success fas fa-gavel fa-2x") + div(class="media-content") + h1.title.is-size-5 Moderation v2 + p.subtitle.is-size-5 If the moderation fails, you may report your issue to the moderation team. br - include includes/footer.pug \ No newline at end of file + footer.footer.has-text-centered(style="background-color: white") + div.container + p Sketchel © 2019, made with Bulma, Express and Pug & more libraries, and also . + p Rules | Terms of Service | Credits + p Quote: #{quote}