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