diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cce817f..e545ce4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - uses: pnpm/action-setup@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b669bc2..4542987 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - uses: pnpm/action-setup@v2 with: diff --git a/README.md b/README.md index 191ffff..277e82e 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Show that you are deafened to others, while in reality you can still hear them. It's also possible to fake mute and fake video. -Direct Download Link: [dev.tharki.FakeDeafen.asar](https://github.com/TharkiDev/FakeDeafen/releases/latest/download/dev.tharki.FakeDeafen.asar) +Direct Download Link: [dev.tharki.FakeDeafen.asar](https://github.com/YofukashiNo/FakeDeafen/releases/latest/download/dev.tharki.FakeDeafen.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=TharkiDev/FakeDeafen&source=github) +[![Install in Replugged](https://img.shields.io/badge/-Install%20in%20Replugged-blue?style=for-the-badge&logo=none)](https://replugged.dev/install?identifier=YofukashiNo/FakeDeafen&source=github) ![fake deaf](https://i.imgur.com/hLCUDCO.gif) diff --git a/esbuild.extra.mjs b/esbuild.extra.mjs new file mode 100644 index 0000000..391e74f --- /dev/null +++ b/esbuild.extra.mjs @@ -0,0 +1,10 @@ +export default ({ loader, ...buildInfo }) => { + // return c + return { + ...buildInfo, + loader: { + ...(loader ?? {}), + ".mp3": "dataurl", + }, + }; +}; diff --git a/flashcord/store/fakedeafen.html b/flashcord/store/fakedeafen.html index c23d8da..fb08cfc 100644 --- a/flashcord/store/fakedeafen.html +++ b/flashcord/store/fakedeafen.html @@ -12,17 +12,17 @@ // Show that you are deafened to others, while in reality you can still hear them. Show that you are deafened to others, while in reality you can still hear them. - // TharkiDev: Note to be careful to edit the correct name for the Github links to work. - TharkiDev + // YofukashiNo: Note to be careful to edit the correct name for the Github links to work. + YofukashiNo // Module License Unlicense // Module's Github Repository - https://github.com/TharkiDev/FakeDeafen + https://github.com/YofukashiNo/FakeDeafen // Your Github Profile - https://github.com/TharkiDev + https://github.com/YofukashiNo // Module's Discord Server https://discord.gg/SgKSKyh9gY @@ -43,7 +43,7 @@ FakeDeafen - Flashcord Store - + @@ -79,21 +79,21 @@

Show that you are deafened to others, while in reality you can still hear them.

It's also possible to fake mute and fake video.

-

Direct Download Link: dev.tharki.FakeDeafen.asar

+

Direct Download Link: dev.tharki.FakeDeafen.asar

FakeDeafen

-

💿

+

💿

-

TharkiDev

+

YofukashiNo

💬

How to install this Plugin:

🔌 Replugged

-

Click here to install the plugin, your web browser will then communicate with your Replugged Client to install the plugin.

+

Click here to install the plugin, your web browser will then communicate with your Replugged Client to install the plugin.

@@ -105,7 +105,7 @@

Disclaimer

- +
diff --git a/flashcord/store/fakedeafen/embed.html b/flashcord/store/fakedeafen/embed.html index 2ee6ed8..fe3edb8 100644 --- a/flashcord/store/fakedeafen/embed.html +++ b/flashcord/store/fakedeafen/embed.html @@ -12,17 +12,17 @@ // Show that you are deafened to others, while in reality you can still hear them. Show that you are deafened to others, while in reality you can still hear them. - // TharkiDev: Note to be careful to edit the correct name for the Github links to work. - TharkiDev + // YofukashiNo: Note to be careful to edit the correct name for the Github links to work. + YofukashiNo // Module License Unlicense // Module's Github Repository - https://github.com/TharkiDev/FakeDeafen + https://github.com/YofukashiNo/FakeDeafen // Your Github Profile - https://github.com/TharkiDev + https://github.com/YofukashiNo // Module's Discord Server https://discord.gg/SgKSKyh9gY @@ -38,7 +38,7 @@ FakeDeafen - Flashcord Store - + @@ -63,15 +63,15 @@

FakeDeafen

-

💿

+

💿

-

TharkiDev

+

YofukashiNo

💬

Show that you are deafened to others, while in reality you can still hear them.

- +
diff --git a/manifest.json b/manifest.json index 1dd438c..31ecde1 100644 --- a/manifest.json +++ b/manifest.json @@ -3,16 +3,16 @@ "name": "FakeDeafen", "description": "Fake your audio status, to make it look like you are muted or deafened from other's perspective when you're not.", "image": "https://i.imgur.com/hLCUDCO.gif", - "source": "https://github.com/TharkiDev/FakeDeafen", + "source": "https://github.com/YofukashiNo/FakeDeafen", "author": { "name": "Ahlawat", "discordID": "1121961711080050780", - "github": "TharkiDev" + "github": "YofukashiNo" }, "version": "1.1.4", "updater": { "type": "github", - "id": "TharkiDev/FakeDeafen" + "id": "YofukashiNo/FakeDeafen" }, "license": "MIT", "type": "replugged-plugin", diff --git a/package.json b/package.json index 34341f2..bcbc143 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-react": "^7.33.2", "prettier": "^2.8.8", - "replugged": "^4.7.6", + "replugged": "4.7.9", "typescript": "^5.3.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 30c65ca..9a66802 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,8 +33,8 @@ devDependencies: specifier: ^2.8.8 version: 2.8.8 replugged: - specifier: ^4.7.6 - version: 4.7.6(@codemirror/view@6.22.1)(@lezer/common@1.1.1) + specifier: 4.7.9 + version: 4.7.9(@codemirror/view@6.22.1)(@lezer/common@1.1.1) typescript: specifier: ^5.3.2 version: 5.3.2 @@ -139,17 +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.11: + resolution: {integrity: sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==} engines: {node: '>=12'} - cpu: [arm64] - os: [android] + cpu: [ppc64] + os: [aix] requiresBuild: true dev: true optional: true - /@esbuild/android-arm64@0.19.8: - resolution: {integrity: sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==} + /@esbuild/android-arm64@0.19.11: + resolution: {integrity: sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -157,8 +157,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.11: + resolution: {integrity: sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -166,17 +166,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.19.8: - resolution: {integrity: sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/android-x64@0.18.20: - resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + /@esbuild/android-x64@0.19.11: + resolution: {integrity: sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -184,17 +175,8 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.19.8: - resolution: {integrity: sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-arm64@0.18.20: - resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + /@esbuild/darwin-arm64@0.19.11: + resolution: {integrity: sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -202,26 +184,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.19.8: - resolution: {integrity: sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-x64@0.18.20: - resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-x64@0.19.8: - resolution: {integrity: sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==} + /@esbuild/darwin-x64@0.19.11: + resolution: {integrity: sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -229,8 +193,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.18.20: - resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + /@esbuild/freebsd-arm64@0.19.11: + resolution: {integrity: sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -238,17 +202,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.19.8: - resolution: {integrity: sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-x64@0.18.20: - resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + /@esbuild/freebsd-x64@0.19.11: + resolution: {integrity: sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -256,26 +211,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.19.8: - resolution: {integrity: sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm64@0.18.20: - resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm64@0.19.8: - resolution: {integrity: sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==} + /@esbuild/linux-arm64@0.19.11: + resolution: {integrity: sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -283,17 +220,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.18.20: - resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm@0.19.8: - resolution: {integrity: sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==} + /@esbuild/linux-arm@0.19.11: + resolution: {integrity: sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -301,17 +229,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.18.20: - resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ia32@0.19.8: - resolution: {integrity: sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==} + /@esbuild/linux-ia32@0.19.11: + resolution: {integrity: sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -319,17 +238,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.18.20: - resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-loong64@0.19.8: - resolution: {integrity: sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==} + /@esbuild/linux-loong64@0.19.11: + resolution: {integrity: sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -337,17 +247,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.18.20: - resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-mips64el@0.19.8: - resolution: {integrity: sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==} + /@esbuild/linux-mips64el@0.19.11: + resolution: {integrity: sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -355,17 +256,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.18.20: - resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ppc64@0.19.8: - resolution: {integrity: sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==} + /@esbuild/linux-ppc64@0.19.11: + resolution: {integrity: sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -373,8 +265,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.18.20: - resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + /@esbuild/linux-riscv64@0.19.11: + resolution: {integrity: sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -382,26 +274,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.19.8: - resolution: {integrity: sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-s390x@0.18.20: - resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-s390x@0.19.8: - resolution: {integrity: sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==} + /@esbuild/linux-s390x@0.19.11: + resolution: {integrity: sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -409,8 +283,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.18.20: - resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + /@esbuild/linux-x64@0.19.11: + resolution: {integrity: sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -418,26 +292,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.19.8: - resolution: {integrity: sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/netbsd-x64@0.18.20: - resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/netbsd-x64@0.19.8: - resolution: {integrity: sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==} + /@esbuild/netbsd-x64@0.19.11: + resolution: {integrity: sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -445,17 +301,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.18.20: - resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/openbsd-x64@0.19.8: - resolution: {integrity: sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==} + /@esbuild/openbsd-x64@0.19.11: + resolution: {integrity: sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -463,8 +310,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.18.20: - resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + /@esbuild/sunos-x64@0.19.11: + resolution: {integrity: sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -472,26 +319,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.19.8: - resolution: {integrity: sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-arm64@0.18.20: - resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-arm64@0.19.8: - resolution: {integrity: sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==} + /@esbuild/win32-arm64@0.19.11: + resolution: {integrity: sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -499,17 +328,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.18.20: - resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-ia32@0.19.8: - resolution: {integrity: sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==} + /@esbuild/win32-ia32@0.19.11: + resolution: {integrity: sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -517,17 +337,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.18.20: - resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-x64@0.19.8: - resolution: {integrity: sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==} + /@esbuild/win32-x64@0.19.11: + resolution: {integrity: sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -1127,10 +938,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'} @@ -1478,74 +1285,45 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild-sass-plugin@2.16.0(esbuild@0.19.8): + /esbuild-sass-plugin@2.16.0(esbuild@0.19.11): resolution: {integrity: sha512-mGCe9MxNYvZ+j77Q/QFO+rwUGA36mojDXkOhtVmoyz1zwYbMaNrtVrmXwwYDleS/UMKTNU3kXuiTtPiAD3K+Pw==} peerDependencies: esbuild: ^0.19.4 dependencies: - esbuild: 0.19.8 + esbuild: 0.19.11 resolve: 1.22.8 sass: 1.69.5 dev: true - /esbuild@0.18.20: - resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + /esbuild@0.19.11: + resolution: {integrity: sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==} 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 - dev: true - - /esbuild@0.19.8: - resolution: {integrity: sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==} - engines: {node: '>=12'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/android-arm': 0.19.8 - '@esbuild/android-arm64': 0.19.8 - '@esbuild/android-x64': 0.19.8 - '@esbuild/darwin-arm64': 0.19.8 - '@esbuild/darwin-x64': 0.19.8 - '@esbuild/freebsd-arm64': 0.19.8 - '@esbuild/freebsd-x64': 0.19.8 - '@esbuild/linux-arm': 0.19.8 - '@esbuild/linux-arm64': 0.19.8 - '@esbuild/linux-ia32': 0.19.8 - '@esbuild/linux-loong64': 0.19.8 - '@esbuild/linux-mips64el': 0.19.8 - '@esbuild/linux-ppc64': 0.19.8 - '@esbuild/linux-riscv64': 0.19.8 - '@esbuild/linux-s390x': 0.19.8 - '@esbuild/linux-x64': 0.19.8 - '@esbuild/netbsd-x64': 0.19.8 - '@esbuild/openbsd-x64': 0.19.8 - '@esbuild/sunos-x64': 0.19.8 - '@esbuild/win32-arm64': 0.19.8 - '@esbuild/win32-ia32': 0.19.8 - '@esbuild/win32-x64': 0.19.8 + '@esbuild/aix-ppc64': 0.19.11 + '@esbuild/android-arm': 0.19.11 + '@esbuild/android-arm64': 0.19.11 + '@esbuild/android-x64': 0.19.11 + '@esbuild/darwin-arm64': 0.19.11 + '@esbuild/darwin-x64': 0.19.11 + '@esbuild/freebsd-arm64': 0.19.11 + '@esbuild/freebsd-x64': 0.19.11 + '@esbuild/linux-arm': 0.19.11 + '@esbuild/linux-arm64': 0.19.11 + '@esbuild/linux-ia32': 0.19.11 + '@esbuild/linux-loong64': 0.19.11 + '@esbuild/linux-mips64el': 0.19.11 + '@esbuild/linux-ppc64': 0.19.11 + '@esbuild/linux-riscv64': 0.19.11 + '@esbuild/linux-s390x': 0.19.11 + '@esbuild/linux-x64': 0.19.11 + '@esbuild/netbsd-x64': 0.19.11 + '@esbuild/openbsd-x64': 0.19.11 + '@esbuild/sunos-x64': 0.19.11 + '@esbuild/win32-arm64': 0.19.11 + '@esbuild/win32-ia32': 0.19.11 + '@esbuild/win32-x64': 0.19.11 dev: true /escalade@3.1.1: @@ -2708,8 +2486,8 @@ packages: rc: 1.2.8 dev: true - /replugged@4.7.6(@codemirror/view@6.22.1)(@lezer/common@1.1.1): - resolution: {integrity: sha512-E7qxlBRlvpQiXz3zXUO/IH0TQqXxgLmQCO/BMugNDqqtWEbm3W5VIIXYnnrPce5UA0n8TgIzxh0fORl+22sS2w==} + /replugged@4.7.9(@codemirror/view@6.22.1)(@lezer/common@1.1.1): + resolution: {integrity: sha512-Eh44KEzXVLRO7UtrZm5mvYXr12KJV4zpifYUEFlNoGaT9mzO598f8WgiMdCQdaUf27bZl+nk6qUngMR4YfkXoA==} engines: {node: '>=18.0.0', pnpm: '>=8.0.0'} hasBin: true requiresBuild: true @@ -2724,14 +2502,14 @@ packages: adm-zip: 0.5.10 chalk: 5.3.0 codemirror: 6.0.1(@lezer/common@1.1.1) - esbuild: 0.19.8 - esbuild-sass-plugin: 2.16.0(esbuild@0.19.8) + esbuild: 0.19.11 + esbuild-sass-plugin: 2.16.0(esbuild@0.19.11) esm: 3.2.25 node-fetch: 3.3.2 prompts: 2.4.2 semver: 7.5.4 standalone-electron-types: 1.0.0 - tsx: 3.14.0 + tsx: 4.7.0 update-notifier: 6.0.2 ws: 8.14.2 yargs: 17.7.2 @@ -2909,18 +2687,6 @@ 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: @@ -3044,13 +2810,13 @@ packages: typescript: 5.3.2 dev: true - /tsx@3.14.0: - resolution: {integrity: sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==} + /tsx@4.7.0: + resolution: {integrity: sha512-I+t79RYPlEYlHn9a+KzwrvEwhJg35h/1zHsLC2JXvhC2mdynMv6Zxzvhv5EMV6VF5qJlLlkSnMVvdZV3PSIGcg==} + engines: {node: '>=18.0.0'} hasBin: true dependencies: - esbuild: 0.18.20 + esbuild: 0.19.11 get-tsconfig: 4.7.2 - source-map-support: 0.5.21 optionalDependencies: fsevents: 2.3.3 dev: true diff --git a/src/Components/AccountDetailsButton.tsx b/src/Components/AccountDetailsButton.tsx index bd0b9be..f537dc4 100644 --- a/src/Components/AccountDetailsButton.tsx +++ b/src/Components/AccountDetailsButton.tsx @@ -1,18 +1,23 @@ import { plugins } from "replugged"; -import { contextMenu as ContextMenuApi } from "replugged/common"; +import { contextMenu as ContextMenuApi, React } from "replugged/common"; import { SettingValues } from "../index"; -import { PanelButton } from "../lib/requiredModules"; +import Modules from "../lib/requiredModules"; import { defaultSettings } from "../lib/consts"; import FakeDeafenContextMenu from "./ContextMenu"; import Icons from "../Components/Icons"; import Utils from "../lib/utils"; -export default (): React.ReactElement | null => { +export const AccountDetailsButton = () => { if ( !SettingValues.get("userPanel", defaultSettings.userPanel) || plugins.getDisabled().includes("dev.tharki.FakeDeafen") ) return null; - const enabled = SettingValues.get("enabled", defaultSettings.enabled); + const [enabled, setEnabled] = React.useState( + SettingValues.get("enabled", defaultSettings.enabled), + ); + React.useEffect(() => { + setEnabled(SettingValues.get("enabled", defaultSettings.enabled)); + }, [SettingValues.get("enabled", defaultSettings.enabled)]); const Icon = ; const DisabledIcon = ( @@ -25,10 +30,10 @@ export default (): React.ReactElement | null => { ); return ( - - ContextMenuApi.open(event, (e) => ( - + ContextMenuApi.open(event, (props) => ( + )) } icon={() => (enabled ? DisabledIcon : Icon)} @@ -37,3 +42,4 @@ export default (): React.ReactElement | null => { /> ); }; +export default () => (Modules.PanelButton ? : <>); diff --git a/src/Components/CenterTrayButton.tsx b/src/Components/CenterTrayButton.tsx new file mode 100644 index 0000000..9cb0267 --- /dev/null +++ b/src/Components/CenterTrayButton.tsx @@ -0,0 +1,67 @@ +import { React, components } from "replugged/common"; +import { SettingValues } from "../index"; +import Modules from "../lib/requiredModules"; +import { defaultSettings } from "../lib/consts"; +import FakeDeafenContextMenu from "./ContextMenu"; +import Icons from "../Components/Icons"; +import Utils from "../lib/utils"; +import Types from "../types"; +const DiscordComponents = components as typeof components & { Popout: Types.Popout }; +export default (): React.ReactElement | null => { + if (!SettingValues.get("centerTray", defaultSettings.centerTray)) return null; + const [enabled, setEnabled] = React.useState( + SettingValues.get("enabled", defaultSettings.enabled), + ); + React.useEffect(() => { + setEnabled(SettingValues.get("enabled", defaultSettings.enabled)); + }, [SettingValues.get("enabled", defaultSettings.enabled)]); + const Icon = ; + const DisabledIcon = ( + + + + ); + return ( + { + const { preventIdle, allowIdle } = Modules.IdleHandler!.usePreventIdle("popup"); + React.useEffect(() => { + preventIdle(); + return () => allowIdle(); + }, [preventIdle, allowIdle]); + return ( + + + + ); + }} + align="center" + position="top" + animation={DiscordComponents.Popout.Animation.FADE}> + {({ + onClick: onPopoutClick, + "aria-expanded": popoutOpen, + }: { + onClick: Types.DefaultTypes.AnyFunction; + "aria-expanded": boolean; + }) => { + return ( + (enabled ? DisabledIcon : Icon)} + isActive={enabled} + label={`${enabled ? "Unfake" : "Fake"} VC Status`} + onClick={() => Utils.toggleSoundStatus(enabled)} + onPopoutClick={onPopoutClick} + popoutOpen={popoutOpen} + /> + ); + }} + + ); +}; diff --git a/src/Components/ContextMenu.tsx b/src/Components/ContextMenu.tsx index 6791e4f..fe4ab5b 100644 --- a/src/Components/ContextMenu.tsx +++ b/src/Components/ContextMenu.tsx @@ -3,45 +3,49 @@ import { ContextMenu } from "replugged/components"; import { SettingValues } from "../index"; import { defaultSettings } from "../lib/consts"; import Utils from "../lib/utils"; - -export default (props) => { - const { value: muteValue, onChange: muteOnChange } = Utils.useSetting( +import Types from "../types"; +export default (props: Types.MenuProps | { onClose: Types.DefaultTypes.AnyFunction }) => { + const [muteValue, muteOnChange] = Utils.useSettingArray( SettingValues, "soundStatus.mute", defaultSettings.soundStatus.mute, ); - const { value: deafValue, onChange: deafOnChange } = Utils.useSetting( + const [deafValue, deafOnChange] = Utils.useSettingArray( SettingValues, "soundStatus.deaf", defaultSettings.soundStatus.deaf, ); - const { value: videoValue, onChange: videoOnChange } = Utils.useSetting( + const [videoValue, videoOnChange] = Utils.useSettingArray( SettingValues, "soundStatus.video", defaultSettings.soundStatus.video, ); return ( - - - - muteOnChange(!muteValue)} - /> - deafOnChange(!deafValue)} - /> - videoOnChange(!videoValue)} - /> + + + + muteOnChange(!muteValue)} + /> + deafOnChange(!deafValue)} + /> + videoOnChange(!videoValue)} + /> + ); }; diff --git a/src/Components/Settings.tsx b/src/Components/Settings.tsx index 5b9eafb..7fd9113 100644 --- a/src/Components/Settings.tsx +++ b/src/Components/Settings.tsx @@ -1,7 +1,6 @@ -import { components } from "replugged"; +import { Category, SwitchItem } from "replugged/components"; import { PluginLogger, SettingValues } from "../index"; import { defaultSettings } from "../lib/consts"; -const { SwitchItem, Category } = components; import KeybindItem from "./KeybindItem"; import Utils from "../lib/utils"; import Types from "../types"; @@ -48,11 +47,11 @@ export const Settings = (): React.ReactElement => { { Show toasts Status picker User panel + + Center Tray + { ); }; + +export default { registerSettings, Settings }; diff --git a/src/assets/assets.d.ts b/src/assets/assets.d.ts new file mode 100644 index 0000000..056db3b --- /dev/null +++ b/src/assets/assets.d.ts @@ -0,0 +1,3 @@ +declare module "*.mp3" { + export default content as string; +} diff --git a/src/assets/fd_disable.mp3 b/src/assets/fd_disable.mp3 new file mode 100644 index 0000000..0c7e459 Binary files /dev/null and b/src/assets/fd_disable.mp3 differ diff --git a/src/assets/fd_enable.mp3 b/src/assets/fd_enable.mp3 new file mode 100644 index 0000000..688d964 Binary files /dev/null and b/src/assets/fd_enable.mp3 differ diff --git a/src/index.ts b/src/index.ts index d596a21..a181fb5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,25 +1,24 @@ import { Injector, Logger, settings } from "replugged"; import { defaultSettings } from "./lib/consts"; import "./style.css"; -import { registerSettings } from "./Components/Settings"; -export const CurrentlyPressed = new Map(); export const PluginInjector = new Injector(); export const { utils: PluginInjectorUtils } = PluginInjector; -export const PluginLogger = Logger.plugin("FakeDeafen"); +export const PluginLogger = Logger.plugin("FakeDeafen", "#b380ff"); export const SettingValues = await settings.init("dev.tharki.FakeDeafen", defaultSettings); - -import { applyInjections } from "./patches/index"; -import { addListeners, removeListeners } from "./listeners/index"; +export const CurrentlyPressed = new Map(); +import Settings from "./Components/Settings"; +import Injections from "./injections/index"; +import Listeners from "./listeners/index"; export const start = (): void => { - registerSettings(); - applyInjections(); - addListeners(); + Settings.registerSettings(); + void Injections.applyInjections(); + void Listeners.addListeners(); }; export const stop = (): void => { PluginInjector.uninjectAll(); - removeListeners(); + Listeners.removeListeners(); }; export { default as _addPanelButton } from "./Components/AccountDetailsButton"; diff --git a/src/patches/Menu.tsx b/src/injections/AccountContextMenu.tsx similarity index 52% rename from src/patches/Menu.tsx rename to src/injections/AccountContextMenu.tsx index 4587b08..6d39098 100644 --- a/src/patches/Menu.tsx +++ b/src/injections/AccountContextMenu.tsx @@ -1,3 +1,4 @@ +import { React } from "replugged/common"; import { ContextMenu } from "replugged/components"; import { PluginInjectorUtils, SettingValues } from "../index"; import { defaultSettings } from "../lib/consts"; @@ -8,22 +9,27 @@ import Types from "../types"; export default (): void => { PluginInjectorUtils.addMenuItem(Types.DefaultTypes.ContextMenuTypes.Account, (_data, menu) => { if (!SettingValues.get("statusPicker", defaultSettings.statusPicker)) return; - const { value: muteValue, onChange: muteOnChange } = Utils.useSetting( + const [muteValue, muteOnChange] = Utils.useSettingArray( SettingValues, "soundStatus.mute", defaultSettings.soundStatus.mute, ); - const { value: deafValue, onChange: deafOnChange } = Utils.useSetting( + const [deafValue, deafOnChange] = Utils.useSettingArray( SettingValues, "soundStatus.deaf", defaultSettings.soundStatus.deaf, ); - const { value: videoValue, onChange: videoOnChange } = Utils.useSetting( + const [videoValue, videoOnChange] = Utils.useSettingArray( SettingValues, "soundStatus.video", defaultSettings.soundStatus.video, ); - const enabled = SettingValues.get("enabled", defaultSettings.enabled); + const [enabled, setEnabled] = React.useState( + SettingValues.get("enabled", defaultSettings.enabled), + ); + React.useEffect(() => { + setEnabled(SettingValues.get("enabled", defaultSettings.enabled)); + }, [SettingValues.get("enabled", defaultSettings.enabled)]); const Icon = ( { fill: "#a61616", }} points="22.6,2.7 22.6,2.8 19.3,6.1 16,9.3 16,9.4 15,10.4 15,10.4 10.3,15 2.8,22.5 1.4,21.1 21.2,1.3 " - />{" "} + /> ); const { children } = menu as { children: React.ReactElement[] }; const switchAccount = children.find((c) => c?.props?.children?.key === "switch-account"); - if (!children.find((c) => c?.props?.className === "tharki")) + if (!children.find((c) => c?.props?.className === "yofukashino")) children.splice( - children.indexOf(switchAccount), + children.indexOf(switchAccount!), 0, - , + , ); - const section = children.find((c) => c?.props?.className === "tharki"); - section.props.children = section.props.children.filter((m) => m?.props?.id !== "fake-deafen"); - if (!section.props.children.find((m) => m?.props?.id === "fake-deafen")) + const section = children.find((c) => c?.props?.className === "yofukashino"); + if (!section) return; + section.props.children = section.props.children.filter( + (m: React.ReactElement) => m?.props?.id !== "fake-deafen", + ); + if (!section.props.children.find((m: React.ReactElement) => m?.props?.id === "fake-deafen")) section.props.children.push( Utils.toggleSoundStatus(enabled)} icon={() => (enabled ? DisabledIcon : Icon)} showIconFirst={true}> - - - muteOnChange(!muteValue)} - /> - deafOnChange(!deafValue)} - /> - videoOnChange(!videoValue)} - /> + + + muteOnChange(!muteValue)} + /> + deafOnChange(!deafValue)} + /> + videoOnChange(!videoValue)} + /> + , ); }); diff --git a/src/patches/AudioResolver.ts b/src/injections/AudioResolver.ts similarity index 64% rename from src/patches/AudioResolver.ts rename to src/injections/AudioResolver.ts index 3618f71..530ab39 100644 --- a/src/patches/AudioResolver.ts +++ b/src/injections/AudioResolver.ts @@ -1,9 +1,9 @@ import { PluginInjector } from "../index"; -import { AudioResolverPromise } from "../lib/requiredModules"; +import Modules from "../lib/requiredModules"; import { Sounds } from "../lib/consts"; export default async (): Promise => { - const AudioResolver = await AudioResolverPromise; + const AudioResolver = await Modules.AudioResolverPromise; PluginInjector.instead(AudioResolver, "exports", ([sound]: [string], res) => { switch (sound) { case `./${Sounds.Enable}.mp3`: { @@ -12,9 +12,10 @@ export default async (): Promise => { case `./${Sounds.Disable}.mp3`: { return Sounds.DisableURL; } - default: { - return res(sound); - } + default: + if (AudioResolver.exports.keys().includes(sound)) { + return res(sound); + } } }); }; diff --git a/src/injections/CenterControlTray.tsx b/src/injections/CenterControlTray.tsx new file mode 100644 index 0000000..cc98961 --- /dev/null +++ b/src/injections/CenterControlTray.tsx @@ -0,0 +1,19 @@ +import CenterTrayButton from "../Components/CenterTrayButton"; +import { PluginInjector } from "../index"; +import Modules from "../lib/requiredModules"; +import Utils from "../lib/utils"; +import Types from "../types"; +export default (): void => { + PluginInjector.after(Modules.CenterControlTray, "default", (_args, res: Types.ReactTree) => { + const Container = Utils.findInReactTree( + res, + (c: Types.ReactTree) => Array.isArray(c?.props?.children) && c.type === "div", + ) as Types.ReactTree; + if (!Container) return res; + const Index = Container.props.children.findIndex((c) => + c?.props?.renderPopout?.toString()?.includes("renderInputModes"), + ); + Container.props.children.splice(Index, 0, ); + return res; + }); +}; diff --git a/src/patches/GatewayConnectionStore.ts b/src/injections/GatewayConnectionStore.ts similarity index 91% rename from src/patches/GatewayConnectionStore.ts rename to src/injections/GatewayConnectionStore.ts index 3d9ebbc..d02ed54 100644 --- a/src/patches/GatewayConnectionStore.ts +++ b/src/injections/GatewayConnectionStore.ts @@ -1,11 +1,11 @@ import { PluginInjector, SettingValues } from "../index"; -import { GatewayConnectionStore } from "../lib/requiredModules"; import { defaultSettings } from "../lib/consts"; +import Modules from "../lib/requiredModules"; import Types from "../types"; export default (): void => { PluginInjector.before( - GatewayConnectionStore.getSocket(), + Modules.GatewayConnectionStore.getSocket(), "voiceStateUpdate", (args: [Types.voiceStateUpdateArgs]) => { const [voiceStateUpdateArgs] = args; diff --git a/src/patches/SettingValues.ts b/src/injections/SettingValues.ts similarity index 100% rename from src/patches/SettingValues.ts rename to src/injections/SettingValues.ts diff --git a/src/injections/index.ts b/src/injections/index.ts new file mode 100644 index 0000000..022260f --- /dev/null +++ b/src/injections/index.ts @@ -0,0 +1,16 @@ +import Modules from "../lib/requiredModules"; +import injectAudioResolver from "./AudioResolver"; +import injectCenterControlTray from "./CenterControlTray"; +import injectGatewayConnectionStore from "./GatewayConnectionStore"; +import injectAccountContextMenu from "./AccountContextMenu"; +import injectSettingSetter from "./SettingValues"; +export const applyInjections = async (): Promise => { + await Modules.loadModules(); + void injectAudioResolver(); + injectCenterControlTray(); + injectGatewayConnectionStore(); + injectAccountContextMenu(); + injectSettingSetter(); +}; + +export default { applyInjections }; diff --git a/src/lib/consts.ts b/src/lib/consts.ts index 3684918..c289d37 100644 --- a/src/lib/consts.ts +++ b/src/lib/consts.ts @@ -1,4 +1,6 @@ -import { KeybindUtils } from "./requiredModules"; +import Modules from "./requiredModules"; +import EnableURL from "../assets/fd_enable.mp3"; +import DisableURL from "../assets/fd_disable.mp3"; export const defaultSettings = { enabled: true, soundStatus: { @@ -8,16 +10,19 @@ export const defaultSettings = { }, statusPicker: true, userPanel: true, + centerTray: true, playAudio: { enable: true, disable: true, }, showToast: true, - keybind: KeybindUtils.toCombo("ctrl+d") as number[][], + get keybind() { + return Modules.KeybindUtils.toCombo("ctrl+d") as number[][]; + }, }; export const Sounds = { Enable: "fd_start", Disable: "fd_stop", - EnableURL: "https://tharkidev.github.io/files-random-host/fd_enable.mp3", - DisableURL: "https://tharkidev.github.io/files-random-host/fd_disable.mp3", + EnableURL, + DisableURL, }; diff --git a/src/lib/requiredModules.ts b/src/lib/requiredModules.ts index 9850e0f..c74dfa2 100644 --- a/src/lib/requiredModules.ts +++ b/src/lib/requiredModules.ts @@ -1,45 +1,43 @@ import { webpack } from "replugged"; import Types from "../types"; -export const WindowInfoStore = webpack.getByProps( - "isFocused", - "isElementFullScreen", - "addChangeListener", - "removeChangeListener", -); - -export const SoundUtils = webpack.getByProps( - "playSound", - "createSound", - "createSoundForPack", -); - -export const KeybindUtils = webpack.getByProps("toCombo"); - -export const StatusPickerClasses = webpack.getByProps( - "status", - "statusItem", -); - -export const GatewayConnectionStore = - webpack.getBySource("GatewayConnectionStore"); - -export const MediaEngineStore = webpack.getByStoreName("MediaEngineStore"); - -export const PanelButton = webpack.getBySource< - React.ComponentClass<{ - onContextMenu?: (event: React.MouseEvent) => void; - icon?: () => React.ReactNode; - tooltipText?: string; - onClick?: () => void; - }> ->("Masks.PANEL_BUTTON"); - -export const AccountDetailsClasses = webpack.getByProps( - "godlike", - "container", -); - -export const AudioResolverPromise = webpack.waitForModule<{ - exports: Types.DefaultTypes.AnyFunction; -}>(webpack.filters.bySource("./mute.mp3"), { raw: true }); +export const Modules: Types.Modules = {}; + +Modules.loadModules = async (): Promise => { + Modules.WindowInfoStore ??= await webpack.waitForProps( + "isFocused", + "isElementFullScreen", + "addChangeListener", + "removeChangeListener", + ); + + Modules.SoundUtils ??= await webpack.waitForProps( + "playSound", + "createSound", + "createSoundForPack", + ); + Modules.KeybindUtils ??= await webpack.waitForProps("toCombo"); + + Modules.GatewayConnection ??= await webpack.waitForProps("Opcode"); + + Modules.CenterControlTray ??= await webpack.waitForProps("GoLiveButton"); + Modules.CenterControlButton ??= await webpack + .waitForProps<{ + CenterControlButton: Types.CenterControlButton; + }>("CenterControlButton") + .then(({ CenterControlButton }) => CenterControlButton); + Modules.IdleHandler ??= await webpack.waitForProps("usePreventIdle"); + Modules.PanelButton ??= await webpack.waitForModule( + webpack.filters.bySource("Masks.PANEL_BUTTON"), + ); + + Modules.AudioResolverPromise = webpack.waitForModule( + webpack.filters.bySource("./mute.mp3"), + { raw: true }, + ); + Modules.GatewayConnectionStore ??= + webpack.getByStoreName("GatewayConnectionStore"); + Modules.MediaEngineStore ??= webpack.getByStoreName("MediaEngineStore"); +}; + +export default Modules; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 87bc5c7..b927b40 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,12 +1,7 @@ import { settings, util } from "replugged"; import { React, channels as UltimateChannelStore, lodash } from "replugged/common"; import { PluginInjector, PluginLogger, SettingValues } from "../index"; -import { - AccountDetailsClasses, - GatewayConnectionStore, - MediaEngineStore, - SoundUtils, -} from "./requiredModules"; +import Modules from "./requiredModules"; import { Sounds, defaultSettings } from "./consts"; import Types from "../types"; @@ -22,11 +17,14 @@ export const forceRerenderElement = async (selector: string): Promise => { }; export const updateSoundStatus = (): void => { - const Channel = UltimateChannelStore.getChannel(UltimateChannelStore.getVoiceChannelId()); + const { MediaEngineStore, GatewayConnectionStore } = Modules; + const Channel = UltimateChannelStore.getChannel(UltimateChannelStore.getVoiceChannelId()!); if (!Channel) return; PluginLogger.log("Updating Voice State."); - GatewayConnectionStore.getSocket().voiceStateUpdate({ + const Socket = GatewayConnectionStore.getSocket(); + const voiceStateUpdate = Socket.voiceStateUpdate.bind(Socket); + voiceStateUpdate({ channelId: Channel.id, guildId: Channel.guild_id, selfDeaf: SettingValues.get("enabled", defaultSettings.enabled) @@ -48,40 +46,38 @@ export const toggleSoundStatus = (enabled: boolean): void => { (enabled && (SettingValues.get("playAudio", defaultSettings.playAudio).disable ?? true)) || (!enabled && (SettingValues.get("playAudio", defaultSettings.playAudio).enable ?? true)) ) { - SoundUtils.playSound(enabled ? Sounds.Disable : Sounds.Enable, 0.5); + Modules.SoundUtils.playSound(enabled ? Sounds.Disable : Sounds.Enable, 0.5); } + PluginLogger.log(enabled ? "Disabled Fake Voice State" : "Enabled Fake Voice State"); SettingValues.set("enabled", !enabled); - if (SettingValues.get("userPanel", defaultSettings.userPanel)) - void forceRerenderElement(`.${AccountDetailsClasses.container}:not(.spotify-modal)`); }; export const useSetting = < T extends Record, D extends keyof T, K extends Extract, F extends Types.NestedType | T[K] | undefined, - P extends `${K}.${string}` | K, + P extends `${K}.${string}` | `${K}/${string}` | `${K}-${string}` | K, + V extends P extends `${K}.${string}` | `${K}/${string}` | `${K}-${string}` + ? NonNullable> + : P extends D + ? NonNullable + : F extends null | undefined + ? T[P] | undefined + : NonNullable | F, >( settings: settings.SettingsManager, key: P, fallback?: F, ): { - value: Types.NestedType | F; - onChange: (newValue: Types.ValType | F>) => void; + value: V; + onChange: (newValue: Types.ValType> | Types.ValType) => void; } => { - const [initialKey, ...pathArray] = Object.keys(settings.all()).includes(key) - ? ([key] as [K]) - : (key.split(".") as [K, ...string[]]); - const path = pathArray.join("."); - const initial = settings.get(initialKey, path.length ? ({} as T[K]) : (fallback as T[K])); - const [value, setValue] = React.useState>( - path.length - ? (lodash.get(initial, path, fallback) as Types.NestedType) - : (initial as Types.NestedType), - ); + const initial = settings.get(key as K) ?? lodash.get(settings.all(), key) ?? fallback; + const [value, setValue] = React.useState(initial as V); return { value, - onChange: (newValue: Types.ValType | F>) => { + onChange: (newValue: Types.ValType> | Types.ValType) => { const isObj = newValue && typeof newValue === "object"; const value = isObj && "value" in newValue ? newValue.value : newValue; const checked = isObj && "checked" in newValue ? newValue.checked : void 0; @@ -91,15 +87,49 @@ export const useSetting = < : void 0; const targetValue = target && "value" in target ? target.value : void 0; const targetChecked = target && "checked" in target ? target.checked : void 0; - const finalValue = checked ?? targetChecked ?? targetValue ?? value ?? newValue; + const finalValue = (checked ?? targetChecked ?? targetValue ?? value ?? newValue) as T[K]; - setValue(finalValue as Types.NestedType); - settings.set( - initialKey, - path.length ? (lodash.set(initial, path, finalValue) as T[K]) : (finalValue as T[K]), - ); + setValue(finalValue as V); + + if (settings.get(key as K)) { + settings.set(key as K, finalValue); + } else { + const [rootKey] = key.split(/[-/.]/); + const setting = lodash.set(settings.all(), key, finalValue)[rootKey as K]; + settings.set(rootKey as K, setting); + } }, }; }; -export default { ...util, forceRerenderElement, updateSoundStatus, toggleSoundStatus, useSetting }; +export const useSettingArray = < + T extends Record, + D extends keyof T, + K extends Extract, + F extends Types.NestedType | T[K] | undefined, + P extends `${K}.${string}` | `${K}/${string}` | `${K}-${string}` | K, + V extends P extends `${K}.${string}` | `${K}/${string}` | `${K}-${string}` + ? NonNullable> + : P extends D + ? NonNullable + : F extends null | undefined + ? T[P] | undefined + : NonNullable | F, +>( + settings: settings.SettingsManager, + key: P, + fallback?: F, +): [V, (newValue: Types.ValType> | Types.ValType) => void] => { + const { value, onChange } = useSetting(settings, key, fallback); + + return [value as V, onChange]; +}; + +export default { + ...util, + forceRerenderElement, + updateSoundStatus, + toggleSoundStatus, + useSetting, + useSettingArray, +}; diff --git a/src/listeners/CleanCallback.ts b/src/listeners/CleanCallback.ts index 059a7c9..51223b5 100644 --- a/src/listeners/CleanCallback.ts +++ b/src/listeners/CleanCallback.ts @@ -1,5 +1,5 @@ import { CurrentlyPressed } from "../index"; -import { WindowInfoStore } from "../lib/requiredModules"; +import Modules from "../lib/requiredModules"; export const cleanKeybindsCallback = (): void => { - if (WindowInfoStore.isFocused()) CurrentlyPressed.clear(); + if (Modules.WindowInfoStore.isFocused()) CurrentlyPressed.clear(); }; diff --git a/src/listeners/KeybindListener.ts b/src/listeners/KeybindListener.ts index 03cd021..1a72c4d 100644 --- a/src/listeners/KeybindListener.ts +++ b/src/listeners/KeybindListener.ts @@ -1,12 +1,12 @@ import { toast as Toasts } from "replugged/common"; import { CurrentlyPressed, SettingValues } from "../index"; import { defaultSettings } from "../lib/consts"; -import { KeybindUtils } from "../lib/requiredModules"; +import Modules from "../lib/requiredModules"; import Utils from "../lib/utils"; import Types from "../types"; export const keybindListener = (e: Types.KeybindEvent): void => { - const keybindEvents = KeybindUtils.toBrowserEvents( + const keybindEvents = Modules.KeybindUtils.toBrowserEvents( SettingValues.get("keybind", defaultSettings.keybind), ) as Types.KeybindEvent[]; if ( diff --git a/src/listeners/index.ts b/src/listeners/index.ts index 6622a05..cc6a02e 100644 --- a/src/listeners/index.ts +++ b/src/listeners/index.ts @@ -1,14 +1,17 @@ -import { WindowInfoStore } from "../lib/requiredModules"; +import Modules from "../lib/requiredModules"; import { cleanKeybindsCallback } from "./CleanCallback"; import { keybindListener } from "./KeybindListener"; -export const addListeners = (): void => { - WindowInfoStore.addChangeListener(cleanKeybindsCallback); +export const addListeners = async (): Promise => { + await Modules.loadModules(); + Modules.WindowInfoStore?.addChangeListener(cleanKeybindsCallback); window.addEventListener("keydown", keybindListener); window.addEventListener("keyup", keybindListener); }; export const removeListeners = (): void => { - WindowInfoStore.removeChangeListener(cleanKeybindsCallback); + Modules.WindowInfoStore.removeChangeListener(cleanKeybindsCallback); window.removeEventListener("keydown", keybindListener); window.removeEventListener("keyup", keybindListener); }; + +export default { addListeners, removeListeners }; diff --git a/src/patches/index.ts b/src/patches/index.ts deleted file mode 100644 index 43e11c8..0000000 --- a/src/patches/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import patchAudioResolver from "./AudioResolver"; -import patchGatewayConnectionStore from "./GatewayConnectionStore"; -import patchStatusPicker from "./Menu"; -import patchSettingSetter from "./SettingValues"; -export const applyInjections = (): void => { - void patchAudioResolver(); - patchGatewayConnectionStore(); - patchStatusPicker(); - patchSettingSetter(); -}; diff --git a/src/plaintextPatches.ts b/src/plaintextPatches.ts index 06e58a2..22053b2 100644 --- a/src/plaintextPatches.ts +++ b/src/plaintextPatches.ts @@ -15,7 +15,7 @@ export default [ replacements: [ { match: /null==\w+\?void 0:\w+\.selfDeaf/, - replace: `$&&&replugged.webpack.getByStoreName("MediaEngineStore").isDeaf()`, + replace: `$&&&replugged.webpack.getByStoreName("MediaEngineStore")?.isDeaf?.()`, }, ], }, diff --git a/src/types.ts b/src/types.ts index c29fdb1..6cd7f05 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,277 +1,385 @@ -import { types as DefaultTypes } from "replugged"; +import { types } from "replugged"; import type { Store } from "replugged/dist/renderer/modules/common/flux"; -export { types as DefaultTypes } from "replugged"; -export interface GenericModule extends Record {} -export interface WindowInfoStore { - isFocused: () => boolean; - addChangeListener: (callback: DefaultTypes.AnyFunction) => void; - removeChangeListener: (callback: DefaultTypes.AnyFunction) => void; - isElementFullScreen: () => boolean; -} -export interface Socket { - analytics: object; - compressionHandler: object; - connectionStartTime: number; - connectionState: string; - didForceClearGuildHashes: boolean; - dispatchExceptionBackoff: object; - dispatchSuccessTimer: number; - expeditedHeartbeatTimeout: null | number; - gatewayBackoff: object; - handleIdentify: DefaultTypes.AnyFunction; - hasConnectedOnce: boolean; - heartbeatAck: boolean; - heartbeatInterval: number; - heartbeater: number; - helloTimeout: null | number; - identifyCompressedByteSize: number; - identifyStartTime: number; - identifyUncompressedByteSize: number; - initialHeartbeatTimeout: null | number; - isDeferringDispatches: boolean; - isFastConnect: boolean; - lastHeartbeatAckTime: number; - nextReconnectIsImmediate: boolean; - queuedDispatches: []; - resumeAnalytics: object; - resumeUrl: string; - send: DefaultTypes.AnyFunction; - voiceStateUpdate: DefaultTypes.AnyFunction; - seq: number; - sessionId: string; - token: string; - webSocket: object; - _events: object; - _eventsCount: number; - _maxListeners: undefined | number; -} -export interface GatewayConnectionStore extends Store { - getSocket: () => Socket; - initialize: DefaultTypes.AnyFunction; - isConnected: DefaultTypes.AnyFunction; - isConnectedOrOverlay: DefaultTypes.AnyFunction; - isTryingToConnect: DefaultTypes.AnyFunction; - lastTimeConnectedChanged: DefaultTypes.AnyFunction; -} -export interface voiceStateUpdateArgs { - channelId: string; - guildId: string; - preferredRegion: string; - selfDeaf: boolean; - selfMute: boolean; - selfVideo: boolean; -} -export interface MediaEngineStore extends Store { - getAecDump: DefaultTypes.AnyFunction; - getAttenuateWhileSpeakingOthers: DefaultTypes.AnyFunction; - getAttenuateWhileSpeakingSelf: DefaultTypes.AnyFunction; - getAttenuation: DefaultTypes.AnyFunction; - getAudioSubsystem: DefaultTypes.AnyFunction; - getAutomaticGainControl: DefaultTypes.AnyFunction; - getAv1Enabled: DefaultTypes.AnyFunction; - getCameraComponent: DefaultTypes.AnyFunction; - getDebugLogging: DefaultTypes.AnyFunction; - getEchoCancellation: DefaultTypes.AnyFunction; - getEnableSilenceWarning: DefaultTypes.AnyFunction; - getEverSpeakingWhileMuted: DefaultTypes.AnyFunction; - getExperimentalEncoders: DefaultTypes.AnyFunction; - getExperimentalSoundshare: DefaultTypes.AnyFunction; - getGoLiveContext: DefaultTypes.AnyFunction; - getGoLiveSource: DefaultTypes.AnyFunction; - getH265Enabled: DefaultTypes.AnyFunction; - getHardwareH264: DefaultTypes.AnyFunction; - getInputDetected: DefaultTypes.AnyFunction; - getInputDeviceId: DefaultTypes.AnyFunction; - getInputDevices: DefaultTypes.AnyFunction; - getInputVolume: DefaultTypes.AnyFunction; - getLocalPan: DefaultTypes.AnyFunction; - getLocalVolume: DefaultTypes.AnyFunction; - getLoopback: DefaultTypes.AnyFunction; - getMediaEngine: DefaultTypes.AnyFunction; - getMode: DefaultTypes.AnyFunction; - getModeOptions: DefaultTypes.AnyFunction; - getNoInputDetectedNotice: DefaultTypes.AnyFunction; - getNoiseCancellation: DefaultTypes.AnyFunction; - getNoiseSuppression: DefaultTypes.AnyFunction; - getOpenH264: DefaultTypes.AnyFunction; - getOutputDeviceId: DefaultTypes.AnyFunction; - getOutputDevices: DefaultTypes.AnyFunction; - getOutputVolume: DefaultTypes.AnyFunction; - getPacketDelay: DefaultTypes.AnyFunction; - getQoS: DefaultTypes.AnyFunction; - getSettings: DefaultTypes.AnyFunction; - getShortcuts: DefaultTypes.AnyFunction; - getSoundshareEnabled: DefaultTypes.AnyFunction; - getState: DefaultTypes.AnyFunction; - getSupportedSecureFramesProtocolVersion: DefaultTypes.AnyFunction; - getVideoComponent: DefaultTypes.AnyFunction; - getVideoDeviceId: DefaultTypes.AnyFunction; - getVideoDevices: DefaultTypes.AnyFunction; - getVideoHook: DefaultTypes.AnyFunction; - getVideoStreamParameters: DefaultTypes.AnyFunction; - getVideoToggleState: DefaultTypes.AnyFunction; - hasContext: DefaultTypes.AnyFunction; - initialize: DefaultTypes.AnyFunction; - isAdvancedVoiceActivitySupported: DefaultTypes.AnyFunction; - isAecDumpSupported: DefaultTypes.AnyFunction; - isAnyLocalVideoAutoDisabled: DefaultTypes.AnyFunction; - isAutomaticGainControlSupported: DefaultTypes.AnyFunction; - isDeaf: DefaultTypes.AnyFunction; - isEnabled: DefaultTypes.AnyFunction; - isExperimentalEncodersSupported: DefaultTypes.AnyFunction; - isHardwareMute: DefaultTypes.AnyFunction; - isInteractionRequired: DefaultTypes.AnyFunction; - isLocalMute: DefaultTypes.AnyFunction; - isLocalVideoAutoDisabled: DefaultTypes.AnyFunction; - isLocalVideoDisabled: DefaultTypes.AnyFunction; - isMediaFilterSettingLoading: DefaultTypes.AnyFunction; - isMute: DefaultTypes.AnyFunction; - isNativeAudioPermissionReady: DefaultTypes.AnyFunction; - isNoiseCancellationError: DefaultTypes.AnyFunction; - isNoiseCancellationSupported: DefaultTypes.AnyFunction; - isNoiseSuppressionSupported: DefaultTypes.AnyFunction; - isScreenSharing: DefaultTypes.AnyFunction; - isSelfDeaf: DefaultTypes.AnyFunction; - isSelfMute: DefaultTypes.AnyFunction; - isSelfMutedTemporarily: DefaultTypes.AnyFunction; - isSimulcastSupported: DefaultTypes.AnyFunction; - isSoundSharing: DefaultTypes.AnyFunction; - isSupported: DefaultTypes.AnyFunction; - isVideoAvailable: DefaultTypes.AnyFunction; - isVideoEnabled: DefaultTypes.AnyFunction; - setCanHavePriority: DefaultTypes.AnyFunction; - supports: DefaultTypes.AnyFunction; - supportsDisableLocalVideo: DefaultTypes.AnyFunction; - supportsEnableSoundshare: DefaultTypes.AnyFunction; - supportsExperimentalSoundshare: DefaultTypes.AnyFunction; - supportsInApp: DefaultTypes.AnyFunction; - supportsScreenSoundshare: DefaultTypes.AnyFunction; - supportsVideoHook: DefaultTypes.AnyFunction; -} +import { ContextMenuProps } from "replugged/dist/renderer/modules/components/ContextMenu"; +import type util from "replugged/util"; -export interface KeybindUtils { - toCombo: DefaultTypes.AnyFunction; - toBrowserEvents: DefaultTypes.AnyFunction; -} -export interface SoundUtils { - createSound: DefaultTypes.AnyFunction; - createSoundForPack: DefaultTypes.AnyFunction; - playSound: DefaultTypes.AnyFunction; -} +export namespace Types { + export import DefaultTypes = types; + export type MenuProps = ContextMenuProps["ContextMenu"]; + export type UtilTree = util.Tree; + export type ReactTree = util.Tree & React.ReactElement; + export interface GenericModule extends Record {} + export interface WindowInfoStore { + isFocused: () => boolean; + addChangeListener: (callback: DefaultTypes.AnyFunction) => void; + removeChangeListener: (callback: DefaultTypes.AnyFunction) => void; + isElementFullScreen: () => boolean; + } + export interface AudioResolver { + exports: Types.DefaultTypes.AnyFunction & { keys: () => string[] }; + } + export interface Popout + extends React.ComponentClass<{ + align: string; + renderPopout: DefaultTypes.AnyFunction; + children: DefaultTypes.AnyFunction; + animation?: string; + autoInvert?: boolean; + nudgeAlignIntoViewport?: boolean; + position?: string; + positionKey?: string; + spacing?: number; + }> { + Animation: { + FADE: string; + NONE: string; + SCALE: string; + TRANSLATE: string; + }; -export interface AccountDetailsClasses { - accountProfilePopoutWrapper: string; - avatar: string; - avatarWrapper: string; - buildOverrideButton: string; - canCopy: string; - container: string; - copySuccess: string; - customStatus: string; - emoji: string; - godlike: string; - hasBuildOverride: string; - nameTag: string; - panelSubtextContainer: string; - panelTitleContainer: string; - redIcon: string; - statusTooltip: string; - strikethrough: string; - usernameContainer: string; - withTagAsButton: string; - withTagless: string; -} -export interface AccountDetails { - AccountDetails: DefaultTypes.AnyFunction; -} -export interface CloseButtonProps { - size?: string; - className?: string; - onClick?: () => void; -} -export interface KeybindEvent { - type: string; - altKey: boolean; - ctrlKey: boolean; - keyCode: number; - metaKey: boolean; - shiftKey: boolean; -} -export interface KeybindRecorderItemProps { - title?: string; - note?: string; - size?: string; - className?: string; - value?: number[][]; - onChange?: (value: unknown) => void; - disabled?: boolean; - clearable?: boolean; -} -export interface StatusPickerClasses { - description: string; - divider: string; - icon: string; - mainStatusIcon: string; - menu: string; - menuItemFocused: string; - menuItemFocusedPremium: string; - modal: string; - status: string; - statusItem: string; - statusPickerModalMenu: string; -} + defaultProps: { + animation: string; + autoInvert: boolean; + nudgeAlignIntoViewport: boolean; + position: string; + positionKey?: string; + spacing: number; + }; + } + export interface Socket { + analytics: object; + compressionHandler: object; + connectionStartTime: number; + connectionState: string; + didForceClearGuildHashes: boolean; + dispatchExceptionBackoff: object; + dispatchSuccessTimer: number; + expeditedHeartbeatTimeout: null | number; + gatewayBackoff: object; + handleIdentify: DefaultTypes.AnyFunction; + hasConnectedOnce: boolean; + heartbeatAck: boolean; + heartbeatInterval: number; + heartbeater: number; + helloTimeout: null | number; + identifyCompressedByteSize: number; + identifyStartTime: number; + identifyUncompressedByteSize: number; + initialHeartbeatTimeout: null | number; + isDeferringDispatches: boolean; + isFastConnect: boolean; + lastHeartbeatAckTime: number; + nextReconnectIsImmediate: boolean; + queuedDispatches: []; + resumeAnalytics: object; + resumeUrl: string; + send: DefaultTypes.AnyFunction; + voiceStateUpdate: DefaultTypes.AnyFunction; + seq: number; + sessionId: string; + token: string; + webSocket: object; + _events: object; + _eventsCount: number; + _maxListeners: undefined | number; + } + export interface GatewayConnectionStore extends Store { + getSocket: () => Socket; + initialize: DefaultTypes.AnyFunction; + isConnected: DefaultTypes.AnyFunction; + isConnectedOrOverlay: DefaultTypes.AnyFunction; + isTryingToConnect: DefaultTypes.AnyFunction; + lastTimeConnectedChanged: DefaultTypes.AnyFunction; + } + export interface voiceStateUpdateArgs { + channelId: string; + guildId: string; + preferredRegion: string; + selfDeaf: boolean; + selfMute: boolean; + selfVideo: boolean; + } + export interface MediaEngineStore extends Store { + getAecDump: DefaultTypes.AnyFunction; + getAttenuateWhileSpeakingOthers: DefaultTypes.AnyFunction; + getAttenuateWhileSpeakingSelf: DefaultTypes.AnyFunction; + getAttenuation: DefaultTypes.AnyFunction; + getAudioSubsystem: DefaultTypes.AnyFunction; + getAutomaticGainControl: DefaultTypes.AnyFunction; + getAv1Enabled: DefaultTypes.AnyFunction; + getCameraComponent: DefaultTypes.AnyFunction; + getDebugLogging: DefaultTypes.AnyFunction; + getEchoCancellation: DefaultTypes.AnyFunction; + getEnableSilenceWarning: DefaultTypes.AnyFunction; + getEverSpeakingWhileMuted: DefaultTypes.AnyFunction; + getExperimentalEncoders: DefaultTypes.AnyFunction; + getExperimentalSoundshare: DefaultTypes.AnyFunction; + getGoLiveContext: DefaultTypes.AnyFunction; + getGoLiveSource: DefaultTypes.AnyFunction; + getH265Enabled: DefaultTypes.AnyFunction; + getHardwareH264: DefaultTypes.AnyFunction; + getInputDetected: DefaultTypes.AnyFunction; + getInputDeviceId: DefaultTypes.AnyFunction; + getInputDevices: DefaultTypes.AnyFunction; + getInputVolume: DefaultTypes.AnyFunction; + getLocalPan: DefaultTypes.AnyFunction; + getLocalVolume: DefaultTypes.AnyFunction; + getLoopback: DefaultTypes.AnyFunction; + getMediaEngine: DefaultTypes.AnyFunction; + getMode: DefaultTypes.AnyFunction; + getModeOptions: DefaultTypes.AnyFunction; + getNoInputDetectedNotice: DefaultTypes.AnyFunction; + getNoiseCancellation: DefaultTypes.AnyFunction; + getNoiseSuppression: DefaultTypes.AnyFunction; + getOpenH264: DefaultTypes.AnyFunction; + getOutputDeviceId: DefaultTypes.AnyFunction; + getOutputDevices: DefaultTypes.AnyFunction; + getOutputVolume: DefaultTypes.AnyFunction; + getPacketDelay: DefaultTypes.AnyFunction; + getQoS: DefaultTypes.AnyFunction; + getSettings: DefaultTypes.AnyFunction; + getShortcuts: DefaultTypes.AnyFunction; + getSoundshareEnabled: DefaultTypes.AnyFunction; + getState: DefaultTypes.AnyFunction; + getSupportedSecureFramesProtocolVersion: DefaultTypes.AnyFunction; + getVideoComponent: DefaultTypes.AnyFunction; + getVideoDeviceId: DefaultTypes.AnyFunction; + getVideoDevices: DefaultTypes.AnyFunction; + getVideoHook: DefaultTypes.AnyFunction; + getVideoStreamParameters: DefaultTypes.AnyFunction; + getVideoToggleState: DefaultTypes.AnyFunction; + hasContext: DefaultTypes.AnyFunction; + initialize: DefaultTypes.AnyFunction; + isAdvancedVoiceActivitySupported: DefaultTypes.AnyFunction; + isAecDumpSupported: DefaultTypes.AnyFunction; + isAnyLocalVideoAutoDisabled: DefaultTypes.AnyFunction; + isAutomaticGainControlSupported: DefaultTypes.AnyFunction; + isDeaf: DefaultTypes.AnyFunction; + isEnabled: DefaultTypes.AnyFunction; + isExperimentalEncodersSupported: DefaultTypes.AnyFunction; + isHardwareMute: DefaultTypes.AnyFunction; + isInteractionRequired: DefaultTypes.AnyFunction; + isLocalMute: DefaultTypes.AnyFunction; + isLocalVideoAutoDisabled: DefaultTypes.AnyFunction; + isLocalVideoDisabled: DefaultTypes.AnyFunction; + isMediaFilterSettingLoading: DefaultTypes.AnyFunction; + isMute: DefaultTypes.AnyFunction; + isNativeAudioPermissionReady: DefaultTypes.AnyFunction; + isNoiseCancellationError: DefaultTypes.AnyFunction; + isNoiseCancellationSupported: DefaultTypes.AnyFunction; + isNoiseSuppressionSupported: DefaultTypes.AnyFunction; + isScreenSharing: DefaultTypes.AnyFunction; + isSelfDeaf: DefaultTypes.AnyFunction; + isSelfMute: DefaultTypes.AnyFunction; + isSelfMutedTemporarily: DefaultTypes.AnyFunction; + isSimulcastSupported: DefaultTypes.AnyFunction; + isSoundSharing: DefaultTypes.AnyFunction; + isSupported: DefaultTypes.AnyFunction; + isVideoAvailable: DefaultTypes.AnyFunction; + isVideoEnabled: DefaultTypes.AnyFunction; + setCanHavePriority: DefaultTypes.AnyFunction; + supports: DefaultTypes.AnyFunction; + supportsDisableLocalVideo: DefaultTypes.AnyFunction; + supportsEnableSoundshare: DefaultTypes.AnyFunction; + supportsExperimentalSoundshare: DefaultTypes.AnyFunction; + supportsInApp: DefaultTypes.AnyFunction; + supportsScreenSoundshare: DefaultTypes.AnyFunction; + supportsVideoHook: DefaultTypes.AnyFunction; + } -export type Jsonifiable = - | null - | undefined - | boolean - | number - | string - | Jsonifiable[] - | { [key: string]: Jsonifiable }; -export type ValType = - | T - | React.ChangeEvent - | (Record & { value?: T; checked?: T }); - -export type NestedType = P extends `${infer Left}.${infer Right}` - ? Left extends keyof T - ? NestedType - : Left extends `${infer FieldKey}[${infer IndexKey}]` - ? FieldKey extends keyof T - ? NestedType extends infer U ? U : never, IndexKey> - : undefined - : undefined - : P extends keyof T - ? T[P] - : P extends `${infer FieldKey}[${infer _IndexKey}]` - ? FieldKey extends keyof T - ? Exclude extends infer U - ? U - : never - : undefined - : undefined; + export interface KeybindUtils { + toCombo: DefaultTypes.AnyFunction; + toBrowserEvents: DefaultTypes.AnyFunction; + } + export interface SoundUtils { + createSound: DefaultTypes.AnyFunction; + createSoundForPack: DefaultTypes.AnyFunction; + playSound: DefaultTypes.AnyFunction; + } + export interface IdleHandler { + usePreventIdle: (e: string) => { + preventIdle: () => void; + allowIdle: () => void; + }; + default: DefaultTypes.AnyFunction; + } + export type PanelButton = React.ComponentClass<{ + onContextMenu?: (event: React.MouseEvent) => void; + icon?: () => React.ReactNode; + tooltipText?: string; + onClick?: () => void; + }>; + export type CenterControlButton = React.ComponentType<{ + className: string; + iconComponent: () => React.ReactElement; -export interface Settings { - enabled: boolean; - soundStatus: { - mute: boolean; - deaf: boolean; - video: boolean; - }; - statusPicker: boolean; - userPanel: boolean; - playAudio: boolean; - showToast: boolean; - keybind: Array<{ + isActive: boolean; + label: string; + onClick: DefaultTypes.AnyFunction; + onPopoutClick: DefaultTypes.AnyFunction; + popoutOpen: boolean; + }>; + export interface CenterControlTray { + GoLiveButton: DefaultTypes.AnyFunction; + default: DefaultTypes.AnyFunction; + handleToggleVideo: DefaultTypes.AnyFunction; + } + export interface AccountDetailsClasses { + accountProfilePopoutWrapper: string; + avatar: string; + avatarWrapper: string; + buildOverrideButton: string; + canCopy: string; + container: string; + copySuccess: string; + customStatus: string; + emoji: string; + godlike: string; + hasBuildOverride: string; + nameTag: string; + panelSubtextContainer: string; + panelTitleContainer: string; + redIcon: string; + statusTooltip: string; + strikethrough: string; + usernameContainer: string; + withTagAsButton: string; + withTagless: string; + } + export interface AccountDetails { + AccountDetails: DefaultTypes.AnyFunction; + } + export interface CloseButtonProps { + size?: string; + className?: string; + onClick?: () => void; + } + export interface KeybindEvent { + type: string; altKey: boolean; - code: string; ctrlKey: boolean; - key: string; keyCode: number; metaKey: boolean; shiftKey: boolean; - }>; -} + } + export interface KeybindRecorderItemProps { + title?: string; + note?: string; + size?: string; + className?: string; + value?: number[][]; + onChange?: (value: unknown) => void; + disabled?: boolean; + clearable?: boolean; + } + export enum OpCode { + CALL_CONNECT = 13, + DISPATCH = 0, + EMBEDDED_ACTIVITY_CLOSE = 26, + EMBEDDED_ACTIVITY_LAUNCH = 25, + EMBEDDED_ACTIVITY_UPDATE = 27, + GET_DELETED_ENTITY_IDS_NOT_MATCHING_HASH = 30, + GUILD_SUBSCRIPTIONS = 14, + GUILD_SUBSCRIPTIONS_BULK = 37, + HEARTBEAT = 1, + HEARTBEAT_ACK = 11, + HELLO = 10, + IDENTIFY = 2, + INVALID_SESSION = 9, + PRESENCE_UPDATE = 3, + RECONNECT = 7, + REMOTE_COMMAND = 29, + REQUEST_CHANNEL_STATUSES = 36, + REQUEST_FORUM_UNREADS = 28, + REQUEST_GUILD_APPLICATION_COMMANDS = 24, + REQUEST_GUILD_MEMBERS = 8, + REQUEST_LAST_MESSAGES = 34, + REQUEST_SOUNDBOARD_SOUNDS = 31, + RESUME = 6, + SEARCH_RECENT_MEMBERS = 35, + SPEED_TEST_CREATE = 32, + SPEED_TEST_DELETE = 33, + STREAM_CREATE = 18, + STREAM_DELETE = 19, + STREAM_PING = 21, + STREAM_SET_PAUSED = 22, + STREAM_WATCH = 20, + VOICE_SERVER_PING = 5, + VOICE_STATE_UPDATE = 4, + } + export interface GatewayConnection { + OpCode: typeof OpCode; + default: DefaultTypes.AnyFunction; + } + export interface Modules { + loadModules?: () => Promise; + WindowInfoStore?: WindowInfoStore; + SoundUtils?: SoundUtils; + KeybindUtils?: KeybindUtils; + GatewayConnectionStore?: GatewayConnectionStore; + GatewayConnection?: GatewayConnection; + MediaEngineStore?: MediaEngineStore; + CenterControlTray?: CenterControlTray; + CenterControlButton?: CenterControlButton; + IdleHandler?: IdleHandler; + PanelButton?: PanelButton; + AudioResolverPromise?: Promise; + } + export type Jsonifiable = + | null + | undefined + | boolean + | number + | string + | Jsonifiable[] + | { [key: string]: Jsonifiable }; + export type ValType = + | T + | React.ChangeEvent + | (Record & { value?: T; checked?: T }); + + export type NestedType = P extends + | `${infer Left}.${infer Right}` + | `${infer Left}/${infer Right}` + | `${infer Left}-${infer Right}` + ? Left extends keyof T + ? NestedType + : Left extends `${infer FieldKey}[${infer IndexKey}]` + ? FieldKey extends keyof T + ? NestedType extends infer U ? U : never, IndexKey> + : undefined + : undefined + : P extends keyof T + ? T[P] + : P extends `${infer FieldKey}[${infer _IndexKey}]` + ? FieldKey extends keyof T + ? Exclude extends infer U + ? U + : never + : undefined + : undefined; -export * as default from "./types"; + export interface Settings { + enabled: boolean; + soundStatus: { + mute: boolean; + deaf: boolean; + video: boolean; + }; + statusPicker: boolean; + userPanel: boolean; + centerTray: boolean; + playAudio: boolean; + showToast: boolean; + keybind: Array<{ + altKey: boolean; + code: string; + ctrlKey: boolean; + key: string; + keyCode: number; + metaKey: boolean; + shiftKey: boolean; + }>; + } +} +export default Types; diff --git a/tsconfig.json b/tsconfig.json index 49bf61b..cf94040 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -76,7 +76,7 @@ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - // "strict": true /* Enable all strict type-checking options. */, + "strict": false /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */