Compare commits

...

10 Commits

Author SHA1 Message Date
Kay Thomas
231dea143a Merge pull request #21 from kaythomas0/v0.5.1
v0.5.1
2022-07-12 17:33:40 -07:00
Kevin Thomas
659d48548d Upgrade passport to 0.6.0 2022-07-12 16:34:42 -07:00
Kay Thomas
7dc4524fa0 Merge pull request #20 from kaythomas0/v0.5.0
v0.5.0
2022-07-05 17:26:25 -07:00
Kay Thomas
9b2bdaf159 Fix accent color picker 2022-07-05 15:32:43 -07:00
Kay Thomas
d3cc1db2f9 Update github workflow 2022-07-05 15:18:20 -07:00
Kay Thomas
34215b4126 Upgrade package version 2022-07-04 22:53:59 -07:00
Kay Thomas
5fc23030d4 Upgrade multer 2022-07-04 22:36:39 -07:00
Kay Thomas
4fc23521c1 Update README.md 2022-06-01 12:27:41 -07:00
Kevin Thomas
cb3e39729a Update screenshot 2022-06-01 12:22:14 -07:00
Kay Thomas
5219f53655 Add accent color picker 2022-05-28 00:50:44 -07:00
14 changed files with 163 additions and 103 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -1,11 +1,15 @@
name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
types:
- labeled
branches:
- 'main'
jobs:
buildx:
if: ${{ github.event.label.name == 'run-workflow' }}
runs-on: ubuntu-latest
steps:
-
@@ -31,4 +35,4 @@ jobs:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: noisedash/noisedash:latest,noisedash/noisedash:${{ github.ref_name }}
tags: noisedash/noisedash:latest,noisedash/noisedash:${{ github.head_ref }}

View File

@@ -2,7 +2,7 @@
Self-hostable web tool for generating ambient noises
![Noisedash](./.github/noisedash-screenshot-1.jpg)
![Noisedash](https://raw.githubusercontent.com/kaythomas0/noisedash/dev/.github/noisedash-screenshot-1.jpg)
(More screenshots on the [wiki](https://github.com/kaythomas0/noisedash/wiki/Screenshots))

140
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "noisedash",
"version": "0.4.0",
"version": "0.5.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -3975,9 +3975,9 @@
}
},
"@vue/vue-loader-v15": {
"version": "npm:vue-loader@15.9.8",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.8.tgz",
"integrity": "sha512-GwSkxPrihfLR69/dSV3+5CdMQ0D+jXg8Ma1S4nQXKJAznYFX14vHdc/NetQc34Dw+rBbIJyP7JOuVb9Fhprvog==",
"version": "npm:vue-loader@15.10.0",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.10.0.tgz",
"integrity": "sha512-VU6tuO8eKajrFeBzMssFUP9SvakEeeSi1BxdTH5o3+1yUyrldp8IERkSdXlMI2t4kxF2sqYUDsQY+WJBxzBmZg==",
"dev": true,
"requires": {
"@vue/component-compiler-utils": "^3.1.0",
@@ -3990,7 +3990,7 @@
"hash-sum": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz",
"integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=",
"integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
"dev": true
},
"json5": {
@@ -4701,12 +4701,11 @@
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
},
"busboy": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz",
"integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
"integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
"requires": {
"dicer": "0.2.5",
"readable-stream": "1.1.x"
"streamsearch": "^1.1.0"
}
},
"bytes": {
@@ -5113,40 +5112,6 @@
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
},
"dependencies": {
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"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=="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"config": {
@@ -5885,15 +5850,6 @@
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
"dev": true
},
"dicer": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz",
"integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=",
"requires": {
"readable-stream": "1.1.x",
"streamsearch": "0.1.2"
}
},
"dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -8013,9 +7969,9 @@
}
},
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"isexe": {
"version": "2.0.0",
@@ -8700,16 +8656,15 @@
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"multer": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.4.tgz",
"integrity": "sha512-2wY2+xD4udX612aMqMcB8Ws2Voq6NIUPEtD1be6m411T4uDH/VtL9i//xvcyFlTVfRdaBsk7hV5tgrGQqhuBiw==",
"version": "1.4.5-lts.1",
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz",
"integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==",
"requires": {
"append-field": "^1.0.0",
"busboy": "^0.2.11",
"busboy": "^1.0.0",
"concat-stream": "^1.5.2",
"mkdirp": "^0.5.4",
"object-assign": "^4.1.1",
"on-finished": "^2.3.0",
"type-is": "^1.6.4",
"xtend": "^4.0.0"
}
@@ -8924,14 +8879,6 @@
"integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
"dev": true
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"on-headers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
@@ -9222,12 +9169,13 @@
}
},
"passport": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.4.1.tgz",
"integrity": "sha512-IxXgZZs8d7uFSt3eqNjM9NQ3g3uQCW5avD8mRNoXV99Yig50vjuaez6dQK2qC0kVWPRTujxY0dWgGfT09adjYg==",
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz",
"integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==",
"requires": {
"passport-strategy": "1.x.x",
"pause": "0.0.1"
"pause": "0.0.1",
"utils-merge": "^1.0.1"
}
},
"passport-local": {
@@ -9290,7 +9238,7 @@
"pause": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
"integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10="
"integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg=="
},
"picocolors": {
"version": "1.0.0",
@@ -9896,14 +9844,24 @@
}
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
},
"dependencies": {
"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=="
}
}
},
"readdirp": {
@@ -10639,9 +10597,9 @@
"dev": true
},
"streamsearch": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
"integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo="
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="
},
"string-width": {
"version": "4.2.3",
@@ -10675,9 +10633,19 @@
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
},
"dependencies": {
"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=="
}
}
},
"strip-ansi": {
"version": "6.0.1",

View File

@@ -1,6 +1,6 @@
{
"name": "noisedash",
"version": "0.4.0",
"version": "0.5.0",
"private": true,
"author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)",
"scripts": {
@@ -19,8 +19,8 @@
"core-js": "^3.22.7",
"express": "^4.18.1",
"express-session": "^1.17.3",
"multer": "^1.4.3",
"passport": "^0.4.1",
"multer": "^1.4.5-lts.1",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"path": "^0.12.7",
"session-file-store": "^1.5.0",

View File

@@ -59,7 +59,7 @@ module.exports = function () {
} else {
const userVersion = row.user_version
if (userVersion === 0) {
if (userVersion < 1) {
db.run('ALTER TABLE samples ADD COLUMN fade_in REAL DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_points_enabled INTEGER DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_start REAL DEFAULT 0')
@@ -67,6 +67,12 @@ module.exports = function () {
db.run('PRAGMA user_version = 1')
}
if (userVersion < 2) {
db.run('ALTER TABLE users ADD COLUMN preferences TEXT DEFAULT "{}"')
db.run('PRAGMA user_version = 2')
}
}
})
})

View File

@@ -36,8 +36,14 @@ router.get('/admin', (req, res) => {
})
router.get('/logout', (req, res) => {
req.logout()
req.logout((err) => {
if (err) {
logger.error(err)
res.sendStatus(500)
} else {
res.sendStatus(200)
}
})
})
router.get('/setup', (req, res) => {

View File

@@ -9,7 +9,11 @@ router.get('/users/current', (req, res) => {
return res.sendStatus(401)
}
db.get('SELECT is_admin as isAdmin, dark_mode as darkMode, can_upload as canUpload, * FROM users WHERE id = ?', [req.user.id], (err, row) => {
db.get(`SELECT
is_admin as isAdmin,
dark_mode as darkMode,
can_upload as canUpload,
* FROM users WHERE id = ?`, [req.user.id], (err, row) => {
if (err) {
logger.error(err)
return res.sendStatus(500)
@@ -24,6 +28,7 @@ router.get('/users/current', (req, res) => {
user.isAdmin = row.isAdmin === 1
user.darkMode = row.darkMode === 1
user.canUpload = row.canUpload === 1
user.preferences = JSON.parse(row.preferences)
}
res.json({ user: user })
@@ -287,4 +292,23 @@ router.delete('/users/:userId', (req, res) => {
})
})
router.patch('/users/preferences', (req, res) => {
if (!req.user) {
return res.sendStatus(401)
}
const preferences = JSON.stringify(req.body.preferences)
db.serialize(() => {
db.run('UPDATE users SET preferences = ? WHERE id = ?', [preferences, req.user.id], (err) => {
if (err) {
logger.error(err)
return res.sendStatus(500)
} else {
return res.sendStatus(200)
}
})
})
})
module.exports = router

View File

@@ -8,6 +8,10 @@
</v-col>
</v-row>
<h2 class="headline font-weight-bold mb-3">
User Management
</h2>
<v-col cols="12">
<v-row>
ID: {{ currentUser.id }}
@@ -26,7 +30,7 @@
>
<template #activator="{ on, attrs }">
<v-btn
class="my-3"
class="mt-5 mb-10"
v-bind="attrs"
v-on="on"
@click="resetChangePasswordForm"
@@ -77,12 +81,35 @@
</v-form>
</v-dialog>
<h2 class="headline font-weight-bold mb-3">
Preferences
</h2>
<h3 class="font-weight-bold">
Dark Mode
</h3>
<v-switch
v-model="$vuetify.theme.dark"
label="Dark Mode"
:label="`${$vuetify.theme.dark ? 'On' : 'Off'}`"
@change="toggleDarkMode"
/>
<h3 class="mb-5 font-weight-bold">
Accent Color
</h3>
<v-color-picker
v-model="accentColor"
/>
<v-btn
class="mt-5"
@click="updateAccentColor"
>
Apply
</v-btn>
<v-snackbar
v-model="snackbar"
timeout="3000"

View File

@@ -7,7 +7,7 @@
dense
>
<v-app-bar-nav-icon
@click="getCurrentUser"
@click="checkForAdmin"
/>
</v-app-bar>
<v-navigation-drawer

View File

@@ -6,6 +6,7 @@ export default {
changePasswordDialog: false,
isPasswordValid: false,
password: '',
accentColor: {},
snackbar: false,
snackbarText: '',
rules: {
@@ -21,6 +22,7 @@ export default {
.then(response => {
if (response.status === 200) {
this.currentUser = response.data.user
this.accentColor = this.currentUser.preferences.accentColor
}
})
},
@@ -45,6 +47,14 @@ export default {
this.$http.patch('/users/dark-mode', {
darkMode: this.$vuetify.theme.dark
})
},
updateAccentColor () {
const preferences = { accentColor: this.accentColor }
this.$http.patch('/users/preferences', {
preferences: preferences
})
this.$vuetify.theme.themes.dark.primary = this.accentColor.hex
this.$vuetify.theme.themes.light.primary = this.accentColor.hex
}
}
}

View File

@@ -6,6 +6,9 @@ export default {
isAdmin: false,
loggedIn: false
}),
created () {
this.getUserPreferences()
},
methods: {
home () {
this.$router.push('/')
@@ -24,7 +27,7 @@ export default {
}
})
},
getCurrentUser () {
checkForAdmin () {
this.loggedIn = false
this.drawyer = true
this.$http.get('/users/current')
@@ -32,12 +35,21 @@ export default {
if (response.status === 200) {
this.loggedIn = true
this.isAdmin = response.data.user.isAdmin
this.$vuetify.theme.dark = response.data.user.darkMode
}
})
.catch(() => {
this.isAdmin = false
})
},
getUserPreferences () {
this.$http.get('/users/current')
.then(response => {
if (response.status === 200) {
const preferences = response.data.user.preferences
this.$vuetify.theme.themes.dark.primary = preferences.accentColor.hex
this.$vuetify.theme.themes.light.primary = preferences.accentColor.hex
}
})
}
}
}

View File

@@ -489,6 +489,9 @@ export default {
if (response.status === 200) {
this.canUpload = response.data.user.canUpload
this.$vuetify.theme.dark = response.data.user.darkMode
const preferences = response.data.user.preferences
this.$vuetify.theme.themes.dark.primary = preferences.accentColor.hex
this.$vuetify.theme.themes.light.primary = preferences.accentColor.hex
}
})
},

View File

@@ -1,5 +1,5 @@
import Vue from 'vue'
import Vuetify from 'vuetify/lib/framework'
import Vuetify from 'vuetify/lib'
import colors from 'vuetify/lib/util/colors'