From 284a65fec15e1abcfd9292f9363751435598f54c Mon Sep 17 00:00:00 2001 From: kawamataryo Date: Tue, 22 Aug 2023 21:55:07 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20work=20with=20members=20of=20li?= =?UTF-8?q?st=20#8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/content.ts | 14 ++++++++++++++ src/lib/constants.ts | 2 ++ src/popup.tsx | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/src/content.ts b/src/content.ts index 85f1c20..d519604 100644 --- a/src/content.ts +++ b/src/content.ts @@ -34,6 +34,20 @@ const searchAndShowBskyUsers = async ({ removeQuery: async (arg: string) => await agent.unfollow(arg), }) break + case MESSAGE_NAMES.SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE: + await searchAndInsertBskyUsers({ + agent, + btnLabel: { + add: "Follow", + remove: "Unfollow", + progressive: "Following", + }, + statusKey: VIEWER_STATE.FOLLOWING, + userCellQueryParam: '[data-testid="UserCell"]', + addQuery: async (arg: string) => await agent.follow(arg), + removeQuery: async (arg: string) => await agent.unfollow(arg), + }) + break case MESSAGE_NAMES.SEARCH_BSKY_USER_ON_BLOCK_PAGE: // TODO: If already blocked, don't show blocking state. because blocking user can't find. await searchAndInsertBskyUsers({ diff --git a/src/lib/constants.ts b/src/lib/constants.ts index e804178..8c4dbb2 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,5 +1,6 @@ export const MESSAGE_NAMES = { SEARCH_BSKY_USER_ON_FOLLOW_PAGE: "search_bsky_user_on_follow_page", + SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE: "search_bsky_user_on_list_members_page", SEARCH_BSKY_USER_ON_BLOCK_PAGE: "search_bsky_user_on_block_page", } @@ -11,6 +12,7 @@ export const STORAGE_KEYS = { export const TARGET_URLS_REGEX = { FOLLOW: /^https:\/\/(twitter|x)\.com\/[^/]+\/follow/, + LIST: /^https:\/\/(twitter|x)\.com\/[^/]+\/lists\/[^/]+\/members/, BLOCK: /^https:\/\/(twitter|x)\.com\/settings\/blocked/, } as const diff --git a/src/popup.tsx b/src/popup.tsx index d63c980..34cef8d 100644 --- a/src/popup.tsx +++ b/src/popup.tsx @@ -55,6 +55,10 @@ function IndexPopup() { P.when((url) => TARGET_URLS_REGEX.BLOCK.test(url)), () => MESSAGE_NAMES.SEARCH_BSKY_USER_ON_BLOCK_PAGE ) + .with( + P.when((url) => TARGET_URLS_REGEX.LIST.test(url)), + () => MESSAGE_NAMES.SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE + ) .run() setMessage(null) From 3908457e962432e08db22a9fae76c75f6d98731b Mon Sep 17 00:00:00 2001 From: kawamataryo Date: Tue, 22 Aug 2023 21:59:09 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20=20add=20changese?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/itchy-hotels-jam.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/itchy-hotels-jam.md diff --git a/.changeset/itchy-hotels-jam.md b/.changeset/itchy-hotels-jam.md new file mode 100644 index 0000000..367d620 --- /dev/null +++ b/.changeset/itchy-hotels-jam.md @@ -0,0 +1,5 @@ +--- +"sky-follower-bridge": minor +--- + +- Fixed to be searchable even by list members.