diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..1b07c39 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +# Ignore artifacts: +build +coverage \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..7b57826 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,12 @@ +{ + "semi": true, + "bracketSpacing": true, + "arrowParens": "always", + "endOfLine": "lf", + "jsxSingleQuote": true, + "printWidth": 140, + "quoteProps": "consistent", + "singleQuote": true, + "trailingComma": "all", + "useTabs": true + } diff --git a/README.md b/README.md index 45c54db..0496bea 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ You can start editing the page by modifying `app/page.tsx`. The page auto-update This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. # Contribute + **Hey Folks I would appreciate if anyone wants to contribute to this repo, and make this application even better** ## Repository Structure diff --git a/contributor.md b/contributor.md index b9866a4..bf14716 100644 --- a/contributor.md +++ b/contributor.md @@ -1,17 +1,17 @@ # Contributors Guide - ## Getting Started -```bash +```bash npm install ``` - Copy .sample.env to .env and create your own appwrite account and create a DB and add Project id in NEXT_PUBLIC_APPWRITE_PROJECT_ID -```bash + +```bash cp .sample.env .env ``` ```bash npm run dev -``` \ No newline at end of file +``` diff --git a/next.config.js b/next.config.js index 23dc302..55e247e 100644 --- a/next.config.js +++ b/next.config.js @@ -1,8 +1,8 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {} +const nextConfig = {}; module.exports = { - experimental: { - serverActions: true, - }, -} + experimental: { + serverActions: true, + }, +}; diff --git a/package-lock.json b/package-lock.json index b60e31c..16c33e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "react-dom": "18.2.0", "react-icons": "^4.10.1", "react-player": "^2.12.0", + "socket.io": "^4.7.2", "tailwindcss": "3.3.2", "typescript": "5.1.6", "uuid": "^9.0.0", @@ -33,7 +34,8 @@ "devDependencies": { "@types/uuid": "^9.0.2", "@types/websocket": "^1.0.5", - "@types/ws": "^8.5.5" + "@types/ws": "^8.5.5", + "prettier": "3.0.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -400,6 +402,11 @@ "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.3.2.tgz", "integrity": "sha512-V+MvGwaHH03hYhY+k6Ef/xKd6RYlc4q8WBx+2ANmipHJcKuktNcI/NgEsJgdSUF6Lw32njT6OnrRsKYCdgHjYw==" }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, "node_modules/@swc/helpers": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", @@ -408,6 +415,19 @@ "tslib": "^2.4.0" } }, + "node_modules/@types/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" + }, + "node_modules/@types/cors": { + "version": "2.8.14", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.14.tgz", + "integrity": "sha512-RXHUvNWYICtbP6s18PnOCaqToK8y14DnLd75c6HfyKf228dxy7pHNOQkxPtvXKp/hINFMDjbYzsj63nnpPMSRQ==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -566,6 +586,18 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -847,6 +879,14 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "engines": { + "node": "^4.5.0 || >= 5.9" + } + }, "node_modules/big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", @@ -1106,6 +1146,26 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, + "node_modules/cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/cross-fetch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", @@ -1310,6 +1370,54 @@ "iconv-lite": "^0.6.2" } }, + "node_modules/engine.io": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.2.tgz", + "integrity": "sha512-IXsMcGpw/xRfjra46sVZVHiSWo/nJ/3g1337q9KNXtS6YRzbW5yIzTCb9DjhrBe7r3GZQR0I4+nq+4ODk5g/cA==", + "dependencies": { + "@types/cookie": "^0.4.1", + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.4.1", + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", + "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/enhanced-resolve": { "version": "5.15.0", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", @@ -3001,6 +3109,14 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/next": { "version": "13.4.9", "resolved": "https://registry.npmjs.org/next/-/next-13.4.9.tgz", @@ -3555,6 +3671,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -3951,6 +4082,63 @@ "node": ">=8" } }, + "node_modules/socket.io": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz", + "integrity": "sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.3.2", + "engine.io": "~6.5.2", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz", + "integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==", + "dependencies": { + "ws": "~8.11.0" + } + }, + "node_modules/socket.io-adapter/node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/source-map-js": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", @@ -4447,6 +4635,14 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", @@ -4838,6 +5034,11 @@ "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.3.2.tgz", "integrity": "sha512-V+MvGwaHH03hYhY+k6Ef/xKd6RYlc4q8WBx+2ANmipHJcKuktNcI/NgEsJgdSUF6Lw32njT6OnrRsKYCdgHjYw==" }, + "@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, "@swc/helpers": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", @@ -4846,6 +5047,19 @@ "tslib": "^2.4.0" } }, + "@types/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" + }, + "@types/cors": { + "version": "2.8.14", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.14.tgz", + "integrity": "sha512-RXHUvNWYICtbP6s18PnOCaqToK8y14DnLd75c6HfyKf228dxy7pHNOQkxPtvXKp/hINFMDjbYzsj63nnpPMSRQ==", + "requires": { + "@types/node": "*" + } + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -4956,6 +5170,15 @@ "eslint-visitor-keys": "^3.3.0" } }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, "acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -5160,6 +5383,11 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" + }, "big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", @@ -5324,6 +5552,20 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, + "cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" + }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "cross-fetch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", @@ -5472,6 +5714,36 @@ "iconv-lite": "^0.6.2" } }, + "engine.io": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.2.tgz", + "integrity": "sha512-IXsMcGpw/xRfjra46sVZVHiSWo/nJ/3g1337q9KNXtS6YRzbW5yIzTCb9DjhrBe7r3GZQR0I4+nq+4ODk5g/cA==", + "requires": { + "@types/cookie": "^0.4.1", + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.4.1", + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0" + }, + "dependencies": { + "ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "requires": {} + } + } + }, + "engine.io-parser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", + "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==" + }, "enhanced-resolve": { "version": "5.15.0", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", @@ -6676,6 +6948,11 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" + }, "next": { "version": "13.4.9", "resolved": "https://registry.npmjs.org/next/-/next-13.4.9.tgz", @@ -7003,6 +7280,12 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" }, + "prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true + }, "prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -7271,6 +7554,45 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" }, + "socket.io": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz", + "integrity": "sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==", + "requires": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.3.2", + "engine.io": "~6.5.2", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + } + }, + "socket.io-adapter": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz", + "integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==", + "requires": { + "ws": "~8.11.0" + }, + "dependencies": { + "ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "requires": {} + } + } + }, + "socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + } + }, "source-map-js": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", @@ -7610,6 +7932,11 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" + }, "watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", diff --git a/package.json b/package.json index 843a035..5c839a5 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "react-dom": "18.2.0", "react-icons": "^4.10.1", "react-player": "^2.12.0", + "socket.io": "^4.7.2", "tailwindcss": "3.3.2", "typescript": "5.1.6", "uuid": "^9.0.0", @@ -34,6 +35,7 @@ "devDependencies": { "@types/uuid": "^9.0.2", "@types/websocket": "^1.0.5", - "@types/ws": "^8.5.5" + "@types/ws": "^8.5.5", + "prettier": "3.0.3" } } diff --git a/postcss.config.js b/postcss.config.js index 33ad091..12a703d 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -3,4 +3,4 @@ module.exports = { tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/src/Context/Authentication/authContext.ts b/src/Context/Authentication/authContext.ts index 3065ed2..e0decf1 100644 --- a/src/Context/Authentication/authContext.ts +++ b/src/Context/Authentication/authContext.ts @@ -1,12 +1,12 @@ -import { createContext } from 'react' +import { createContext } from "react"; const AuthContext = createContext<{ - authStatus: boolean; - setAuthStatus: (status: boolean) => void; + authStatus: boolean; + setAuthStatus: (status: boolean) => void; }>({ - authStatus: false, - setAuthStatus: () => {}, -}) + authStatus: false, + setAuthStatus: () => {}, +}); -export const AuthProvider = AuthContext.Provider -export default AuthContext; \ No newline at end of file +export const AuthProvider = AuthContext.Provider; +export default AuthContext; diff --git a/src/Context/Authentication/useAuth.ts b/src/Context/Authentication/useAuth.ts index 4baebfd..0ac1b8d 100644 --- a/src/Context/Authentication/useAuth.ts +++ b/src/Context/Authentication/useAuth.ts @@ -3,8 +3,8 @@ import { useContext } from "react"; import AuthContext from "./authContext"; export const useAuth = () => { - const data = useContext(AuthContext); - return data; -} + const data = useContext(AuthContext); + return data; +}; -export default useAuth; \ No newline at end of file +export default useAuth; diff --git a/src/Context/Connection/socketProvider.tsx b/src/Context/Connection/socketProvider.tsx index de4fe65..fdbd19e 100644 --- a/src/Context/Connection/socketProvider.tsx +++ b/src/Context/Connection/socketProvider.tsx @@ -24,7 +24,8 @@ export const SocketProvider = ({ children }: IProps) => { getURL() { return getURL; }, - }}> + }} + > {children} ); diff --git a/src/Context/UserData/UserData.ts b/src/Context/UserData/UserData.ts index aec9ede..ecd2d82 100644 --- a/src/Context/UserData/UserData.ts +++ b/src/Context/UserData/UserData.ts @@ -11,6 +11,4 @@ export const IUserContext = createContext({ addUser(user) {}, }); - export const useUserContext = () => useContext(IUserContext); - diff --git a/src/Context/Video/useVideo.ts b/src/Context/Video/useVideo.ts index 960e3e3..96f8e01 100644 --- a/src/Context/Video/useVideo.ts +++ b/src/Context/Video/useVideo.ts @@ -2,6 +2,6 @@ import { useContext } from "react"; import VideoContext from "./videoContext"; export const useVideo = () => { - const data = useContext(VideoContext); - return data; -} \ No newline at end of file + const data = useContext(VideoContext); + return data; +}; diff --git a/src/Context/Video/videoContext.ts b/src/Context/Video/videoContext.ts index 63f9bad..e9b5134 100644 --- a/src/Context/Video/videoContext.ts +++ b/src/Context/Video/videoContext.ts @@ -1,14 +1,13 @@ import { createContext } from "react"; - export const VideoContext = createContext<{ - videoStatus: boolean; - setVideoStatus: (status: boolean) => void; + videoStatus: boolean; + setVideoStatus: (status: boolean) => void; }>({ - videoStatus: true, - setVideoStatus: () => {}, -}) + videoStatus: true, + setVideoStatus: () => {}, +}); -export const VideoProvider = VideoContext.Provider +export const VideoProvider = VideoContext.Provider; -export default VideoContext; \ No newline at end of file +export default VideoContext; diff --git a/src/app/(auth)/(protected)/demo/layout.tsx b/src/app/(auth)/(protected)/demo/layout.tsx index f03c1f8..ad028e8 100644 --- a/src/app/(auth)/(protected)/demo/layout.tsx +++ b/src/app/(auth)/(protected)/demo/layout.tsx @@ -12,7 +12,5 @@ export default function RootLayout({ }: { children: React.ReactNode; }) { - return ( -
{children}
- ); + return
{children}
; } diff --git a/src/app/(auth)/(protected)/demo/page.tsx b/src/app/(auth)/(protected)/demo/page.tsx index 6eb829a..9429d50 100644 --- a/src/app/(auth)/(protected)/demo/page.tsx +++ b/src/app/(auth)/(protected)/demo/page.tsx @@ -27,13 +27,11 @@ const Demo = () => { name: "aditya", rid: "123", }; - axios - .post("/api/v1/create", data) - .then((res: any) => { - if (res.status === 200) { - axios.post('api/v1/rtcConnection',data) - } - }); + axios.post("/api/v1/create", data).then((res: any) => { + if (res.status === 200) { + axios.post("api/v1/rtcConnection", data); + } + }); }; return ( diff --git a/src/app/(auth)/(protected)/join/page.tsx b/src/app/(auth)/(protected)/join/page.tsx index eba6538..5422ff4 100644 --- a/src/app/(auth)/(protected)/join/page.tsx +++ b/src/app/(auth)/(protected)/join/page.tsx @@ -79,7 +79,8 @@ const Join = () => {

diff --git a/src/app/(auth)/(protected)/layout.tsx b/src/app/(auth)/(protected)/layout.tsx index 1ed6bbf..599fe59 100644 --- a/src/app/(auth)/(protected)/layout.tsx +++ b/src/app/(auth)/(protected)/layout.tsx @@ -12,7 +12,6 @@ export default function RootLayout({ }: { children: React.ReactNode; }) { - return ( <> {children} diff --git a/src/app/(auth)/(protected)/preview/page.tsx b/src/app/(auth)/(protected)/preview/page.tsx index 43eff79..5fcbbe1 100644 --- a/src/app/(auth)/(protected)/preview/page.tsx +++ b/src/app/(auth)/(protected)/preview/page.tsx @@ -143,20 +143,23 @@ const Preview = () => { Room Id - {roomId}

diff --git a/src/app/(auth)/(protected)/profile/page.tsx b/src/app/(auth)/(protected)/profile/page.tsx index a04aeb7..f4ca08b 100644 --- a/src/app/(auth)/(protected)/profile/page.tsx +++ b/src/app/(auth)/(protected)/profile/page.tsx @@ -52,12 +52,14 @@ const ProfilePage = () => {

diff --git a/src/app/(auth)/(protected)/room/[rid]/page.tsx b/src/app/(auth)/(protected)/room/[rid]/page.tsx index 821c126..9b0fc6d 100644 --- a/src/app/(auth)/(protected)/room/[rid]/page.tsx +++ b/src/app/(auth)/(protected)/room/[rid]/page.tsx @@ -103,7 +103,8 @@ const Room = () => { onClick={toggleMyVideo} className={`px-4 py-2 flex justify-center rounded-md ${ videoStatus ? "bg-red-500" : "bg-green-500" - } mx-2 text-xl`}> + } mx-2 text-xl`} + > {videoStatus ? : } diff --git a/src/app/(auth)/app.css b/src/app/(auth)/app.css index aa25adc..335ee3d 100644 --- a/src/app/(auth)/app.css +++ b/src/app/(auth)/app.css @@ -1,6 +1,6 @@ .landing { - background-image: url('/calls.jpg'); - background-repeat: no-repeat; - background-position: center; - background-size: cover; -} \ No newline at end of file + background-image: url("/calls.jpg"); + background-repeat: no-repeat; + background-position: center; + background-size: cover; +} diff --git a/src/app/(auth)/childLayout.tsx b/src/app/(auth)/childLayout.tsx index b6c13f8..808be26 100644 --- a/src/app/(auth)/childLayout.tsx +++ b/src/app/(auth)/childLayout.tsx @@ -8,20 +8,19 @@ export default function TempLayout({ }: { children: React.ReactNode; }) { - const [authStatus, setAuthStatus] = useState(false); - const [loader, setLoader] = useState(true); - - - useEffect(() => { - appwriteService - .isLoggedIn() - .then(setAuthStatus) - .finally(() => setLoader(false)); - }, []); - - return ( - - {!loader &&
{children}
} -
- ) -} \ No newline at end of file + const [authStatus, setAuthStatus] = useState(false); + const [loader, setLoader] = useState(true); + + useEffect(() => { + appwriteService + .isLoggedIn() + .then(setAuthStatus) + .finally(() => setLoader(false)); + }, []); + + return ( + + {!loader &&
{children}
} +
+ ); +} diff --git a/src/app/(auth)/layout.tsx b/src/app/(auth)/layout.tsx index 59b8e0c..31506db 100644 --- a/src/app/(auth)/layout.tsx +++ b/src/app/(auth)/layout.tsx @@ -11,10 +11,9 @@ export default function RootLayout({ }: { children: React.ReactNode; }) { - return ( <> {children} - ) + ); } diff --git a/src/app/(auth)/login/page.tsx b/src/app/(auth)/login/page.tsx index add63aa..50fa0ef 100644 --- a/src/app/(auth)/login/page.tsx +++ b/src/app/(auth)/login/page.tsx @@ -29,7 +29,8 @@ const Login = () => { Don't Have a account?{" "}

diff --git a/src/app/(auth)/page.tsx b/src/app/(auth)/page.tsx index baa2bc8..bc4f79a 100644 --- a/src/app/(auth)/page.tsx +++ b/src/app/(auth)/page.tsx @@ -1,29 +1,38 @@ -"use client" -import './app.css' -import Link from 'next/link' -import useAuth from '@/Context/Authentication/useAuth' -import { useRouter } from 'next/navigation' -import { useEffect } from 'react' +"use client"; +import "./app.css"; +import Link from "next/link"; +import useAuth from "@/Context/Authentication/useAuth"; +import { useRouter } from "next/navigation"; +import { useEffect } from "react"; export default function Home() { - const router = useRouter(); - const {authStatus} = useAuth(); - useEffect(()=> { - if(authStatus){ - router.replace('/profile') + const { authStatus } = useAuth(); + useEffect(() => { + if (authStatus) { + router.replace("/profile"); } - },[]) + }, []); return (
-
-

EZE Streamz

- +
+

EZE Streamz

+ + + -

Don't Have an account yet? Join us for free 👨🏽‍💻

- +

+ Don't Have an account yet? Join us for free 👨🏽‍💻 +

+ + +
- ) + ); } diff --git a/src/app/(auth)/signup/page.tsx b/src/app/(auth)/signup/page.tsx index 30ff82c..ccdc5d0 100644 --- a/src/app/(auth)/signup/page.tsx +++ b/src/app/(auth)/signup/page.tsx @@ -30,7 +30,8 @@ const Signup = () => { Have a account already?{" "}

diff --git a/src/app/api/v1/temp-create/route.ts b/src/app/api/v1/temp-create/route.ts index e69de29..c544681 100644 --- a/src/app/api/v1/temp-create/route.ts +++ b/src/app/api/v1/temp-create/route.ts @@ -0,0 +1,3 @@ +import {NextRequest,NextResponse} from "next/server"; + + diff --git a/src/app/error.tsx b/src/app/error.tsx index ee08d55..65188ae 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -1,15 +1,17 @@ -'use client' -import React from 'react' +"use client"; +import React from "react"; -const error = ({error, reset}:{error:Error, reset:()=> void}) => { +const error = ({ error, reset }: { error: Error; reset: () => void }) => { return ( <> -
+
{error.message || "Error"} - +
- ) -} + ); +}; -export default error \ No newline at end of file +export default error; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 4f181d2..9e6c610 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -14,10 +14,9 @@ export default function RootLayout({ }: { children: React.ReactNode; }) { - return ( - {children} + {children} ); } diff --git a/src/appwrite-service/config.ts b/src/appwrite-service/config.ts index 4b0b828..a5ca24e 100644 --- a/src/appwrite-service/config.ts +++ b/src/appwrite-service/config.ts @@ -18,7 +18,7 @@ export class AppwriteService { ID.unique(), email, password, - name + name, ); if (userAccount) { return this.login({ email, password }); @@ -62,6 +62,6 @@ export class AppwriteService { } } -const appwriteService = new AppwriteService() +const appwriteService = new AppwriteService(); -export default appwriteService \ No newline at end of file +export default appwriteService; diff --git a/src/components/login.tsx b/src/components/login.tsx index 880781f..0cf4e84 100644 --- a/src/components/login.tsx +++ b/src/components/login.tsx @@ -6,11 +6,11 @@ import useAuth from "@/Context/Authentication/useAuth"; import { useRouter } from "next/navigation"; import { AuthRequiredError } from "@/lib/AuthRequired"; -interface Props{ - setError: Dispatch> +interface Props { + setError: Dispatch>; } -const LoginForm:FC = ({setError}:Props) => { +const LoginForm: FC = ({ setError }: Props) => { const router = useRouter(); const { setAuthStatus } = useAuth(); const [userInput, setInput] = useState({ @@ -28,8 +28,8 @@ const LoginForm:FC = ({setError}:Props) => { }; const loginAction = async () => { - if(userInput.password.length < 8 || userInput.email.length < 8){ - setError("Please Enter valid Credentials") + if (userInput.password.length < 8 || userInput.email.length < 8) { + setError("Please Enter valid Credentials"); return; } @@ -39,7 +39,7 @@ const LoginForm:FC = ({setError}:Props) => { setAuthStatus(true); } } catch (error) { - setError("Invalid Creds") + setError("Invalid Creds"); throw new AuthRequiredError(); } }; @@ -65,7 +65,8 @@ const LoginForm:FC = ({setError}:Props) => { />
diff --git a/src/components/signup.tsx b/src/components/signup.tsx index f1bae01..4c1ccd2 100644 --- a/src/components/signup.tsx +++ b/src/components/signup.tsx @@ -6,11 +6,11 @@ import useAuth from "@/Context/Authentication/useAuth"; import { useRouter } from "next/navigation"; interface Props { - setError: Dispatch> + setError: Dispatch>; } -const SignupForm:FC = ({setError}:Props) => { - const {setAuthStatus} = useAuth(); +const SignupForm: FC = ({ setError }: Props) => { + const { setAuthStatus } = useAuth(); const router = useRouter(); const [userInput, setInput] = useState({ email: "", @@ -31,21 +31,23 @@ const SignupForm:FC = ({setError}:Props) => { } }; - const signUpAction = async() => { - if(userInput.password.length < 8 && userInput.email.length < 7){ - setError("Email and Password too short, Provide Authentic Details") - return + const signUpAction = async () => { + if (userInput.password.length < 8 && userInput.email.length < 7) { + setError("Email and Password too short, Provide Authentic Details"); + return; } - if(userInput.email.length < 7){ - setError("Provide Authentic Email") - return + if (userInput.email.length < 7) { + setError("Provide Authentic Email"); + return; } - if(userInput.password.length < 8){ - setError("Password too short, please enter a valid password with atleast 8 characters") - return + if (userInput.password.length < 8) { + setError( + "Password too short, please enter a valid password with atleast 8 characters", + ); + return; } const res = await appwriteService.createUser(userInput); - if(res){ + if (res) { setAuthStatus(true); router.replace("/"); } @@ -80,7 +82,8 @@ const SignupForm:FC = ({setError}:Props) => { /> diff --git a/src/config-appwrite/config.ts b/src/config-appwrite/config.ts index 6416308..79092a7 100644 --- a/src/config-appwrite/config.ts +++ b/src/config-appwrite/config.ts @@ -1,6 +1,6 @@ const config = { - appwriteUrl: String(process.env.NEXT_PUBLIC_APPWRITE_URL), - appwriteProjectId: String(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID), -} + appwriteUrl: String(process.env.NEXT_PUBLIC_APPWRITE_URL), + appwriteProjectId: String(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID), +}; -export default config; \ No newline at end of file +export default config; diff --git a/src/lib/AuthRequired.tsx b/src/lib/AuthRequired.tsx index eaa3daa..0d2bc59 100644 --- a/src/lib/AuthRequired.tsx +++ b/src/lib/AuthRequired.tsx @@ -1,6 +1,6 @@ export class AuthRequiredError extends Error { - constructor(message = "Invalid Credentials! Please enter valid inputs"){ - super(message) - this.name = "AuthRequiredError" - }; -} \ No newline at end of file + constructor(message = "Invalid Credentials! Please enter valid inputs") { + super(message); + this.name = "AuthRequiredError"; + } +} diff --git a/src/lib/clientSocket.ts b/src/lib/clientSocket.ts index c11d817..c283afb 100644 --- a/src/lib/clientSocket.ts +++ b/src/lib/clientSocket.ts @@ -1,7 +1,5 @@ -import type {IWebSocketInit} from '@/types/socketData' +import type { IWebSocketInit } from "@/types/socketData"; export class clientSocket { - async createClientRTC(data: IWebSocketInit) { - - } -} \ No newline at end of file + async createClientRTC(data: IWebSocketInit) {} +} diff --git a/src/middleware.ts b/src/middleware.ts index c16340a..72a27a3 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -1,15 +1,15 @@ -import { NextResponse } from 'next/server' -import type { NextRequest } from 'next/server'; - -// Todo- Prevent redirect from preview/join route to profile route if Camera is turned on +import { NextResponse } from "next/server"; +import type { NextRequest } from "next/server"; + +// Todo- Prevent redirect from preview/join route to profile route if Camera is turned on // This function can be marked `async` if using `await` inside export function middleware(request: NextRequest) { -// if(request.nextUrl.pathname.startsWith('/profile') && videoStatus){ -// return NextResponse.redirect(new URL('/preview', request.url)) -// } + // if(request.nextUrl.pathname.startsWith('/profile') && videoStatus){ + // return NextResponse.redirect(new URL('/preview', request.url)) + // } } - + // See "Matching Paths" below to learn more export const config = { -// matcher: '/about/:path*', -} \ No newline at end of file + // matcher: '/about/:path*', +}; diff --git a/src/server/clientRTC.ts b/src/server/clientRTC.ts index 9195b51..d135859 100644 --- a/src/server/clientRTC.ts +++ b/src/server/clientRTC.ts @@ -1,5 +1,5 @@ -'use client' -import type {IWebSocketInit} from '@/types/socketData' +"use client"; +import type { IWebSocketInit } from "@/types/socketData"; async function createClientRTC(data: IWebSocketInit) { const ws = new WebSocket("ws://localhost:3001"); @@ -12,7 +12,7 @@ async function createClientRTC(data: IWebSocketInit) { ws.onmessage = (message) => { console.log(`Received message: ${message.data}`); - ws.send("Hello from server") + ws.send("Hello from server"); }; ws.onclose = () => { diff --git a/src/types/IRoomUsers.d.ts b/src/types/IRoomUsers.d.ts index 0ab7f44..63a8eb9 100644 --- a/src/types/IRoomUsers.d.ts +++ b/src/types/IRoomUsers.d.ts @@ -1,7 +1,7 @@ export type IRoomUsers = { - user1? : string; - rid? : string; - user2 ?: string; - emailUser1? : string; - emailUser2 ?: string; -}; \ No newline at end of file + user1?: string; + rid?: string; + user2?: string; + emailUser1?: string; + emailUser2?: string; +}; diff --git a/src/types/appwrite.d.ts b/src/types/appwrite.d.ts index 840046f..f6e103a 100644 --- a/src/types/appwrite.d.ts +++ b/src/types/appwrite.d.ts @@ -1,10 +1,10 @@ export type CreateUser = { - email: string; - password: string; - name: string; -} + email: string; + password: string; + name: string; +}; export type User = { - email: string; - password: string; -} \ No newline at end of file + email: string; + password: string; +}; diff --git a/src/web-socket/socket.ts b/src/web-socket/socket.ts index 2207994..2cafdfd 100644 --- a/src/web-socket/socket.ts +++ b/src/web-socket/socket.ts @@ -8,11 +8,11 @@ const createWebSocket = async () => { const websocket = new server({ httpServer: httpserver, }); - + websocket.on("request", (request) => { connection = request.accept(null, request.origin); }); - return connection + return connection; }; export default createWebSocket; diff --git a/tailwind.config.js b/tailwind.config.js index b102e16..fac17d6 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,19 +1,19 @@ /** @type {import('tailwindcss').Config} */ module.exports = { content: [ - './src/pages/**/*.{js,ts,jsx,tsx,mdx}', - './src/components/**/*.{js,ts,jsx,tsx,mdx}', - './src/app/**/*.{js,ts,jsx,tsx,mdx}', + "./src/pages/**/*.{js,ts,jsx,tsx,mdx}", + "./src/components/**/*.{js,ts,jsx,tsx,mdx}", + "./src/app/**/*.{js,ts,jsx,tsx,mdx}", ], theme: { extend: { backgroundImage: { - 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', - 'gradient-conic': - 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))', - 'homebg': '/calls.jpg' + "gradient-radial": "radial-gradient(var(--tw-gradient-stops))", + "gradient-conic": + "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))", + homebg: "/calls.jpg", }, }, }, plugins: [], -} +};