From 8e5bfc979038323edba6f1a82823e9591fe365ea Mon Sep 17 00:00:00 2001 From: Lennart Kloock Date: Fri, 16 Feb 2024 20:05:35 +0100 Subject: [PATCH 1/5] fix: react 18 support --- src/common/ReactHooks.ts | 7 +++---- src/site/twitch.tv/modules/chat-input/ChatInputModule.vue | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common/ReactHooks.ts b/src/common/ReactHooks.ts index 171b62488..43c831a9f 100644 --- a/src/common/ReactHooks.ts +++ b/src/common/ReactHooks.ts @@ -14,9 +14,8 @@ export function getRootVNode(): ReactExtended.ReactVNode | undefined { const element = document.querySelector(REACT_ROOT_SELECTOR); if (!element) return undefined; - const root = Reflect.get(element, "_reactRootContainer"); - - return root?._internalRoot?.current; + const root = Reflect.get(element, "_reactRootContainer") || Reflect.get(element, "__reactContainer$"); + return root; } /** @@ -106,7 +105,7 @@ export function findComponentChildren */ export function getVNodeFromDOM(el: Node): ReactExtended.ReactVNode | undefined { for (const k in el) { - if (k.startsWith("__reactInternalInstance$")) { + if (k.startsWith("__reactInternalInstance$") || k.startsWith('__reactFiber$')) { return Reflect.get(el, k); } } diff --git a/src/site/twitch.tv/modules/chat-input/ChatInputModule.vue b/src/site/twitch.tv/modules/chat-input/ChatInputModule.vue index 773ecf57a..65f307b2c 100644 --- a/src/site/twitch.tv/modules/chat-input/ChatInputModule.vue +++ b/src/site/twitch.tv/modules/chat-input/ChatInputModule.vue @@ -57,7 +57,7 @@ for (const hc of hookChecks) { parentSelector: ".chat-input", maxDepth: 20, predicate: (n) => { - return n.props.setModifierTray && n.key === hc.key; + return n.props?.setModifierTray && n.key === hc.key; }, }, { From 5f2aa4aec1bbcec6ca00fdeff7c5e7bea1c50720 Mon Sep 17 00:00:00 2001 From: Lennart Kloock Date: Sat, 17 Feb 2024 00:59:27 +0100 Subject: [PATCH 2/5] docs: add ci docs --- .github/workflows/ci.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ci.md diff --git a/.github/workflows/ci.md b/.github/workflows/ci.md new file mode 100644 index 000000000..c3d176740 --- /dev/null +++ b/.github/workflows/ci.md @@ -0,0 +1,35 @@ +# Jobs + +## Build job (`ci`) + +- Builds the chrome extension with `yarn build:prod` and firefox extension with `MOZILLA_ID=moz-addon-prod@7tv.app MV2=true yarn build:prod` +- Both builds get zipped +- For chrome: Create CRX from zip with action `cardinalby/webext-buildtools-chrome-crx-action@v2` and private key `secrets.WEB_EXTENSION_CRX` +- For Firefox: Create XPI from zip with action `kewisch/action-web-ext@v1` +- CRX and XPI files uploaded as artifact `installable` +- Chrome zip and Firefox zip uploaded as artifact `build` +- Both manifest jsons uploaded as artifact `manifest` + +## Release job (`release`) + +- Creates Github releases and tags + +## Side loading deploy job (`deploy`) + +- Builds with `yarn build-hosted:prod` +- Uploads to Cloudflare R2 with action `shallwefootball/s3-upload-action@master` + - Endpoint: `secrets.R2_API_ENDPOINT` + - Access Key: `secrets.R2_API_AK` + - Secret Key: `secrets.R2_API_SECRET` + - Bucket: `7tv-extension` + +## Push job (`push`) + +- Upload zip file (not crx) to chrome web store (cws) with npm package `chrome-webstore-upload-cli` + - Extension id: `ammjkodgmmoknidbanneddgankgfejfh` + - Client id, client secret, refresh token in `secrets.CWS` +- Sign XPI file with action `kewisch/action-web-ext@v1` + - API key: `secrets.AMO_API_KEY` + - API secret: `secrets.AMO_API_SECRET` + - upload signed XPI as artifact `installable` +- Update Github release From 5b37cbb4754703da9e5626c0e83e8d323fa8f05d Mon Sep 17 00:00:00 2001 From: Lennart Kloock Date: Sat, 17 Feb 2024 01:23:03 +0100 Subject: [PATCH 3/5] chore: lint and changelog --- CHANGELOG-nightly.md | 3 ++- src/common/ReactHooks.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-nightly.md b/CHANGELOG-nightly.md index ca25655e5..963ff36e5 100644 --- a/CHANGELOG-nightly.md +++ b/CHANGELOG-nightly.md @@ -1,8 +1,9 @@ -### Untitled Version +### 3.0.17.1000 **The changes listed here are not assigned to an official release**. - Reinstated animated avatars +- Fixed extension not working on twitch for some users (React 18 support) ### 3.0.16.1000 diff --git a/src/common/ReactHooks.ts b/src/common/ReactHooks.ts index 43c831a9f..35bfaeadc 100644 --- a/src/common/ReactHooks.ts +++ b/src/common/ReactHooks.ts @@ -105,7 +105,7 @@ export function findComponentChildren */ export function getVNodeFromDOM(el: Node): ReactExtended.ReactVNode | undefined { for (const k in el) { - if (k.startsWith("__reactInternalInstance$") || k.startsWith('__reactFiber$')) { + if (k.startsWith("__reactInternalInstance$") || k.startsWith("__reactFiber$")) { return Reflect.get(el, k); } } From 2a5baf8464ada84bc0328be716ef6844053ffc93 Mon Sep 17 00:00:00 2001 From: Lennart Kloock Date: Sat, 17 Feb 2024 01:29:52 +0100 Subject: [PATCH 4/5] chore: undo version rename --- CHANGELOG-nightly.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG-nightly.md b/CHANGELOG-nightly.md index 963ff36e5..e65a13971 100644 --- a/CHANGELOG-nightly.md +++ b/CHANGELOG-nightly.md @@ -1,4 +1,4 @@ -### 3.0.17.1000 +### Untitled Version **The changes listed here are not assigned to an official release**. From 52d344a6e532c985af0e4f74ec735b2e408d30a6 Mon Sep 17 00:00:00 2001 From: Lennart Kloock Date: Sat, 17 Feb 2024 01:39:37 +0100 Subject: [PATCH 5/5] fix: react root --- src/common/ReactHooks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/ReactHooks.ts b/src/common/ReactHooks.ts index 35bfaeadc..f59e255a8 100644 --- a/src/common/ReactHooks.ts +++ b/src/common/ReactHooks.ts @@ -15,7 +15,7 @@ export function getRootVNode(): ReactExtended.ReactVNode | undefined { if (!element) return undefined; const root = Reflect.get(element, "_reactRootContainer") || Reflect.get(element, "__reactContainer$"); - return root; + return root?._internalRoot?.current ?? root; } /**