From 04b23ceb98a205a6250b98a0a31e6919d5465e19 Mon Sep 17 00:00:00 2001 From: Tharki-God Date: Tue, 26 Mar 2024 00:30:42 +0530 Subject: [PATCH] init --- .eslintrc.yml | 2 + README.md | 4 +- manifest.json | 6 +- package.json | 12 +- pnpm-lock.yaml | 305 +++++++++++----------- src/Components/Icons.tsx | 23 +- src/Components/MenuItem.tsx | 43 ++- src/Components/Settings.tsx | 12 +- src/index.ts | 4 +- src/lib/HomeButtonContextMenuApi.tsx | 26 +- src/lib/requiredModules.ts | 4 - src/plaintextPatches.ts | 5 +- src/types.ts | 377 +++++++++++++-------------- 13 files changed, 405 insertions(+), 418 deletions(-) delete mode 100644 src/lib/requiredModules.ts diff --git a/.eslintrc.yml b/.eslintrc.yml index 539d7e3..e12f621 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -49,6 +49,8 @@ overrides: - files: "**/src/**/*.ts" extends: eslint-config-dmitmel/rules/typescript/with-type-checking + rules: + "@typescript-eslint/no-unnecessary-condition": off - files: "**/*.d.ts" rules: diff --git a/README.md b/README.md index 623c8e8..6e0d65c 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@ Get an option to copy the current web address by right clicking on the home butt Same as the URL in your browser. -Direct Download Link: [dev.tharki.Address.asar](https://github.com/TharkiDev/Address/releases/latest/download/dev.tharki.Address.asar) +Direct Download Link: [dev.tharki.Address.asar](https://github.com/YofukashiNo/Address/releases/latest/download/dev.tharki.Address.asar) Install Link: [![Install in Replugged](https://img.shields.io/badge/-Install%20in%20Replugged-blue?style=for-the-badge&logo=none)](https://replugged.dev/install?identifier=dev.tharki.Address) -![image](https://TharkiDev.github.io/files-random-host/bdpluginsassets/address.png) +![image](https://YofukashiNo.github.io/files-random-host/bdpluginsassets/address.png) > For issues related to plugin either DM the dev or ask in support server listed below. > diff --git a/manifest.json b/manifest.json index 9f7d766..739c758 100644 --- a/manifest.json +++ b/manifest.json @@ -3,11 +3,11 @@ "name": "Address", "description": "Get an option to copy the current web address by right clicking on the home button.", "image": "https://i.imgur.com/YJHbIsk.png", - "source": "https://github.com/TharkiDev/Address", + "source": "https://github.com/YofukashiNo/Address", "author": { - "name": "Ahlawat", + "name": "Nanakusa", "discordID": "1121961711080050780", - "github": "TharkiDev" + "github": "YofukashiNo" }, "version": "1.0.2", "updater": { diff --git a/package.json b/package.json index d652f29..6fa1895 100644 --- a/package.json +++ b/package.json @@ -22,16 +22,16 @@ "author": "", "license": "ISC", "devDependencies": { - "@types/node": "^18.17.6", - "@types/react": "^18.2.20", - "@typescript-eslint/eslint-plugin": "^6.7.0", - "@typescript-eslint/parser": "^6.7.0", - "eslint": "^8.47.0", + "@types/node": "^18.18.6", + "@types/react": "^18.2.31", + "@typescript-eslint/eslint-plugin": "^6.8.0", + "@typescript-eslint/parser": "^6.8.0", + "eslint": "^8.52.0", "eslint-config-dmitmel": "github:dmitmel/eslint-config-dmitmel", "eslint-plugin-node": "^11.1.0", "eslint-plugin-react": "^7.33.2", "prettier": "^2.8.8", - "replugged": "^4.7.7", + "replugged": "^4.7.9", "typescript": "^5.0.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8990c3..fe43ef4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,35 +6,35 @@ settings: devDependencies: '@types/node': - specifier: ^18.17.6 - version: 18.17.6 + specifier: ^18.18.6 + version: 18.19.26 '@types/react': - specifier: ^18.2.20 - version: 18.2.20 + specifier: ^18.2.31 + version: 18.2.70 '@typescript-eslint/eslint-plugin': - specifier: ^6.7.0 - version: 6.14.0(@typescript-eslint/parser@6.14.0)(eslint@8.47.0)(typescript@5.3.3) + specifier: ^6.8.0 + version: 6.14.0(@typescript-eslint/parser@6.14.0)(eslint@8.57.0)(typescript@5.3.3) '@typescript-eslint/parser': - specifier: ^6.7.0 - version: 6.14.0(eslint@8.47.0)(typescript@5.3.3) + specifier: ^6.8.0 + version: 6.14.0(eslint@8.57.0)(typescript@5.3.3) eslint: - specifier: ^8.47.0 - version: 8.47.0 + specifier: ^8.52.0 + version: 8.57.0 eslint-config-dmitmel: specifier: github:dmitmel/eslint-config-dmitmel - version: github.com/dmitmel/eslint-config-dmitmel/690f1b1121d342fcc8ee511ca9f2af7502f53db6(eslint@8.47.0) + version: github.com/dmitmel/eslint-config-dmitmel/690f1b1121d342fcc8ee511ca9f2af7502f53db6(eslint@8.57.0) eslint-plugin-node: specifier: ^11.1.0 - version: 11.1.0(eslint@8.47.0) + version: 11.1.0(eslint@8.57.0) eslint-plugin-react: specifier: ^7.33.2 - version: 7.33.2(eslint@8.47.0) + version: 7.33.2(eslint@8.57.0) prettier: specifier: ^2.8.8 version: 2.8.8 replugged: - specifier: ^4.7.7 - version: 4.7.7(@codemirror/view@6.16.0)(@lezer/common@1.1.1) + specifier: ^4.7.9 + version: 4.7.9(@codemirror/view@6.16.0)(@lezer/common@1.1.1) typescript: specifier: ^5.0.0 version: 5.3.3 @@ -139,8 +139,17 @@ packages: minimatch: 3.1.2 dev: true - /@esbuild/android-arm64@0.18.20: - resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + /@esbuild/aix-ppc64@0.19.12: + resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.19.12: + resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -157,8 +166,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.18.20: - resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + /@esbuild/android-arm@0.19.12: + resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -175,8 +184,8 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.18.20: - resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + /@esbuild/android-x64@0.19.12: + resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -193,8 +202,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.18.20: - resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + /@esbuild/darwin-arm64@0.19.12: + resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -211,8 +220,8 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.18.20: - resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + /@esbuild/darwin-x64@0.19.12: + resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -229,8 +238,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.18.20: - resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + /@esbuild/freebsd-arm64@0.19.12: + resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -247,8 +256,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.18.20: - resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + /@esbuild/freebsd-x64@0.19.12: + resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -265,8 +274,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.18.20: - resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + /@esbuild/linux-arm64@0.19.12: + resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -283,8 +292,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.18.20: - resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + /@esbuild/linux-arm@0.19.12: + resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -301,8 +310,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.18.20: - resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + /@esbuild/linux-ia32@0.19.12: + resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -319,8 +328,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.18.20: - resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + /@esbuild/linux-loong64@0.19.12: + resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -337,8 +346,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.18.20: - resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + /@esbuild/linux-mips64el@0.19.12: + resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -355,8 +364,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.18.20: - resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + /@esbuild/linux-ppc64@0.19.12: + resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -373,8 +382,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.18.20: - resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + /@esbuild/linux-riscv64@0.19.12: + resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -391,8 +400,8 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.18.20: - resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + /@esbuild/linux-s390x@0.19.12: + resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -409,8 +418,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.18.20: - resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + /@esbuild/linux-x64@0.19.12: + resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -427,8 +436,8 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.18.20: - resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + /@esbuild/netbsd-x64@0.19.12: + resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -445,8 +454,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.18.20: - resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + /@esbuild/openbsd-x64@0.19.12: + resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -463,8 +472,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.18.20: - resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + /@esbuild/sunos-x64@0.19.12: + resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -481,8 +490,8 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.18.20: - resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + /@esbuild/win32-arm64@0.19.12: + resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -499,8 +508,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.18.20: - resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + /@esbuild/win32-ia32@0.19.12: + resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -517,8 +526,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.18.20: - resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + /@esbuild/win32-x64@0.19.12: + resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -535,13 +544,13 @@ packages: dev: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.47.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.57.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.47.0 + eslint: 8.57.0 eslint-visitor-keys: 3.4.3 dev: true @@ -550,8 +559,8 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true - /@eslint/eslintrc@2.1.2: - resolution: {integrity: sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==} + /@eslint/eslintrc@2.1.4: + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -567,16 +576,16 @@ packages: - supports-color dev: true - /@eslint/js@8.47.0: - resolution: {integrity: sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==} + /@eslint/js@8.57.0: + resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@humanwhocodes/config-array@0.11.10: - resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==} + /@humanwhocodes/config-array@0.11.14: + resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} dependencies: - '@humanwhocodes/object-schema': 1.2.1 + '@humanwhocodes/object-schema': 2.0.2 debug: 4.3.4 minimatch: 3.1.2 transitivePeerDependencies: @@ -588,8 +597,8 @@ packages: engines: {node: '>=12.22'} dev: true - /@humanwhocodes/object-schema@1.2.1: - resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} + /@humanwhocodes/object-schema@2.0.2: + resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} dev: true /@lezer/common@1.1.1: @@ -780,16 +789,18 @@ packages: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} dev: true - /@types/node@18.17.6: - resolution: {integrity: sha512-fGmT/P7z7ecA6bv/ia5DlaWCH4YeZvAQMNpUhrJjtAhOhZfoxS1VLUgU2pdk63efSjQaOJWdXMuAJsws+8I6dg==} + /@types/node@18.19.26: + resolution: {integrity: sha512-+wiMJsIwLOYCvUqSdKTrfkS8mpTp+MPINe6+Np4TAGFWWRWiBQ5kSq9nZGCSPkzx9mvT+uEukzpX4MOSCydcvw==} + dependencies: + undici-types: 5.26.5 dev: true /@types/prop-types@15.7.5: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true - /@types/react@18.2.20: - resolution: {integrity: sha512-WKNtmsLWJM/3D5mG4U84cysVY31ivmyw85dE84fOCk5Hx78wezB/XEjVPWl2JTZ5FkEeaTJf+VgUAUn3PE7Isw==} + /@types/react@18.2.70: + resolution: {integrity: sha512-hjlM2hho2vqklPhopNkXkdkeq6Lv8WSZTpr7956zY+3WS5cfYUewtCzsJLsbW5dEv3lfSeQ4W14ZFeKC437JRQ==} dependencies: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.3 @@ -804,7 +815,7 @@ packages: resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} dev: true - /@typescript-eslint/eslint-plugin@6.14.0(@typescript-eslint/parser@6.14.0)(eslint@8.47.0)(typescript@5.3.3): + /@typescript-eslint/eslint-plugin@6.14.0(@typescript-eslint/parser@6.14.0)(eslint@8.57.0)(typescript@5.3.3): resolution: {integrity: sha512-1ZJBykBCXaSHG94vMMKmiHoL0MhNHKSVlcHVYZNw+BKxufhqQVTOawNpwwI1P5nIFZ/4jLVop0mcY6mJJDFNaw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -816,13 +827,13 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.6.2 - '@typescript-eslint/parser': 6.14.0(eslint@8.47.0)(typescript@5.3.3) + '@typescript-eslint/parser': 6.14.0(eslint@8.57.0)(typescript@5.3.3) '@typescript-eslint/scope-manager': 6.14.0 - '@typescript-eslint/type-utils': 6.14.0(eslint@8.47.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.14.0(eslint@8.47.0)(typescript@5.3.3) + '@typescript-eslint/type-utils': 6.14.0(eslint@8.57.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.14.0(eslint@8.57.0)(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.14.0 debug: 4.3.4 - eslint: 8.47.0 + eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.2.4 natural-compare: 1.4.0 @@ -833,7 +844,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.14.0(eslint@8.47.0)(typescript@5.3.3): + /@typescript-eslint/parser@6.14.0(eslint@8.57.0)(typescript@5.3.3): resolution: {integrity: sha512-QjToC14CKacd4Pa7JK4GeB/vHmWFJckec49FR4hmIRf97+KXole0T97xxu9IFiPxVQ1DBWrQ5wreLwAGwWAVQA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -848,7 +859,7 @@ packages: '@typescript-eslint/typescript-estree': 6.14.0(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.14.0 debug: 4.3.4 - eslint: 8.47.0 + eslint: 8.57.0 typescript: 5.3.3 transitivePeerDependencies: - supports-color @@ -862,7 +873,7 @@ packages: '@typescript-eslint/visitor-keys': 6.14.0 dev: true - /@typescript-eslint/type-utils@6.14.0(eslint@8.47.0)(typescript@5.3.3): + /@typescript-eslint/type-utils@6.14.0(eslint@8.57.0)(typescript@5.3.3): resolution: {integrity: sha512-x6OC9Q7HfYKqjnuNu5a7kffIYs3No30isapRBJl1iCHLitD8O0lFbRcVGiOcuyN837fqXzPZ1NS10maQzZMKqw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -873,9 +884,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 6.14.0(typescript@5.3.3) - '@typescript-eslint/utils': 6.14.0(eslint@8.47.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.14.0(eslint@8.57.0)(typescript@5.3.3) debug: 4.3.4 - eslint: 8.47.0 + eslint: 8.57.0 ts-api-utils: 1.0.3(typescript@5.3.3) typescript: 5.3.3 transitivePeerDependencies: @@ -908,19 +919,19 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.14.0(eslint@8.47.0)(typescript@5.3.3): + /@typescript-eslint/utils@6.14.0(eslint@8.57.0)(typescript@5.3.3): resolution: {integrity: sha512-XwRTnbvRr7Ey9a1NT6jqdKX8y/atWG+8fAIu3z73HSP8h06i3r/ClMhmaF/RGWGW1tHJEwij1uEg2GbEmPYvYg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.47.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 '@typescript-eslint/scope-manager': 6.14.0 '@typescript-eslint/types': 6.14.0 '@typescript-eslint/typescript-estree': 6.14.0(typescript@5.3.3) - eslint: 8.47.0 + eslint: 8.57.0 semver: 7.5.4 transitivePeerDependencies: - supports-color @@ -935,6 +946,10 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@ungap/structured-clone@1.2.0: + resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + dev: true + /acorn-jsx@5.3.2(acorn@8.10.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -1120,10 +1135,6 @@ packages: fill-range: 7.0.1 dev: true - /buffer-from@1.1.2: - resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - dev: true - /cacheable-lookup@7.0.0: resolution: {integrity: sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==} engines: {node: '>=14.16'} @@ -1470,34 +1481,35 @@ packages: sass: 1.66.1 dev: true - /esbuild@0.18.20: - resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + /esbuild@0.19.12: + resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.18.20 - '@esbuild/android-arm64': 0.18.20 - '@esbuild/android-x64': 0.18.20 - '@esbuild/darwin-arm64': 0.18.20 - '@esbuild/darwin-x64': 0.18.20 - '@esbuild/freebsd-arm64': 0.18.20 - '@esbuild/freebsd-x64': 0.18.20 - '@esbuild/linux-arm': 0.18.20 - '@esbuild/linux-arm64': 0.18.20 - '@esbuild/linux-ia32': 0.18.20 - '@esbuild/linux-loong64': 0.18.20 - '@esbuild/linux-mips64el': 0.18.20 - '@esbuild/linux-ppc64': 0.18.20 - '@esbuild/linux-riscv64': 0.18.20 - '@esbuild/linux-s390x': 0.18.20 - '@esbuild/linux-x64': 0.18.20 - '@esbuild/netbsd-x64': 0.18.20 - '@esbuild/openbsd-x64': 0.18.20 - '@esbuild/sunos-x64': 0.18.20 - '@esbuild/win32-arm64': 0.18.20 - '@esbuild/win32-ia32': 0.18.20 - '@esbuild/win32-x64': 0.18.20 + '@esbuild/aix-ppc64': 0.19.12 + '@esbuild/android-arm': 0.19.12 + '@esbuild/android-arm64': 0.19.12 + '@esbuild/android-x64': 0.19.12 + '@esbuild/darwin-arm64': 0.19.12 + '@esbuild/darwin-x64': 0.19.12 + '@esbuild/freebsd-arm64': 0.19.12 + '@esbuild/freebsd-x64': 0.19.12 + '@esbuild/linux-arm': 0.19.12 + '@esbuild/linux-arm64': 0.19.12 + '@esbuild/linux-ia32': 0.19.12 + '@esbuild/linux-loong64': 0.19.12 + '@esbuild/linux-mips64el': 0.19.12 + '@esbuild/linux-ppc64': 0.19.12 + '@esbuild/linux-riscv64': 0.19.12 + '@esbuild/linux-s390x': 0.19.12 + '@esbuild/linux-x64': 0.19.12 + '@esbuild/netbsd-x64': 0.19.12 + '@esbuild/openbsd-x64': 0.19.12 + '@esbuild/sunos-x64': 0.19.12 + '@esbuild/win32-arm64': 0.19.12 + '@esbuild/win32-ia32': 0.19.12 + '@esbuild/win32-x64': 0.19.12 dev: true /esbuild@0.19.7: @@ -1545,25 +1557,25 @@ packages: engines: {node: '>=10'} dev: true - /eslint-plugin-es@3.0.1(eslint@8.47.0): + /eslint-plugin-es@3.0.1(eslint@8.57.0): resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=4.19.1' dependencies: - eslint: 8.47.0 + eslint: 8.57.0 eslint-utils: 2.1.0 regexpp: 3.2.0 dev: true - /eslint-plugin-node@11.1.0(eslint@8.47.0): + /eslint-plugin-node@11.1.0(eslint@8.57.0): resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} engines: {node: '>=8.10.0'} peerDependencies: eslint: '>=5.16.0' dependencies: - eslint: 8.47.0 - eslint-plugin-es: 3.0.1(eslint@8.47.0) + eslint: 8.57.0 + eslint-plugin-es: 3.0.1(eslint@8.57.0) eslint-utils: 2.1.0 ignore: 5.2.4 minimatch: 3.1.2 @@ -1571,7 +1583,7 @@ packages: semver: 6.3.1 dev: true - /eslint-plugin-react@7.33.2(eslint@8.47.0): + /eslint-plugin-react@7.33.2(eslint@8.57.0): resolution: {integrity: sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==} engines: {node: '>=4'} peerDependencies: @@ -1582,7 +1594,7 @@ packages: array.prototype.tosorted: 1.1.1 doctrine: 2.1.0 es-iterator-helpers: 1.0.13 - eslint: 8.47.0 + eslint: 8.57.0 estraverse: 5.3.0 jsx-ast-utils: 3.3.5 minimatch: 3.1.2 @@ -1621,18 +1633,19 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.47.0: - resolution: {integrity: sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==} + /eslint@8.57.0: + resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.47.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@eslint-community/regexpp': 4.6.2 - '@eslint/eslintrc': 2.1.2 - '@eslint/js': 8.47.0 - '@humanwhocodes/config-array': 0.11.10 + '@eslint/eslintrc': 2.1.4 + '@eslint/js': 8.57.0 + '@humanwhocodes/config-array': 0.11.14 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 + '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 @@ -2688,8 +2701,8 @@ packages: rc: 1.2.8 dev: true - /replugged@4.7.7(@codemirror/view@6.16.0)(@lezer/common@1.1.1): - resolution: {integrity: sha512-7MT75GGyfBomNRDqfPWh7dD3oodjVHBPJFReZ6k5l69LwpcpvHAqR+CAeLu/1JjBwrBGYTFGsvHu8Huqh0TWCg==} + /replugged@4.7.9(@codemirror/view@6.16.0)(@lezer/common@1.1.1): + resolution: {integrity: sha512-Eh44KEzXVLRO7UtrZm5mvYXr12KJV4zpifYUEFlNoGaT9mzO598f8WgiMdCQdaUf27bZl+nk6qUngMR4YfkXoA==} engines: {node: '>=18.0.0', pnpm: '>=8.0.0'} hasBin: true requiresBuild: true @@ -2711,7 +2724,7 @@ packages: prompts: 2.4.2 semver: 7.5.4 standalone-electron-types: 1.0.0 - tsx: 3.14.0 + tsx: 4.7.1 update-notifier: 6.0.2 ws: 8.14.2 yargs: 17.7.2 @@ -2879,22 +2892,10 @@ packages: engines: {node: '>=0.10.0'} dev: true - /source-map-support@0.5.21: - resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} - dependencies: - buffer-from: 1.1.2 - source-map: 0.6.1 - dev: true - - /source-map@0.6.1: - resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} - engines: {node: '>=0.10.0'} - dev: true - /standalone-electron-types@1.0.0: resolution: {integrity: sha512-0HOi/tlTz3mjWhsAz4uRbpQcHMZ+ifj1JzWW9nugykOHClBBG77ps8QinrzX1eow4Iw2pnC+RFaSYRgufF4BOg==} dependencies: - '@types/node': 18.17.6 + '@types/node': 18.19.26 dev: true /string-width@4.2.3: @@ -3013,13 +3014,13 @@ packages: typescript: 5.3.3 dev: true - /tsx@3.14.0: - resolution: {integrity: sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==} + /tsx@4.7.1: + resolution: {integrity: sha512-8d6VuibXHtlN5E3zFkgY8u4DX7Y3Z27zvvPKVmLon/D4AjuKzarkUBTLDBgj9iTQ0hg5xM7c/mYiRVM+HETf0g==} + engines: {node: '>=18.0.0'} hasBin: true dependencies: - esbuild: 0.18.20 + esbuild: 0.19.12 get-tsconfig: 4.7.2 - source-map-support: 0.5.21 optionalDependencies: fsevents: 2.3.3 dev: true @@ -3105,6 +3106,10 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + dev: true + /unique-string@3.0.0: resolution: {integrity: sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==} engines: {node: '>=12'} @@ -3299,7 +3304,7 @@ packages: resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} dev: true - github.com/dmitmel/eslint-config-dmitmel/690f1b1121d342fcc8ee511ca9f2af7502f53db6(eslint@8.47.0): + github.com/dmitmel/eslint-config-dmitmel/690f1b1121d342fcc8ee511ca9f2af7502f53db6(eslint@8.57.0): resolution: {tarball: https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/690f1b1121d342fcc8ee511ca9f2af7502f53db6} id: github.com/dmitmel/eslint-config-dmitmel/690f1b1121d342fcc8ee511ca9f2af7502f53db6 name: eslint-config-dmitmel @@ -3308,5 +3313,5 @@ packages: peerDependencies: eslint: '>=8.17.0' dependencies: - eslint: 8.47.0 + eslint: 8.57.0 dev: true diff --git a/src/Components/Icons.tsx b/src/Components/Icons.tsx index 6c868b4..3018a54 100644 --- a/src/Components/Icons.tsx +++ b/src/Components/Icons.tsx @@ -1,14 +1,21 @@ -export const glob = (width: number | string, height: number | string): React.ReactElement => ( - +export const globe = ({ + children, + ...props +}: React.SVGProps & { children?: React.ReactNode }): React.ReactElement => ( + + {children} ); -export default { glob }; +export default { globe }; diff --git a/src/Components/MenuItem.tsx b/src/Components/MenuItem.tsx index 9400092..c4fb19a 100644 --- a/src/Components/MenuItem.tsx +++ b/src/Components/MenuItem.tsx @@ -2,36 +2,33 @@ import { toast as Toasts } from "replugged/common"; import { ContextMenu } from "replugged/components"; import { PluginLogger, SettingValues } from "../index"; import { defaultSettings } from "../lib/consts"; -import { DiscordNative } from "../lib/requiredModules"; import Icons from "./Icons"; const { MenuItem } = ContextMenu; export const AddressMenuItem = ( Icons.glob("20", "20"), - action: () => { - try { - const Address = SettingValues.get("normalizeAddress", defaultSettings.normalizeAddress) - ? `https://discord.com/${window.location.href.split("discord.com/")[1]}` - : window.location.href; - if (!Address) { - PluginLogger.error("Whoops! I couldn't find the current web address."); - if (SettingValues.get("showToast", defaultSettings.showToast)) - Toasts.toast("Whoops! I couldn't find the current web address.", Toasts.Kind.FAILURE); - return; - } - DiscordNative.clipboard.copy(Address); + label="Copy Address" + id="copy-address" + icon={() => } + action={() => { + try { + const Address = SettingValues.get("normalizeAddress", defaultSettings.normalizeAddress) + ? `https://discord.com/${window.location.href.split("discord.com/")[1]}` + : window.location.href; + if (!Address) { + PluginLogger.error("Whoops! I couldn't find the current web address."); if (SettingValues.get("showToast", defaultSettings.showToast)) - Toasts.toast("Address Copied to Clipboard.", Toasts.Kind.SUCCESS); - } catch (error) { - if (SettingValues.get("showToast", defaultSettings.showToast)) - Toasts.toast(`Error: ${error}.`, Toasts.Kind.FAILURE); - PluginLogger.error(error); + Toasts.toast("Whoops! I couldn't find the current web address.", Toasts.Kind.FAILURE); + return; } - }, + DiscordNative.clipboard.copy(Address); + if (SettingValues.get("showToast", defaultSettings.showToast)) + Toasts.toast("Address Copied to Clipboard.", Toasts.Kind.SUCCESS); + } catch (error) { + if (SettingValues.get("showToast", defaultSettings.showToast)) + Toasts.toast(`Error: ${error}.`, Toasts.Kind.FAILURE); + PluginLogger.error(error); + } }} /> ); diff --git a/src/Components/Settings.tsx b/src/Components/Settings.tsx index 769b42f..dc3a9d9 100644 --- a/src/Components/Settings.tsx +++ b/src/Components/Settings.tsx @@ -15,17 +15,13 @@ export const Settings = () => { return (
+ note="Get a confirmation/error message when copying the web address." + {...util.useSetting(SettingValues, "showToast", defaultSettings.showToast)}> Pop-up/Toast + note="Replace PTB/Canary links with normal (Stable) Discord links." + {...util.useSetting(SettingValues, "normalizeAddress", defaultSettings.normalizeAddress)}> Normalize address
diff --git a/src/index.ts b/src/index.ts index 906f338..7191036 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,11 +9,11 @@ import HBCM from "./lib/HomeButtonContextMenuApi"; export const start = (): void => { registerSettings(); - HBCM.addItem("Address", AddressMenuItem); + HBCM.getAPI().addItem("Address", AddressMenuItem); }; export const stop = (): void => { - HBCM.removeItem("Address"); + HBCM.getAPI().removeItem("Address"); }; export { Settings } from "./Components/Settings"; diff --git a/src/lib/HomeButtonContextMenuApi.tsx b/src/lib/HomeButtonContextMenuApi.tsx index 20347c6..99b015a 100644 --- a/src/lib/HomeButtonContextMenuApi.tsx +++ b/src/lib/HomeButtonContextMenuApi.tsx @@ -1,7 +1,6 @@ import { contextMenu as ContextMenuApi } from "replugged/common"; import { ContextMenu } from "replugged/components"; -import Types from "../types"; -class HomeButtonContextMenuApi { +export default class HomeButtonContextMenuApi { items: Map; constructor() { this.items = new Map(); @@ -20,25 +19,16 @@ class HomeButtonContextMenuApi { .sort((a, b) => a?.props?.label?.localeCompare(b?.props?.label)) : []; const HomeButtonContextMenu = (props) => ( - + {...HomeButtonContextMenuItems} ); - ContextMenuApi.open(event, (e) => ( - + ContextMenuApi.open(event, (props) => ( + )); } -} - -export default await new Promise((resolve, reject) => { - try { - if (Object.hasOwnProperty.call(window, "HomeButtonContextMenuApi")) - resolve(window.HomeButtonContextMenuApi); - else - window.HomeButtonContextMenuApi = - new HomeButtonContextMenuApi() as Types.HomeButtonContextMenuApi; - resolve(window.HomeButtonContextMenuApi); - } catch (error) { - reject(error); + static getAPI(): HomeButtonContextMenuApi { + window.HomeButtonContextMenuApi ??= new HomeButtonContextMenuApi(); + return window.HomeButtonContextMenuApi; } -}); +} diff --git a/src/lib/requiredModules.ts b/src/lib/requiredModules.ts deleted file mode 100644 index 68345fc..0000000 --- a/src/lib/requiredModules.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { webpack } from "replugged"; -import Types from "../types"; - -export const DiscordNative = webpack.getByProps("clipboard", "process"); diff --git a/src/plaintextPatches.ts b/src/plaintextPatches.ts index f7ed184..c1a43e7 100644 --- a/src/plaintextPatches.ts +++ b/src/plaintextPatches.ts @@ -1,11 +1,12 @@ -import * as Types from "./types"; +import Types from "./types"; export default [ { find: "Messages.DISCODO_DISABLED", replacements: [ { match: /},(children.+?"friends-list")/, - replace: `},onContextMenu: HomeButtonContextMenuApi?.openContextMenu,$1`, + replace: (_, suffix: string) => + `},onContextMenu: window.HomeButtonContextMenuApi?.openContextMenu,${suffix}`, }, ], }, diff --git a/src/types.ts b/src/types.ts index b10275f..ba1d85b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,197 +1,190 @@ -import { types as DefaultTypes } from "replugged"; -export { types as DefaultTypes } from "replugged"; +import { types } from "replugged"; +import type HBCM from "./lib/HomeButtonContextMenuApi"; +export namespace Types { + export import DefaultTypes = types; + export type GenericModule = Record; + export interface Settings { + showToast: boolean; + normalizeAddress: boolean; + } +} +export default Types; + declare global { interface Window { - HomeButtonContextMenuApi: HomeButtonContextMenuApi; + HomeButtonContextMenuApi: HBCM; } -} -export interface HomeButtonContextMenuApi { - items?: Map; - constructor?: DefaultTypes.AnyFunction; - addItem?: DefaultTypes.AnyFunction; - removeItem?: DefaultTypes.AnyFunction; - forceUpdate?: DefaultTypes.AnyFunction; - openContextMenu?: DefaultTypes.AnyFunction; -} -export interface GenericModule { - [key: string]: DefaultTypes.AnyFunction; -} -export interface DiscordNative { - accessibility: { - isAccessibilitySupportEnabled: DefaultTypes.AnyFunction; - }; - app: { - dock: { - setBadge: DefaultTypes.AnyFunction; - bounce: DefaultTypes.AnyFunction; - cancelBounce: DefaultTypes.AnyFunction; - }; - getBuildNumber: DefaultTypes.AnyFunction; - getDefaultDoubleClickAction: DefaultTypes.AnyFunction; - getModuleVersions: DefaultTypes.AnyFunction; - getPath: DefaultTypes.AnyFunction; - getReleaseChannel: DefaultTypes.AnyFunction; - getVersion: DefaultTypes.AnyFunction; - registerUserInteractionHandler: DefaultTypes.AnyFunction; - relaunch: DefaultTypes.AnyFunction; - setBadgeCount: DefaultTypes.AnyFunction; - }; - clipboard: { - copy: DefaultTypes.AnyFunction; - copyImage: DefaultTypes.AnyFunction; - cut: DefaultTypes.AnyFunction; - paste: DefaultTypes.AnyFunction; - read: DefaultTypes.AnyFunction; - }; - clips: { - deleteClip: DefaultTypes.AnyFunction; - loadClip: DefaultTypes.AnyFunction; - loadClipsDirectory: DefaultTypes.AnyFunction; - }; - crashReporter: { - getMetadata: DefaultTypes.AnyFunction; - updateCrashReporter: DefaultTypes.AnyFunction; - }; - desktopCapture: { - getDesktopCaptureSources: DefaultTypes.AnyFunction; - }; - features: { - declareSupported: DefaultTypes.AnyFunction; - supports: DefaultTypes.AnyFunction; - }; - fileManager: { - basename: DefaultTypes.AnyFunction; - cleanupTempFiles: DefaultTypes.AnyFunction; - dirname: DefaultTypes.AnyFunction; - extname: DefaultTypes.AnyFunction; - getModuleDataPathSync: DefaultTypes.AnyFunction; - getModulePath: DefaultTypes.AnyFunction; - join: DefaultTypes.AnyFunction; - openFiles: DefaultTypes.AnyFunction; - readLogFiles: DefaultTypes.AnyFunction; - readTimeSeriesLogFiles: DefaultTypes.AnyFunction; - saveWithDialog: DefaultTypes.AnyFunction; - showItemInFolder: DefaultTypes.AnyFunction; - showOpenDialog: DefaultTypes.AnyFunction; - }; - gpuSettings: { - getEnableHardwareAcceleration: DefaultTypes.AnyFunction; - setEnableHardwareAcceleration: DefaultTypes.AnyFunction; - }; - http: { - getAPIEndpoint: DefaultTypes.AnyFunction; - makeChunkedRequest: DefaultTypes.AnyFunction; - }; - ipc: { - invoke: DefaultTypes.AnyFunction; - on: DefaultTypes.AnyFunction; - send: DefaultTypes.AnyFunction; - }; - isRenderer: boolean; - nativeModules: { - canBootstrapNewUpdater: boolean; - ensureModule: DefaultTypes.AnyFunction; - requireModule: DefaultTypes.AnyFunction; - }; - os: { - arch: string; - release: string; - }; - powerMonitor: { - getSystemIdleTimeMs: DefaultTypes.AnyFunction; - on: DefaultTypes.AnyFunction; - removeAllListeners: DefaultTypes.AnyFunction; - removeListener: DefaultTypes.AnyFunction; - }; - powerSaveBlocker: { - blockDisplaySleep: DefaultTypes.AnyFunction; - cleanupDisplaySleep: DefaultTypes.AnyFunction; - unblockDisplaySleep: DefaultTypes.AnyFunction; - }; - process: { - arch: string; - env: object; - platform: string; - }; - processUtils: { - flushCookies: DefaultTypes.AnyFunction; - flushDNSCache: DefaultTypes.AnyFunction; - flushStorageData: DefaultTypes.AnyFunction; - getCPUCoreCount: DefaultTypes.AnyFunction; - getCurrentCPUUsagePercent: DefaultTypes.AnyFunction; - getCurrentMemoryUsageKB: DefaultTypes.AnyFunction; - getLastCrash: DefaultTypes.AnyFunction; - getMainArgvSync: DefaultTypes.AnyFunction; - purgeMemory: DefaultTypes.AnyFunction; - }; - remoteApp: { - dock: { - setBadge: DefaultTypes.AnyFunction; - bounce: DefaultTypes.AnyFunction; - cancelBounce: DefaultTypes.AnyFunction; - }; - getBuildNumber: DefaultTypes.AnyFunction; - getDefaultDoubleClickAction: DefaultTypes.AnyFunction; - getModuleVersions: DefaultTypes.AnyFunction; - getPath: DefaultTypes.AnyFunction; - getReleaseChannel: DefaultTypes.AnyFunction; - getVersion: DefaultTypes.AnyFunction; - registerUserInteractionHandler: DefaultTypes.AnyFunction; - relaunch: DefaultTypes.AnyFunction; - setBadgeCount: DefaultTypes.AnyFunction; - }; - remotePowerMonitor: { - getSystemIdleTimeMs: DefaultTypes.AnyFunction; - on: DefaultTypes.AnyFunction; - removeAllListeners: DefaultTypes.AnyFunction; - removeListener: DefaultTypes.AnyFunction; - }; - safeStorage: { - decryptString: DefaultTypes.AnyFunction; - encryptString: DefaultTypes.AnyFunction; - isEncryptionAvailable: DefaultTypes.AnyFunction; - }; - setUncaughtExceptionHandler: DefaultTypes.AnyFunction; - settings: { - get: DefaultTypes.AnyFunction; - getSync: DefaultTypes.AnyFunction; - set: DefaultTypes.AnyFunction; - }; - spellCheck: { - getAvailableDictionaries: DefaultTypes.AnyFunction; - on: DefaultTypes.AnyFunction; - removeListener: DefaultTypes.AnyFunction; - replaceMisspelling: DefaultTypes.AnyFunction; - setLearnedWords: DefaultTypes.AnyFunction; - setLocale: DefaultTypes.AnyFunction; - }; - thumbar: { setThumbarButtons: DefaultTypes.AnyFunction }; - userDataCache: { - cacheUserData: DefaultTypes.AnyFunction; - deleteCache: DefaultTypes.AnyFunction; - getCached: DefaultTypes.AnyFunction; - }; - window: { - USE_OSX_NATIVE_TRAFFIC_LIGHTS: boolean; - blur: DefaultTypes.AnyFunction; - close: DefaultTypes.AnyFunction; - flashFrame: DefaultTypes.AnyFunction; - focus: DefaultTypes.AnyFunction; - fullscreen: DefaultTypes.AnyFunction; - isAlwaysOnTop: DefaultTypes.AnyFunction; - maximize: DefaultTypes.AnyFunction; - minimize: DefaultTypes.AnyFunction; - restore: DefaultTypes.AnyFunction; - setAlwaysOnTop: DefaultTypes.AnyFunction; - setBackgroundThrottling: DefaultTypes.AnyFunction; - setDevtoolsCallbacks: DefaultTypes.AnyFunction; - setProgressBar: DefaultTypes.AnyFunction; - setZoomFactor: DefaultTypes.AnyFunction; + export const DiscordNative: { + accessibility: { + isAccessibilitySupportEnabled: Types.DefaultTypes.AnyFunction; + }; + app: { + dock: { + setBadge: Types.DefaultTypes.AnyFunction; + bounce: Types.DefaultTypes.AnyFunction; + cancelBounce: Types.DefaultTypes.AnyFunction; + }; + getBuildNumber: Types.DefaultTypes.AnyFunction; + getDefaultDoubleClickAction: Types.DefaultTypes.AnyFunction; + getModuleVersions: Types.DefaultTypes.AnyFunction; + getPath: Types.DefaultTypes.AnyFunction; + getReleaseChannel: Types.DefaultTypes.AnyFunction; + getVersion: Types.DefaultTypes.AnyFunction; + registerUserInteractionHandler: Types.DefaultTypes.AnyFunction; + relaunch: Types.DefaultTypes.AnyFunction; + setBadgeCount: Types.DefaultTypes.AnyFunction; + }; + clipboard: { + copy: Types.DefaultTypes.AnyFunction; + copyImage: Types.DefaultTypes.AnyFunction; + cut: Types.DefaultTypes.AnyFunction; + paste: Types.DefaultTypes.AnyFunction; + read: Types.DefaultTypes.AnyFunction; + }; + clips: { + deleteClip: Types.DefaultTypes.AnyFunction; + loadClip: Types.DefaultTypes.AnyFunction; + loadClipsDirectory: Types.DefaultTypes.AnyFunction; + }; + crashReporter: { + getMetadata: Types.DefaultTypes.AnyFunction; + updateCrashReporter: Types.DefaultTypes.AnyFunction; + }; + desktopCapture: { + getDesktopCaptureSources: Types.DefaultTypes.AnyFunction; + }; + features: { + declareSupported: Types.DefaultTypes.AnyFunction; + supports: Types.DefaultTypes.AnyFunction; + }; + fileManager: { + basename: Types.DefaultTypes.AnyFunction; + cleanupTempFiles: Types.DefaultTypes.AnyFunction; + dirname: Types.DefaultTypes.AnyFunction; + extname: Types.DefaultTypes.AnyFunction; + getModuleDataPathSync: Types.DefaultTypes.AnyFunction; + getModulePath: Types.DefaultTypes.AnyFunction; + join: Types.DefaultTypes.AnyFunction; + openFiles: Types.DefaultTypes.AnyFunction; + readLogFiles: Types.DefaultTypes.AnyFunction; + readTimeSeriesLogFiles: Types.DefaultTypes.AnyFunction; + saveWithDialog: Types.DefaultTypes.AnyFunction; + showItemInFolder: Types.DefaultTypes.AnyFunction; + showOpenDialog: Types.DefaultTypes.AnyFunction; + }; + gpuSettings: { + getEnableHardwareAcceleration: Types.DefaultTypes.AnyFunction; + setEnableHardwareAcceleration: Types.DefaultTypes.AnyFunction; + }; + http: { + getAPIEndpoint: Types.DefaultTypes.AnyFunction; + makeChunkedRequest: Types.DefaultTypes.AnyFunction; + }; + ipc: { + invoke: Types.DefaultTypes.AnyFunction; + on: Types.DefaultTypes.AnyFunction; + send: Types.DefaultTypes.AnyFunction; + }; + isRenderer: boolean; + nativeModules: { + canBootstrapNewUpdater: boolean; + ensureModule: Types.DefaultTypes.AnyFunction; + requireModule: Types.DefaultTypes.AnyFunction; + }; + os: { + arch: string; + release: string; + }; + powerMonitor: { + getSystemIdleTimeMs: Types.DefaultTypes.AnyFunction; + on: Types.DefaultTypes.AnyFunction; + removeAllListeners: Types.DefaultTypes.AnyFunction; + removeListener: Types.DefaultTypes.AnyFunction; + }; + powerSaveBlocker: { + blockDisplaySleep: Types.DefaultTypes.AnyFunction; + cleanupDisplaySleep: Types.DefaultTypes.AnyFunction; + unblockDisplaySleep: Types.DefaultTypes.AnyFunction; + }; + process: { + arch: string; + env: object; + platform: string; + }; + processUtils: { + flushCookies: Types.DefaultTypes.AnyFunction; + flushDNSCache: Types.DefaultTypes.AnyFunction; + flushStorageData: Types.DefaultTypes.AnyFunction; + getCPUCoreCount: Types.DefaultTypes.AnyFunction; + getCurrentCPUUsagePercent: Types.DefaultTypes.AnyFunction; + getCurrentMemoryUsageKB: Types.DefaultTypes.AnyFunction; + getLastCrash: Types.DefaultTypes.AnyFunction; + getMainArgvSync: Types.DefaultTypes.AnyFunction; + purgeMemory: Types.DefaultTypes.AnyFunction; + }; + remoteApp: { + dock: { + setBadge: Types.DefaultTypes.AnyFunction; + bounce: Types.DefaultTypes.AnyFunction; + cancelBounce: Types.DefaultTypes.AnyFunction; + }; + getBuildNumber: Types.DefaultTypes.AnyFunction; + getDefaultDoubleClickAction: Types.DefaultTypes.AnyFunction; + getModuleVersions: Types.DefaultTypes.AnyFunction; + getPath: Types.DefaultTypes.AnyFunction; + getReleaseChannel: Types.DefaultTypes.AnyFunction; + getVersion: Types.DefaultTypes.AnyFunction; + registerUserInteractionHandler: Types.DefaultTypes.AnyFunction; + relaunch: Types.DefaultTypes.AnyFunction; + setBadgeCount: Types.DefaultTypes.AnyFunction; + }; + remotePowerMonitor: { + getSystemIdleTimeMs: Types.DefaultTypes.AnyFunction; + on: Types.DefaultTypes.AnyFunction; + removeAllListeners: Types.DefaultTypes.AnyFunction; + removeListener: Types.DefaultTypes.AnyFunction; + }; + safeStorage: { + decryptString: Types.DefaultTypes.AnyFunction; + encryptString: Types.DefaultTypes.AnyFunction; + isEncryptionAvailable: Types.DefaultTypes.AnyFunction; + }; + setUncaughtExceptionHandler: Types.DefaultTypes.AnyFunction; + settings: { + get: Types.DefaultTypes.AnyFunction; + getSync: Types.DefaultTypes.AnyFunction; + set: Types.DefaultTypes.AnyFunction; + }; + spellCheck: { + getAvailableDictionaries: Types.DefaultTypes.AnyFunction; + on: Types.DefaultTypes.AnyFunction; + removeListener: Types.DefaultTypes.AnyFunction; + replaceMisspelling: Types.DefaultTypes.AnyFunction; + setLearnedWords: Types.DefaultTypes.AnyFunction; + setLocale: Types.DefaultTypes.AnyFunction; + }; + thumbar: { setThumbarButtons: Types.DefaultTypes.AnyFunction }; + userDataCache: { + cacheUserData: Types.DefaultTypes.AnyFunction; + deleteCache: Types.DefaultTypes.AnyFunction; + getCached: Types.DefaultTypes.AnyFunction; + }; + window: { + USE_OSX_NATIVE_TRAFFIC_LIGHTS: boolean; + blur: Types.DefaultTypes.AnyFunction; + close: Types.DefaultTypes.AnyFunction; + flashFrame: Types.DefaultTypes.AnyFunction; + focus: Types.DefaultTypes.AnyFunction; + fullscreen: Types.DefaultTypes.AnyFunction; + isAlwaysOnTop: Types.DefaultTypes.AnyFunction; + maximize: Types.DefaultTypes.AnyFunction; + minimize: Types.DefaultTypes.AnyFunction; + restore: Types.DefaultTypes.AnyFunction; + setAlwaysOnTop: Types.DefaultTypes.AnyFunction; + setBackgroundThrottling: Types.DefaultTypes.AnyFunction; + setDevtoolsCallbacks: Types.DefaultTypes.AnyFunction; + setProgressBar: Types.DefaultTypes.AnyFunction; + setZoomFactor: Types.DefaultTypes.AnyFunction; + }; }; } -export interface Settings { - showToast: boolean; - normalizeAddress: boolean; -} - -export * as default from "./types";