Skip to content

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

Merge branch 'dev' into worker

Isaac7fa9621de1d7
diff --cc lib/api/archiveHandler.ts
index 0e5ce84d,46af54b5..e49a1274
--- a/lib/api/archiveHandler.ts
+++ b/lib/api/archiveHandler.ts
@@@ -17,16 -21,9 +17,18 @@@ import { isArchivalTag } from "../../ho
const BROWSER_TIMEOUT = Number(process.env.BROWSER_TIMEOUT) || 5;
-export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
+export interface ArchivalSettings {
+ archiveAsScreenshot: boolean;
+ archiveAsMonolith: boolean;
+ archiveAsPDF: boolean;
+ archiveAsReadable: boolean;
+ archiveAsWaybackMachine: boolean;
+ aiTag: boolean;
+}
+
+export default async function archiveHandler(link: LinkWithCollectionOwnerAndTags) {
+ const user = link.collection?.owner;
+
if (process.env.DISABLE_PRESERVATION === "true") {
await prisma.link.update({
where: { id: link.id },
@@@ -67,28 -75,6 +80,26 @@@
createFolder({ filePath: `archives/preview/${link.collectionId}` });
createFolder({ filePath: `archives/${link.collectionId}` });
- const user = link.collection?.owner;
-
+ const archivalTags = link.tags.filter(isArchivalTag);
+
+ const archivalSettings: ArchivalSettings = archivalTags.length > 0
+ ? {
+ archiveAsScreenshot: archivalTags.some(tag => tag.archiveAsScreenshot),
+ archiveAsMonolith: archivalTags.some(tag => tag.archiveAsMonolith),
+ archiveAsPDF: archivalTags.some(tag => tag.archiveAsPDF),
+ archiveAsReadable: archivalTags.some(tag => tag.archiveAsReadable),
+ archiveAsWaybackMachine: archivalTags.some(tag => tag.archiveAsWaybackMachine),
+ aiTag: archivalTags.some(tag => tag.aiTag),
+ }
+ : {
+ archiveAsScreenshot: user.archiveAsScreenshot,
+ archiveAsMonolith: user.archiveAsMonolith,
+ archiveAsPDF: user.archiveAsPDF,
+ archiveAsReadable: user.archiveAsReadable,
+ archiveAsWaybackMachine: user.archiveAsWaybackMachine,
+ aiTag: user.aiTaggingMethod !== AiTaggingMethod.DISABLED,
+ };
+
try {
await Promise.race([
(async () => {
@@@ -121,11 -114,13 +139,13 @@@
// Auto-tagging
if (
- user.aiTaggingMethod !== AiTaggingMethod.DISABLED &&
+ archivalSettings.aiTag &&
!link.aiTagged &&
- process.env.NEXT_PUBLIC_OLLAMA_ENDPOINT_URL
+ (process.env.NEXT_PUBLIC_OLLAMA_ENDPOINT_URL ||
+ process.env.OPENAI_API_KEY ||
+ process.env.ANTHROPIC_API_KEY)
)
- await autoTagLink(user, link.id);
+ await autoTagLink(user, link.id, metaDescription);
// Screenshot/PDF
if (
diff --cc pages/settings/preference.tsx
index fa14e8b9,e3ac537a..268a86ec
--- a/pages/settings/preference.tsx
+++ b/pages/settings/preference.tsx
@@@ -52,8 -44,10 +52,11 @@@ export default function Preference()
account.aiTaggingMethod
);
const [aiPredefinedTags, setAiPredefinedTags] = useState<string[]>();
+ const [aiTagExistingLinks, setAiTagExistingLinks] = useState<boolean>(
+ account.aiTagExistingLinks
+ );
-
+ const [hasAccountChanges, setHasAccountChanges] = useState(false);
+ const [hasTagChanges, setHasTagChanges] = useState(false);
const { data: config } = useConfig();
useEffect(() => {
diff --cc public/locales/en/common.json
index 1e9bc1db,9695504a..bf1aff3f
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@@ -460,21 -463,5 +463,22 @@@
"search_for_links": "Search for Links",
"search_query_invalid_symbol": "The search query should not contain '%'.",
"open_modal_new_tab": "Open this modal in a new tab",
- "file": "File"
+ "file": "File",
+ "write_new_note": "Write a New Note",
+ "new_note": "New Note",
+ "add_a_title_placeholder": "Add a title...",
+ "write_notes_here_placeholder": "Write some notes here...",
+ "archival_tag_settings": "Tag archival settings:",
+ "archival_tag_info": "Applying archival tags to a link will override the global archival settings.",
+ "ai_tagging": "AI Tagging",
+ "worker": "Worker",
+ "regenerate_broken_preservations": "Regenerate all broken or missing preservations.",
+ "delete_all_preservations": "Delete preservation for all webpages.",
+ "delete_all_preservations_and_regenerate": "Delete preservation for all webpages and re-preserve.",
+ "delete_all_preservation_warning": "This action will delete all existing preservations.",
+ "no_broken_preservations": "No broken preservations.",
+ "successfully_represerved_link": "Successfully re-preserved 1 link.",
+ "successfully_represerved_links": "Successfully re-preserved {{count}} links.",
+ "cancel": "Cancel"
++
}