From 9537880b5bf37f91cae68a86999156f3191ce4a4 Mon Sep 17 00:00:00 2001 From: ImSoZRious <30285202+ImSoZRious@users.noreply.github.com> Date: Sat, 30 Mar 2024 19:17:20 +0700 Subject: [PATCH 1/2] fix: ci --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b871e56..88caf22 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,6 +43,6 @@ jobs: with: push: true context: "{{defaultContext}}:apps/server" - tags: ${{ env.IMAGE_NAME }}:latest + tags: ${{ env.IMAGE_NAME }}:${{ inputs.tag }} cache-from: type=gha,ref=${{ env.IMAGE_NAME }}:buildcache cache-to: type=gha,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max From aa99712de8ba0fc50ca03c3ad64e40a7e022f347 Mon Sep 17 00:00:00 2001 From: Sirawit Chanaburanasak Date: Sat, 30 Mar 2024 19:22:23 +0700 Subject: [PATCH 2/2] feat: use uuid instead of fingerprintjs (#20) * feat: use uuid instead of fingerprintjs * feat: remove fingerprintjs from dependencies --------- Co-authored-by: punpunkeshin05 <97283645+punpunkeshin05@users.noreply.github.com> --- apps/web/package.json | 5 ++-- apps/web/pnpm-lock.yaml | 22 ++++++----------- apps/web/src/app/(screen)/screen/page.tsx | 24 +++++++++---------- .../app/(user)/shake/[university]/page.tsx | 9 +++---- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index f2a5512..d37be63 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -13,15 +13,14 @@ "lint": "next lint" }, "dependencies": { - "@fingerprintjs/fingerprintjs": "^4.2.2", "axios": "^1.6.8", "js-cookie": "^3.0.5", "next": "14.1.4", "react": "^18", "react-dom": "^18", "socket.io-client": "^4.7.5", - "uuid": "^9.0.1", - "universal-cookie": "^7.1.0" + "universal-cookie": "^7.1.0", + "uuid": "^9.0.1" }, "devDependencies": { "@types/js-cookie": "^3.0.6", diff --git a/apps/web/pnpm-lock.yaml b/apps/web/pnpm-lock.yaml index fba1781..189a5cb 100644 --- a/apps/web/pnpm-lock.yaml +++ b/apps/web/pnpm-lock.yaml @@ -5,9 +5,6 @@ settings: excludeLinksFromLockfile: false dependencies: - '@fingerprintjs/fingerprintjs': - specifier: ^4.2.2 - version: 4.2.2 axios: specifier: ^1.6.8 version: 1.6.8 @@ -26,12 +23,12 @@ dependencies: socket.io-client: specifier: ^4.7.5 version: 4.7.5 - uuid: - specifier: ^9.0.1 - version: 9.0.1 universal-cookie: specifier: ^7.1.0 version: 7.1.0 + uuid: + specifier: ^9.0.1 + version: 9.0.1 devDependencies: '@types/js-cookie': @@ -69,12 +66,6 @@ packages: engines: {node: '>=10'} dev: true - /@fingerprintjs/fingerprintjs@4.2.2: - resolution: {integrity: sha512-scD+pDgNZW78LuFAr7ms2yxmDx2NWC4+K5iiOjPT2ZlTlHFbLsORUzLJI2rcKicxxLtHbvf3A7BU1drVr4iHGg==} - dependencies: - tslib: 2.6.2 - dev: false - /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -240,13 +231,14 @@ packages: tslib: 2.6.2 dev: false - /@types/js-cookie@3.0.6: - resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==} - dev: true /@types/cookie@0.6.0: resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==} dev: false + /@types/js-cookie@3.0.6: + resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==} + dev: true + /@types/node@20.11.30: resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==} dependencies: diff --git a/apps/web/src/app/(screen)/screen/page.tsx b/apps/web/src/app/(screen)/screen/page.tsx index 3c9f283..3c76fa8 100644 --- a/apps/web/src/app/(screen)/screen/page.tsx +++ b/apps/web/src/app/(screen)/screen/page.tsx @@ -4,10 +4,11 @@ import { useEffect, useState } from "react"; import OverLay from "./components/Overlay"; import Display from "./components/Display"; import Cookies from "universal-cookie"; -import FingerprintJS from "@fingerprintjs/fingerprintjs"; import { Socket, io } from "socket.io-client"; +import { v4 as uuidv4 } from 'uuid'; const Screen = () => { + let fid: string | null = null; const [showedPage, setShowPage] = useState<"overlay" | "display">("overlay"); const [ data, setData ] = useState({ status: "waiting", @@ -61,20 +62,17 @@ const Screen = () => { }; (async () => { - const savedCid = cookies.get('cid'); - - if(!cookies.get('fid')){ - const fp = await FingerprintJS.load(); - const result = await fp.get(); - const fid = result.visitorId; - cookies.set('fid', fid) + fid = cookies.get('fid'); + if (!fid) { + fid = uuidv4(); + cookies.set('fid', fid); } - - const fid = cookies.get('fid') - + + const savedCid = cookies.get('cid'); + const extraHeaders: { [key: string]: string } = { - fid: fid, - name: 'pun1' + fid: fid || '', + name: 'john' }; if (savedCid) { diff --git a/apps/web/src/app/(user)/shake/[university]/page.tsx b/apps/web/src/app/(user)/shake/[university]/page.tsx index 9032edd..ac9d678 100644 --- a/apps/web/src/app/(user)/shake/[university]/page.tsx +++ b/apps/web/src/app/(user)/shake/[university]/page.tsx @@ -7,9 +7,8 @@ import ShakeComponent from '../../../../components/Shake'; import { useParams, useSearchParams } from "next/navigation"; import { Suspense } from 'react'; import { io, Socket } from "socket.io-client"; -import FingerprintJS from '@fingerprintjs/fingerprintjs'; import Cookies from 'universal-cookie'; - +import { v4 as uuidv4 } from 'uuid'; let shaking: { x: number; y: number; z: number } | undefined; function normalize(x: number, y: number, z: number) { @@ -55,9 +54,7 @@ export default function Shake() { (async () => { fid = cookies.get('fid'); if (!fid) { - const fp = await FingerprintJS.load(); - const result = await fp.get(); - fid = result.visitorId; + fid = uuidv4(); cookies.set('fid', fid); } @@ -65,7 +62,7 @@ export default function Shake() { const savedCid = cookies.get('cid'); const extraHeaders: { [key: string]: string } = { - fid: fid, + fid: fid || '', name: 'john' };