driftnet 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "driftnet",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "mcpName": "io.github.KevinChu1110/driftnet",
5
5
  "description": "Drop links into any chat; get them sorted, explained and searchable, for you and your agents. Any model, or none.",
6
6
  "license": "MIT",
package/public/index.html CHANGED
@@ -50,6 +50,11 @@
50
50
  .brand { display: flex; align-items: center; gap: 8px; font-size: 19px; margin: 0; letter-spacing: -0.02em; font-weight: 750; }
51
51
  @media (min-width: 721px) { header { padding-inline: max(20px, calc((100vw - 1200px) / 2 + 20px)); } }
52
52
  .stats { color: var(--muted); font-size: 13px; }
53
+ .update { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; background: var(--bg); }
54
+ .update[hidden] { display: none; }
55
+ .update a { color: var(--accent); text-decoration: none; }
56
+ .update a:hover, .update a:focus-visible { text-decoration: underline; }
57
+ .update button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 999px; line-height: 1; }
53
58
  .search { flex: 1; min-width: 180px; max-width: 420px; margin-left: auto; padding: 9px 12px; border: 1px solid var(--line);
54
59
  border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
55
60
  .skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 10px; }
@@ -515,6 +520,10 @@
515
520
  .md-try pre { margin: 0; padding: 10px 70px 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: auto; font-size: 13px; user-select: text; -webkit-user-select: text; }
516
521
  .md-try button { position: absolute; top: 6px; right: 6px; }
517
522
  .md-tags { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--muted); }
523
+ .md-hist ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
524
+ .md-hist li { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: var(--star-soft); font-size: 13px; }
525
+ .md-hist li div { min-width: 0; overflow-wrap: anywhere; }
526
+ .md-hist li small { display: block; color: var(--muted); }
518
527
  .md-fine { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; }
519
528
  .md-actions { flex: none; margin: 0; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
520
529
  .md-actions .spacer { flex: 1; }
@@ -587,6 +596,7 @@
587
596
  </button>
588
597
  <h1 class="brand"><img src="/favicon.svg" alt="" width="26" height="26">driftnet</h1>
589
598
  <span class="stats" id="stats"></span>
599
+ <span class="update" id="update" hidden><a id="update-link" target="_blank" rel="noopener noreferrer"></a><button id="update-x" type="button">✕</button></span>
590
600
  <input id="q" class="search" type="search" enterkeyhint="search">
591
601
  <button id="lock" class="lock" type="button" hidden></button>
592
602
  <button id="palette-btn" class="lang" type="button" aria-haspopup="dialog"></button>
@@ -732,7 +742,7 @@
732
742
  save: "Save", cancel: "Cancel", del: "Delete folder", delSure: "Delete? Links move up",
733
743
  refresh: "Refresh (fetch and summarise again)", refreshed: (n) => `Refreshed “${n}”`, refreshBusy: "Already refreshing this one.", refreshWait: "Refreshed a moment ago — try again in a minute.", refreshFailed: (why) => `Couldn’t refresh${why ? `: ${why}` : ""}`,
734
744
  moveTo: "Move to…", moveTitle: (n) => `Move “${n}” to`, moved: (n, f) => `Moved “${n}” to ${f}`, expand: "Show sub-folders",
735
- dragHint: "Drag onto a folder in the sidebar", foundIn: "Found in this post:", folderMoved: (n, f) => `“${n}” is now inside ${f}`,
745
+ dragHint: "Drag onto a folder in the sidebar", foundIn: "Found in this post:", related: "Related:", folderMoved: (n, f) => `“${n}” is now inside ${f}`,
736
746
  topLevelShort: "the top level",
737
747
  pkShare: "Share as pack…", pkTitle: "Share as pack", pkHelp: "A pack is this folder, its sub-folders and the cards in them as one file. Someone else imports it with one click. Your notes, chat text and counters are never included.", pkName: "Pack name", pkDesc: "Description", pkDownload: "Download pack", pkLinkL: "Link to share", pkCopy: "Copy link", pkCopied: "Link copied", pkSigned: "Anyone with this link can download this one pack, and nothing else in your catalogue.", pkOpen: "Anyone who can reach this address can download this pack.", pkNoLink: "No public address is set, so there is no link to share yet. Set one in Settings → Access, or start a tunnel. You can still download the file.", pkClose: "Close", pkTooBig: "This folder is too big to share as a pack.",
738
748
  mapAll: "All", focusCrumb: "Mind map location", focusUp: "Up one level", focusFolder: "Focus on this folder", mapTree: "Mind map",
@@ -745,6 +755,9 @@
745
755
  layoutBoth: "Both sides", layoutRight: "Right side", layoutHelp: "Switch between branches on both sides (XMind) and all to the right",
746
756
  zoom: "Zoom", gotIt: "Got it", more: (n) => `+${n} more`, mapSearch: (q) => `Highlighting “${q}”`, openLink: "Open link", mdDemo: "What you'll see", mdWhy: "Why it's here", mdHighlights: "Highlights", mdUse: "Good for", mdTry: "Try it", mdCopy: "Copy", mdCopied: "Copied", mdPrev: "Previous card", mdNext: "Next card", mdPos: (n, m) => `${n} of ${m}`, mdSlide: (n, m) => `Picture ${n} of ${m}`, mdPlay: "Play the video", mdPictures: "Pictures", mdTags: "Tags", mdHasNote: "Has your note", showInList: "Show in the list", close: "Close",
747
757
  needPassword: "Changing things needs the admin password.",
758
+ histBtn: "History", histTitle: "Change history", histNone: "No changes recorded yet.", histRestore: "Restore", histRestored: "Restored an earlier version.", histErr: "Could not load the history.", histForget: "Forget history", histForgot: "History for this card was erased.",
759
+ histField: { note: "Note", summary: "Summary", title: "Title", folder: "Folder", favorite: "Star", trashed: "Trash" }, histEmptyVal: "(empty)", histStarOn: "starred", histStarOff: "not starred", histInTrash: "in the trash", histOutTrash: "not in the trash",
760
+ histActor: (a) => a === "admin" ? "You" : a === "system:refresh" ? "Refresh" : a === "system" ? "System" : a.replace(/^agent:/, "agent "),
748
761
  notes: "Notes", note: "Note", addNote: "Add a note", editNote: "Edit note", noteFor: (n) => `Note on “${n}”`,
749
762
  noteHelp: "Only for you: what you thought, whether you tried it…", newNote: "New note", noteTitle: "Title",
750
763
  noteBody: "Markdown. Write #12 to link card 12.", delNote: "Delete note", delNoteSure: "Really delete?", untitled: "Untitled",
@@ -787,6 +800,13 @@
787
800
  locked: "set by the environment driftnet runs in", forbidden: "Server settings can only be changed on the computer running driftnet (or set DRIFTNET_TOKEN). Display settings still work.",
788
801
  savedServer: "Saved — already in effect", chat: "Chat replies", webhook: "Outgoing webhook", digest: "Scheduled digest", feed: "Feed (RSS)", genCopied: "New password generated and copied — press Save to keep it",
789
802
  tabGeneral: "General", tabAccess: "Access", tabAi: "AI",
803
+ updates: "Updates", bkTitle: "Backup", bkHelp: "One zip with your whole catalogue (cards, folders, notes, tokens) and your settings. Passwords and keys are left out unless you tick the box.",
804
+ bkDownload: "Download backup", bkSecrets: "Include passwords and keys (enter the admin password again)", bkPassword: "Admin password",
805
+ bkRestoreFile: "Restore from a backup file", bkRestoreHelp: "The backup is checked first. Nothing changes until you restart driftnet; your current data is kept next to it as a before-restore copy.",
806
+ bkChecking: "Checking the backup…", bkNeedPassword: "Type the admin password to include passwords and keys.", bkMade: "Backup downloaded.",
807
+ bkRestartTitle: "Restart driftnet to finish restoring", bkRestartBody: (n) => `The backup (${n} cards) is checked and waiting. It replaces your data the next time driftnet starts.`,
808
+ bkSettingsTitle: "Settings in the backup (not applied). Copy what you want into Settings:", bkPending: "A restore is waiting: restart driftnet to finish restoring.",
809
+ updOut: (v) => `driftnet ${v} is out`, updHow: "How to update", updDismiss: "Dismiss",
790
810
  impPackTitle: "From a pack link", impPackHelp: "Paste the link someone sent you for a folder pack. It comes in already summarised (no model calls), under its own folder.", impPackGo: "Check link", impPackConfirm: (name, n, dup) => `Pack “${name}”: ${n} new cards (${dup} already there). Import it?`, impPackNone: (name, dup) => `Pack “${name}” has nothing new (${dup} already there). Import anyway to file them?`, impPackDone: (name, added, already) => `Imported “${name}”: ${added} added, ${already} already there.`,
791
811
  impTitle: "Import bookmarks", impHelp: "Bring in a bookmarks file from your browser (HTML), Pocket, Raindrop (CSV), a driftnet JSON list, or any text with links.",
792
812
  impFile: "Choose a file", impKeep: "Keep my bookmark folders (under Imported)", impReading: "Reading the file…",
@@ -836,6 +856,12 @@
836
856
  DRIFTNET_LLM_EFFORT: ["Reasoning effort", ""],
837
857
  TYPESAFE_API_KEY: ["Jev key", "Optional: a ~100 ms classifier that saves model calls (console.typesafe.ai)"],
838
858
  DRIFTNET_JUDGE: ["Judge", "Who files each link before the model does. Rules is free: it needs no model."],
859
+ DRIFTNET_EMBED: ["Search by meaning", "Finds cards by what they are about, not just the words (\"login\" finds OAuth). Needs an embedding model: Ollama with nomic-embed-text, or a provider below. Costs no summary tokens."],
860
+ DRIFTNET_EMBED_PROVIDER: ["Embedding provider", "Naming one turns Search by meaning on. Ollama stays on your machine; OpenAI and Gemini send each card's summary (never your notes or chat) to them."],
861
+ DRIFTNET_EMBED_MODEL: ["Embedding model", "Default: nomic-embed-text (Ollama), text-embedding-3-small (OpenAI), gemini-embedding-001 (Gemini). Changing it re-embeds everything in the background."],
862
+ DRIFTNET_EMBED_BASE_URL: ["Embedding API URL", "Ollama or an OpenAI-compatible server, e.g. http://127.0.0.1:11434. Empty: the provider's own address."],
863
+ DRIFTNET_EMBED_API_KEY: ["Embedding API key", "OpenAI or Gemini. The summary model's key is reused only when it is the same vendor."],
864
+ DRIFTNET_EMBED_FLOOR: ["Meaning match threshold", "0–1. How close a card must be in meaning to show without a matching word. Default 0.55 for nomic-embed-text; higher shows fewer matches."],
839
865
  DRIFTNET_LLM_REGION: ["Region", "Bedrock: e.g. us-east-1. Vertex: e.g. us-central1 (default). Not used by other providers."],
840
866
  AWS_ACCESS_KEY_ID: ["AWS access key ID", "Bedrock. Leave empty if you use a Bedrock API key."],
841
867
  AWS_SECRET_ACCESS_KEY: ["AWS secret access key", "Bedrock."],
@@ -852,6 +878,8 @@
852
878
  DRIFTNET_PUBLIC_URL: ["This page's public URL", "Replies link here, e.g. https://driftnet.example.com"],
853
879
  DRIFTNET_SUMMARY_DEPTH: ["Summary detail", "How much each card says. Detailed costs more model tokens and reads twice as much of each page."],
854
880
  DRIFTNET_SUMMARY_RULES: ["Extra rules for summaries", "e.g. Say whether it's free. Mention if it needs a GPU."],
881
+ DRIFTNET_PROFILE: ["About you", "Who you are and what you care about (600 characters at most). The model uses it to judge what is worth your time and to write the \"why\" line. e.g. Backend engineer, Odoo and TypeScript; collecting AI coding tools and MCP servers; not interested in crypto."],
882
+ DRIFTNET_UPDATE_CHECK: ["Check for new versions", "Once a day driftnet asks the npm registry for the latest version number (nothing about you is sent) and shows a small notice. Off (the default) = never."],
855
883
  DRIFTNET_BLOCK_DOMAINS: ["Never catalogue these domains", "Comma or space separated, e.g. example.com, spam.io"],
856
884
  DRIFTNET_WEBHOOK_URL: ["Webhook URL", "driftnet POSTs each new or updated card here (n8n, Zapier, Slack workflows…). Treated as a secret."],
857
885
  DRIFTNET_WEBHOOK_SECRET: ["Webhook signing secret", "Optional. Adds X-Driftnet-Signature: sha256=<HMAC of the body>."],
@@ -879,7 +907,10 @@
879
907
  DRIFTNET_DIGEST_DAY: { "": "Monday (default)", mon: "Monday", tue: "Tuesday", wed: "Wednesday", thu: "Thursday", fri: "Friday", sat: "Saturday", sun: "Sunday" },
880
908
  DRIFTNET_WEBHOOK_ALLOW_LOCAL: { "": "No (public addresses only)", 1: "Yes" },
881
909
  DRIFTNET_HEALTH: { "": "Off (default)", off: "Off", weekly: "Weekly (recommended)" },
882
- DRIFTNET_VIDEO: { "": "Automatic (default)", auto: "Automatic: use the tools found", off: "Off" },
910
+ DRIFTNET_EMBED: { "": "Automatic (default): on when a local model is found", auto: "Automatic: on when a local model is found", off: "Off" },
911
+ DRIFTNET_EMBED_PROVIDER: { "": "Automatic (local Ollama only)", ollama: "Ollama (on this computer)", openai: "OpenAI", gemini: "Gemini" },
912
+ DRIFTNET_UPDATE_CHECK: { "": "Off (default)", 1: "On", 0: "Off" },
913
+ DRIFTNET_VIDEO: { "": "Automatic (default)", auto: "Automatic: use the tools found", captions: "Captions only (light on battery: no download, OCR or speech)", off: "Off" },
883
914
  },
884
915
  },
885
916
  },
@@ -904,7 +935,7 @@
904
935
  save: "儲存", cancel: "取消", del: "刪除資料夾", delSure: "確定刪除?內容移到上一層",
905
936
  refresh: "重新整理(再抓一次並重新摘要)", refreshed: (n) => `已重新整理「${n}」`, refreshBusy: "這張卡片正在重新整理。", refreshWait: "剛剛才整理過,請一分鐘後再試。", refreshFailed: (why) => `重新整理失敗${why ? `:${why}` : ""}`,
906
937
  moveTo: "移動到…", moveTitle: (n) => `把「${n}」移動到`, moved: (n, f) => `已將「${n}」移到 ${f}`, expand: "展開子資料夾",
907
- dragHint: "拖到側邊欄的資料夾", foundIn: "從這篇找到:", folderMoved: (n, f) => `「${n}」已移到 ${f} 底下`,
938
+ dragHint: "拖到側邊欄的資料夾", foundIn: "從這篇找到:", related: "相關卡片:", folderMoved: (n, f) => `「${n}」已移到 ${f} 底下`,
908
939
  topLevelShort: "最上層",
909
940
  pkShare: "分享成資料夾包…", pkTitle: "分享成資料夾包", pkHelp: "資料夾包把這個資料夾、底下的子資料夾和裡面的卡片包成一個檔案,別人一鍵就能匯入。你的筆記、聊天內容和各種計數都不會放進去。", pkName: "資料夾包名稱", pkDesc: "說明", pkDownload: "下載資料夾包", pkLinkL: "分享連結", pkCopy: "複製連結", pkCopied: "已複製連結", pkSigned: "拿到這個連結的人只能下載這一個資料夾包,看不到你目錄裡的其他內容。", pkOpen: "任何連得到這個位址的人都能下載這個資料夾包。", pkNoLink: "還沒設定公開網址,所以暫時沒有可分享的連結。請到「設定 → 存取」設定,或啟動通道。現在仍可以下載檔案。", pkClose: "關閉", pkTooBig: "這個資料夾太大,無法分享成資料夾包。",
910
941
  mapAll: "全部", focusCrumb: "樹狀圖位置", focusUp: "回上一層", focusFolder: "聚焦這個資料夾", mapTree: "樹狀圖",
@@ -917,6 +948,9 @@
917
948
  layoutBoth: "兩側展開", layoutRight: "往右展開", layoutHelp: "切換:分支分佈在兩側(XMind 預設)或全部往右",
918
949
  zoom: "縮放", gotIt: "知道了", more: (n) => `還有 ${n} 張`, mapSearch: (q) => `標亮「${q}」`, openLink: "開啟連結", mdDemo: "你會看到什麼", mdWhy: "為什麼收進來", mdHighlights: "重點", mdUse: "適合用在", mdTry: "試試看", mdCopy: "複製", mdCopied: "已複製", mdPrev: "上一張卡片", mdNext: "下一張卡片", mdPos: (n, m) => `第 ${n} / ${m} 張`, mdSlide: (n, m) => `第 ${n} 張圖,共 ${m} 張`, mdPlay: "播放影片", mdPictures: "圖片", mdTags: "標籤", mdHasNote: "有你的筆記", showInList: "在清單中查看", close: "關閉",
919
950
  needPassword: "要修改需要管理密碼。",
951
+ histBtn: "修改紀錄", histTitle: "修改紀錄", histNone: "還沒有修改紀錄。", histRestore: "還原", histRestored: "已還原成先前的版本。", histErr: "無法載入修改紀錄。", histForget: "清除紀錄", histForgot: "這張卡片的修改紀錄已清除。",
952
+ histField: { note: "筆記", summary: "摘要", title: "標題", folder: "資料夾", favorite: "星號", trashed: "垃圾桶" }, histEmptyVal: "(空白)", histStarOn: "已加星", histStarOff: "未加星", histInTrash: "在垃圾桶", histOutTrash: "不在垃圾桶",
953
+ histActor: (a) => a === "admin" ? "你" : a === "system:refresh" ? "重新整理" : a === "system" ? "系統" : a.replace(/^agent:/, "agent "),
920
954
  notes: "筆記", note: "筆記", addNote: "加筆記", editNote: "改筆記", noteFor: (n) => `「${n}」的筆記`,
921
955
  noteHelp: "只有你看得到:心得、試用結果、要注意的地方…", newNote: "新筆記", noteTitle: "標題",
922
956
  noteBody: "支援 Markdown。寫 #12 就會連到第 12 張卡片。", delNote: "刪除筆記", delNoteSure: "確定刪除?", untitled: "未命名",
@@ -959,6 +993,13 @@
959
993
  locked: "由執行環境設定", forbidden: "伺服器設定只能在執行 driftnet 的那台電腦上改(或設定 DRIFTNET_TOKEN)。顯示設定照常可用。",
960
994
  savedServer: "已儲存,馬上生效", chat: "聊天室回覆", webhook: "對外 Webhook", digest: "定時摘要", feed: "訂閱源(RSS)", genCopied: "已產生新密碼並複製,按「儲存」才會生效",
961
995
  tabGeneral: "一般", tabAccess: "存取", tabAi: "AI",
996
+ updates: "更新", bkTitle: "備份", bkHelp: "一個 zip 檔,包含整個收藏(卡片、資料夾、筆記、權杖)和設定。除非勾選,否則不會包含密碼和金鑰。",
997
+ bkDownload: "下載備份", bkSecrets: "包含密碼和金鑰(需要再輸入一次管理員密碼)", bkPassword: "管理員密碼",
998
+ bkRestoreFile: "從備份檔還原", bkRestoreHelp: "會先檢查備份檔。重新啟動 driftnet 之前不會有任何改變;目前的資料會留在旁邊,檔名帶有 before-restore。",
999
+ bkChecking: "正在檢查備份檔…", bkNeedPassword: "要包含密碼和金鑰,請輸入管理員密碼。", bkMade: "備份已下載。",
1000
+ bkRestartTitle: "請重新啟動 driftnet 以完成還原", bkRestartBody: (n) => `備份檔(${n} 張卡片)已檢查完畢並等待中,下次 driftnet 啟動時會取代目前的資料。`,
1001
+ bkSettingsTitle: "備份裡的設定(不會自動套用)。需要的話請自行複製到「設定」:", bkPending: "有一份還原正在等待:請重新啟動 driftnet 以完成還原。",
1002
+ updOut: (v) => `driftnet ${v} 已發布`, updHow: "如何更新", updDismiss: "關閉",
962
1003
  impPackTitle: "從資料夾包連結匯入", impPackHelp: "貼上別人傳給你的資料夾包連結。卡片已經整理好(不會呼叫模型),會放進它自己的資料夾。", impPackGo: "檢查連結", impPackConfirm: (name, n, dup) => `資料夾包「${name}」:${n} 張新卡片(${dup} 張已經有了)。要匯入嗎?`, impPackNone: (name, dup) => `資料夾包「${name}」沒有新的卡片(${dup} 張已經有了)。仍要匯入把它們歸檔嗎?`, impPackDone: (name, added, already) => `已匯入「${name}」:新增 ${added}、原本就有 ${already}。`,
963
1004
  impTitle: "匯入書籤", impHelp: "匯入瀏覽器的書籤檔(HTML)、Pocket、Raindrop(CSV)、driftnet 的 JSON 清單,或任何含有連結的文字檔。",
964
1005
  impFile: "選擇檔案", impKeep: "保留我的書籤資料夾(放在「Imported」底下)", impReading: "讀取檔案中…",
@@ -1008,6 +1049,12 @@
1008
1049
  DRIFTNET_LLM_EFFORT: ["推理強度", ""],
1009
1050
  TYPESAFE_API_KEY: ["Jev 金鑰", "選填:約 100ms 的分類器,可以省下模型呼叫(console.typesafe.ai)"],
1010
1051
  DRIFTNET_JUDGE: ["判斷器", "在模型之前先決定每個連結放哪。「規則」免費,不需要模型。"],
1052
+ DRIFTNET_EMBED: ["以語意搜尋", "依內容意思找卡片,不只比對字(搜「登入」能找到 OAuth)。需要嵌入模型:本機 Ollama 的 nomic-embed-text,或下面的服務。不花摘要的 token。"],
1053
+ DRIFTNET_EMBED_PROVIDER: ["嵌入服務", "指定一個就會開啟語意搜尋。Ollama 全程在你的電腦上;OpenAI、Gemini 會收到每張卡片的摘要(不會有你的筆記或聊天內容)。"],
1054
+ DRIFTNET_EMBED_MODEL: ["嵌入模型", "預設:nomic-embed-text(Ollama)、text-embedding-3-small(OpenAI)、gemini-embedding-001(Gemini)。更換後會在背景重新計算全部卡片。"],
1055
+ DRIFTNET_EMBED_BASE_URL: ["嵌入 API 網址", "Ollama 或相容 OpenAI 的伺服器,例如 http://127.0.0.1:11434。留空:用該服務的預設位址。"],
1056
+ DRIFTNET_EMBED_API_KEY: ["嵌入 API 金鑰", "OpenAI 或 Gemini 用。只有摘要模型是同一家時才會沿用它的金鑰。"],
1057
+ DRIFTNET_EMBED_FLOOR: ["語意相符門檻", "0–1。沒有字面相符時,意思要多接近才會出現。nomic-embed-text 預設 0.55;調高結果會變少。"],
1011
1058
  DRIFTNET_LLM_REGION: ["區域", "Bedrock:例如 us-east-1。Vertex:例如 us-central1(預設)。其他供應商用不到。"],
1012
1059
  AWS_ACCESS_KEY_ID: ["AWS 存取金鑰 ID", "Bedrock 用。有 Bedrock API 金鑰就留空。"],
1013
1060
  AWS_SECRET_ACCESS_KEY: ["AWS 秘密存取金鑰", "Bedrock 用。"],
@@ -1024,6 +1071,8 @@
1024
1071
  DRIFTNET_PUBLIC_URL: ["這個網頁的公開網址", "回覆裡的連結會指到這裡,例如 https://driftnet.example.com"],
1025
1072
  DRIFTNET_SUMMARY_DEPTH: ["摘要詳細程度", "每張卡片寫多少。詳細會用較多模型 token,且每個頁面讀兩倍的內容。"],
1026
1073
  DRIFTNET_SUMMARY_RULES: ["摘要的額外規則", "例如:說明是否免費。需要 GPU 的話要提到。"],
1074
+ DRIFTNET_PROFILE: ["關於你", "你是誰、關心什麼(最多 600 字)。模型會用它判斷什麼值得你花時間,並寫「為什麼值得看」那一句。例如:後端工程師,做 Odoo 和 TypeScript;蒐集 AI 寫程式工具和 MCP 伺服器;對加密貨幣沒興趣。"],
1075
+ DRIFTNET_UPDATE_CHECK: ["檢查新版本", "每天向 npm 查一次最新版本號(不會傳送任何與你有關的資料),有新版就顯示小提示。關閉(預設)=完全不查。"],
1027
1076
  DRIFTNET_BLOCK_DOMAINS: ["不要收錄的網域", "用逗號或空白分隔,例如 example.com, spam.io"],
1028
1077
  DRIFTNET_WEBHOOK_URL: ["Webhook 網址", "每張新增或更新的卡片都會 POST 到這裡(n8n、Zapier、Slack 工作流程…)。視為機密。"],
1029
1078
  DRIFTNET_WEBHOOK_SECRET: ["Webhook 簽章密鑰", "選填。會加上 X-Driftnet-Signature: sha256=<內容的 HMAC>。"],
@@ -1051,7 +1100,10 @@
1051
1100
  DRIFTNET_DIGEST_DAY: { "": "週一(預設)", mon: "週一", tue: "週二", wed: "週三", thu: "週四", fri: "週五", sat: "週六", sun: "週日" },
1052
1101
  DRIFTNET_WEBHOOK_ALLOW_LOCAL: { "": "否(只允許公開位址)", 1: "是" },
1053
1102
  DRIFTNET_HEALTH: { "": "關閉(預設)", off: "關閉", weekly: "每週(建議)" },
1054
- DRIFTNET_VIDEO: { "": "自動(預設)", auto: "自動:有找到工具就用", off: "關閉" },
1103
+ DRIFTNET_EMBED: { "": "自動(預設):找到本機模型就開", auto: "自動:找到本機模型就開", off: "關閉" },
1104
+ DRIFTNET_EMBED_PROVIDER: { "": "自動(只找本機 Ollama)", ollama: "Ollama(在這台電腦上)", openai: "OpenAI", gemini: "Gemini" },
1105
+ DRIFTNET_UPDATE_CHECK: { "": "關閉(預設)", 1: "開啟", 0: "關閉" },
1106
+ DRIFTNET_VIDEO: { "": "自動(預設)", auto: "自動:有找到工具就用", captions: "只抓字幕(省電:不下載影片、不跑文字辨識和語音模型)", off: "關閉" },
1055
1107
  },
1056
1108
  },
1057
1109
  },
@@ -1230,6 +1282,7 @@
1230
1282
  if (!STRINGS[saved] && STRINGS[ui.locale]) locale = ui.locale;
1231
1283
  applyLocale();
1232
1284
  $("stats").textContent = T().stats(stats.items, stats.shares);
1285
+ showUpdate(stats.update);
1233
1286
  $("lock").innerHTML = `${ic("lock")}<span class="long">${esc(T().st.viewOnly)}</span><span class="short">${esc(T().st.unlockShort)}</span>`;
1234
1287
  const btn = (field, key, label, n, icon) =>
1235
1288
  `<button type="button" data-field="${field}" data-value="${esc(key)}" aria-pressed="${state[field] === key}">
@@ -1693,7 +1746,7 @@
1693
1746
  const yes = (b) => (b ? "✓" : "—");
1694
1747
  const accessStatus = `<p class="set-status">${esc(st.accessStatus(yes(a.passwordSet), yes(a.readKey), a.tunnel.running ? a.tunnel.url : "—"))}</p>`;
1695
1748
  server = {
1696
- general: group("language") + group("chat") + group("digest") + group("webhook") + importPanel(),
1749
+ general: group("language") + group("chat") + group("digest") + group("webhook") + group("updates") + importPanel() + backupPanel(serverSettings),
1697
1750
  access: accessStatus + accessPanel(serverSettings, field) + (agentTokens ? tokensPanel(serverSettings.access, agentTokens, minted) + pairPanel(serverSettings.access) : ""),
1698
1751
  ai: `<p class="set-status" id="st-status">${esc(st.status(serverSettings.engines))}</p>` + group("model") + group("rules") +
1699
1752
  `<fieldset class="set-group"><legend>${esc(st.plugins)}</legend><div class="set-row">${plugins}</div></fieldset>`,
@@ -1717,6 +1770,53 @@
1717
1770
  $("settings-dlg").showModal();
1718
1771
  $("st-body").querySelector('[data-tab-btn][aria-selected="true"]')?.focus();
1719
1772
  }
1773
+ /** Settings › Backup: download a zip (secrets only with the password typed again) or restore one (applied at the next start). */
1774
+ function backupPanel(sv) {
1775
+ const st = T().st;
1776
+ return `<fieldset class="set-group" id="backup-panel"><legend>${esc(st.bkTitle)}</legend>
1777
+ <small>${esc(st.bkHelp)}</small>
1778
+ <label class="set-row check"><input type="checkbox" id="bk-secrets"><span>${esc(st.bkSecrets)}</span></label>
1779
+ <label class="set-row" id="bk-pw-row" hidden><span>${esc(st.bkPassword)}</span><input type="password" id="bk-pw" autocomplete="off"></label>
1780
+ <div><button class="btn" type="button" id="bk-download">${esc(st.bkDownload)}</button></div>
1781
+ <small>${esc(st.bkRestoreHelp)}</small>
1782
+ <label class="set-row"><span>${esc(st.bkRestoreFile)}</span><input type="file" id="bk-file" accept=".zip,application/zip"></label>
1783
+ <p class="set-status" id="bk-status" role="status" aria-live="polite">${sv.restorePending ? esc(st.bkPending) : ""}</p>
1784
+ <pre id="bk-settings" hidden style="white-space:pre-wrap;user-select:all;font-size:12px"></pre></fieldset>`;
1785
+ }
1786
+ $("st-body").addEventListener("change", (e) => {
1787
+ if (e.target.id === "bk-secrets") $("bk-pw-row").hidden = !e.target.checked;
1788
+ });
1789
+ $("st-body").addEventListener("click", async (e) => {
1790
+ if (e.target.id !== "bk-download") return;
1791
+ const st = T().st, out = $("bk-status"), token = store.get("driftnet-token");
1792
+ const secrets = $("bk-secrets").checked, pw = $("bk-pw").value;
1793
+ if (secrets && !pw) { out.textContent = st.bkNeedPassword; return; }
1794
+ const res = await fetch(`/api/backup${secrets ? "?secrets=1" : ""}`, { headers: { ...(token ? { authorization: `Bearer ${token}` } : {}), ...(secrets ? { "x-driftnet-confirm": pw } : {}) } }).catch(() => null);
1795
+ $("bk-pw").value = "";
1796
+ if (res?.status === 401) { askToken(); return; }
1797
+ if (!res?.ok) { out.textContent = (await res?.json().catch(() => null))?.error ?? T().failed; return; }
1798
+ const name = /filename="([^"]+)"/.exec(res.headers.get("content-disposition") ?? "")?.[1] ?? "driftnet-backup.zip";
1799
+ const a = Object.assign(document.createElement("a"), { href: URL.createObjectURL(await res.blob()), download: name });
1800
+ document.body.append(a); a.click(); a.remove();
1801
+ setTimeout(() => URL.revokeObjectURL(a.href), 1000);
1802
+ out.textContent = st.bkMade;
1803
+ });
1804
+ $("st-body").addEventListener("change", async (e) => {
1805
+ if (e.target.id !== "bk-file") return;
1806
+ const st = T().st, out = $("bk-status"), pre = $("bk-settings"), token = store.get("driftnet-token");
1807
+ const file = e.target.files?.[0];
1808
+ pre.hidden = true;
1809
+ if (!file) { out.textContent = ""; return; }
1810
+ out.textContent = st.bkChecking;
1811
+ const res = await fetch("/api/backup/restore", { method: "POST", body: file, headers: { "content-type": "application/zip", ...(token ? { authorization: `Bearer ${token}` } : {}) } }).catch(() => null);
1812
+ e.target.value = "";
1813
+ if (res?.status === 401 || res?.status === 403) { askToken(); return; }
1814
+ const body = res ? await res.json().catch(() => ({})) : {};
1815
+ if (!res?.ok) { out.textContent = body.error ?? T().failed; return; }
1816
+ out.textContent = `${st.bkRestartTitle}. ${st.bkRestartBody(body.items)}`;
1817
+ out.style.fontWeight = "600";
1818
+ if (body.settings) { pre.textContent = `${st.bkSettingsTitle}\n\n${body.settings}`; pre.hidden = false; }
1819
+ });
1720
1820
  /** Settings › Import bookmarks: pick a file, preview the counts (dry run), confirm, then watch the job. */
1721
1821
  let importContent = "", importUrl = "", importPack = null, importTimer = null;
1722
1822
  function importPanel() {
@@ -2600,6 +2700,20 @@
2600
2700
  return `<div class="gallery"><div class="g-track" id="g-track" tabindex="0" role="region" aria-label="${esc(t.mdPictures)}">${m.map(slide).join("")}</div>${
2601
2701
  m.length > 1 ? `<div class="g-thumbs">${m.map((x, n) => `<button type="button" class="g-th ${n ? "" : "on"}" data-g="${n}" aria-label="${esc(t.mdSlide(n + 1, m.length))}">${img(x, "t")}</button>`).join("")}</div>` : ""}</div>`;
2602
2702
  }
2703
+ // Related cards ({id, name}) come with the single-card endpoint; fetched once per card, painted into their own row.
2704
+ const relatedCache = new Map();
2705
+ function paintRelated(id) {
2706
+ const box = $("md-related");
2707
+ if (!box) return;
2708
+ const rel = relatedCache.get(id);
2709
+ if (rel === undefined) {
2710
+ relatedCache.set(id, []);
2711
+ api(`/api/items/${id}`).then((r) => { relatedCache.set(id, r.related ?? []); if (modalId === id) paintRelated(id); }).catch(() => relatedCache.delete(id));
2712
+ return;
2713
+ }
2714
+ box.hidden = !rel.length;
2715
+ box.innerHTML = rel.length ? `<span>${esc(T().related)}</span>${rel.map((c) => `<a href="#item-${c.id}" data-open="${c.id}">${esc(c.name)}</a>`).join("")}` : "";
2716
+ }
2603
2717
  function paintModal() {
2604
2718
  const i = find(modalId);
2605
2719
  if (!i) return void (mdlDlg.open && mdlDlg.close());
@@ -2630,8 +2744,10 @@
2630
2744
  ${sec("try", t.mdTry, s?.tryIt ? `<div class="md-try"><pre><code>${esc(s.tryIt)}</code></pre><button class="btn" type="button" data-md="copy">${esc(t.mdCopy)}</button></div>` : "")}
2631
2745
  ${sec("tags", t.mdTags, s?.tags?.length ? `<div class="md-tags tags">${s.tags.map((x) => `<span class="tag">#${esc(x)}</span>`).join(" ")}</div>` : "")}
2632
2746
  ${i.found?.length ? `<div class="found"><span>${esc(t.foundIn)}</span>${i.found.map((c) => `<a href="#item-${c.id}" data-open="${c.id}">${esc(c.name)}</a>`).join("")}</div>` : ""}
2747
+ <div class="found" id="md-related" hidden></div>
2633
2748
  ${flagLines(i, t)}
2634
2749
  <div class="md-fine">${i.shareCount ? `<span>${esc(t.shared(i.shareCount))}</span>` : ""}<span>${esc(i.createdAt.slice(0, 10))}</span>${i.enrichedBy ? `<span>${esc(t.enrichedBy(i.enrichedBy.replace(/^agent:/, "")))}</span>` : ""}</div>`;
2750
+ paintRelated(i.id);
2635
2751
  const busy = refreshing.has(i.id);
2636
2752
  const btn = (act, icon, label, extra = "") => `<button class="btn ${extra}" type="button" data-md="${act}">${ic(icon)} ${esc(label)}</button>`;
2637
2753
  $("md-actions").innerHTML = `<a class="btn primary" href="${esc(url)}" target="_blank" rel="noopener noreferrer">${ic("link")} ${esc(t.openLink)}</a>` +
@@ -2639,11 +2755,64 @@
2639
2755
  : btn("favorite", "star", i.favorite ? t.unfavorite : t.favorite, i.favorite ? "on" : "") + btn("move", "move", t.moveTo) +
2640
2756
  `<button class="btn ${busy ? "spin" : ""}" type="button" data-md="refresh" ${busy ? "disabled" : ""}>${ic("refresh")} ${esc(t.refresh)}</button>` +
2641
2757
  btn("health", "refresh", t.checkLink) + btn("note", "note", i.note ? t.editNote : t.addNote) + `<span class="spacer"></span>` + btn("trash", "trash", t.remove, "danger")) : "") +
2758
+ btn("history", "undo", t.histBtn, histFor === i.id ? "on" : "") +
2642
2759
  (modalFrom === "map" ? btn("list", "list", t.showInList) : "");
2760
+ if (histFor === i.id) paintHistory(i);
2761
+ }
2762
+ // ── Change history (read: anyone who can read the card; restore: admin) ──
2763
+ let histFor = null, histRows = null;
2764
+ function histPreview(row, f) {
2765
+ const t = T(), b = row.before, cut = (x) => { x = String(x ?? "").replace(/\s+/g, " ").trim(); return x ? (x.length > 80 ? x.slice(0, 80) + "…" : x) : t.histEmptyVal; };
2766
+ if (f === "note" || f === "title") return cut(b[f]);
2767
+ if (f === "summary") { try { const o = JSON.parse(b.summary); return cut(o.oneLiner || o.name); } catch { return t.histEmptyVal; } }
2768
+ if (f === "folder") return folderPath(b.category);
2769
+ if (f === "favorite") return b.favorite ? t.histStarOn : t.histStarOff;
2770
+ return b.trashed_at ? t.histInTrash : t.histOutTrash;
2771
+ }
2772
+ function paintHistory(i) {
2773
+ const t = T(), admin = role === "admin";
2774
+ let sec = document.getElementById("md-hist");
2775
+ if (!sec) { sec = document.createElement("section"); sec.id = "md-hist"; sec.className = "md-sec md-hist"; $("md-scroll").appendChild(sec); }
2776
+ const body = histRows == null ? "…" : !histRows.length ? `<p>${esc(t.histNone)}</p>` :
2777
+ `<ul>${histRows.map((r) => `<li><div>${r.fields.map((f) => `<span>${esc(t.histField[f] ?? f)}: ${esc(histPreview(r, f))}</span>`).join("<br>")}<small>${when(r.at)} · ${esc(t.histActor(r.actor))}</small></div>${
2778
+ admin ? `<button class="btn" type="button" data-md="hist-restore" data-v="${r.v}">${esc(t.histRestore)}</button>` : ""}</li>`).join("")}</ul>`;
2779
+ sec.innerHTML = `<h4>${esc(t.histTitle)}</h4>${body}${admin && histRows?.length ? `<button class="btn" type="button" data-md="hist-forget">${esc(t.histForget)}</button>` : ""}`;
2780
+ }
2781
+ const when = (iso) => { const d = new Date(iso); return esc(isNaN(d) ? iso : d.toLocaleString(locale, { dateStyle: "short", timeStyle: "short" })); };
2782
+ async function loadHistory(id) {
2783
+ try { const rows = await api(`/api/items/${id}/history`); if (histFor === id) histRows = rows; } catch { if (histFor === id) { histRows = []; toast(T().histErr); } }
2784
+ if (histFor === id && modalId === id && mdlDlg.open) paintModal();
2785
+ }
2786
+ async function restoreVersion(id, v) {
2787
+ const saved = await mapWrite(`/api/items/${id}/history/${v}/restore`, "POST");
2788
+ if (!saved) return;
2789
+ const item = find(id);
2790
+ if (item) {
2791
+ // The server omits empty optional fields (a cleared note): replace the card's data, keep what only the list adds.
2792
+ const extra = { found: item.found, said: item.said, suggestions: item.suggestions };
2793
+ for (const k of Object.keys(item)) delete item[k];
2794
+ Object.assign(item, saved, extra);
2795
+ const el = document.getElementById(`item-${id}`);
2796
+ if (el) { el.outerHTML = card(item); attachSwipe(document.getElementById(`item-${id}`)); }
2797
+ }
2798
+ if (mapShown()) drawMap();
2799
+ refreshCounts(); refreshFolders();
2800
+ const rows = await api(`/api/items/${id}/history`).catch(() => null);
2801
+ const undoV = rows?.[0]?.v; // the restore itself is the newest version: restoring it again undoes it
2802
+ histRows = rows ?? histRows;
2803
+ if (modalId === id && mdlDlg.open) paintModal();
2804
+ toast(T().histRestored, undoV ? async () => { await restoreVersion(id, undoV); } : undefined);
2805
+ }
2806
+ async function forgetHistory(id) {
2807
+ if (!(await mapWrite(`/api/items/${id}/history`, "DELETE"))) return;
2808
+ histRows = [];
2809
+ if (modalId === id && mdlDlg.open) paintModal();
2810
+ toast(T().histForgot);
2643
2811
  }
2644
2812
  function openModal(id, from = "list") {
2645
2813
  if (!find(id)) return;
2646
2814
  const wasOpen = mdlDlg.open;
2815
+ if (modalId !== id) { histFor = null; histRows = null; }
2647
2816
  modalId = id; modalFrom = from;
2648
2817
  paintModal();
2649
2818
  if (!wasOpen) mdlDlg.showModal();
@@ -2694,6 +2863,13 @@
2694
2863
  history.replaceState(null, "", `#item-${id}`);
2695
2864
  return load();
2696
2865
  }
2866
+ if (act1 === "history") {
2867
+ histFor = histFor === id ? null : id; histRows = null;
2868
+ if (histFor) loadHistory(id);
2869
+ return paintModal();
2870
+ }
2871
+ if (act1 === "hist-restore") return restoreVersion(id, Number(b.dataset.v));
2872
+ if (act1 === "hist-forget") return forgetHistory(id);
2697
2873
  if (act1 === "move") { mdlDlg.close(); return openMovePicker(id); }
2698
2874
  if (act1 === "refresh") return refreshItem(id);
2699
2875
  if (act1 === "health") return checkLink(id);
@@ -3469,9 +3645,23 @@
3469
3645
  }
3470
3646
  }
3471
3647
 
3648
+ /** A newer release is out: a small header notice, dismissed per version (this browser only). */
3649
+ function showUpdate(u) {
3650
+ const el = $("update");
3651
+ const ok = u && /^\d{1,9}\.\d{1,9}\.\d{1,9}(-[0-9A-Za-z.-]{1,40})?$/.test(u.latest ?? "");
3652
+ if (!ok || store.get("driftnet-update-dismissed") === u.latest) { el.hidden = true; return; }
3653
+ const t = T().st;
3654
+ const a = $("update-link");
3655
+ a.href = `https://github.com/KevinChu1110/driftnet/releases/tag/v${u.latest}`;
3656
+ a.textContent = `${t.updOut(u.latest)} · ${t.updHow}`;
3657
+ $("update-x").setAttribute("aria-label", t.updDismiss);
3658
+ $("update-x").onclick = () => { store.set("driftnet-update-dismissed", u.latest); el.hidden = true; };
3659
+ el.hidden = false;
3660
+ }
3472
3661
  async function refreshCounts() {
3473
3662
  const stats = await api("/api/stats").catch(() => null);
3474
3663
  if (!stats) return;
3664
+ showUpdate(stats.update);
3475
3665
  $("stats").textContent = T().stats(stats.items, stats.shares);
3476
3666
  const set = (v, n) => { const c = $("nav").querySelector(`[data-field="view"][data-value="${v}"] .count`); if (c) c.textContent = n || (v === "all" ? "0" : ""); };
3477
3667
  set("all", stats.items); set("favorites", stats.favorites); set("trash", stats.trash); set("inbox", stats.inbox); set("review", stats.review);