@@ -24,7 +24,10 @@ export const SentryConfig: BrowserOptions = {
|
||||
/adsbygoogle/i.test(error.message) ||
|
||||
/Failed to fetch/i.test(error.message) ||
|
||||
error.message.includes("fetch failed") ||
|
||||
error.message.includes("Unable to open cursor"))
|
||||
error.message.includes("Unable to open cursor") ||
|
||||
error.message.includes(
|
||||
"Document is not focused.",
|
||||
))
|
||||
) {
|
||||
return null
|
||||
}
|
||||
@@ -37,8 +40,9 @@ export const SentryConfig: BrowserOptions = {
|
||||
return false
|
||||
},
|
||||
)
|
||||
const isAbortError = error instanceof Error && error.name === "AbortError"
|
||||
|
||||
if (isPassthroughError) {
|
||||
if (isPassthroughError || isAbortError) {
|
||||
return null
|
||||
}
|
||||
return event
|
||||
|
||||
@@ -6,7 +6,11 @@ import {
|
||||
} from "@renderer/atoms/readability"
|
||||
import { useIntegrationSettingKey } from "@renderer/atoms/settings/integration"
|
||||
import { whoami } from "@renderer/atoms/user"
|
||||
import { SimpleIconsEagle, SimpleIconsInstapaper, SimpleIconsReadwise } from "@renderer/components/ui/platform-icon/icons"
|
||||
import {
|
||||
SimpleIconsEagle,
|
||||
SimpleIconsInstapaper,
|
||||
SimpleIconsReadwise,
|
||||
} from "@renderer/components/ui/platform-icon/icons"
|
||||
import { COPY_MAP } from "@renderer/constants"
|
||||
import { shortcuts } from "@renderer/constants/shortcuts"
|
||||
import { tipcClient } from "@renderer/lib/client"
|
||||
@@ -39,9 +43,15 @@ export const useEntryReadabilityToggle = ({
|
||||
setReadabilityStatus({
|
||||
[id]: ReadabilityStatus.WAITING,
|
||||
})
|
||||
const result = await tipcClient?.readability({
|
||||
url,
|
||||
})
|
||||
const result = await tipcClient
|
||||
?.readability({
|
||||
url,
|
||||
})
|
||||
.catch(() => {
|
||||
setReadabilityStatus({
|
||||
[id]: ReadabilityStatus.FAILURE,
|
||||
})
|
||||
})
|
||||
|
||||
if (result) {
|
||||
const status = getReadabilityStatus()[id]
|
||||
@@ -162,7 +172,8 @@ export const useEntryActions = ({
|
||||
icon: <SimpleIconsEagle />,
|
||||
key: "saveToEagle",
|
||||
hide:
|
||||
!enableEagle || (checkEagle.isLoading ? true : !checkEagle.data) ||
|
||||
!enableEagle ||
|
||||
(checkEagle.isLoading ? true : !checkEagle.data) ||
|
||||
!populatedEntry.entries.media?.length,
|
||||
onClick: async () => {
|
||||
if (
|
||||
@@ -209,9 +220,18 @@ export const useEntryActions = ({
|
||||
saved_using: "Follow",
|
||||
},
|
||||
})
|
||||
toast.success(<>Saved to Readwise, <a target="_blank" className="underline" href={data.url}>view</a></>, {
|
||||
duration: 3000,
|
||||
})
|
||||
toast.success(
|
||||
<>
|
||||
Saved to Readwise,
|
||||
{" "}
|
||||
<a target="_blank" className="underline" href={data.url}>
|
||||
view
|
||||
</a>
|
||||
</>,
|
||||
{
|
||||
duration: 3000,
|
||||
},
|
||||
)
|
||||
} catch {
|
||||
toast.error("Failed to save to Readwise.", {
|
||||
duration: 3000,
|
||||
@@ -223,7 +243,11 @@ export const useEntryActions = ({
|
||||
name: "Save to Instapaper",
|
||||
icon: <SimpleIconsInstapaper />,
|
||||
key: "saveToInstapaper",
|
||||
hide: !enableInstapaper || !instapaperPassword || !instapaperUsername || !populatedEntry.entries.url,
|
||||
hide:
|
||||
!enableInstapaper ||
|
||||
!instapaperPassword ||
|
||||
!instapaperUsername ||
|
||||
!populatedEntry.entries.url,
|
||||
onClick: async () => {
|
||||
try {
|
||||
const data = await ofetch("https://www.instapaper.com/api/add", {
|
||||
@@ -233,13 +257,28 @@ export const useEntryActions = ({
|
||||
},
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Basic ${btoa(`${instapaperUsername}:${instapaperPassword}`)}`,
|
||||
Authorization: `Basic ${btoa(
|
||||
`${instapaperUsername}:${instapaperPassword}`,
|
||||
)}`,
|
||||
},
|
||||
parseResponse: JSON.parse,
|
||||
})
|
||||
toast.success(<>Saved to Instapaper, <a target="_blank" className="underline" href={`https://www.instapaper.com/read/${data.bookmark_id}`}>view</a></>, {
|
||||
duration: 3000,
|
||||
})
|
||||
toast.success(
|
||||
<>
|
||||
Saved to Instapaper,
|
||||
{" "}
|
||||
<a
|
||||
target="_blank"
|
||||
className="underline"
|
||||
href={`https://www.instapaper.com/read/${data.bookmark_id}`}
|
||||
>
|
||||
view
|
||||
</a>
|
||||
</>,
|
||||
{
|
||||
duration: 3000,
|
||||
},
|
||||
)
|
||||
} catch {
|
||||
toast.error("Failed to save to Instapaper.", {
|
||||
duration: 3000,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @see https://github.com/streamich/react-use/blob/master/src/factory/createHTMLMediaHook.ts
|
||||
*/
|
||||
import { noop } from "foxact/noop"
|
||||
import * as React from "react"
|
||||
import { useEffect, useRef } from "react"
|
||||
import { useEventCallback } from "usehooks-ts"
|
||||
@@ -183,7 +184,7 @@ export default function createHTMLMediaHook<
|
||||
}
|
||||
|
||||
if (!lockPlay) {
|
||||
const promise = el.play()
|
||||
const promise = el.play().catch(noop)
|
||||
const isPromise = typeof promise === "object"
|
||||
|
||||
if (isPromise) {
|
||||
|
||||
Reference in New Issue
Block a user