mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-04-23 20:12:22 -06:00
refactor: rename
This commit is contained in:
parent
bc1dcc32d3
commit
e07fbf91c3
@ -1,4 +1,4 @@
|
|||||||
import type { CrawledUser } from "~types";
|
import type { CrawledUserInfo } from "~types";
|
||||||
import { BSKY_DOMAIN } from "./constants";
|
import { BSKY_DOMAIN } from "./constants";
|
||||||
|
|
||||||
export const getUserCells = ({
|
export const getUserCells = ({
|
||||||
@ -22,7 +22,7 @@ export const getUserCells = ({
|
|||||||
return Array.from(userCells);
|
return Array.from(userCells);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const extractUserData = (userCell: Element): CrawledUser => {
|
export const extractUserData = (userCell: Element): CrawledUserInfo => {
|
||||||
const anchors = Array.from(userCell.querySelectorAll("a"));
|
const anchors = Array.from(userCell.querySelectorAll("a"));
|
||||||
const [avatarEl, displayNameEl] = anchors;
|
const [avatarEl, displayNameEl] = anchors;
|
||||||
const accountName = avatarEl?.getAttribute("href")?.replace("/", "");
|
const accountName = avatarEl?.getAttribute("href")?.replace("/", "");
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
import { extractUserData, getUserCells } from "~lib/domHelpers";
|
import { extractUserData, getUserCells } from "~lib/domHelpers";
|
||||||
import { searchBskyUser } from "~lib/searchBskyUsers";
|
import { searchBskyUser } from "~lib/searchBskyUsers";
|
||||||
import { wait } from "~lib/utils";
|
import { wait } from "~lib/utils";
|
||||||
import type { CrawledUser, MatchType } from "~types";
|
import type { CrawledUserInfo, MatchType } from "~types";
|
||||||
|
|
||||||
export type BskyUser = {
|
export type BskyUser = {
|
||||||
did: string;
|
did: string;
|
||||||
@ -65,7 +65,7 @@ export const useRetrieveBskyUsers = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const retrieveBskyUsers = React.useCallback(
|
const retrieveBskyUsers = React.useCallback(
|
||||||
async (usersData: CrawledUser[]) => {
|
async (usersData: CrawledUserInfo[]) => {
|
||||||
for (const userData of usersData) {
|
for (const userData of usersData) {
|
||||||
const searchResult = await searchBskyUser({
|
const searchResult = await searchBskyUser({
|
||||||
client: bskyClient.current,
|
client: bskyClient.current,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
|
import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
|
||||||
import { isSimilarUser } from "~lib/bskyHelpers";
|
import { isSimilarUser } from "~lib/bskyHelpers";
|
||||||
import { isOneSymbol } from "~lib/utils";
|
import { isOneSymbol } from "~lib/utils";
|
||||||
import type { CrawledUser } from "~types";
|
import type { CrawledUserInfo } from "~types";
|
||||||
import type { BskyServiceWorkerClient } from "./bskyServiceWorkerClient";
|
import type { BskyServiceWorkerClient } from "./bskyServiceWorkerClient";
|
||||||
import { BSKY_PROFILE_LABEL } from "./constants";
|
import { BSKY_PROFILE_LABEL } from "./constants";
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ export const searchBskyUser = async ({
|
|||||||
userData,
|
userData,
|
||||||
}: {
|
}: {
|
||||||
client: BskyServiceWorkerClient;
|
client: BskyServiceWorkerClient;
|
||||||
userData: CrawledUser;
|
userData: CrawledUserInfo;
|
||||||
}) => {
|
}) => {
|
||||||
const searchTerms = [
|
const searchTerms = [
|
||||||
...(userData.bskyHandle ? [userData.bskyHandle] : []),
|
...(userData.bskyHandle ? [userData.bskyHandle] : []),
|
||||||
|
@ -23,7 +23,7 @@ export type MatchTypeFilterValue = {
|
|||||||
[BSKY_USER_MATCH_TYPE.FOLLOWING]: boolean;
|
[BSKY_USER_MATCH_TYPE.FOLLOWING]: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CrawledUser = {
|
export type CrawledUserInfo = {
|
||||||
accountName: string;
|
accountName: string;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
accountNameRemoveUnderscore: string;
|
accountNameRemoveUnderscore: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user