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": {
"listeningPort": 3000,
"listeningPort": 1432,
"sessionFileStorePath": "sessions",
"sampleUploadPath": "samples",
"sessionSecret": "cats",

View File

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

View File

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

View File

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

View File

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