mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-04-23 20:12:22 -06:00
🐛 fix non query error
This commit is contained in:
parent
02ced36232
commit
eaa6b88ecb
@ -1,7 +1,7 @@
|
|||||||
import { isOutOfTopViewport, removeReloadEl } from './domHelpers';
|
import { isOutOfTopViewport, removeReloadEl } from './domHelpers';
|
||||||
import { getAccountNameAndDisplayName, getUserCells, insertBskyProfileEl, insertNotFoundEl, insertReloadEl } from "~lib/domHelpers";
|
import { getAccountNameAndDisplayName, getUserCells, insertBskyProfileEl, insertNotFoundEl, insertReloadEl } from "~lib/domHelpers";
|
||||||
import { isSimilarUser } from "~lib/bskyHelpers";
|
import { isSimilarUser } from "~lib/bskyHelpers";
|
||||||
import { debugLog } from "~lib/utils";
|
import { debugLog, isOneSymbol } from "~lib/utils";
|
||||||
import type { BskyClient } from './bskyClient';
|
import type { BskyClient } from './bskyClient';
|
||||||
import type { ViewerState } from '@atproto/api/dist/client/types/app/bsky/actor/defs';
|
import type { ViewerState } from '@atproto/api/dist/client/types/app/bsky/actor/defs';
|
||||||
import type { UserCellBtnLabel } from './components/BskyUserCell';
|
import type { UserCellBtnLabel } from './components/BskyUserCell';
|
||||||
@ -62,9 +62,11 @@ export const searchAndInsertBskyUsers = async (
|
|||||||
|
|
||||||
// Loop over search parameters and break if a user is found
|
// Loop over search parameters and break if a user is found
|
||||||
for (const term of searchTerms) {
|
for (const term of searchTerms) {
|
||||||
if (!term) {
|
// one symbol is not a valid search term for bsky
|
||||||
|
if (!term || isOneSymbol(term)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
const [searchResult] = await agent.searchUser({
|
const [searchResult] = await agent.searchUser({
|
||||||
term: term,
|
term: term,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
@ -81,6 +83,9 @@ export const searchAndInsertBskyUsers = async (
|
|||||||
matchType = type
|
matchType = type
|
||||||
break; // Stop searching when a user is found
|
break; // Stop searching when a user is found
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert bsky profile or not found element
|
// insert bsky profile or not found element
|
||||||
|
@ -3,3 +3,7 @@ export const debugLog = (message: string) => {
|
|||||||
console.log(`🔷 [Sky Follower Bridge] ${message}`)
|
console.log(`🔷 [Sky Follower Bridge] ${message}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const isOneSymbol = (str: string) => {
|
||||||
|
return /^[^\w\s]$/.test(str);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user