From 8b38f8ec6b09b2ffaad5ddd7c05fdff31f09fed8 Mon Sep 17 00:00:00 2001 From: Pouria Delfanazari Date: Mon, 18 Dec 2023 13:00:31 -0800 Subject: [PATCH 1/4] Update post search to the new atproto method --- package-lock.json | 527 +------------------------------- package.json | 1 - src/lib/api/bsky/actor/index.ts | 22 +- 3 files changed, 9 insertions(+), 541 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1940512c..1e2b6527 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,6 @@ "react-dropzone": "^14.2.3", "react-hot-toast": "^2.4.1", "react-intersection-observer": "^9.5.3", - "sharp": "^0.33.1", "tailwindcss-animate": "^1.0.7", "tinyld": "^1.3.4", "use-clipboard-copy": "^0.2.0", @@ -146,15 +145,6 @@ "node": ">=6.9.0" } }, - "node_modules/@emnapi/runtime": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-0.44.0.tgz", - "integrity": "sha512-ZX/etZEZw8DR7zAB1eVQT40lNo0jeqpb6dCgOvctB6FIQ5PoXfMuNY8+ayQfu8tNQbAB8gQWSSJupR8NxeiZXw==", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, "node_modules/@emoji-mart/data": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@emoji-mart/data/-/data-1.1.2.tgz", @@ -313,437 +303,6 @@ "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", "dev": true }, - "node_modules/@img/sharp-darwin-arm64": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.1.tgz", - "integrity": "sha512-esr2BZ1x0bo+wl7Gx2hjssYhjrhUsD88VQulI0FrG8/otRQUOxLWHMBd1Y1qo2Gfg2KUvXNpT0ASnV9BzJCexw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.0.0" - } - }, - "node_modules/@img/sharp-darwin-x64": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.1.tgz", - "integrity": "sha512-YrnuB3bXuWdG+hJlXtq7C73lF8ampkhU3tMxg5Hh+E7ikxbUVOU9nlNtVTloDXz6pRHt2y2oKJq7DY/yt+UXYw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-x64": "1.0.0" - } - }, - "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.0.tgz", - "integrity": "sha512-VzYd6OwnUR81sInf3alj1wiokY50DjsHz5bvfnsFpxs5tqQxESoHtJO6xyksDs3RIkyhMWq2FufXo6GNSU9BMw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "macos": ">=11", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-darwin-x64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.0.tgz", - "integrity": "sha512-dD9OznTlHD6aovRswaPNEy8dKtSAmNo4++tO7uuR4o5VxbVAOoEQ1uSmN4iFAdQneTHws1lkTZeiXPrcCkh6IA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "macos": ">=10.13", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.0.tgz", - "integrity": "sha512-VwgD2eEikDJUk09Mn9Dzi1OW2OJFRQK+XlBTkUNmAWPrtj8Ly0yq05DFgu1VCMx2/DqCGQVi5A1dM9hTmxf3uw==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.28", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.0.tgz", - "integrity": "sha512-xTYThiqEZEZc0PRU90yVtM3KE7lw1bKdnDQ9kCTHWbqWyHOe4NpPOtMGy27YnN51q0J5dqRrvicfPbALIOeAZA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-s390x": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.0.tgz", - "integrity": "sha512-o9E46WWBC6JsBlwU4QyU9578G77HBDT1NInd+aERfxeOPbk0qBZHgoDsQmA2v9TbqJRWzoBPx1aLOhprBMgPjw==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.28", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-x64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.0.tgz", - "integrity": "sha512-naldaJy4hSVhWBgEjfdBY85CAa4UO+W1nx6a1sWStHZ7EUfNiuBTTN2KUYT5dH1+p/xij1t2QSXfCiFJoC5S/Q==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-arm64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.0.tgz", - "integrity": "sha512-OdorplCyvmSAPsoJLldtLh3nLxRrkAAAOHsGWGDYfN0kh730gifK+UZb3dWORRa6EusNqCTjfXV4GxvgJ/nPDQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "musl": ">=1.2.2", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-x64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.0.tgz", - "integrity": "sha512-FW8iK6rJrg+X2jKD0Ajhjv6y74lToIBEvkZhl42nZt563FfxkCYacrXZtd+q/sRQDypQLzY5WdLkVTbJoPyqNg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "musl": ">=1.2.2", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-linux-arm": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.1.tgz", - "integrity": "sha512-Ii4X1vnzzI4j0+cucsrYA5ctrzU9ciXERfJR633S2r39CiD8npqH2GMj63uFZRCFt3E687IenAdbwIpQOJ5BNA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.28", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm": "1.0.0" - } - }, - "node_modules/@img/sharp-linux-arm64": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.1.tgz", - "integrity": "sha512-59B5GRO2d5N3tIfeGHAbJps7cLpuWEQv/8ySd9109ohQ3kzyCACENkFVAnGPX00HwPTQcaBNF7HQYEfZyZUFfw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm64": "1.0.0" - } - }, - "node_modules/@img/sharp-linux-s390x": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.1.tgz", - "integrity": "sha512-tRGrb2pHnFUXpOAj84orYNxHADBDIr0J7rrjwQrTNMQMWA4zy3StKmMvwsI7u3dEZcgwuMMooIIGWEWOjnmG8A==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.28", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-s390x": "1.0.0" - } - }, - "node_modules/@img/sharp-linux-x64": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.1.tgz", - "integrity": "sha512-4y8osC0cAc1TRpy02yn5omBeloZZwS62fPZ0WUAYQiLhSFSpWJfY/gMrzKzLcHB9ulUV6ExFiu2elMaixKDbeg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "glibc": ">=2.26", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-x64": "1.0.0" - } - }, - "node_modules/@img/sharp-linuxmusl-arm64": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.1.tgz", - "integrity": "sha512-D3lV6clkqIKUizNS8K6pkuCKNGmWoKlBGh5p0sLO2jQERzbakhu4bVX1Gz+RS4vTZBprKlWaf+/Rdp3ni2jLfA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "musl": ">=1.2.2", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-arm64": "1.0.0" - } - }, - "node_modules/@img/sharp-linuxmusl-x64": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.1.tgz", - "integrity": "sha512-LOGKNu5w8uu1evVqUAUKTix2sQu1XDRIYbsi5Q0c/SrXhvJ4QyOx+GaajxmOg5PZSsSnCYPSmhjHHsRBx06/wQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "musl": ">=1.2.2", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-x64": "1.0.0" - } - }, - "node_modules/@img/sharp-wasm32": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.1.tgz", - "integrity": "sha512-vWI/sA+0p+92DLkpAMb5T6I8dg4z2vzCUnp8yvxHlwBpzN8CIcO3xlSXrLltSvK6iMsVMNswAv+ub77rsf25lA==", - "cpu": [ - "wasm32" - ], - "optional": true, - "dependencies": { - "@emnapi/runtime": "^0.44.0" - }, - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-win32-ia32": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.1.tgz", - "integrity": "sha512-/xhYkylsKL05R+NXGJc9xr2Tuw6WIVl2lubFJaFYfW4/MQ4J+dgjIo/T4qjNRizrqs/szF/lC9a5+updmY9jaQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-win32-x64": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.1.tgz", - "integrity": "sha512-XaM69X0n6kTEsp9tVYYLhXdg7Qj32vYJlAKRutxUsm1UlgQNx6BOhHwZPwukCGXBU2+tH87ip2eV1I/E8MQnZg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0", - "npm": ">=9.6.5", - "pnpm": ">=7.1.0", - "yarn": ">=3.2.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -2975,22 +2534,11 @@ } ] }, - "node_modules/color": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", - "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", - "dependencies": { - "color-convert": "^2.0.1", - "color-string": "^1.9.0" - }, - "engines": { - "node": ">=12.5.0" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -3001,16 +2549,8 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/color-string": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", - "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", - "dependencies": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/commander": { "version": "4.1.1", @@ -3150,14 +2690,6 @@ "node": ">=6" } }, - "node_modules/detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", - "engines": { - "node": ">=8" - } - }, "node_modules/detect-node-es": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", @@ -4310,11 +3842,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" - }, "node_modules/is-async-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", @@ -6168,6 +5695,7 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -6212,45 +5740,6 @@ "node": ">= 0.4" } }, - "node_modules/sharp": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.1.tgz", - "integrity": "sha512-iAYUnOdTqqZDb3QjMneBKINTllCJDZ3em6WaWy7NPECM4aHncvqHRm0v0bN9nqJxMiwamv5KIdauJ6lUzKDpTQ==", - "hasInstallScript": true, - "dependencies": { - "color": "^4.2.3", - "detect-libc": "^2.0.2", - "semver": "^7.5.4" - }, - "engines": { - "libvips": ">=8.15.0", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.33.1", - "@img/sharp-darwin-x64": "0.33.1", - "@img/sharp-libvips-darwin-arm64": "1.0.0", - "@img/sharp-libvips-darwin-x64": "1.0.0", - "@img/sharp-libvips-linux-arm": "1.0.0", - "@img/sharp-libvips-linux-arm64": "1.0.0", - "@img/sharp-libvips-linux-s390x": "1.0.0", - "@img/sharp-libvips-linux-x64": "1.0.0", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.0", - "@img/sharp-libvips-linuxmusl-x64": "1.0.0", - "@img/sharp-linux-arm": "0.33.1", - "@img/sharp-linux-arm64": "0.33.1", - "@img/sharp-linux-s390x": "0.33.1", - "@img/sharp-linux-x64": "0.33.1", - "@img/sharp-linuxmusl-arm64": "0.33.1", - "@img/sharp-linuxmusl-x64": "0.33.1", - "@img/sharp-wasm32": "0.33.1", - "@img/sharp-win32-ia32": "0.33.1", - "@img/sharp-win32-x64": "0.33.1" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -6286,14 +5775,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/simple-swizzle": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", - "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", - "dependencies": { - "is-arrayish": "^0.3.1" - } - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", diff --git a/package.json b/package.json index f5e4d2e7..9f22a620 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "react-dropzone": "^14.2.3", "react-hot-toast": "^2.4.1", "react-intersection-observer": "^9.5.3", - "sharp": "^0.33.1", "tailwindcss-animate": "^1.0.7", "tinyld": "^1.3.4", "use-clipboard-copy": "^0.2.0", diff --git a/src/lib/api/bsky/actor/index.ts b/src/lib/api/bsky/actor/index.ts index d5e57ca6..d32e83fe 100644 --- a/src/lib/api/bsky/actor/index.ts +++ b/src/lib/api/bsky/actor/index.ts @@ -6,10 +6,7 @@ import { BskyThreadViewPreference, } from "@atproto/api"; import { getAgent } from "../agent"; -import { - ContentFilterLabel, - FeedSearchResult, -} from "../../../../../types/feed"; +import { ContentFilterLabel } from "../../../../../types/feed"; export const getProfile = async ( handle: string | undefined, @@ -62,20 +59,11 @@ export const searchProfilesTypehead = async ( export const searchPosts = async (term: string, agent?: BskyAgent) => { if (!agent) agent = await getAgent(); try { - const response = await fetch( - `https://search.bsky.social/search/posts?q=${term}` - ); - if (response.ok) { - const results: FeedSearchResult[] = await response.json(); - if (results.length === 0) return []; - - const uris = results.map( - (result) => `at://${result.user.did}/${result.tid}` - ); + const response = await agent.app.bsky.feed.searchPosts({ q: term }); + if (response.success) { + if (response.data.length === 0) return []; - // 25 is max limit for getPosts by BlueSky - const postResponse = await agent.getPosts({ uris: uris.slice(0, 25) }); - const posts: AppBskyFeedDefs.PostView[] = postResponse.data.posts; + const posts: AppBskyFeedDefs.PostView[] = response.data.posts; return posts; } } catch (e) { From dd7e922c4cc0884007333292e7b4b2824cb0f05f Mon Sep 17 00:00:00 2001 From: Pouria Delfanazari Date: Mon, 18 Dec 2023 13:39:59 -0800 Subject: [PATCH 2/4] Add infinite query to post search, refactor search into containers --- .../searchList/PostsSearchList.tsx | 49 ----------- .../contentDisplay/searchList/SearchList.tsx | 8 +- src/containers/search/PostSearchContainer.tsx | 84 +++++++++++++++++++ .../search/UserSearchContainer.tsx} | 28 ++++--- src/lib/api/bsky/actor/index.ts | 18 ++-- 5 files changed, 114 insertions(+), 73 deletions(-) delete mode 100644 src/components/contentDisplay/searchList/PostsSearchList.tsx create mode 100644 src/containers/search/PostSearchContainer.tsx rename src/{components/contentDisplay/searchList/UsersSearchList.tsx => containers/search/UserSearchContainer.tsx} (78%) diff --git a/src/components/contentDisplay/searchList/PostsSearchList.tsx b/src/components/contentDisplay/searchList/PostsSearchList.tsx deleted file mode 100644 index 7c1f8b25..00000000 --- a/src/components/contentDisplay/searchList/PostsSearchList.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { searchPosts } from "@/lib/api/bsky/actor"; -import useAgent from "@/lib/hooks/bsky/useAgent"; -import { useQuery } from "@tanstack/react-query"; -import FeedPostSkeleton from "../feedPost/FeedPostSkeleton"; -import { Fragment } from "react"; -import EndOfFeed from "@/components/feedback/endOfFeed/EndOfFeed"; -import SearchPost from "../searchPost/SearchPost"; -import FeedAlert from "@/components/feedback/feedAlert/FeedAlert"; - -interface Props { - query: string; -} - -export default function PostsSearchList(props: Props) { - const { query } = props; - const decoded = decodeURIComponent(query); - const agent = useAgent(); - - const { - status, - data: posts, - error, - isLoading, - isFetching, - } = useQuery({ - queryKey: ["searchPosts", decoded], - queryFn: () => searchPosts(decoded, agent), - }); - - return ( - <> - {isFetching && } -
- {posts && - posts.map((post, i) => ( - - - - ))} -
- {posts && posts.length === 0 && ( -
- -
- )} - {posts && posts.length > 0 && } - - ); -} diff --git a/src/components/contentDisplay/searchList/SearchList.tsx b/src/components/contentDisplay/searchList/SearchList.tsx index ef8d2b94..6b3c3d62 100644 --- a/src/components/contentDisplay/searchList/SearchList.tsx +++ b/src/components/contentDisplay/searchList/SearchList.tsx @@ -1,8 +1,8 @@ "use client"; import { useState } from "react"; -import UsersSearchList from "./UsersSearchList"; -import PostsSearchList from "./PostsSearchList"; +import PostSearchContainer from "@/containers/search/PostSearchContainer"; +import UserSearchContainer from "@/containers/search/UserSearchContainer"; interface Props { query: string; @@ -47,8 +47,8 @@ export default function SearchList(props: Props) { - {currenTab === "posts" && } - {currenTab === "users" && } + {currenTab === "posts" && } + {currenTab === "users" && } ); } diff --git a/src/containers/search/PostSearchContainer.tsx b/src/containers/search/PostSearchContainer.tsx new file mode 100644 index 00000000..9390e135 --- /dev/null +++ b/src/containers/search/PostSearchContainer.tsx @@ -0,0 +1,84 @@ +import { searchPosts } from "@/lib/api/bsky/actor"; +import useAgent from "@/lib/hooks/bsky/useAgent"; +import { useInfiniteQuery } from "@tanstack/react-query"; +import { Fragment, useEffect } from "react"; +import EndOfFeed from "@/components/feedback/endOfFeed/EndOfFeed"; +import FeedAlert from "@/components/feedback/feedAlert/FeedAlert"; +import FeedPostSkeleton from "@/components/contentDisplay/feedPost/FeedPostSkeleton"; +import SearchPost from "@/components/contentDisplay/searchPost/SearchPost"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import { useInView } from "react-intersection-observer"; + +interface Props { + query: string; +} + +export default function PostSearchContainer(props: Props) { + const { query } = props; + const decoded = decodeURIComponent(query); + const agent = useAgent(); + + const { + status, + data: posts, + error, + isLoading, + isFetching, + isFetchingNextPage, + hasNextPage, + fetchNextPage, + } = useInfiniteQuery({ + queryKey: ["searchPosts", decoded], + queryFn: ({ pageParam }) => searchPosts(decoded, pageParam, agent), + initialPageParam: "", + getNextPageParam: (lastPage) => lastPage?.data.cursor, + }); + + const isEmpty = + !isFetching && + !isFetchingNextPage && + posts?.pages[0]?.data?.posts?.length === 0; + + const { ref: observerRef, inView } = useInView(); + + useEffect(() => { + if (inView) { + fetchNextPage(); + } + }, [fetchNextPage, inView]); + + return ( + <> + {isFetching && } +
+ {posts?.pages + .flatMap((page) => page?.data.posts) + .map((post, i) => ( + + {post && } + + ))} +
+ {isEmpty && !hasNextPage && ( +
+ +
+ )} + {isFetching && !isFetchingNextPage && } + {isFetchingNextPage && ( +
+ +
+ )} + {error && ( + + )} + {!isEmpty && + !error && + !isFetching && + !hasNextPage && + !isFetchingNextPage && } +
+ + ); +} diff --git a/src/components/contentDisplay/searchList/UsersSearchList.tsx b/src/containers/search/UserSearchContainer.tsx similarity index 78% rename from src/components/contentDisplay/searchList/UsersSearchList.tsx rename to src/containers/search/UserSearchContainer.tsx index cc52f3a0..2586e416 100644 --- a/src/components/contentDisplay/searchList/UsersSearchList.tsx +++ b/src/containers/search/UserSearchContainer.tsx @@ -3,21 +3,21 @@ import { searchProfiles } from "@/lib/api/bsky/actor"; import useAgent from "@/lib/hooks/bsky/useAgent"; import { useInfiniteQuery } from "@tanstack/react-query"; -import ProfileCard from "../profileCard/ProfileCard"; import { Fragment, useEffect } from "react"; -import ProfileCardSkeleton from "../profileCard/ProfileCardSkeleton"; import { useInView } from "react-intersection-observer"; import { Icon } from "@iconify/react/dist/iconify.js"; import FeedAlert from "@/components/feedback/feedAlert/FeedAlert"; +import ProfileCard from "@/components/contentDisplay/profileCard/ProfileCard"; +import ProfileCardSkeleton from "@/components/contentDisplay/profileCard/ProfileCardSkeleton"; interface Props { query: string; } -export default function UsersSearchList(props: Props) { +export default function UserSearchContainer(props: Props) { const { query } = props; const agent = useAgent(); - const { ref, inView } = useInView(); + const { ref: observerRef, inView } = useInView(); const { status, @@ -35,6 +35,11 @@ export default function UsersSearchList(props: Props) { getNextPageParam: (lastPage) => lastPage?.cursor, }); + const isEmpty = + !isFetching && + !isFetchingNextPage && + profiles?.pages[0]?.actors?.length === 0; + useEffect(() => { if (inView) { fetchNextPage(); @@ -59,6 +64,11 @@ export default function UsersSearchList(props: Props) { ))} + {isEmpty && ( +
+ +
+ )} {isFetching && !isFetchingNextPage && ( )} @@ -67,15 +77,7 @@ export default function UsersSearchList(props: Props) { )} -
- {profiles?.pages[0]?.actors.length === 0 && ( -
- -
- )} +
); } diff --git a/src/lib/api/bsky/actor/index.ts b/src/lib/api/bsky/actor/index.ts index d32e83fe..c310a24a 100644 --- a/src/lib/api/bsky/actor/index.ts +++ b/src/lib/api/bsky/actor/index.ts @@ -56,15 +56,19 @@ export const searchProfilesTypehead = async ( } }; -export const searchPosts = async (term: string, agent?: BskyAgent) => { +export const searchPosts = async ( + term: string, + cursor: string, + agent?: BskyAgent +) => { if (!agent) agent = await getAgent(); try { - const response = await agent.app.bsky.feed.searchPosts({ q: term }); - if (response.success) { - if (response.data.length === 0) return []; - - const posts: AppBskyFeedDefs.PostView[] = response.data.posts; - return posts; + const response = await agent.app.bsky.feed.searchPosts({ + q: term, + cursor: cursor, + }); + if (response.success) { + return response; } } catch (e) { console.error(e); From 5989d137710fc47a56acd6f80d5d5a857056bea3 Mon Sep 17 00:00:00 2001 From: Pouria Delfanazari Date: Mon, 18 Dec 2023 15:52:12 -0800 Subject: [PATCH 3/4] Fix issue where deleted post isn't shown on thread and results into an infinite loop And refactor embeds so they don't have inherent margin values, unless they're replies --- src/app/providers/query.tsx | 1 + .../dataDisplay/postEmbed/BlockedEmbed.tsx | 11 ++++++++-- .../dataDisplay/postEmbed/NotFoundEmbed.tsx | 13 +++++++++--- .../dataDisplay/postEmbed/RecordEmbed.tsx | 12 +++++++++-- src/containers/thread/PostThreadContainer.tsx | 11 +++++----- src/lib/api/bsky/feed/index.ts | 2 +- src/lib/hooks/bsky/feed/useOrganizeThread.tsx | 21 +++++++------------ types/feed.ts | 12 ++++++++++- 8 files changed, 55 insertions(+), 28 deletions(-) diff --git a/src/app/providers/query.tsx b/src/app/providers/query.tsx index 61a815b5..24136b37 100644 --- a/src/app/providers/query.tsx +++ b/src/app/providers/query.tsx @@ -18,6 +18,7 @@ export default function QueryProvider({ // With SSR, we usually want to set some default staleTime // above 0 to avoid refetching immediately on the client staleTime: 60 * 1000, + retry: false, }, }, }) diff --git a/src/components/dataDisplay/postEmbed/BlockedEmbed.tsx b/src/components/dataDisplay/postEmbed/BlockedEmbed.tsx index bb695fec..fb11e306 100644 --- a/src/components/dataDisplay/postEmbed/BlockedEmbed.tsx +++ b/src/components/dataDisplay/postEmbed/BlockedEmbed.tsx @@ -2,21 +2,28 @@ import { Icon } from "@iconify/react/dist/iconify.js"; interface Props { depth: number; + isReply?: boolean; } export default function BlockedEmbed(props: Props) { - const { depth } = props; + const { depth = 0, isReply = false } = props; + const replyStyle = isReply && "mb-6"; return ( <> {depth < 1 && ( -
+
Post is from a blocked user or someone who has blocked you.
+ {isReply && ( +
+ )}
)} diff --git a/src/components/dataDisplay/postEmbed/NotFoundEmbed.tsx b/src/components/dataDisplay/postEmbed/NotFoundEmbed.tsx index da7d7604..bd15640c 100644 --- a/src/components/dataDisplay/postEmbed/NotFoundEmbed.tsx +++ b/src/components/dataDisplay/postEmbed/NotFoundEmbed.tsx @@ -2,19 +2,26 @@ import { Icon } from "@iconify/react/dist/iconify.js"; interface Props { depth: number; + isReply?: boolean; } export default function NotFoundEmbed(props: Props) { - const { depth } = props; + const { depth = 0, isReply = false } = props; + const replyStyle = isReply && "mb-6"; return ( <> {depth < 1 && ( -
+
- Post cannot be found + Deleted post
+ {isReply && ( +
+ )}
)} diff --git a/src/components/dataDisplay/postEmbed/RecordEmbed.tsx b/src/components/dataDisplay/postEmbed/RecordEmbed.tsx index add6a2e0..e017e8b2 100644 --- a/src/components/dataDisplay/postEmbed/RecordEmbed.tsx +++ b/src/components/dataDisplay/postEmbed/RecordEmbed.tsx @@ -23,8 +23,16 @@ export default function RecordEmbed(props: Props) { return (
- {isBlocked && } - {notFound && } + {isBlocked && ( +
+ +
+ )} + {notFound && ( +
+ +
+ )} {media && } {isViewable && depth < 1 && (
)} @@ -98,15 +99,15 @@ export default function PostThreadContainer(props: Props) { {parentChain && parentChain.length > 0 && (
{parentChain.map((parent, i) => ( -
+
{AppBskyFeedDefs.isBlockedPost(parent) && ( - + )} {AppBskyFeedDefs.isNotFoundPost(parent) && ( - + )} {AppBskyFeedDefs.isBlockedAuthor(parent) && ( - + )} {AppBskyFeedDefs.isThreadViewPost(parent) && contentFilter && ( diff --git a/src/lib/api/bsky/feed/index.ts b/src/lib/api/bsky/feed/index.ts index 4f721b53..519a77a6 100644 --- a/src/lib/api/bsky/feed/index.ts +++ b/src/lib/api/bsky/feed/index.ts @@ -228,7 +228,7 @@ export const getPostThread = async (agent: BskyAgent, uri: string) => { const posts = await agent.getPostThread({ uri: uri }); return posts.data.thread; } catch (e) { - throw new Error("Could not fetch post thread"); + throw e; } }; diff --git a/src/lib/hooks/bsky/feed/useOrganizeThread.tsx b/src/lib/hooks/bsky/feed/useOrganizeThread.tsx index 50908403..fbe51cd5 100644 --- a/src/lib/hooks/bsky/feed/useOrganizeThread.tsx +++ b/src/lib/hooks/bsky/feed/useOrganizeThread.tsx @@ -1,15 +1,8 @@ import { AppBskyFeedDefs } from "@atproto/api"; +import { Thread } from "../../../../../types/feed"; interface Props { - thread: - | AppBskyFeedDefs.ThreadViewPost - | AppBskyFeedDefs.NotFoundPost - | AppBskyFeedDefs.BlockedPost - | { - [k: string]: unknown; - $type: string; - } - | undefined; + thread: Thread; } export default function useOrganizeThread(props: Props) { @@ -45,13 +38,13 @@ export default function useOrganizeThread(props: Props) { return currentChain; }; - const getParentChain = (post: AppBskyFeedDefs.ThreadViewPost) => { - const chain: AppBskyFeedDefs.ThreadViewPost[] = []; + const getParentChain = (post: Thread) => { + const chain: Thread[] = []; let currentPost = post; while (currentPost && currentPost.parent) { - if (AppBskyFeedDefs.isThreadViewPost(currentPost.parent)) { - chain.push(currentPost.parent); - currentPost = currentPost.parent; + if (currentPost.parent) { + chain.push(currentPost.parent as Thread); + currentPost = currentPost.parent as Thread; } } return chain.reverse(); diff --git a/types/feed.ts b/types/feed.ts index f79710c6..bd5633b4 100644 --- a/types/feed.ts +++ b/types/feed.ts @@ -1,4 +1,4 @@ -import {} from "@atproto/api"; +import { AppBskyFeedDefs } from "@atproto/api"; import { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; import { GeneratorView } from "@atproto/api/dist/client/types/app/bsky/feed/defs"; import { Notification } from "@atproto/api/dist/client/types/app/bsky/notification/listNotifications"; @@ -71,3 +71,13 @@ export type PreferencesResult = { feedFilter: FeedFilterResult; threadPreferences: ThreadViewResult; }; + +export type Thread = + | AppBskyFeedDefs.ThreadViewPost + | AppBskyFeedDefs.NotFoundPost + | AppBskyFeedDefs.BlockedPost + | { + [k: string]: unknown; + $type: string; + } + | undefined; From 5bc7df1463fdc03d21dcd5be7371ff77a99085ec Mon Sep 17 00:00:00 2001 From: Pouria Delfanazari Date: Mon, 18 Dec 2023 16:26:21 -0800 Subject: [PATCH 4/4] Refactor searchPosts, remove refetch on focus for post search --- src/containers/FeedContainer.tsx | 3 ++- src/containers/search/PostSearchContainer.tsx | 15 ++++++--------- src/lib/api/bsky/actor/index.ts | 3 ++- src/lib/hooks/bsky/feed/useFeed.tsx | 1 - 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/containers/FeedContainer.tsx b/src/containers/FeedContainer.tsx index 0ee3b88b..a853712a 100644 --- a/src/containers/FeedContainer.tsx +++ b/src/containers/FeedContainer.tsx @@ -28,6 +28,7 @@ export default function FeedContainer(props: Props) { isFetchingFeedNextPage, feedHasNextPage, } = useFeed(feed); + const isEmpty = !isFetchingFeed && !isFetchingFeedNextPage && @@ -42,7 +43,7 @@ export default function FeedContainer(props: Props) { { window.scrollTo({ top: 0, behavior: "smooth" }); - refetchFeed(); + refetchFeed(); }} /> diff --git a/src/containers/search/PostSearchContainer.tsx b/src/containers/search/PostSearchContainer.tsx index 9390e135..b76db29e 100644 --- a/src/containers/search/PostSearchContainer.tsx +++ b/src/containers/search/PostSearchContainer.tsx @@ -28,16 +28,14 @@ export default function PostSearchContainer(props: Props) { hasNextPage, fetchNextPage, } = useInfiniteQuery({ - queryKey: ["searchPosts", decoded], + queryKey: ["searchPosts", query], queryFn: ({ pageParam }) => searchPosts(decoded, pageParam, agent), initialPageParam: "", - getNextPageParam: (lastPage) => lastPage?.data.cursor, + getNextPageParam: (lastPage) => lastPage?.cursor, }); const isEmpty = - !isFetching && - !isFetchingNextPage && - posts?.pages[0]?.data?.posts?.length === 0; + !isFetching && !isFetchingNextPage && posts?.pages[0]?.posts?.length === 0; const { ref: observerRef, inView } = useInView(); @@ -48,11 +46,10 @@ export default function PostSearchContainer(props: Props) { }, [fetchNextPage, inView]); return ( - <> - {isFetching && } +
{posts?.pages - .flatMap((page) => page?.data.posts) + .flatMap((page) => page?.posts) .map((post, i) => ( {post && } @@ -79,6 +76,6 @@ export default function PostSearchContainer(props: Props) { !hasNextPage && !isFetchingNextPage && }
- +
); } diff --git a/src/lib/api/bsky/actor/index.ts b/src/lib/api/bsky/actor/index.ts index c310a24a..74e972ee 100644 --- a/src/lib/api/bsky/actor/index.ts +++ b/src/lib/api/bsky/actor/index.ts @@ -66,9 +66,10 @@ export const searchPosts = async ( const response = await agent.app.bsky.feed.searchPosts({ q: term, cursor: cursor, + limit: 25, }); if (response.success) { - return response; + return response.data; } } catch (e) { console.error(e); diff --git a/src/lib/hooks/bsky/feed/useFeed.tsx b/src/lib/hooks/bsky/feed/useFeed.tsx index e23d9c5f..eef676f1 100644 --- a/src/lib/hooks/bsky/feed/useFeed.tsx +++ b/src/lib/hooks/bsky/feed/useFeed.tsx @@ -28,7 +28,6 @@ export default function useFeed(feed: string) { : getFeed(agent, feed, pageParam), initialPageParam: "", getNextPageParam: (lastPage) => lastPage.data.cursor, - refetchOnWindowFocus: false, }); useEffect(() => {