Start dockerizing, fix app bar bugs

This commit is contained in:
Kevin Thomas
2021-11-09 19:14:58 -08:00
parent d52aea3fd9
commit 8c6c4a00cc
7 changed files with 28 additions and 7 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
dist
log
node_modules
samples
sessions
db.sqlite3

10
Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM node:14-alpine
LABEL maintainer="me@kevinthomas.dev"
WORKDIR /var/noisedash
COPY package*.json ./
RUN npm install
COPY . .
ENV NODE_ENV production
RUN npm run build
EXPOSE 1432
CMD [ "node", "server/bin/www.js" ]

View File

@@ -1,6 +1,6 @@
{ {
"Server": { "Server": {
"listeningPort": 3000, "listeningPort": 1432,
"sessionFileStorePath": "sessions", "sessionFileStorePath": "sessions",
"sampleUploadPath": "samples", "sampleUploadPath": "samples",
"sessionSecret": "cats", "sessionSecret": "cats",

View File

@@ -41,6 +41,7 @@
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item <v-list-item
:disabled="!loggedIn"
@click="logout" @click="logout"
> >
<v-list-item-icon> <v-list-item-icon>
@@ -54,6 +55,7 @@
<v-switch <v-switch
v-model="$vuetify.theme.dark" v-model="$vuetify.theme.dark"
label="Dark Mode" label="Dark Mode"
:disabled="!loggedIn"
@change="toggleDarkMode" @change="toggleDarkMode"
/> />
</v-list-item> </v-list-item>

View File

@@ -3,7 +3,8 @@ export default {
data: () => ({ data: () => ({
drawyer: false, drawyer: false,
isAdmin: false isAdmin: false,
loggedIn: false
}), }),
methods: { methods: {
home () { home () {
@@ -24,10 +25,12 @@ export default {
}) })
}, },
getCurrentUser () { getCurrentUser () {
this.loggedIn = false
this.drawyer = true this.drawyer = true
this.$http.get('/users/current') this.$http.get('/users/current')
.then(response => { .then(response => {
if (response.status === 200) { if (response.status === 200) {
this.loggedIn = true
this.isAdmin = response.data.user.isAdmin this.isAdmin = response.data.user.isAdmin
this.$vuetify.theme.dark = response.data.user.darkMode this.$vuetify.theme.dark = response.data.user.darkMode
} }

View File

@@ -47,12 +47,12 @@ router.beforeEach((to, from, next) => {
if (response.status === 200) { if (response.status === 200) {
next() next()
} else { } else {
next('/login') next('/register')
} }
}) })
.catch((error) => { .catch((error) => {
console.error(error.response) console.error(error.response)
next('/login') next('/register')
}) })
} else if (to.name === 'Admin') { } else if (to.name === 'Admin') {
instance.get('/admin') instance.get('/admin')
@@ -71,14 +71,14 @@ router.beforeEach((to, from, next) => {
instance.get('/setup') instance.get('/setup')
.then(response => { .then(response => {
if (!response.data.setup) { if (!response.data.setup) {
next('/') next('/login')
} else { } else {
next() next()
} }
}) })
.catch((error) => { .catch((error) => {
console.error(error.response) console.error(error.response)
next('/') next('/login')
}) })
} else { } else {
next() next()

View File

@@ -3,6 +3,6 @@ module.exports = {
'vuetify' 'vuetify'
], ],
devServer: { devServer: {
proxy: 'http://localhost:3000' proxy: 'http://localhost:1432'
} }
} }