mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-19 16:13:19 +00:00
fix linkedin bot status
This commit is contained in:
parent
ee55830481
commit
bee6f2d4e1
2 changed files with 29 additions and 1 deletions
|
|
@ -467,6 +467,7 @@ export default function OnboardingPage() {
|
|||
found?: boolean
|
||||
handle?: string
|
||||
reason?: string
|
||||
verified?: boolean
|
||||
} = await response.json().catch(() => ({}))
|
||||
|
||||
if (controller.signal.aborted) return
|
||||
|
|
@ -474,10 +475,14 @@ export default function OnboardingPage() {
|
|||
if (response.ok && data.found === true) {
|
||||
const account =
|
||||
source === "x" && data.handle ? ` @${data.handle}` : ""
|
||||
const message =
|
||||
source === "linkedin" && data.verified === false
|
||||
? "LinkedIn profile link looks valid - press Enter to continue"
|
||||
: `${SOURCE_NAME[source]} account${account} found - press Enter to continue`
|
||||
setAccountLookup({
|
||||
source,
|
||||
status: "found",
|
||||
message: `${SOURCE_NAME[source]} account${account} found - press Enter to continue`,
|
||||
message,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,17 @@ function looksUnavailable(source: AccountSource, html: string) {
|
|||
)
|
||||
}
|
||||
|
||||
function linkedinFallback(account: ParsedAccount, status?: number) {
|
||||
return Response.json({
|
||||
found: true,
|
||||
verified: false,
|
||||
reason: "valid_linkedin_profile_url",
|
||||
handle: account.handle,
|
||||
status,
|
||||
url: account.url,
|
||||
})
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url)
|
||||
const source = searchParams.get("source")
|
||||
|
|
@ -128,6 +139,10 @@ export async function GET(request: Request) {
|
|||
}
|
||||
|
||||
if (!response.ok) {
|
||||
if (source === "linkedin") {
|
||||
return linkedinFallback(account, response.status)
|
||||
}
|
||||
|
||||
return Response.json(
|
||||
{
|
||||
error: "Unable to verify account",
|
||||
|
|
@ -150,6 +165,10 @@ export async function GET(request: Request) {
|
|||
})
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name === "AbortError") {
|
||||
if (source === "linkedin") {
|
||||
return linkedinFallback(account)
|
||||
}
|
||||
|
||||
return Response.json(
|
||||
{ error: "Account lookup timed out", handle: account.handle },
|
||||
{ status: 504 },
|
||||
|
|
@ -157,6 +176,10 @@ export async function GET(request: Request) {
|
|||
}
|
||||
|
||||
console.error("Account status lookup failed:", error)
|
||||
if (source === "linkedin") {
|
||||
return linkedinFallback(account)
|
||||
}
|
||||
|
||||
return Response.json(
|
||||
{ error: "Unable to verify account", handle: account.handle },
|
||||
{ status: 502 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue