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 name: Docker Image CI
on: on:
push: pull_request:
branches: [ main ] types:
- labeled
branches:
- 'main'
jobs: jobs:
buildx: buildx:
if: ${{ github.event.label.name == 'run-workflow' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
@@ -31,4 +35,4 @@ jobs:
context: . context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64 platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true 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 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)) (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", "name": "noisedash",
"version": "0.4.0", "version": "0.5.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -3975,9 +3975,9 @@
} }
}, },
"@vue/vue-loader-v15": { "@vue/vue-loader-v15": {
"version": "npm:vue-loader@15.9.8", "version": "npm:vue-loader@15.10.0",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.8.tgz", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.10.0.tgz",
"integrity": "sha512-GwSkxPrihfLR69/dSV3+5CdMQ0D+jXg8Ma1S4nQXKJAznYFX14vHdc/NetQc34Dw+rBbIJyP7JOuVb9Fhprvog==", "integrity": "sha512-VU6tuO8eKajrFeBzMssFUP9SvakEeeSi1BxdTH5o3+1yUyrldp8IERkSdXlMI2t4kxF2sqYUDsQY+WJBxzBmZg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@vue/component-compiler-utils": "^3.1.0", "@vue/component-compiler-utils": "^3.1.0",
@@ -3990,7 +3990,7 @@
"hash-sum": { "hash-sum": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", "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 "dev": true
}, },
"json5": { "json5": {
@@ -4701,12 +4701,11 @@
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
}, },
"busboy": { "busboy": {
"version": "0.2.14", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
"integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=", "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
"requires": { "requires": {
"dicer": "0.2.5", "streamsearch": "^1.1.0"
"readable-stream": "1.1.x"
} }
}, },
"bytes": { "bytes": {
@@ -5113,40 +5112,6 @@
"inherits": "^2.0.3", "inherits": "^2.0.3",
"readable-stream": "^2.2.2", "readable-stream": "^2.2.2",
"typedarray": "^0.0.6" "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": { "config": {
@@ -5885,15 +5850,6 @@
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
"dev": true "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": { "dir-glob": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -8013,9 +7969,9 @@
} }
}, },
"isarray": { "isarray": {
"version": "0.0.1", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
}, },
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
@@ -8700,16 +8656,15 @@
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}, },
"multer": { "multer": {
"version": "1.4.4", "version": "1.4.5-lts.1",
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.4.tgz", "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz",
"integrity": "sha512-2wY2+xD4udX612aMqMcB8Ws2Voq6NIUPEtD1be6m411T4uDH/VtL9i//xvcyFlTVfRdaBsk7hV5tgrGQqhuBiw==", "integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==",
"requires": { "requires": {
"append-field": "^1.0.0", "append-field": "^1.0.0",
"busboy": "^0.2.11", "busboy": "^1.0.0",
"concat-stream": "^1.5.2", "concat-stream": "^1.5.2",
"mkdirp": "^0.5.4", "mkdirp": "^0.5.4",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"on-finished": "^2.3.0",
"type-is": "^1.6.4", "type-is": "^1.6.4",
"xtend": "^4.0.0" "xtend": "^4.0.0"
} }
@@ -8924,14 +8879,6 @@
"integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
"dev": true "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": { "on-headers": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
@@ -9222,12 +9169,13 @@
} }
}, },
"passport": { "passport": {
"version": "0.4.1", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.4.1.tgz", "resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz",
"integrity": "sha512-IxXgZZs8d7uFSt3eqNjM9NQ3g3uQCW5avD8mRNoXV99Yig50vjuaez6dQK2qC0kVWPRTujxY0dWgGfT09adjYg==", "integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==",
"requires": { "requires": {
"passport-strategy": "1.x.x", "passport-strategy": "1.x.x",
"pause": "0.0.1" "pause": "0.0.1",
"utils-merge": "^1.0.1"
} }
}, },
"passport-local": { "passport-local": {
@@ -9290,7 +9238,7 @@
"pause": { "pause": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
"integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10=" "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg=="
}, },
"picocolors": { "picocolors": {
"version": "1.0.0", "version": "1.0.0",
@@ -9896,14 +9844,24 @@
} }
}, },
"readable-stream": { "readable-stream": {
"version": "1.1.14", "version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "~1.0.0",
"inherits": "~2.0.1", "inherits": "~2.0.3",
"isarray": "0.0.1", "isarray": "~1.0.0",
"string_decoder": "~0.10.x" "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": { "readdirp": {
@@ -10639,9 +10597,9 @@
"dev": true "dev": true
}, },
"streamsearch": { "streamsearch": {
"version": "0.1.2", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
"integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="
}, },
"string-width": { "string-width": {
"version": "4.2.3", "version": "4.2.3",
@@ -10675,9 +10633,19 @@
} }
}, },
"string_decoder": { "string_decoder": {
"version": "0.10.31", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" "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": { "strip-ansi": {
"version": "6.0.1", "version": "6.0.1",

View File

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

View File

@@ -59,7 +59,7 @@ module.exports = function () {
} else { } else {
const userVersion = row.user_version 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 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_points_enabled INTEGER DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_start REAL 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') 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) => { router.get('/logout', (req, res) => {
req.logout() req.logout((err) => {
res.sendStatus(200) if (err) {
logger.error(err)
res.sendStatus(500)
} else {
res.sendStatus(200)
}
})
}) })
router.get('/setup', (req, res) => { router.get('/setup', (req, res) => {

View File

@@ -9,7 +9,11 @@ router.get('/users/current', (req, res) => {
return res.sendStatus(401) 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) { if (err) {
logger.error(err) logger.error(err)
return res.sendStatus(500) return res.sendStatus(500)
@@ -24,6 +28,7 @@ router.get('/users/current', (req, res) => {
user.isAdmin = row.isAdmin === 1 user.isAdmin = row.isAdmin === 1
user.darkMode = row.darkMode === 1 user.darkMode = row.darkMode === 1
user.canUpload = row.canUpload === 1 user.canUpload = row.canUpload === 1
user.preferences = JSON.parse(row.preferences)
} }
res.json({ user: user }) 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 module.exports = router

View File

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

View File

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

View File

@@ -6,6 +6,7 @@ export default {
changePasswordDialog: false, changePasswordDialog: false,
isPasswordValid: false, isPasswordValid: false,
password: '', password: '',
accentColor: {},
snackbar: false, snackbar: false,
snackbarText: '', snackbarText: '',
rules: { rules: {
@@ -21,6 +22,7 @@ export default {
.then(response => { .then(response => {
if (response.status === 200) { if (response.status === 200) {
this.currentUser = response.data.user this.currentUser = response.data.user
this.accentColor = this.currentUser.preferences.accentColor
} }
}) })
}, },
@@ -45,6 +47,14 @@ export default {
this.$http.patch('/users/dark-mode', { this.$http.patch('/users/dark-mode', {
darkMode: this.$vuetify.theme.dark 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, isAdmin: false,
loggedIn: false loggedIn: false
}), }),
created () {
this.getUserPreferences()
},
methods: { methods: {
home () { home () {
this.$router.push('/') this.$router.push('/')
@@ -24,7 +27,7 @@ export default {
} }
}) })
}, },
getCurrentUser () { checkForAdmin () {
this.loggedIn = false this.loggedIn = false
this.drawyer = true this.drawyer = true
this.$http.get('/users/current') this.$http.get('/users/current')
@@ -32,12 +35,21 @@ export default {
if (response.status === 200) { if (response.status === 200) {
this.loggedIn = true this.loggedIn = true
this.isAdmin = response.data.user.isAdmin this.isAdmin = response.data.user.isAdmin
this.$vuetify.theme.dark = response.data.user.darkMode
} }
}) })
.catch(() => { .catch(() => {
this.isAdmin = false 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) { if (response.status === 200) {
this.canUpload = response.data.user.canUpload this.canUpload = response.data.user.canUpload
this.$vuetify.theme.dark = response.data.user.darkMode 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 Vue from 'vue'
import Vuetify from 'vuetify/lib/framework' import Vuetify from 'vuetify/lib'
import colors from 'vuetify/lib/util/colors' import colors from 'vuetify/lib/util/colors'