Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

Format & Lint

Isaac Wise378fec06bb37
diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsx
index d97b6953..6504dd65 100644
--- a/components/CollectionListing.tsx
+++ b/components/CollectionListing.tsx
@@ -246,10 +246,11 @@ const renderItem = (
return (
<div ref={provided.innerRef} {...provided.draggableProps} className="mb-1">
<div
- className={`${currentPath === `/collections/${collection.id}`
+ className={`${
+ currentPath === `/collections/${collection.id}`
? "bg-primary/20 is-active"
: "hover:bg-neutral/20"
- } duration-100 flex gap-1 items-center pr-2 pl-1 rounded-md`}
+ } duration-100 flex gap-1 items-center pr-2 pl-1 rounded-md`}
>
{Dropdown(item as ExtendedTreeItem, onExpand, onCollapse)}
diff --git a/components/LinkListOptions.tsx b/components/LinkListOptions.tsx
index 279917c5..8a2c0fb2 100644
--- a/components/LinkListOptions.tsx
+++ b/components/LinkListOptions.tsx
@@ -113,10 +113,11 @@ const LinkListOptions = ({
setEditMode(!editMode);
setSelectedLinks([]);
}}
- className={`btn btn-square btn-sm btn-ghost ${editMode
+ className={`btn btn-square btn-sm btn-ghost ${
+ editMode
? "bg-primary/20 hover:bg-primary/20"
: "hover:bg-neutral/20"
- }`}
+ }`}
>
<i className="bi-pencil-fill text-neutral text-xl"></i>
</div>
diff --git a/pages/api/v1/links/index.ts b/pages/api/v1/links/index.ts
index 4360add1..dc7a2173 100644
--- a/pages/api/v1/links/index.ts
+++ b/pages/api/v1/links/index.ts
@@ -61,7 +61,6 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
req.body.newData
);
-
return res.status(updated.status).json({
response: updated.response,
});
diff --git a/pages/api/v1/user/rss/index.ts b/pages/api/v1/user/rss/index.ts
index 7f4c0b65..2e2465ae 100644
--- a/pages/api/v1/user/rss/index.ts
+++ b/pages/api/v1/user/rss/index.ts
@@ -33,8 +33,9 @@ export default async function handler(
if (!dataValidation.success) {
return res.status(400).json({
- response: `Error: ${dataValidation.error.issues[0].message
- } [${dataValidation.error.issues[0].path.join(", ")}]`,
+ response: `Error: ${
+ dataValidation.error.issues[0].message
+ } [${dataValidation.error.issues[0].path.join(", ")}]`,
});
}
diff --git a/pages/public/collections/[id]/index.tsx b/pages/public/collections/[id]/index.tsx
index 5d2c994b..04ea1daf 100644
--- a/pages/public/collections/[id]/index.tsx
+++ b/pages/public/collections/[id]/index.tsx
@@ -40,22 +40,22 @@ export default function PublicCollections() {
if (tag) {
Object.keys(searchFilter).forEach(
(v) =>
- (searchFilter[
- v as keyof {
- name: boolean;
- url: boolean;
- description: boolean;
- tags: boolean;
- textContent: boolean;
- }
- ] = false)
+ (searchFilter[
+ v as keyof {
+ name: boolean;
+ url: boolean;
+ description: boolean;
+ tags: boolean;
+ textContent: boolean;
+ }
+ ] = false)
);
searchFilter.tags = true;
return router.push(
"/public/collections/" +
- router.query.id +
- "?q=" +
- encodeURIComponent(tag || "")
+ router.query.id +
+ "?q=" +
+ encodeURIComponent(tag || "")
);
} else {
return router.push("/public/collections/" + router.query.id);
@@ -122,8 +122,9 @@ export default function PublicCollections() {
<div
className="h-96"
style={{
- backgroundImage: `linear-gradient(${collection?.color}30 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
- } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
+ backgroundImage: `linear-gradient(${collection?.color}30 10%, ${
+ settings.theme === "dark" ? "#262626" : "#f3f4f6"
+ } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
}}
>
{collection && (
@@ -143,7 +144,11 @@ export default function PublicCollections() {
</p>
<div className="flex gap-2 items-center mt-8 min-w-fit">
<div className="tooltip tooltip-bottom" data-tip={t("rss_feed")}>
- <Link href={`/public/collections/${collection.id}/rss`} target="_blank" className="text-neutral btn btn-ghost btn-sm size-8">
+ <Link
+ href={`/public/collections/${collection.id}/rss`}
+ target="_blank"
+ className="text-neutral btn btn-ghost btn-sm size-8"
+ >
<i className="bi bi-rss text-xl"></i>
</Link>
</div>
@@ -200,20 +205,20 @@ export default function PublicCollections() {
<p className="text-neutral text-sm">
{collection.members.length > 0 &&
- collection.members.length === 1
+ collection.members.length === 1
? t("by_author_and_other", {
- author: collectionOwner.name,
- count: collection.members.length,
- })
- : collection.members.length > 0 &&
- collection.members.length !== 1
- ? t("by_author_and_others", {
author: collectionOwner.name,
count: collection.members.length,
})
+ : collection.members.length > 0 &&
+ collection.members.length !== 1
+ ? t("by_author_and_others", {
+ author: collectionOwner.name,
+ count: collection.members.length,
+ })
: t("by_author", {
- author: collectionOwner.name,
- })}
+ author: collectionOwner.name,
+ })}
</p>
</div>
</div>
@@ -237,11 +242,11 @@ export default function PublicCollections() {
placeholder={
collection._count?.links === 1
? t("search_count_link", {
- count: collection._count?.links,
- })
+ count: collection._count?.links,
+ })
: t("search_count_links", {
- count: collection._count?.links,
- })
+ count: collection._count?.links,
+ })
}
/>
</LinkListOptions>
@@ -252,10 +257,11 @@ export default function PublicCollections() {
onClick={() => handleTagSelection(undefined)}
>
<div
- className={`${!router.query.q
- ? "bg-primary/20"
- : "bg-neutral-content/20 hover:bg-neutral/20"
- } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
+ className={`${
+ !router.query.q
+ ? "bg-primary/20"
+ : "bg-neutral-content/20 hover:bg-neutral/20"
+ } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
>
<p className="truncate px-3">{t("all_links")}</p>
</div>
@@ -273,10 +279,11 @@ export default function PublicCollections() {
onClick={() => handleTagSelection(e)}
>
<div
- className={`${active
- ? "bg-primary/20"
- : "bg-neutral-content/20 hover:bg-neutral/20"
- } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
+ className={`${
+ active
+ ? "bg-primary/20"
+ : "bg-neutral-content/20 hover:bg-neutral/20"
+ } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
>
<i className="bi-hash text-2xl text-primary drop-shadow"></i>
<p className="truncate pr-3">{e}</p>
diff --git a/pages/public/collections/[id]/rss.tsx b/pages/public/collections/[id]/rss.tsx
index c6592bee..7f0daead 100644
--- a/pages/public/collections/[id]/rss.tsx
+++ b/pages/public/collections/[id]/rss.tsx
@@ -1,72 +1,77 @@
-import React from 'react'
-import { GetServerSideProps } from 'next'
-import { prisma } from '@/lib/api/db'
-import RSS from 'rss'
+import React from "react";
+import { GetServerSideProps } from "next";
+import { prisma } from "@/lib/api/db";
+import RSS from "rss";
-const RSSFeed: React.FC = () => null
+const RSSFeed: React.FC = () => null;
-export const getServerSideProps: GetServerSideProps = async ({ params, res, req }) => {
- const id = parseInt(params?.id as string, 10);
- if (isNaN(id)) {
- if (res) {
- res.statusCode = 404
- res.end()
- }
- return { props: {} }
- }
+export const getServerSideProps: GetServerSideProps = async ({
+ params,
+ res,
+ req,
+}) => {
+ const id = parseInt(params?.id as string, 10);
+ if (isNaN(id)) {
+ if (res) {
+ res.statusCode = 404;
+ res.end();
+ }
+ return { props: {} };
+ }
- const data = await prisma.collection.findUnique({
- where: {
- id: parseInt(params?.id as string),
- isPublic: true,
- },
- include: {
- links: {
- orderBy: {
- createdAt: 'desc',
- },
- take: 20,
- }
- },
- })
+ const data = await prisma.collection.findUnique({
+ where: {
+ id: parseInt(params?.id as string),
+ isPublic: true,
+ },
+ include: {
+ links: {
+ orderBy: {
+ createdAt: "desc",
+ },
+ take: 20,
+ },
+ },
+ });
- if (!data) {
- res.statusCode = 404;
- res.end('Not Found');
- return { props: {} };
- }
+ if (!data) {
+ res.statusCode = 404;
+ res.end("Not Found");
+ return { props: {} };
+ }
- const host = req.headers.host;
+ const host = req.headers.host;
- const protocol = req.headers['x-forwarded-proto'] || (req.socket ? 'https' : 'http');
- const siteUrl = `${protocol}://${host}/public/collections/${data.id}`;
- const feedUrl = `${protocol}://${host}/public/collections/${data.id}/rss`;
+ const protocol =
+ req.headers["x-forwarded-proto"] || (req.socket ? "https" : "http");
+ const siteUrl = `${protocol}://${host}/public/collections/${data.id}`;
+ const feedUrl = `${protocol}://${host}/public/collections/${data.id}/rss`;
- const feed = new RSS({
- title: data.name,
- description: data.description,
- site_url: siteUrl,
- feed_url: feedUrl,
- })
+ const feed = new RSS({
+ title: data.name,
+ description: data.description,
+ site_url: siteUrl,
+ feed_url: feedUrl,
+ });
- data.links.forEach((link) => {
- feed.item({
- title: link.name,
- description: link.description,
- url: link.url || '',
- date: link.createdAt,
- })
- })
+ data.links.forEach((link) => {
+ feed.item({
+ title: link.name,
+ description: link.description,
+ url: link.url || "",
+ date: link.createdAt,
+ });
+ });
- const xml = feed.xml({ indent: true });
+ const xml = feed.xml({ indent: true });
- if (res) {
- res.setHeader('Content-Type', 'text/xml')
- res.write(xml)
- res.end()
- }
+ if (res) {
+ res.setHeader("Content-Type", "text/xml");
+ res.write(xml);
+ res.end();
+ }
- return { props: {} }
-}
+ return { props: {} };
+};
-export default RSSFeed
\ No newline at end of file
+export default RSSFeed;