mirror of
https://github.com/kaythomas0/noisedash.git
synced 2025-11-12 03:16:20 +00:00
Update routes and db
This commit is contained in:
@@ -43,7 +43,7 @@ app.use(passport.authenticate('session'))
|
|||||||
|
|
||||||
// Define routes
|
// Define routes
|
||||||
app.use('/', authRouter)
|
app.use('/', authRouter)
|
||||||
app.use('/users', usersRouter)
|
app.use('/', usersRouter)
|
||||||
app.use('/profiles', profilesRouter)
|
app.use('/', profilesRouter)
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|||||||
@@ -11,19 +11,20 @@ module.exports = function () {
|
|||||||
)
|
)
|
||||||
|
|
||||||
db.run(`CREATE TABLE IF NOT EXISTS profiles (
|
db.run(`CREATE TABLE IF NOT EXISTS profiles (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
name TEXT UNIQUE,
|
name TEXT UNIQUE,
|
||||||
user INTEGER,
|
user INTEGER,
|
||||||
timer_enabled INTEGER,
|
timer_enabled INTEGER,
|
||||||
timer_seconds INTEGER,
|
duration INTEGER,
|
||||||
volume INTEGER,
|
volume INTEGER,
|
||||||
noise_color TEXT,
|
noise_color TEXT,
|
||||||
filter_enabled INTEGER,
|
filter_enabled INTEGER,
|
||||||
filter_type TEXT,
|
filter_type TEXT,
|
||||||
filter_cutoff INTEGER,
|
filter_cutoff INTEGER,
|
||||||
filter_cutoff_lfo_enabled INTEGER,
|
lfo_filter_cutoff_enabled INTEGER,
|
||||||
filter_cutoff_lfo_rate REAL,
|
lfo_filter_cutoff_frequency REAL,
|
||||||
filter_cutoff_lfo_min INTEGER,
|
lfo_filter_cutoff_low INTEGER,
|
||||||
filter_cutoff_lfo_max INTEGER,
|
lfo_filter_cutoff_high INTEGER,
|
||||||
tremolo_enabled INTEGER,
|
tremolo_enabled INTEGER,
|
||||||
tremolo_frequency REAL,
|
tremolo_frequency REAL,
|
||||||
tremolo_depth REAL,
|
tremolo_depth REAL,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const db = require('../db')
|
|||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
router.post('/', function (req, res, next) {
|
router.post('/profiles', function (req, res, next) {
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.sendStatus(401)
|
return res.sendStatus(401)
|
||||||
}
|
}
|
||||||
@@ -47,6 +47,7 @@ router.post('/', function (req, res, next) {
|
|||||||
],
|
],
|
||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.log(err)
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ router.post('/', function (req, res, next) {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
router.get('/', function (req, res, next) {
|
router.get('/profiles', function (req, res, next) {
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.sendStatus(401)
|
return res.sendStatus(401)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const db = require('../db')
|
|||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
router.post('/', function (req, res, next) {
|
router.post('/users', function (req, res, next) {
|
||||||
const salt = crypto.randomBytes(16)
|
const salt = crypto.randomBytes(16)
|
||||||
crypto.pbkdf2(req.body.password, salt, 10000, 32, 'sha256', function (err, hashedPassword) {
|
crypto.pbkdf2(req.body.password, salt, 10000, 32, 'sha256', function (err, hashedPassword) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user