refactor: sunset Omnivore integration (#1953)
* refactor: remove Omnivore integration and related settings * refactor: remove Omnivore integration from localization files * refactor: remove Omnivore integration from settings and command types * refactor: remove Omnivore entries from localization files
This commit is contained in:
@@ -19,7 +19,6 @@ export const COMMAND_ID = {
|
||||
saveToEagle: "integration:save-to-eagle",
|
||||
saveToReadwise: "integration:save-to-readwise",
|
||||
saveToInstapaper: "integration:save-to-instapaper",
|
||||
saveToOmnivore: "integration:save-to-omnivore",
|
||||
saveToObsidian: "integration:save-to-obsidian",
|
||||
saveToOutline: "integration:save-to-outline",
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
SimpleIconsEagle,
|
||||
SimpleIconsInstapaper,
|
||||
SimpleIconsObsidian,
|
||||
SimpleIconsOmnivore,
|
||||
SimpleIconsOutline,
|
||||
SimpleIconsReadwise,
|
||||
} from "@follow/components/ui/platform-icon/icons.js"
|
||||
@@ -29,7 +28,6 @@ export const useRegisterIntegrationCommands = () => {
|
||||
useRegisterEagleCommands()
|
||||
useRegisterReadwiseCommands()
|
||||
useRegisterInstapaperCommands()
|
||||
useRegisterOmnivoreCommands()
|
||||
useRegisterObsidianCommands()
|
||||
useRegisterOutlineCommands()
|
||||
}
|
||||
@@ -236,90 +234,6 @@ const useRegisterInstapaperCommands = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const useRegisterOmnivoreCommands = () => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const enableOmnivore = useIntegrationSettingKey("enableOmnivore")
|
||||
const omnivoreToken = useIntegrationSettingKey("omnivoreToken")
|
||||
const omnivoreEndpoint = useIntegrationSettingKey("omnivoreEndpoint")
|
||||
|
||||
const isOmnivoreAvailable = enableOmnivore && !!omnivoreToken && !!omnivoreEndpoint
|
||||
|
||||
useRegisterCommandEffect(
|
||||
!isOmnivoreAvailable
|
||||
? []
|
||||
: defineFollowCommand({
|
||||
id: COMMAND_ID.integration.saveToOmnivore,
|
||||
label: t("entry_actions.save_to_omnivore"),
|
||||
icon: <SimpleIconsOmnivore />,
|
||||
run: async ({ entryId }) => {
|
||||
const entry = useEntryStore.getState().flatMapEntries[entryId]
|
||||
if (!entry) {
|
||||
toast.error("Failed to save to Omnivore: entry is not available", { duration: 3000 })
|
||||
return
|
||||
}
|
||||
const saveUrlQuery = `
|
||||
mutation SaveUrl($input: SaveUrlInput!) {
|
||||
saveUrl(input: $input) {
|
||||
... on SaveSuccess {
|
||||
url
|
||||
clientRequestId
|
||||
}
|
||||
... on SaveError {
|
||||
errorCodes
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
window.analytics?.capture("integration", {
|
||||
type: "omnivore",
|
||||
event: "save",
|
||||
})
|
||||
try {
|
||||
const data = await ofetch(omnivoreEndpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: omnivoreToken,
|
||||
},
|
||||
body: {
|
||||
query: saveUrlQuery,
|
||||
variables: {
|
||||
input: {
|
||||
url: entry.entries.url,
|
||||
source: "Follow",
|
||||
clientRequestId: globalThis.crypto.randomUUID(),
|
||||
publishedAt: new Date(entry.entries.publishedAt),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
toast.success(
|
||||
<>
|
||||
{t("entry_actions.saved_to_omnivore")},{" "}
|
||||
<a target="_blank" className="underline" href={data.data.saveUrl.url}>
|
||||
view
|
||||
</a>
|
||||
</>,
|
||||
{
|
||||
duration: 3000,
|
||||
},
|
||||
)
|
||||
} catch {
|
||||
toast.error(t("entry_actions.failed_to_save_to_omnivore"), {
|
||||
duration: 3000,
|
||||
})
|
||||
}
|
||||
},
|
||||
}),
|
||||
{
|
||||
deps: [isOmnivoreAvailable],
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
const getEntryContentAsMarkdown = async (entry: FlatEntryModel) => {
|
||||
const isReadabilityReady = getReadabilityStatus()[entry.entries.id] === ReadabilityStatus.SUCCESS
|
||||
const content =
|
||||
|
||||
@@ -106,11 +106,6 @@ export type SaveToInstapaperCommand = Command<{
|
||||
fn: (payload: { entryId: string }) => void
|
||||
}>
|
||||
|
||||
export type SaveToOmnivoreCommand = Command<{
|
||||
id: typeof COMMAND_ID.integration.saveToOmnivore
|
||||
fn: (payload: { entryId: string }) => void
|
||||
}>
|
||||
|
||||
export type SaveToObsidianCommand = Command<{
|
||||
id: typeof COMMAND_ID.integration.saveToObsidian
|
||||
fn: (payload: { entryId: string }) => void
|
||||
@@ -125,7 +120,6 @@ export type IntegrationCommand =
|
||||
| SaveToEagleCommand
|
||||
| SaveToReadwiseCommand
|
||||
| SaveToInstapaperCommand
|
||||
| SaveToOmnivoreCommand
|
||||
| SaveToObsidianCommand
|
||||
| SaveToOutlineCommand
|
||||
|
||||
|
||||
Reference in New Issue
Block a user