From 5be11538ca9bac7381d0fde60f83ead8aaa3a4e6 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 20 Mar 2024 10:28:48 +0100 Subject: [PATCH] Remove some more unused code and dependencies --- package-lock.json | 358 +----------------- package.json | 2 - patches/intel+1.2.0.patch | 28 -- public/vercel.svg | 1 - scripts/is-coveralls-configured.js | 21 - src/app/api/v1/scan/route.ts | 85 ----- .../functions/server/changeSubscription.ts | 17 + src/customTypes.d.ts | 24 -- src/scripts/webp.sh | 5 - src/utils/fxa.js | 86 ----- src/utils/redisMock.js | 31 -- src/utils/stringHelpers.js | 34 -- tsconfig.json | 3 - 13 files changed, 24 insertions(+), 671 deletions(-) delete mode 100644 patches/intel+1.2.0.patch delete mode 100644 public/vercel.svg delete mode 100644 scripts/is-coveralls-configured.js delete mode 100644 src/app/api/v1/scan/route.ts delete mode 100644 src/customTypes.d.ts delete mode 100644 src/scripts/webp.sh delete mode 100644 src/utils/redisMock.js delete mode 100644 src/utils/stringHelpers.js diff --git a/package-lock.json b/package-lock.json index 5172bbfc2..2899ab225 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "@types/react": "^18.2.61", "@types/react-dom": "^18.2.19", "canvas-confetti": "^1.9.1", - "client-oauth2": "^4.3.3", "dotenv": "^16.4.5", "eslint-config-next": "^14.1.3", "jsdom": "^24.0.0", @@ -39,7 +38,6 @@ "next": "^14.1.3", "next-auth": "^4.24.6", "nodemailer": "^6.9.10", - "patch-package": "^8.0.0", "pg": "^8.11.3", "react": "^18.2.0", "react-aria": "^3.32.1", @@ -6593,11 +6591,6 @@ "node": ">= 8" } }, - "node_modules/@servie/events": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@servie/events/-/events-1.0.0.tgz", - "integrity": "sha512-sBSO19KzdrJCM3gdx6eIxV8M9Gxfgg6iDQmH5TIAGaUu+X9VDdsINXJOnoiZ1Kx3TrHdH4bt5UVglkjsEGBcvw==" - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -10176,11 +10169,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/@yarnpkg/lockfile": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", - "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==" - }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -10711,14 +10699,6 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -11507,11 +11487,6 @@ "node": ">=10.16.0" } }, - "node_modules/byte-length": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/byte-length/-/byte-length-1.0.2.tgz", - "integrity": "sha512-ovBpjmsgd/teRmgcPh23d4gJvxDoXtAzEL9xTfMU8Yc2kqCDb7L9jAG0XHl1nzuGl+h3ebCIF1i62UFyA9V/2Q==" - }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -11715,6 +11690,7 @@ "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, "funding": [ { "type": "github", @@ -11888,18 +11864,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/client-oauth2": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/client-oauth2/-/client-oauth2-4.3.3.tgz", - "integrity": "sha512-k8AvUYJon0vv75ufoVo4nALYb/qwFFicO3I0+39C6xEdflqVtr+f9cy+0ZxAduoVSTfhP5DX2tY2XICAd5hy6Q==", - "dependencies": { - "popsicle": "^12.0.5", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", @@ -15185,14 +15149,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-yarn-workspace-root": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", - "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", - "dependencies": { - "micromatch": "^4.0.2" - } - }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", @@ -16833,6 +16789,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, "bin": { "is-docker": "cli.js" }, @@ -17169,6 +17126,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, "dependencies": { "is-docker": "^2.0.0" }, @@ -19106,23 +19064,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, - "node_modules/json-stable-stringify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.0.tgz", - "integrity": "sha512-zfA+5SuwYN2VWqN1/5HZaDzQKLJHaBVMZIIM+wuYjdptkaQsqzDdqjqf+lZZJUuJq1aanHiY8LhH8LmH+qBYJA==", - "dependencies": { - "call-bind": "^1.0.5", - "isarray": "^2.0.5", - "jsonify": "^0.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -19144,6 +19085,7 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, "dependencies": { "universalify": "^2.0.0" }, @@ -19151,14 +19093,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsonify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", - "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/jsonwebtoken": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", @@ -19289,14 +19223,6 @@ "node": ">=0.10.0" } }, - "node_modules/klaw-sync": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", - "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", - "dependencies": { - "graceful-fs": "^4.1.11" - } - }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -20171,15 +20097,8 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" - }, - "node_modules/make-error-cause": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-2.3.0.tgz", - "integrity": "sha512-etgt+n4LlOkGSJbBTV9VROHA5R7ekIPS4vfh+bCAoJgRrJWdqJCBbpS3osRJ/HrT7R68MzMiY3L3sDJ/Fd8aBg==", - "dependencies": { - "make-error": "^1.3.5" - } + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "node_modules/makeerror": { "version": "1.0.12", @@ -21257,21 +21176,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/open": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", - "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", - "dependencies": { - "is-docker": "^2.0.0", - "is-wsl": "^2.1.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/openid-client": { "version": "5.6.1", "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.1.tgz", @@ -21396,14 +21300,6 @@ "integrity": "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==", "dev": true }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/p-defer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-3.0.0.tgz", @@ -21557,140 +21453,6 @@ "tslib": "^2.0.3" } }, - "node_modules/patch-package": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", - "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", - "dependencies": { - "@yarnpkg/lockfile": "^1.1.0", - "chalk": "^4.1.2", - "ci-info": "^3.7.0", - "cross-spawn": "^7.0.3", - "find-yarn-workspace-root": "^2.0.0", - "fs-extra": "^9.0.0", - "json-stable-stringify": "^1.0.2", - "klaw-sync": "^6.0.0", - "minimist": "^1.2.6", - "open": "^7.4.2", - "rimraf": "^2.6.3", - "semver": "^7.5.3", - "slash": "^2.0.0", - "tmp": "^0.0.33", - "yaml": "^2.2.2" - }, - "bin": { - "patch-package": "index.js" - }, - "engines": { - "node": ">=14", - "npm": ">5" - } - }, - "node_modules/patch-package/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/patch-package/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/patch-package/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/patch-package/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/patch-package/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/patch-package/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/patch-package/node_modules/slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "engines": { - "node": ">=6" - } - }, - "node_modules/patch-package/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "node_modules/patch-package/node_modules/yaml": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", - "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", - "engines": { - "node": ">= 14" - } - }, "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", @@ -22048,82 +21810,6 @@ "node": ">=10" } }, - "node_modules/popsicle": { - "version": "12.1.2", - "resolved": "https://registry.npmjs.org/popsicle/-/popsicle-12.1.2.tgz", - "integrity": "sha512-xE2vEUa15TiHvFhGmKTtdKk9aSLL5CHX8Vw5kHfVM3R0YHiaTon6Ybsamw0XYqMR+Ng2RijX88iYUKPBMpLBww==", - "dependencies": { - "popsicle-content-encoding": "^1.0.0", - "popsicle-cookie-jar": "^1.0.1", - "popsicle-redirects": "^1.1.0", - "popsicle-transport-http": "^1.1.0", - "popsicle-transport-xhr": "^2.0.0", - "popsicle-user-agent": "^1.0.0", - "servie": "^4.3.3", - "throwback": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/popsicle-content-encoding": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/popsicle-content-encoding/-/popsicle-content-encoding-1.0.0.tgz", - "integrity": "sha512-4Df+vTfM8wCCJVTzPujiI6eOl3SiWQkcZg0AMrOkD1enMXsF3glIkFUZGvour1Sj7jOWCsNSEhBxpbbhclHhzw==", - "peerDependencies": { - "servie": "^4.0.0" - } - }, - "node_modules/popsicle-cookie-jar": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/popsicle-cookie-jar/-/popsicle-cookie-jar-1.0.1.tgz", - "integrity": "sha512-QVIZhADP8nDbXIQW6wq8GU9IOSE8INUACO/9KD9TFKQ7qq8r/y3qUDz59xIi6p6TH19lCJJyBAPSXP1liIoySw==", - "dependencies": { - "@types/tough-cookie": "^4.0.2", - "tough-cookie": "^4.1.3" - }, - "engines": { - "node": ">=8" - }, - "peerDependencies": { - "servie": "^4.0.0" - } - }, - "node_modules/popsicle-redirects": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/popsicle-redirects/-/popsicle-redirects-1.1.1.tgz", - "integrity": "sha512-mC2HrKjdTAWDalOjGxlXw9j6Qxrz/Yd2ui6bPxpi2IQDYWpF4gUAMxbA8EpSWJhLi0PuWKDwTHHPrUPGutAoIA==", - "peerDependencies": { - "servie": "^4.1.0" - } - }, - "node_modules/popsicle-transport-http": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/popsicle-transport-http/-/popsicle-transport-http-1.2.1.tgz", - "integrity": "sha512-i5r3IGHkGiBDm1oPFvOfEeSGWR0lQJcsdTqwvvDjXqcTHYJJi4iSi3ecXIttDiTBoBtRAFAE9nF91fspQr63FQ==", - "dependencies": { - "make-error-cause": "^2.2.0" - }, - "peerDependencies": { - "servie": "^4.2.0" - } - }, - "node_modules/popsicle-transport-xhr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/popsicle-transport-xhr/-/popsicle-transport-xhr-2.0.0.tgz", - "integrity": "sha512-5Sbud4Widngf1dodJE5cjEYXkzEUIl8CzyYRYR57t6vpy9a9KPGQX6KBKdPjmBZlR5A06pOBXuJnVr23l27rtA==", - "peerDependencies": { - "servie": "^4.2.0" - } - }, - "node_modules/popsicle-user-agent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/popsicle-user-agent/-/popsicle-user-agent-1.0.0.tgz", - "integrity": "sha512-epKaq3TTfTzXcxBxjpoKYMcTTcAX8Rykus6QZu77XNhJuRHSRxMd+JJrbX/3PFI0opFGSN0BabbAYCbGxbu0mA==", - "peerDependencies": { - "servie": "^4.0.0" - } - }, "node_modules/postcss": { "version": "8.4.31", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", @@ -23930,16 +23616,6 @@ "resolved": "https://registry.npmjs.org/server-only/-/server-only-0.0.1.tgz", "integrity": "sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==" }, - "node_modules/servie": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/servie/-/servie-4.3.3.tgz", - "integrity": "sha512-b0IrY3b1gVMsWvJppCf19g1p3JSnS0hQi6xu4Hi40CIhf0Lx8pQHcvBL+xunShpmOiQzg1NOia812NAWdSaShw==", - "dependencies": { - "@servie/events": "^1.0.0", - "byte-length": "^1.0.2", - "ts-expect": "^1.1.0" - } - }, "node_modules/set-function-length": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", @@ -25596,11 +25272,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/throwback": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/throwback/-/throwback-4.1.0.tgz", - "integrity": "sha512-dLFe8bU8SeH0xeqeKL7BNo8XoPC/o91nz9/ooeplZPiso+DZukhoyZcSz9TFnUNScm+cA9qjU1m1853M6sPOng==" - }, "node_modules/tildify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/tildify/-/tildify-2.0.0.tgz", @@ -25636,17 +25307,6 @@ "node": ">=14.0.0" } }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -25749,11 +25409,6 @@ "node": ">=6.10" } }, - "node_modules/ts-expect": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/ts-expect/-/ts-expect-1.3.0.tgz", - "integrity": "sha512-e4g0EJtAjk64xgnFPD6kTBUtpnMVzDrMb12N1YZV0VvSlhnVT3SGxiYTLdGy8Q5cYHOIC/FAHmZ10eGrAguicQ==" - }, "node_modules/ts-jest": { "version": "29.1.2", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", @@ -26212,6 +25867,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, "engines": { "node": ">= 10.0.0" } diff --git a/package.json b/package.json index c6f1298ef..2fd610dcb 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "@types/react": "^18.2.61", "@types/react-dom": "^18.2.19", "canvas-confetti": "^1.9.1", - "client-oauth2": "^4.3.3", "dotenv": "^16.4.5", "eslint-config-next": "^14.1.3", "jsdom": "^24.0.0", @@ -69,7 +68,6 @@ "next": "^14.1.3", "next-auth": "^4.24.6", "nodemailer": "^6.9.10", - "patch-package": "^8.0.0", "pg": "^8.11.3", "react": "^18.2.0", "react-aria": "^3.32.1", diff --git a/patches/intel+1.2.0.patch b/patches/intel+1.2.0.patch deleted file mode 100644 index 122e46673..000000000 --- a/patches/intel+1.2.0.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/node_modules/intel/lib/handlers/index.js b/node_modules/intel/lib/handlers/index.js -index 0ee3caa..2471a4c 100644 ---- a/node_modules/intel/lib/handlers/index.js -+++ b/node_modules/intel/lib/handlers/index.js -@@ -2,19 +2,7 @@ - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - --const fs = require('fs'); -- --fs.readdirSync(__dirname).forEach(function(file) { -- if (file === 'index.js' || file === 'handler.js') { -- return; -- } -- -- var handler = file.replace('.js', ''); -- var capital = handler[0].toUpperCase() + handler.substring(1); -- -- Object.defineProperty(exports, capital, { -- get: function() { -- return require('./' + handler); -- } -- }); --}); -+exports.Console = require('./console'); -+exports.File = require('./file'); -+exports.Null = require('./null'); -+exports.Stream = require('./stream'); diff --git a/public/vercel.svg b/public/vercel.svg deleted file mode 100644 index d2f842227..000000000 --- a/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/scripts/is-coveralls-configured.js b/scripts/is-coveralls-configured.js deleted file mode 100644 index c60485cef..000000000 --- a/scripts/is-coveralls-configured.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' -/* -Check if coveralls configuration is available. - -Exit 0 if configured to run coveralls -Exit 1 if coveralls will fail - -For required environment variables, see: -https://github.com/nickmerwin/node-coveralls -*/ - -const { existsSync } = require('node:fs') - -if (process.env.COVERALLS_REPO_TOKEN) { - console.log('coveralls configured with environment variable COVERALLS_REPO_TOKEN.') -} else if (existsSync('.coveralls.yml')) { - console.log('coveralls configured with configuration file ".coveralls.yml".') -} else { - console.log('coveralls is not configured.') - process.exit(1) -} diff --git a/src/app/api/v1/scan/route.ts b/src/app/api/v1/scan/route.ts deleted file mode 100644 index 7f5458a5a..000000000 --- a/src/app/api/v1/scan/route.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import { NextResponse } from "next/server"; -import { validateEmailAddress } from "../../../../utils/emailAddress"; -import { getBreaches } from "../../../functions/server/getBreaches"; -import { getBreachesForEmail } from "../../../../utils/hibp"; -import { getSha1 } from "../../../../utils/fxa"; -import { getL10n } from "../../../functions/server/l10n"; -import { getBreachLogo } from "../../../../utils/breachLogo"; -import { Breach } from "../../../functions/universal/breach"; - -export interface RequestBreachScanErrorResponse { - success: false; -} - -export interface RequestBreachScanSuccessResponse { - success: true; - breaches: Array; - heading: string; - logos: string[]; - dataClassStrings: string[][]; - total: number; -} - -export type RequestBreachScanResponse = - | RequestBreachScanErrorResponse - | RequestBreachScanSuccessResponse; - -export async function POST(request: Request) { - const body = await request.json(); - - const validatedEmail = validateEmailAddress(body.email); - - if (validatedEmail === null) { - return NextResponse.json({ success: false }, { status: 400 }); - } - - const l10n = getL10n(); - - try { - const allBreaches = await getBreaches(); - const breaches = (await getBreachesForEmail( - getSha1(validatedEmail.email), - allBreaches, - false, - )) as Breach[]; - - const successResponse: RequestBreachScanSuccessResponse = { - success: true, - breaches: breaches.slice(0, 6), - total: breaches.length, - heading: - // This is sent in the API response so we can replace the variables in - // the Fluent string (because Fluent might change the strings depending - // on the variables, specifically the count, and we don't run Fluent on - // the client side): - l10n - .getString("exposure-landing-result-hero-heading", { - // Will be injected client-side, since this is derived from user - // input and thus needs to be sanitized by the browser: - email: "", - count: breaches.length, - }) - .replace("", '') - .replace("", "") - .replace("", '') - .replace("", ""), - // This is sent in the API response because we don't have Fluent on the - // client side, and thus can't dynamically localise breached data classes: - dataClassStrings: breaches.map((breach) => - breach.DataClasses.map((dataClass: string) => - l10n.getString(dataClass), - ), - ), - // This is sent in the API response because we can't call `getBreachLogo` - // client side, where it would expose AppConstants: - logos: breaches.map((breach) => getBreachLogo(breach)), - }; - return NextResponse.json(successResponse); - } catch (e) { - return NextResponse.json({ success: false }, { status: 500 }); - } -} diff --git a/src/app/functions/server/changeSubscription.ts b/src/app/functions/server/changeSubscription.ts index 562290ac1..eafd1840f 100644 --- a/src/app/functions/server/changeSubscription.ts +++ b/src/app/functions/server/changeSubscription.ts @@ -28,3 +28,20 @@ export async function changeSubscription( currentFxAProfile.subscriptions = subscriptions; await updateFxAProfileData(subscriber, JSON.stringify(currentFxAProfile)); } + +/** + * See https://github.com/mozilla/fxa/blob/564949dfc69f0f675ebb4e5f267282c2546a5767/packages/fxa-profile-server/lib/routes/profile.js#L63-L77 + */ +type FxaProfile = { + email?: string; + uid?: string; + avatar?: string; + avatarDefault?: boolean; + displayName?: string; + locale?: string; + amrValues?: string[]; + twoFactorAuthentication?: boolean; + subscriptions?: string[]; + metricsEnabled?: boolean; + sub?: string; +}; diff --git a/src/customTypes.d.ts b/src/customTypes.d.ts deleted file mode 100644 index e59ac9ed8..000000000 --- a/src/customTypes.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * See https://github.com/mozilla/fxa/blob/564949dfc69f0f675ebb4e5f267282c2546a5767/packages/fxa-profile-server/lib/routes/profile.js#L63-L77 - */ -type FxaProfile = { - email?: string; - uid?: string; - avatar?: string; - avatarDefault?: boolean; - displayName?: string; - locale?: string; - amrValues?: string[]; - twoFactorAuthentication?: boolean; - subscriptions?: string[]; - metricsEnabled?: boolean; - sub?: string; -}; -interface Window { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - gtag: any; -} diff --git a/src/scripts/webp.sh b/src/scripts/webp.sh deleted file mode 100644 index 79e9a04e4..000000000 --- a/src/scripts/webp.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -#convert all png files in client/images/ to webp, then delete the png source. -#requires cwebp encoder: https://developers.google.com/speed/webp/docs/cwebp -for file in client/images/*.png ; do cwebp -q 70 -short "$file" -o "${file%.png}.webp"; rm -f "$file"; done diff --git a/src/utils/fxa.js b/src/utils/fxa.js index b7346754b..886aa28ae 100644 --- a/src/utils/fxa.js +++ b/src/utils/fxa.js @@ -2,33 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import ClientOAuth2 from 'client-oauth2' import crypto from 'crypto' import { URL } from 'url' import { InternalServerError } from '../utils/error.js' import AppConstants from '../appConstants.js' -// This object exists instead of inlining the env vars to make it easy -// to abstract fetching API endpoints from the OAuth server (instead -// of specifying them in the environment) in the future. -const FxAOAuthUtils = { - get authorizationUri() { return AppConstants.OAUTH_AUTHORIZATION_URI }, - get tokenUri() { return AppConstants.OAUTH_TOKEN_URI }, - // TODO: Add unit test when changing this code: - /* c8 ignore next */ - get profileUri() { return AppConstants.OAUTH_PROFILE_URI } -} - -const FxAOAuthClient = new ClientOAuth2({ - clientId: AppConstants.OAUTH_CLIENT_ID, - clientSecret: AppConstants.OAUTH_CLIENT_SECRET, - accessTokenUri: FxAOAuthUtils.tokenUri, - authorizationUri: FxAOAuthUtils.authorizationUri, - redirectUri: AppConstants.SERVER_URL + '/oauth/confirmed', - scopes: ['profile'] -}) - /** * @param {string} path * @param {any} token @@ -60,23 +39,6 @@ async function postTokenRequest(path, token) { } /* c8 ignore stop */ -/** - * @param {string} token - */ -// TODO: Add unit test when changing this code: -/* c8 ignore start */ -async function verifyOAuthToken(token) { - try { - const response = await postTokenRequest('/v1/verify', token) - return response - } catch (e) { - if (e instanceof Error) { - console.error('verifyOAuthToken', { stack: e.stack }) - } - } -} -/* c8 ignore stop */ - /** * fxa doc: https://mozilla.github.io/ecosystem-platform/api#tag/Oauth/operation/postOauthDestroy * @@ -111,50 +73,6 @@ async function revokeOAuthTokens(subscriber) { await destroyOAuthToken({ token: subscriber.fxa_refresh_token, token_type_hint: "refresh_token" }) } -/** - * @param {any} accessToken - */ -// TODO: Add unit test when changing this code: -/* c8 ignore start */ -async function getProfileData(accessToken) { - try { - const response = await fetch(FxAOAuthUtils.profileUri, { - headers: { Authorization: `Bearer ${accessToken}` } - }) - if (!response.ok) throw new InternalServerError(`bad response: ${response.status}`) - return await response.text() - } catch (e) { - if (e instanceof Error) { - console.warn('getProfileData', { stack: e.stack }) - } - return e - } -} -/* c8 ignore stop */ - -/** - * @param {string} path - */ -// Not covered by tests; mostly side-effects. See test-coverage.md#mock-heavy -/* c8 ignore start */ -async function sendMetricsFlowPing(path) { - const fxaMetricsFlowUrl = new URL(path, AppConstants.NEXT_PUBLIC_FXA_SETTINGS_URL) - try { - const response = await fetch(fxaMetricsFlowUrl, { - headers: { Origin: AppConstants.SERVER_URL } - }) - if (!response.ok) throw new InternalServerError(`bad response: ${response.status}`) - console.info('pinged FXA metrics flow.') - return response - } catch (e) { - if (e instanceof Error) { - console.error('sendMetricsFlowPing', { stack: e.stack }) - } - return false - } -} -/* c8 ignore stop */ - /** * @param {string} bearerToken * @returns {Promise | null>} @@ -236,12 +154,8 @@ function getSha1(email) { } export { - FxAOAuthClient, - verifyOAuthToken, destroyOAuthToken, revokeOAuthTokens, - getProfileData, - sendMetricsFlowPing, getSha1, getSubscriptions, deleteSubscription diff --git a/src/utils/redisMock.js b/src/utils/redisMock.js deleted file mode 100644 index ea9042d2f..000000000 --- a/src/utils/redisMock.js +++ /dev/null @@ -1,31 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// redis-mock is not compatible with redis@4. -// The breaking changes apparently involve promise compatibility. -// Below is a hacky work-around to keep redisMock alive. -// See also https://github.com/yeahoffline/redis-mock/issues/195 - -import redisMock from 'redis-mock' -import { promisify } from 'node:util' - -const legacyMockClient = redisMock.createClient() -const patchedMockClient = { - connect: () => undefined, - get: promisify(legacyMockClient.get).bind(legacyMockClient), - set: promisify(legacyMockClient.set).bind(legacyMockClient), - del: promisify(legacyMockClient.del).bind(legacyMockClient), - hSet: promisify(legacyMockClient.hset).bind(legacyMockClient), - hGet: promisify(legacyMockClient.hget).bind(legacyMockClient), - hDel: promisify(legacyMockClient.hdel).bind(legacyMockClient), - flushAll: promisify(legacyMockClient.flushall).bind(legacyMockClient), - setEx: promisify(legacyMockClient.setex).bind(legacyMockClient), - expire: promisify(legacyMockClient.expire).bind(legacyMockClient), - mGet: promisify(legacyMockClient.mget).bind(legacyMockClient), - on: () => undefined -} - -console.warn('Using a mock version of Redis. To use an actual Redis server, update the Redis URL in your environment variables.') - -export { patchedMockClient as redisMockClient } diff --git a/src/utils/stringHelpers.js b/src/utils/stringHelpers.js deleted file mode 100644 index 843ec0116..000000000 --- a/src/utils/stringHelpers.js +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * Convert kebab-case to camelCase - * - * @param {string} str - a kebab-case string - * @example - * camelize ('two-hump-camel') - * // returns 'twoHumpCamel' - */ - -function camelize (str) { - return str.replace(/-./g, substr => substr[1].toUpperCase()) -} - -/** - * Capitalize the first letter of a string, taking into account localization - * - * @param {string} str - * @example - * capitalFirstLetter ('carte di credito') - * // returns 'Carte di credito' - * @example - * capitalFirstLetter ('账户余额') - * // returns '账户余额' - */ - -function capitalFirstLetter (str) { - return str[0].toLocaleUpperCase() + str.slice(1) -} - -export { camelize, capitalFirstLetter } diff --git a/tsconfig.json b/tsconfig.json index 225228e75..4f2e0acca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -96,8 +96,5 @@ "exclude": [ "node_modules/", "sentry.*.config.ts", - // TODO NEXT.JS MIGRATION: Remove old Express files: - "src/controllers/**/*.js", - "src/views/**/*.js" ] }