From 7ec5746192ac59b38f7666643bad5e68ef4b46d7 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sun, 3 Nov 2024 19:49:04 +0000
Subject: feature: Add support for importing bookmarks from Omnivore. Fixes
 #602

---
 apps/web/components/settings/ImportExport.tsx | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

(limited to 'apps/web/components/settings/ImportExport.tsx')

diff --git a/apps/web/components/settings/ImportExport.tsx b/apps/web/components/settings/ImportExport.tsx
index b6fa6e03..7889b4d8 100644
--- a/apps/web/components/settings/ImportExport.tsx
+++ b/apps/web/components/settings/ImportExport.tsx
@@ -11,6 +11,7 @@ import {
   ParsedBookmark,
   parseHoarderBookmarkFile,
   parseNetscapeBookmarkFile,
+  parseOmnivoreBookmarkFile,
   parsePocketBookmarkFile,
 } from "@/lib/importBookmarkParser";
 import { cn } from "@/lib/utils";
@@ -128,7 +129,7 @@ export function ImportExportRow() {
       source,
     }: {
       file: File;
-      source: "html" | "pocket" | "hoarder";
+      source: "html" | "pocket" | "omnivore" | "hoarder";
     }) => {
       if (source === "html") {
         return await parseNetscapeBookmarkFile(file);
@@ -136,6 +137,8 @@ export function ImportExportRow() {
         return await parsePocketBookmarkFile(file);
       } else if (source === "hoarder") {
         return await parseHoarderBookmarkFile(file);
+      } else if (source === "omnivore") {
+        return await parseOmnivoreBookmarkFile(file);
       } else {
         throw new Error("Unknown source");
       }
@@ -223,6 +226,18 @@ export function ImportExportRow() {
           <Upload />
           <p>Import Bookmarks from Pocket export</p>
         </FilePickerButton>
+        <FilePickerButton
+          loading={false}
+          accept=".json"
+          multiple={false}
+          className="flex items-center gap-2"
+          onFileSelect={(file) =>
+            runUploadBookmarkFile({ file, source: "omnivore" })
+          }
+        >
+          <Upload />
+          <p>Import Bookmarks from Omnivore export</p>
+        </FilePickerButton>
         <FilePickerButton
           loading={false}
           accept=".json"
-- 
cgit v1.2.3-70-g09d2

