diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..95f1e93 --- /dev/null +++ b/.env.development @@ -0,0 +1,3 @@ +VUE_APP_API_URL=localhost:8000 +VUE_APP_API_PROTOCOL=http:// +VUE_APP_WS_PROTOCOL=ws:// \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..047eb46 --- /dev/null +++ b/.env.production @@ -0,0 +1,3 @@ +VUE_APP_API_URL=caiapi.voidcorp.nl +VUE_APP_API_PROTOCOL=https:// +VUE_APP_WS_PROTOCOL=wss:// \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b78c876 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:alpine as build + +# Set work dir +WORKDIR /app/ + +# Copy package files +COPY package.json ./ +COPY yarn.lock ./ + +RUN yarn install + +COPY . . + +RUN yarn build + +FROM nginx:alpine as production-stage + +RUN apk add curl --no-cache + +WORKDIR /usr/share/nginx/html + +COPY --from=build /app/dist . diff --git a/package.json b/package.json index 2ea9070..ed4da7a 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,10 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "@chenfengyuan/vue-qrcode": "^1.0.1", "axios": "^0.19.0", "core-js": "^2.6.5", + "qrcode.vue": "^1.6.2", "register-service-worker": "^1.6.2", "vue": "^2.6.10", "vue-class-component": "^7.0.2", diff --git a/public/index.html b/public/index.html index 54f7328..d67b345 100644 --- a/public/index.html +++ b/public/index.html @@ -4,12 +4,13 @@ + - cards-frontend + Cards Against Idiots
diff --git a/src/App.vue b/src/App.vue index a2c1558..02cfd6a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,9 +1,10 @@ diff --git a/src/components/CardComponent.vue b/src/components/CardComponent.vue index df4c9d4..6471178 100644 --- a/src/components/CardComponent.vue +++ b/src/components/CardComponent.vue @@ -1,6 +1,6 @@ @@ -20,6 +20,7 @@ diff --git a/src/util/api.ts b/src/util/api.ts index 19e0fda..598dbca 100644 --- a/src/util/api.ts +++ b/src/util/api.ts @@ -2,8 +2,10 @@ import axios from "axios"; import { Message, MessageType } from "../models/Message"; import { Answer } from "../models/Answer"; -const webProt = "http://"; -const baseURL = "localhost:8000"; +export const webProt = process.env.VUE_APP_API_PROTOCOL; +export const baseURL = process.env.VUE_APP_API_URL; +export const fullURL = webProt + baseURL; +export const wsProt = process.env.VUE_APP_WS_PROTOCOL; export const axios_api = axios.create({ baseURL: webProt + baseURL, @@ -21,8 +23,8 @@ export class Game { private sub: WebSocket; constructor(code: string, name: string, message_callback: (message: Message) => void) { - this.pub = new WebSocket(`ws://${baseURL}/ws/room/${code}/pub`); - this.sub = new WebSocket(`ws://${baseURL}/ws/room/${code}/sub`); + this.pub = new WebSocket(`${wsProt}${baseURL}/ws/room/${code}/pub`); + this.sub = new WebSocket(`${wsProt}${baseURL}/ws/room/${code}/sub`); this.pub.addEventListener("open", (event) => { console.info("pub-ws connected"); diff --git a/src/views/About.vue b/src/views/About.vue index 378183c..c364ac1 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -1,5 +1,207 @@ diff --git a/src/views/Game.vue b/src/views/Game.vue index c568647..a5ed34c 100644 --- a/src/views/Game.vue +++ b/src/views/Game.vue @@ -1,8 +1,7 @@ diff --git a/src/views/JoinRoom.vue b/src/views/JoinRoom.vue index 8875962..ee2d219 100644 --- a/src/views/JoinRoom.vue +++ b/src/views/JoinRoom.vue @@ -14,25 +14,24 @@ - -