⚡️⚡️⚡️ 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
dereulenspiegel8ad9ab775591
diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.tsindex cff6006c..9f3d1066 100644--- a/lib/api/archiveHandler.ts+++ b/lib/api/archiveHandler.ts@@ -49,7 +49,20 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {);});- const browserOptions = getBrowserOptions();+ // allow user to configure a proxy+ let browserOptions: LaunchOptions = {};+ if (process.env.PROXY) {+ browserOptions.proxy = {+ server: process.env.PROXY,+ bypass: process.env.PROXY_BYPASS,+ username: process.env.PROXY_USERNAME,+ password: process.env.PROXY_PASSWORD,+ };+ }+ if (process.env.PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH) {+ browserOptions.executablePath =+ process.env.PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH;+ }const browser = await chromium.launch(browserOptions);const context = await browser.newContext({@@ -137,7 +150,7 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {preview: !finalLink.preview ? "unavailable" : undefined,aiTagged:user.aiTaggingMethod !== AiTaggingMethod.DISABLED &&- !finalLink.aiTagged+ !finalLink.aiTagged? true: undefined,},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 80f69c03..379c8d3d 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!",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 {