diff --git a/README.md b/README.md index 855fa662..922274cb 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ The whole SAMA stack can be tested using https://app.samacloud.io public cloud. - In `packages/app`: copy `.env.example` to `.env`. - Generate VAPID keys via `npx web-push generate-vapid-keys` and set Public Key to `VITE_PUBLIC_VAPID_KEY` in `.env` file - `npm install` to install dependencies -- `npm run start -workspace=sama` to run server +- `npm run build --workspace=sama-sdk` to install SAMA api +- `npm run start --workspace=sama` to run server - Access http://localhost:3000 in your browser There are also other components. Make sure to check [Deploying SAMA chat server stack: a comprehensive guide](https://medium.com/sama-communications/deploying-sama-chat-server-stack-a-comprehensive-guide-294ddb9a2d78) diff --git a/apps/client/package.json b/apps/client/package.json index f244deba..ee25fefa 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -17,7 +17,8 @@ "type": "module", "scripts": { "start": "vite", - "build": "vite build" + "build": "vite build", + "preview": "vite preview" }, "dependencies": { "@reduxjs/toolkit": "^1.8.6", @@ -26,7 +27,6 @@ "blurhash": "^2.0.5", "browser-image-compression": "^2.0.2", "framer-motion": "^8.0.2", - "get-browser-fingerprint": "^3.2.0", "heic2any": "^0.0.4", "jsonwebtoken": "^8.5.1", "jwt-decode": "^3.1.2", diff --git a/package-lock.json b/package-lock.json index 04adafc6..4f193fef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,6 @@ "blurhash": "^2.0.5", "browser-image-compression": "^2.0.2", "framer-motion": "^8.0.2", - "get-browser-fingerprint": "^3.2.0", "heic2any": "^0.0.4", "jsonwebtoken": "^8.5.1", "jwt-decode": "^3.1.2", @@ -5596,11 +5595,6 @@ "node": ">=6.9.0" } }, - "node_modules/get-browser-fingerprint": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/get-browser-fingerprint/-/get-browser-fingerprint-3.2.0.tgz", - "integrity": "sha512-EUDjS8nxSGI6ogbGFNkUMCp8bWQKk0Qt7kWVR6Q4aLi6uBuJt3PgqaD2qC0EhgA3GMJF6KNX83uGVUwGpxziNQ==" - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", diff --git a/packages/sdk/src/api/api.ts b/packages/sdk/src/api/api.ts index f244902d..736f559c 100644 --- a/packages/sdk/src/api/api.ts +++ b/packages/sdk/src/api/api.ts @@ -8,7 +8,7 @@ class SAMAClient { private httpEndpoint: string; private curerntUserId: string | null = null; private responsesPromises: Record = {}; - private deviceId: string; + private deviceId: string | null = null; public onMessageListener: ((message: IMessage) => void) | null = null; public onMessageStatusListener: ((status: any) => void) | null = null; @@ -25,7 +25,7 @@ class SAMAClient { constructor({ endpoint: { ws, http } }: { endpoint: { ws: string; http: string } }) { this.wsEndpoint = ws; this.httpEndpoint = http; - this.deviceId = getBrowserFingerprint({ hardwareOnly: true }).toString(); + getBrowserFingerprint({ hardwareOnly: true }).then((device_id) => (this.deviceId = device_id.toString())); } async connect(): Promise {