From e87b81c5c88fc9c570ecd05d4b2324f7866a545c Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 28 Oct 2022 17:44:14 +0800 Subject: [PATCH] Use order instead of page to indicate highlight location in Readwise --- packages/api/src/services/integrations.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/api/src/services/integrations.ts b/packages/api/src/services/integrations.ts index 00f65a4ed..d10b9e547 100644 --- a/packages/api/src/services/integrations.ts +++ b/packages/api/src/services/integrations.ts @@ -3,7 +3,7 @@ import { env } from '../env' import axios from 'axios' import { wait } from '../utils/helpers' import { Page } from '../elastic/types' -import { getHighlightLocation, getHighlightUrl } from './highlights' +import { getHighlightUrl } from './highlights' import { Integration } from '../entity/integration' import { getRepository } from '../entity/utils' @@ -66,7 +66,6 @@ const validateReadwiseToken = async (token: string): Promise => { const pageToReadwiseHighlight = (page: Page): ReadwiseHighlight[] => { if (!page.highlights) return [] return page.highlights.map((highlight) => { - const location = getHighlightLocation(highlight.patch) return { text: highlight.quote, title: page.title, @@ -75,8 +74,8 @@ const pageToReadwiseHighlight = (page: Page): ReadwiseHighlight[] => { highlighted_at: new Date(highlight.createdAt).toISOString(), category: 'articles', image_url: page.image, - location, - location_type: location ? 'page' : 'order', + location: highlight.highlightPositionPercent || undefined, + location_type: 'order', note: highlight.annotation || undefined, source_type: 'omnivore', source_url: page.url,