⚡️⚡️⚡️ 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
fixed monolith for docker users
daniel31x1322b273449401
diff --git a/.env.sample b/.env.sampleindex 41716cb9..c21f3d7e 100644--- a/.env.sample+++ b/.env.sample@@ -53,10 +53,6 @@ PROXY_BYPASS=PDF_MARGIN_TOP=PDF_MARGIN_BOTTOM=-# Singlefile archive settings-SINGLEFILE_ARCHIVE_COMMAND= # single-file "{{URL}}" --dump-content-SINGLEFILE_ARCHIVE_HTTP_API= # http://singlefile:3000/-################## SSO Providers ##################diff --git a/Dockerfile b/Dockerfileindex 2c573c59..d51b65d1 100644--- a/Dockerfile+++ b/Dockerfile@@ -8,15 +8,30 @@ WORKDIR /dataCOPY ./package.json ./yarn.lock ./playwright.config.ts ./-# Increase timeout to pass github actions arm64 buildRUN --mount=type=cache,sharing=locked,target=/usr/local/share/.cache/yarn yarn install --network-timeout 10000000-# RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && brew install monolith+RUN apt-get update++RUN apt-get install -y \+ build-essential \+ curl \+ libssl-dev \+ pkg-config++RUN apt-get update++RUN curl https://sh.rustup.rs -sSf | bash -s -- -y++ENV PATH="/root/.cargo/bin:${PATH}"++RUN cargo install monolithRUN npx playwright install-deps && \apt-get clean && \yarn cache clean+RUN yarn playwright install+COPY . .RUN yarn prisma generate && \diff --git a/docker-compose.yml b/docker-compose.ymlindex 628a5d6a..63a87403 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -19,9 +19,3 @@ services:- ./data:/data/datadepends_on:- postgres- # monolith:- # image: ghcr.io/linkwarden/monolith:latest- # container_name: monolith- # singlefile:- # image: rutkai/single-file-web:latest- # container_name: singlefilediff --git a/lib/api/controllers/links/getLinks.ts b/lib/api/controllers/links/getLinks.tsindex 0086e930..976f1f18 100644--- a/lib/api/controllers/links/getLinks.ts+++ b/lib/api/controllers/links/getLinks.ts@@ -2,7 +2,8 @@ import { prisma } from "@/lib/api/db";import { LinkRequestQuery, Sort } from "@/types/global";export default async function getLink(userId: number, query: LinkRequestQuery) {- const POSTGRES_IS_ENABLED = process.env.DATABASE_URL.startsWith("postgresql");+ const POSTGRES_IS_ENABLED =+ process.env.DATABASE_URL?.startsWith("postgresql");let order: any;if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };diff --git a/lib/api/controllers/public/links/getPublicLinksUnderCollection.ts b/lib/api/controllers/public/links/getPublicLinksUnderCollection.tsindex e94a3e16..1b489840 100644--- a/lib/api/controllers/public/links/getPublicLinksUnderCollection.ts+++ b/lib/api/controllers/public/links/getPublicLinksUnderCollection.ts@@ -4,7 +4,8 @@ import { LinkRequestQuery, Sort } from "@/types/global";export default async function getLink(query: Omit<LinkRequestQuery, "tagId" | "pinnedOnly">) {- const POSTGRES_IS_ENABLED = process.env.DATABASE_URL.startsWith("postgresql");+ const POSTGRES_IS_ENABLED =+ process.env.DATABASE_URL?.startsWith("postgresql");let order: any;if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };diff --git a/lib/api/controllers/tokens/postToken.ts b/lib/api/controllers/tokens/postToken.tsindex f88030d8..faedd8a7 100644--- a/lib/api/controllers/tokens/postToken.ts+++ b/lib/api/controllers/tokens/postToken.ts@@ -65,12 +65,12 @@ export default async function postToken(jti: crypto.randomUUID(),},maxAge: expiryDateSecond || 604800,- secret: process.env.NEXTAUTH_SECRET,+ secret: process.env.NEXTAUTH_SECRET as string,});const tokenBody = await decode({token,- secret: process.env.NEXTAUTH_SECRET,+ secret: process.env.NEXTAUTH_SECRET as string,});const createToken = await prisma.accessToken.create({diff --git a/lib/api/preservationScheme/handleMonolith.ts b/lib/api/preservationScheme/handleMonolith.tsindex de5bd2ac..111b9371 100644--- a/lib/api/preservationScheme/handleMonolith.ts+++ b/lib/api/preservationScheme/handleMonolith.ts@@ -1,16 +1,11 @@import { execSync } from "child_process";import createFile from "../storage/createFile";-import axios from "axios";-import { Agent } from "http";import { prisma } from "../db";import { Link } from "@prisma/client";-import { Page } from "playwright";const handleMonolith = async (link: Link, content: string) => {if (!link.url) return;- let command = process.env.SINGLEFILE_ARCHIVE_COMMAND;- let httpApi = process.env.SINGLEFILE_ARCHIVE_HTTP_API;try {let html = execSync(`monolith - -I -b ${link.url} ${@@ -42,56 +37,6 @@ const handleMonolith = async (link: Link, content: string) => {} catch (err) {console.error("Error running SINGLEFILE_ARCHIVE_COMMAND:", err);}- // if (httpApi) {- // try {- // let html = await axios.post(- // httpApi,- // { url: link.url },- // {- // headers: {- // "Content-Type": "application/x-www-form-urlencoded",- // },- // httpAgent: new Agent({ keepAlive: false }),- // }- // );-- // if (!html.data.length) {- // console.error("Error running SINGLEFILE_ARCHIVE_COMMAND: Empty buffer");- // return;- // }-- // const collectionId = (- // await prisma.link.findUnique({- // where: { id: link.id },- // select: { collectionId: true },- // })- // )?.collectionId;-- // if (!collectionId) {- // console.error(- // "Error running SINGLEFILE_ARCHIVE_COMMAND: Collection ID not found"- // );- // return;- // }-- // await createFile({- // data: html.data,- // filePath: `archives/${collectionId}/${link.id}.html`,- // }).then(async () => {- // await prisma.link.update({- // where: { id: link.id },- // data: {- // singlefile: `archives/${collectionId}/${link.id}.html`,- // },- // });- // });- // } catch (err) {- // console.error(- // "Error fetching Singlefile using SINGLEFILE_ARCHIVE_HTTP_API:",- // err- // );- // }- // }};export default handleMonolith;