⚡️⚡️⚡️ 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
fixes and improvements
daniel31x131f20180a51e3
diff --git a/components/LinkCard.tsx b/components/LinkCard.tsxindex 555358a8..7a23d870 100644--- a/components/LinkCard.tsx+++ b/components/LinkCard.tsx@@ -218,7 +218,7 @@ export default function LinkCard({ link, count, className }: Props) {width={64}height={64}alt=""- className={`absolute w-12 duration-100 bg-white rounded-md p-1 bottom-5 right-5 select-none z-10`}+ className={`absolute w-12 duration-100 bg-white shadow rounded-md p-1 bottom-5 right-5 select-none z-10`}draggable="false"onError={(e) => {const target = e.target as HTMLElement;diff --git a/components/Modal/Link/PreservedFormats.tsx b/components/Modal/Link/PreservedFormats.tsxindex d1bc5bf1..4017c322 100644--- a/components/Modal/Link/PreservedFormats.tsx+++ b/components/Modal/Link/PreservedFormats.tsx@@ -92,7 +92,7 @@ export default function PreservedFormats() {{link?.screenshotPath && link?.screenshotPath !== "pending" ? (<div className="flex justify-between items-center pr-1 border border-neutral-content rounded-md"><div className="flex gap-2 items-center">- <div className="text-white bg-primary p-2 rounded-l-md">+ <div className="bg-primary text-primary-content p-2 rounded-l-md"><FontAwesomeIcon icon={faFileImage} className="w-6 h-6" /></div>@@ -131,7 +131,7 @@ export default function PreservedFormats() {{link?.pdfPath && link.pdfPath !== "pending" ? (<div className="flex justify-between items-center pr-1 border border-neutral-content rounded-md"><div className="flex gap-2 items-center">- <div className="text-white bg-primary p-2 rounded-l-md">+ <div className="bg-primary text-primary-content p-2 rounded-l-md"><FontAwesomeIcon icon={faFilePdf} className="w-6 h-6" /></div>@@ -166,7 +166,7 @@ export default function PreservedFormats() {<div className="flex flex-col-reverse sm:flex-row gap-5 items-center justify-center">{link?.collection.ownerId === session.data?.user.id ? (<div- className={`w-full text-center bg-sky-700 p-1 rounded-md cursor-pointer select-none hover:bg-sky-600 duration-100 ${+ className={`btn btn-accent text-white ${link?.pdfPath &&link?.screenshotPath &&link?.pdfPath !== "pending" &&@@ -176,12 +176,14 @@ export default function PreservedFormats() {}`}onClick={() => updateArchive()}>- <p>Update Preserved Formats</p>- <p className="text-xs">(Refresh Link)</p>+ <div>+ <p>Update Preserved Formats</p>+ <p className="text-xs">(Refresh Link)</p>+ </div></div>) : undefined}<Link- href={`https://web.archive.org/web/${link?.url.replace(+ href={`https://web.archive.org/web/${link?.url?.replace(/(^\w+:|^)\/\//,"")}`}diff --git a/components/ModalContent/EditCollectionModal.tsx b/components/ModalContent/EditCollectionModal.tsxindex da22a879..96ddf71d 100644--- a/components/ModalContent/EditCollectionModal.tsx+++ b/components/ModalContent/EditCollectionModal.tsx@@ -110,7 +110,10 @@ export default function EditCollectionModal({</div></div>- <button className="btn btn-accent w-fit ml-auto" onClick={submit}>+ <button+ className="btn btn-accent text-white w-fit ml-auto"+ onClick={submit}+ >Save</button></div>diff --git a/components/ModalContent/EditCollectionSharingModal.tsx b/components/ModalContent/EditCollectionSharingModal.tsxindex e6771cec..e456d753 100644--- a/components/ModalContent/EditCollectionSharingModal.tsx+++ b/components/ModalContent/EditCollectionSharingModal.tsx@@ -180,7 +180,7 @@ export default function EditCollectionSharingModal({setMemberState)}- className="btn btn-primary btn-square btn-sm h-10 w-10"+ className="btn btn-accent text-white btn-square btn-sm h-10 w-10"><FontAwesomeIcon icon={faUserPlus} className="w-5 h-5" /></div>@@ -436,7 +436,7 @@ export default function EditCollectionSharingModal({{permissions === true && (<button- className="btn btn-accent w-fit ml-auto mt-3"+ className="btn btn-accent text-white w-fit ml-auto mt-3"onClick={submit}>Savediff --git a/components/ModalContent/EditLinkModal.tsx b/components/ModalContent/EditLinkModal.tsxindex 2214e0ee..27157c8c 100644--- a/components/ModalContent/EditLinkModal.tsx+++ b/components/ModalContent/EditLinkModal.tsx@@ -159,7 +159,7 @@ export default function EditLinkModal({ onClose, activeLink }: Props) {</div><div className="flex justify-end items-center mt-5">- <button className="btn btn-accent" onClick={submit}>+ <button className="btn btn-accent text-white" onClick={submit}>Save</button></div>diff --git a/components/ModalContent/NewCollectionModal.tsx b/components/ModalContent/NewCollectionModal.tsxindex 2c3a806f..8d43fc7d 100644--- a/components/ModalContent/NewCollectionModal.tsx+++ b/components/ModalContent/NewCollectionModal.tsx@@ -115,7 +115,10 @@ export default function NewCollectionModal({ onClose }: Props) {</div></div>- <button className="btn btn-accent w-fit ml-auto" onClick={submit}>+ <button+ className="btn btn-accent text-white w-fit ml-auto"+ onClick={submit}+ >Create Collection</button></div>diff --git a/components/ModalContent/NewLinkModal.tsx b/components/ModalContent/NewLinkModal.tsxindex 3eaa6aa7..307339de 100644--- a/components/ModalContent/NewLinkModal.tsx+++ b/components/ModalContent/NewLinkModal.tsx@@ -193,7 +193,7 @@ export default function NewLinkModal({ onClose }: Props) {<p>{optionsExpanded ? "Hide" : "More"} Options</p></div>- <button className="btn btn-accent" onClick={submit}>+ <button className="btn btn-accent text-white" onClick={submit}>Create Link</button></div>diff --git a/components/ModalContent/UploadFileModal.tsx b/components/ModalContent/UploadFileModal.tsxindex 8939bd19..42faf6d8 100644--- a/components/ModalContent/UploadFileModal.tsx+++ b/components/ModalContent/UploadFileModal.tsx@@ -110,7 +110,6 @@ export default function UploadFileModal({ onClose }: Props) {else if (file.type === "image/png") fileType = ArchivedFormat.png;else if (file.type === "application/pdf") fileType = ArchivedFormat.pdf;- console.log(fileType);if (fileType !== null) {setSubmitLoader(true);@@ -227,7 +226,7 @@ export default function UploadFileModal({ onClose }: Props) {<p>{optionsExpanded ? "Hide" : "More"} Options</p></div>- <button className="btn btn-accent" onClick={submit}>+ <button className="btn btn-accent text-white" onClick={submit}>Create Link</button></div>diff --git a/components/SubmitButton.tsx b/components/SubmitButton.tsxindex d33ce1f0..1ee208b9 100644--- a/components/SubmitButton.tsx+++ b/components/SubmitButton.tsx@@ -21,7 +21,7 @@ export default function SubmitButton({return (<buttontype={type ? type : undefined}- className={`btn btn-primary text-white tracking-wider w-fit flex items-center gap-2 ${+ className={`btn btn-accent text-white tracking-wider w-fit flex items-center gap-2 ${className || ""}`}onClick={() => {diff --git a/lib/api/controllers/links/postLink.ts b/lib/api/controllers/links/postLink.tsindex c6755b4c..6cd4d55f 100644--- a/lib/api/controllers/links/postLink.ts+++ b/lib/api/controllers/links/postLink.ts@@ -75,7 +75,6 @@ export default async function postLink(name: link.name,description,type: linkType,- readabilityPath: "pending",collection: {connectOrCreate: {where: {@@ -118,11 +117,33 @@ export default async function postLink(? urlHandler(newLink.id, newLink.url, userId): undefined;- linkType === "pdf" ? pdfHandler(newLink.id, newLink.url) : undefined;+ newLink.url && linkType === "pdf"+ ? pdfHandler(newLink.id, newLink.url)+ : undefined;- linkType === "image"+ newLink.url && linkType === "image"? imageHandler(newLink.id, newLink.url, imageExtension): undefined;+ !newLink.url && linkType === "pdf"+ ? await prisma.link.update({+ where: { id: newLink.id },+ data: {+ pdfPath: "pending",+ lastPreserved: new Date().toISOString(),+ },+ })+ : undefined;++ !newLink.url && linkType === "image"+ ? await prisma.link.update({+ where: { id: newLink.id },+ data: {+ screenshotPath: "pending",+ lastPreserved: new Date().toISOString(),+ },+ })+ : undefined;+return { response: newLink, status: 200 };}diff --git a/pages/_app.tsx b/pages/_app.tsxindex 3f52d9b6..eea08e48 100644--- a/pages/_app.tsx+++ b/pages/_app.tsx@@ -47,7 +47,7 @@ export default function App({reverseOrder={false}toastOptions={{className:- "border border-sky-100 dark:border-neutral-700 dark:bg-neutral-900 dark:text-white",+ "border border-sky-100 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",}}/><Component {...pageProps} />diff --git a/pages/api/v1/archives/[linkId].ts b/pages/api/v1/archives/[linkId].tsindex 1502048a..0b8992ed 100644--- a/pages/api/v1/archives/[linkId].ts+++ b/pages/api/v1/archives/[linkId].ts@@ -89,8 +89,6 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {});form.parse(req, async (err, fields, files) => {- console.log(files);-const allowedMIMETypes = ["application/pdf","image/png",@@ -109,17 +107,31 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {response: `Sorry, we couldn't process your file. Please ensure it's a PDF, PNG, or JPG format and doesn't exceed ${MAX_UPLOAD_SIZE}MB.`,});} else {- console.log(files.file[0].mimetype);-const fileBuffer = fs.readFileSync(files.file[0].filepath);- console.log(fileBuffer);-- await createFile({- filePath: `archives/${collectionPermissions?.id}/${linkId + suffix}`,- data: fileBuffer,+ const linkStillExists = await prisma.link.findUnique({+ where: { id: linkId },});+ if (linkStillExists) {+ await createFile({+ filePath: `archives/${collectionPermissions?.id}/${+ linkId + suffix+ }`,+ data: fileBuffer,+ });++ await prisma.link.update({+ where: { id: linkId },+ data: {+ screenshotPath: `archives/${collectionPermissions?.id}/${+ linkId + suffix+ }`,+ lastPreserved: new Date().toISOString(),+ },+ });+ }+fs.unlinkSync(files.file[0].filepath);}diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsxindex 9bd57144..6734b005 100644--- a/pages/collections/[id].tsx+++ b/pages/collections/[id].tsx@@ -133,7 +133,7 @@ export default function Index() {</div>) : null}</div>- <p className="text-neutral text-xs">+ <p className="text-neutral text-sm font-semibold">By {collectionOwner.name}{activeCollection.members.length > 0? ` and ${activeCollection.members.length} others`diff --git a/pages/public/collections/[id].tsx b/pages/public/collections/[id].tsxindex 18bbde12..7d25b71f 100644--- a/pages/public/collections/[id].tsx+++ b/pages/public/collections/[id].tsx@@ -169,7 +169,7 @@ export default function PublicCollections() {) : null}</div>- <p className="text-neutral text-xs">+ <p className="text-neutral text-sm font-semibold">By {collectionOwner.name}{collection.members.length > 0? ` and ${collection.members.length} others`diff --git a/tailwind.config.js b/tailwind.config.jsindex e3c7cc05..45322f5c 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -6,9 +6,9 @@ module.exports = {themes: [{light: {- primary: "#0284c7",+ primary: "#0369a1",secondary: "#0891b2",- accent: "#6366f1",+ accent: "#6d28d9",neutral: "#6b7280","neutral-content": "#d1d5db","base-100": "#ffffff",@@ -22,9 +22,9 @@ module.exports = {},{dark: {- primary: "#38bdf8",+ primary: "#7dd3fc",secondary: "#22d3ee",- accent: "#6366f1",+ accent: "#6d28d9",neutral: "#9ca3af","neutral-content": "#404040","base-100": "#171717",