mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-04-10 14:11:22 -06:00
fix: skip searching users with the "impersonation" label.
This commit is contained in:
parent
8e233d8488
commit
f2d4160db8
@ -100,4 +100,8 @@ export const DOCUMENT_LINK = {
|
|||||||
"https://www.sky-follower-bridge.dev/troubleshooting.html#page-errors",
|
"https://www.sky-follower-bridge.dev/troubleshooting.html#page-errors",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const BSKY_DOMAIN = process.env.PLASMO_PUBLIC_BSKY_DOMAIN || "bsky.social";
|
export const BSKY_DOMAIN = process.env.PLASMO_PUBLIC_BSKY_DOMAIN || "bsky.social";
|
||||||
|
|
||||||
|
export const BSKY_PROFILE_LABEL = {
|
||||||
|
IMPERSONATION: "impersonation",
|
||||||
|
} as const;
|
||||||
|
@ -2,6 +2,12 @@ import { isSimilarUser } from "~lib/bskyHelpers";
|
|||||||
import type { getAccountNameAndDisplayName } from "~lib/domHelpers";
|
import type { getAccountNameAndDisplayName } from "~lib/domHelpers";
|
||||||
import { isOneSymbol } from "~lib/utils";
|
import { isOneSymbol } from "~lib/utils";
|
||||||
import type { BskyServiceWorkerClient } from "./bskyServiceWorkerClient";
|
import type { BskyServiceWorkerClient } from "./bskyServiceWorkerClient";
|
||||||
|
import { BSKY_PROFILE_LABEL } from "./constants";
|
||||||
|
import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
|
||||||
|
|
||||||
|
const isImpersonationUser = (user: ProfileView) => {
|
||||||
|
return user.labels.some((label) => label.val === BSKY_PROFILE_LABEL.IMPERSONATION);
|
||||||
|
}
|
||||||
|
|
||||||
export const searchBskyUser = async ({
|
export const searchBskyUser = async ({
|
||||||
client,
|
client,
|
||||||
@ -25,11 +31,17 @@ export const searchBskyUser = async ({
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const searchResults = await client.searchUser({
|
const searchResults = await client.searchUser({
|
||||||
term: term,
|
term,
|
||||||
limit: 3,
|
limit: 3,
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const searchResult of searchResults) {
|
for (const searchResult of searchResults) {
|
||||||
|
|
||||||
|
// skip impersonation users
|
||||||
|
if (isImpersonationUser(searchResult)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const { isSimilar: isUserFound, type } = isSimilarUser(
|
const { isSimilar: isUserFound, type } = isSimilarUser(
|
||||||
// TODO: simplify
|
// TODO: simplify
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user