Skip to content

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

better UX

daniel31x131626a277e0dd
diff --git a/components/Checkbox.tsx b/components/Checkbox.tsx
index cd69f932..5f5dd663 100644
--- a/components/Checkbox.tsx
+++ b/components/Checkbox.tsx
@@ -5,20 +5,29 @@ type Props = {
state: boolean;
className?: string;
onClick: ChangeEventHandler<HTMLInputElement>;
+ disabled?: boolean;
};
-export default function Checkbox({ label, state, className, onClick }: Props) {
+export default function Checkbox({
+ label,
+ state,
+ className,
+ onClick,
+ disabled,
+}: Props) {
return (
<label
className={`label cursor-pointer flex gap-2 justify-start ${
className || ""
}`}
+ aria-disabled={disabled}
>
<input
type="checkbox"
checked={state}
onChange={onClick}
className="checkbox checkbox-primary"
+ disabled={disabled}
/>
<span className="label-text">{label}</span>
</label>
diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.ts
index 724dd59a..65f05216 100644
--- a/lib/api/archiveHandler.ts
+++ b/lib/api/archiveHandler.ts
@@ -22,6 +22,8 @@ type LinksAndCollectionAndOwner = Link & {
const BROWSER_TIMEOUT = Number(process.env.BROWSER_TIMEOUT) || 5;
export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
+ const user = link.collection?.owner;
+
if (process.env.DISABLE_PRESERVATION === "true") {
await prisma.link.update({
where: { id: link.id },
@@ -32,8 +34,19 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
monolith: "unavailable",
pdf: "unavailable",
preview: "unavailable",
+
+ // To prevent re-archiving the same link
+ aiTagged:
+ user.aiTaggingMethod !== AiTaggingMethod.DISABLED &&
+ !link.aiTagged &&
+ (process.env.NEXT_PUBLIC_OLLAMA_ENDPOINT_URL ||
+ process.env.OPENAI_API_KEY ||
+ process.env.ANTHROPIC_API_KEY)
+ ? true
+ : undefined,
},
});
+
return;
}
@@ -62,8 +75,6 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
createFolder({ filePath: `archives/preview/${link.collectionId}` });
createFolder({ filePath: `archives/${link.collectionId}` });
- const user = link.collection?.owner;
-
try {
await Promise.race([
(async () => {
diff --git a/pages/settings/preference.tsx b/pages/settings/preference.tsx
index e8b0414d..e3ac537a 100644
--- a/pages/settings/preference.tsx
+++ b/pages/settings/preference.tsx
@@ -196,14 +196,6 @@ export default function Appearance() {
<div className="divider my-3"></div>
- <div className="mb-3">
- <Checkbox
- label={t("generate_tags_for_existing_links")}
- state={aiTagExistingLinks}
- onClick={() => setAiTagExistingLinks(!aiTagExistingLinks)}
- />
- </div>
-
<p>{t("ai_tagging_method")}</p>
<div className="p-3">
@@ -301,6 +293,21 @@ export default function Appearance() {
)}
</div>
</div>
+ <div
+ className={`mb-3 ${
+ aiTaggingMethod === AiTaggingMethod.DISABLED ? "opacity-50" : ""
+ }`}
+ >
+ <Checkbox
+ label={t("generate_tags_for_existing_links")}
+ state={aiTagExistingLinks}
+ onClick={() =>
+ aiTaggingMethod !== AiTaggingMethod.DISABLED &&
+ setAiTagExistingLinks(!aiTagExistingLinks)
+ }
+ disabled={aiTaggingMethod === AiTaggingMethod.DISABLED}
+ />
+ </div>
</div>
)}