diff --git a/.env.template b/.env.template index 4bf95e4a..eb702ad2 100644 --- a/.env.template +++ b/.env.template @@ -24,6 +24,6 @@ USERS_SERVICE_NAME=users USERS_SERVICE_PORT=3000 USERS_SERVICE_URI=http://${USERS_SERVICE_NAME}:${USERS_SERVICE_PORT} -MULTIMEDIA_SERVICE_NAME=MULTIMEDIA +MULTIMEDIA_SERVICE_NAME=multimedia MULTIMEDIA_SERVICE_PORT=3000 MULTIMEDIA_SERVICE_URI=http://${MULTIMEDIA_SERVICE_NAME}:${MULTIMEDIA_SERVICE_PORT} diff --git a/Dockerfile b/Dockerfile index db4343d6..d2d325dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,4 +5,4 @@ COPY ./services/ ./services/ RUN ["rm", "-rf", "services/*/dist"] COPY ./tsconfig.json ./tsconfig.json RUN [ "npm", "install" ] -# RUN [ "npm", "run", "--workspace", "services/frontend", "build", "--if-present" ] +RUN [ "npm", "run", "--workspace", "services/frontend", "build", "--if-present" ] diff --git a/package-lock.json b/package-lock.json index 9f8cbab0..cbdc5d57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "axios": "^1.5.0", "bcrypt": "^5.1.1", "cookie-parser": "^1.4.6", + "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.2", "mongoose": "^7.5.0", @@ -53,7 +54,8 @@ "ts-node-dev": "^2.0.0", "tsc-alias": "^1.8.7", "tsconfig-paths": "^4.2.0", - "typescript": "<5.2.0" + "typescript": "<5.2.0", + "vite-plugin-rewrite-all": "^1.0.2" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -737,6 +739,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=12" } @@ -753,6 +756,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=12" } @@ -769,6 +773,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=12" } @@ -785,6 +790,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">=12" } @@ -801,6 +807,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">=12" } @@ -817,6 +824,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">=12" } @@ -833,6 +841,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">=12" } @@ -849,6 +858,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -865,6 +875,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -881,6 +892,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -897,6 +909,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -913,6 +926,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -929,6 +943,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -945,6 +960,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -961,6 +977,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -977,6 +994,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=12" } @@ -993,6 +1011,7 @@ "os": [ "netbsd" ], + "peer": true, "engines": { "node": ">=12" } @@ -1009,6 +1028,7 @@ "os": [ "openbsd" ], + "peer": true, "engines": { "node": ">=12" } @@ -1025,6 +1045,7 @@ "os": [ "sunos" ], + "peer": true, "engines": { "node": ">=12" } @@ -1041,6 +1062,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=12" } @@ -1057,6 +1079,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=12" } @@ -1073,6 +1096,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=12" } @@ -4532,6 +4556,15 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, "node_modules/console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -10543,9 +10576,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sass": { - "version": "1.32.12", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.32.12.tgz", - "integrity": "sha512-zmXn03k3hN0KaiVTjohgkg98C3UowhL1/VSGdj4/VAAiMKGQOE80PFPxFP2Kyq0OUskPKcY5lImkhBKEHlypJA==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.33.0.tgz", + "integrity": "sha512-9v0MUXnSi62FtfjqcwZ+b8B9FIxdwFEb3FPUkjEPXWd0b5KcnPGSp2XF9WrzcH1ZxedfgJVTdA3A1j4eEj53xg==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0" @@ -12005,6 +12038,21 @@ } } }, + "node_modules/vite-plugin-rewrite-all": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/vite-plugin-rewrite-all/-/vite-plugin-rewrite-all-1.0.2.tgz", + "integrity": "sha512-NpiFyHi9w8iHm3kZ28ma/IU16LFCkNJNqTvGy6cjoit2EMBi7dgFWFZFYcwZjUrc+pOMup//rsQTRVILvF2efQ==", + "dev": true, + "dependencies": { + "connect-history-api-fallback": "^1.6.0" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "vite": "^2.0.0 || ^3.0.0 || ^4.0.0" + } + }, "node_modules/vue": { "version": "3.3.8", "resolved": "https://registry.npmjs.org/vue/-/vue-3.3.8.tgz", @@ -12500,8 +12548,9 @@ "@vue/tsconfig": "^0.4.0", "eslint-plugin-vue": "^9.17.0", "npm-run-all": "^4.1.5", - "sass": "1.32.12", + "sass": "1.33.0", "vite": "^4.4.9", + "vite-plugin-rewrite-all": "^1.0.2", "vue-tsc": "^1.8.8" } }, diff --git a/services/frontend/docker-compose.yaml b/services/frontend/docker-compose.yaml index 14d5842f..f117a87e 100644 --- a/services/frontend/docker-compose.yaml +++ b/services/frontend/docker-compose.yaml @@ -21,5 +21,4 @@ services: - frontend labels: - | - traefik.http.routers.frontend-service.rule= - (Method(`GET`) && PathPrefix(`/`)) + traefik.http.routers.frontend-service.rule=Method(`GET`) && PathPrefix(`/`) diff --git a/services/frontend/package.json b/services/frontend/package.json index 2361822c..05efdada 100644 --- a/services/frontend/package.json +++ b/services/frontend/package.json @@ -4,7 +4,7 @@ "scripts": { "build": "vite build", "build:check": "run-p type-check build", - "start": "serve dist", + "start": "serve -s dist", "dev": "vite --base /site", "preview": "vite preview", "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", @@ -33,7 +33,7 @@ "@vue/tsconfig": "^0.4.0", "eslint-plugin-vue": "^9.17.0", "npm-run-all": "^4.1.5", - "sass": "1.32.12", + "sass": "1.33.0", "vite": "^4.4.9", "vue-tsc": "^1.8.8" } diff --git a/services/frontend/src/router/index.ts b/services/frontend/src/router/index.ts index 666cd9d8..f63e6aa7 100644 --- a/services/frontend/src/router/index.ts +++ b/services/frontend/src/router/index.ts @@ -13,6 +13,12 @@ const router = createRouter({ name: 'Monitoring', component: MonitoringView, meta: { requiresAuth: false } + }, + { + path: '/:pathMatch(.*)*', + name: 'NotFound', + component: HomeView, + meta: { requiresAuth: true } } ] }) diff --git a/services/messages/docker-compose.yaml b/services/messages/docker-compose.yaml index 1fdfd9fc..f07cff45 100755 --- a/services/messages/docker-compose.yaml +++ b/services/messages/docker-compose.yaml @@ -21,8 +21,7 @@ services: - 'MONGO_URI=mongodb://db-messages-service:27017/messages' labels: - | - traefik.http.routers.messages-service.rule= - (Method(`GET`, `POST`) && Path(`/users/{username:[^/]+}/messages`)) || + traefik.http.routers.messages-service.rule=(Method(`GET`, `POST`) && Path(`/users/{username:[^/]+}/messages`)) || (Method(`GET`, `POST`) && Path(`/servers/{serverId:[^/]+}/channels/{channelId:[^/]+}/messages`)) db-messages-service: diff --git a/services/monitoring/docker-compose.yaml b/services/monitoring/docker-compose.yaml index b54d04ad..3bcff3b1 100755 --- a/services/monitoring/docker-compose.yaml +++ b/services/monitoring/docker-compose.yaml @@ -22,8 +22,7 @@ services: - 'SERVICES_URI=${USERS_SERVICE_URI},${MESSAGES_SERVICE_URI},${PIPERCHAT_SERVICE_URI},${MULTIMEDIA_SERVICE_URI},${NOTIFICATIONS_SERVICE_URI}' labels: - | - traefik.http.routers.monitoring-service.rule= - (Method(`GET`) && Path(`/status`)) + traefik.http.routers.monitoring-service.rule=Method(`GET`) && Path(`/status`) db-monitoring-service: image: mongo diff --git a/services/multimedia/docker-compose.yaml b/services/multimedia/docker-compose.yaml index 0b4c17ed..d4656ca0 100755 --- a/services/multimedia/docker-compose.yaml +++ b/services/multimedia/docker-compose.yaml @@ -23,8 +23,7 @@ services: - 'MONGO_URI=mongodb://db-multimedia-service:27017/multimedia' labels: - | - traefik.http.routers.multimedia-service.rule= - (Method(`GET`) && PathPrefix(`/webrtc`)) || + traefik.http.routers.multimedia-service.rule=(Method(`GET`) && PathPrefix(`/webrtc`)) || (Method(`GET`) && Path(`/users/{username:[^/]+}/session`))|| (Method(`GET`) && Path(`/servers/{serverId:[^/]+}/channels/{channelId:[^/]+}/session`))|| (Method(`GET`) && Path(`/sessions/{sessionId:[^/]+}`)) diff --git a/services/notifications/docker-compose.yaml b/services/notifications/docker-compose.yaml index 93ec9372..a58604ae 100644 --- a/services/notifications/docker-compose.yaml +++ b/services/notifications/docker-compose.yaml @@ -21,8 +21,7 @@ services: - 'MONGO_URI=mongodb://db-notifications-service:27017/notifications' labels: - | - traefik.http.routers.notifications-service.rule= - (Method(`GET`) && Path(`/users/{username:[^/]+}/status`)) || + traefik.http.routers.notifications-service.rule=(Method(`GET`) && Path(`/users/{username:[^/]+}/status`)) || (Method(`GET`) && PathPrefix(`/notification`)) db-notifications-service: diff --git a/services/piperchat/docker-compose.yaml b/services/piperchat/docker-compose.yaml index 2774689c..fe3c0c2f 100644 --- a/services/piperchat/docker-compose.yaml +++ b/services/piperchat/docker-compose.yaml @@ -21,8 +21,7 @@ services: - 'MONGO_URI=mongodb://db-piperchat-service:27017/piperchat' labels: - | - traefik.http.routers.piperchat-service.rule= - (Method(`GET`, `POST`) && Path(`/servers`)) || + traefik.http.routers.piperchat-service.rule=(Method(`GET`, `POST`) && Path(`/servers`)) || (Method(`GET`, `PUT`, `DELETE`) && Path(`/servers/{serverId:[^/]+}`)) || (Method(`GET`, `POST`, `DELETE`) && Path(`/servers/{serverId:[^/]+}/participants`)) || (Method(`DELETE`) && Path(`/servers/{serverId:[^/]+}/participants/{userId:[^/]+}`)) || diff --git a/services/users/docker-compose.yaml b/services/users/docker-compose.yaml index 1854d204..d6ac566c 100755 --- a/services/users/docker-compose.yaml +++ b/services/users/docker-compose.yaml @@ -23,8 +23,7 @@ services: - 'MONGO_URI=mongodb://db-users-service:27017/users' labels: - | - traefik.http.routers.users-service.rule= - (Method(`POST`) && Path(`/auth/{p:(login|register|logout|refresh-token)}`)) || + traefik.http.routers.users-service.rule=(Method(`POST`) && Path(`/auth/{p:(login|register|logout|refresh-token)}`)) || (Method(`PUT`) && Path(`/profile/{p:(photo|description)}`)) || (Method(`GET`) && Path(`/friends`)) || (Method(`GET`, `POST`) && Path(`/friends/requests`)) ||