fix: format

This commit is contained in:
kawamataryo
2024-11-18 11:25:19 +09:00
parent f2d4160db8
commit d2709d3397
4 changed files with 11 additions and 7 deletions

View File

@@ -100,7 +100,8 @@ export const DOCUMENT_LINK = {
"https://www.sky-follower-bridge.dev/troubleshooting.html#page-errors",
} 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",

View File

@@ -29,7 +29,9 @@ export const getAccountNameAndDisplayName = (userCell: Element) => {
const twAccountNameReplaceUnderscore = twAccountName.replaceAll("_", "-");
const twDisplayName = displayNameEl?.textContent;
const bskyHandle =
userCell.textContent?.match(new RegExp(`([^/\\s]+\\.${BSKY_DOMAIN})`))?.[1] ??
userCell.textContent?.match(
new RegExp(`([^/\\s]+\\.${BSKY_DOMAIN})`),
)?.[1] ??
userCell.textContent
?.match(/bsky\.app\/profile\/([^/\s]+)…?/)?.[1]
?.replace("…", "") ??

View File

@@ -1,13 +1,15 @@
import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
import { isSimilarUser } from "~lib/bskyHelpers";
import type { getAccountNameAndDisplayName } from "~lib/domHelpers";
import { isOneSymbol } from "~lib/utils";
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);
}
return user.labels.some(
(label) => label.val === BSKY_PROFILE_LABEL.IMPERSONATION,
);
};
export const searchBskyUser = async ({
client,
@@ -36,7 +38,6 @@ export const searchBskyUser = async ({
});
for (const searchResult of searchResults) {
// skip impersonation users
if (isImpersonationUser(searchResult)) {
continue;