⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
Added basic infrastructure to be able to have omnivore imports
dereulenspiegele1a31481ad55
diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.tsindex 87dafb06..f30ba118 100644--- a/lib/api/archiveHandler.ts+++ b/lib/api/archiveHandler.ts@@ -44,7 +44,8 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {};}if (process.env.PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH) {- browserOptions.executablePath = process.env.PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH;+ browserOptions.executablePath =+ process.env.PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH;}const browser = await chromium.launch(browserOptions);diff --git a/lib/api/controllers/migration/importFromOmnivore.ts b/lib/api/controllers/migration/importFromOmnivore.tsnew file mode 100644index 00000000..f17482ee--- /dev/null+++ b/lib/api/controllers/migration/importFromOmnivore.ts@@ -0,0 +1,12 @@+import { prisma } from "@/lib/api/db";+import createFolder from "@/lib/api/storage/createFolder";+import { JSDOM } from "jsdom";+import { parse, Node, Element, TextNode } from "himalaya";+import { hasPassedLimit } from "../../verifyCapacity";++export default async function importFromOmnivore(+ userId: number,+ rawData: string+) {+ console.log("Received data:\n" + rawData);+}diff --git a/pages/api/v1/migration/index.ts b/pages/api/v1/migration/index.tsindex 4e479847..790af031 100644--- a/pages/api/v1/migration/index.ts+++ b/pages/api/v1/migration/index.ts@@ -5,6 +5,7 @@ import importFromLinkwarden from "@/lib/api/controllers/migration/importFromLinkimport { MigrationFormat, MigrationRequest } from "@/types/global";import verifyUser from "@/lib/api/verifyUser";import importFromWallabag from "@/lib/api/controllers/migration/importFromWallabag";+import importFromOmnivore from "@/lib/api/controllers/migration/importFromOmnivore";export const config = {api: {@@ -45,6 +46,8 @@ export default async function users(req: NextApiRequest, res: NextApiResponse) {data = await importFromLinkwarden(user.id, request.data);else if (request.format === MigrationFormat.wallabag)data = await importFromWallabag(user.id, request.data);+ else if (request.format == MigrationFormat.omnivore)+ data = await importFromOmnivore(user.id, request.data);if (data) return res.status(data.status).json({ response: data.response });}diff --git a/pages/dashboard.tsx b/pages/dashboard.tsxindex cc67e66d..2c92b4a0 100644--- a/pages/dashboard.tsx+++ b/pages/dashboard.tsx@@ -51,7 +51,7 @@ export default function Dashboard() {account.referredBy === null &&// if user is using Linkwarden for more than 3 daysnew Date().getTime() - new Date(account.createdAt).getTime() >- 3 * 24 * 60 * 60 * 1000+ 3 * 24 * 60 * 60 * 1000) {setTimeout(() => {setShowsSurveyModal(true);@@ -104,7 +104,7 @@ export default function Dashboard() {toast.error(errorData.response ||- "Failed to import bookmarks. Please try again."+ "Failed to import bookmarks. Please try again.");return;}@@ -352,6 +352,27 @@ export default function Dashboard() {/></label></li>+ <li>+ <label+ tabIndex={0}+ role="button"+ htmlFor="import-omnivore-file"+ title={t("from_omnivore")}+ className="whitespace-nowrap"+ >+ {t("from_omnivore")}+ <input+ type="file"+ name="photo"+ id="import-omnivore-file"+ accept=".zip"+ className="hidden"+ onChange={(e) =>+ importBookmarks(e, MigrationFormat.omnivore)+ }+ />+ </label>+ </li></ul></div></div>diff --git a/public/locales/en/common.json b/public/locales/en/common.jsonindex 256bfff0..ff237758 100644--- a/public/locales/en/common.json+++ b/public/locales/en/common.json@@ -42,6 +42,7 @@"from_linkwarden": "From Linkwarden","from_html": "From Bookmarks HTML file","from_wallabag": "From Wallabag (JSON file)",+ "from_omnivore": "From Omnivore (ZIP file)","pinned": "Pinned","pinned_links_desc": "Your pinned Links","pin_favorite_links_here": "Pin Your Favorite Links Here!",@@ -394,7 +395,7 @@"upload_preview_image": "Upload Preview Image","columns": "Columns","default": "Default",- "invalid_url_guide":"Please enter a valid Address for the Link. (It should start with http/https)",+ "invalid_url_guide": "Please enter a valid Address for the Link. (It should start with http/https)","email_invalid": "Please enter a valid email address.","username_invalid_guide": "Username has to be at least 3 characters, no spaces and special characters are allowed.","team_management": "Team Management",diff --git a/types/global.ts b/types/global.tsindex 39da331d..d2c6e397 100644--- a/types/global.ts+++ b/types/global.ts@@ -119,6 +119,7 @@ export enum MigrationFormat {linkwarden,htmlFile,wallabag,+ omnivore,}export enum Plan {