diff --git a/Web-App/frontend/src/views/space/SpaceView.vue b/Web-App/frontend/src/views/space/SpaceView.vue
index c03ffb9..48229e3 100644
--- a/Web-App/frontend/src/views/space/SpaceView.vue
+++ b/Web-App/frontend/src/views/space/SpaceView.vue
@@ -169,7 +169,7 @@ async function newPage() {
ref="picker"
type="file"
multiple
- accept=".md,.markdown,.txt,.html,.htm,.docx,.zip,text/markdown,text/html"
+ accept=".md,.markdown,.txt,.html,.htm,.docx,.csv,.mht,.mhtml,.zip,.bear2bk,text/markdown,text/html,text/csv"
class="hidden"
data-testid="import-input"
@change="importPicked"
diff --git a/Web-App/frontend/src/views/workspace/NewWorkspaceView.vue b/Web-App/frontend/src/views/workspace/NewWorkspaceView.vue
index 9276e71..4d4b517 100644
--- a/Web-App/frontend/src/views/workspace/NewWorkspaceView.vue
+++ b/Web-App/frontend/src/views/workspace/NewWorkspaceView.vue
@@ -31,6 +31,27 @@ onMounted(async () => {
}
});
+// Restoring a snapshot makes the workspace from the file; the name is optional then.
+const snapshot = ref
(null);
+const restoring = ref(false);
+async function restore() {
+ if (!snapshot.value) return;
+ restoring.value = true;
+ errors.reset();
+ try {
+ const ws = await api.workspaces.restore(snapshot.value, {
+ name: name.value.trim() || undefined,
+ organization: isSuperadmin.value ? organization.value : undefined,
+ });
+ await workspaces.load();
+ router.replace({ name: "workspace-settings", params: { id: ws.id } });
+ } catch (e) {
+ errors.show(e);
+ } finally {
+ restoring.value = false;
+ }
+}
+
async function submit() {
busy.value = true;
errors.reset();
@@ -62,5 +83,25 @@ async function submit() {
{{ $t("workspace.create") }}
+
diff --git a/Web-App/frontend/src/views/workspace/WorkspaceSettingsView.vue b/Web-App/frontend/src/views/workspace/WorkspaceSettingsView.vue
index 31a4c04..d5cd301 100644
--- a/Web-App/frontend/src/views/workspace/WorkspaceSettingsView.vue
+++ b/Web-App/frontend/src/views/workspace/WorkspaceSettingsView.vue
@@ -15,6 +15,7 @@ import WorkspaceWebhooks from "../../components/WorkspaceWebhooks.vue";
import { useFormErrors } from "../../composables/useFormErrors";
import { useAuthStore } from "../../stores/auth";
import { atLeast, grantableRoles, useWorkspacesStore } from "../../stores/workspaces";
+import { saveBlob } from "../../lib/download";
const props = defineProps<{ id: string }>();
const api = useApi();
@@ -98,6 +99,20 @@ async function copyLink(link: string) {
setTimeout(() => (copied.value = false), 2000);
}
+const snapshotting = ref(false);
+async function downloadSnapshot() {
+ snapshotting.value = true;
+ errors.reset();
+ try {
+ const { blob, filename } = await api.workspaces.snapshot(props.id);
+ saveBlob(blob, filename);
+ } catch (e) {
+ errors.show(e);
+ } finally {
+ snapshotting.value = false;
+ }
+}
+
async function removeWorkspace() {
if (!ws.value || !confirm(t("workspace.confirmDelete", { name: ws.value.name }))) return;
busy.value = true;
@@ -259,6 +274,14 @@ async function removeWorkspace() {
+
+ {{ $t("workspace.snapshotTitle") }}
+ {{ $t("workspace.snapshotHint") }}
+
+ {{ $t(snapshotting ? "workspace.snapshotPreparing" : "workspace.snapshotDownload") }}
+
+
+
{{ $t("org.dangerTitle") }}
{{ $t("workspace.deleteHint") }}
diff --git a/Web-Clipper/README.md b/Web-Clipper/README.md
new file mode 100644
index 0000000..02e530f
--- /dev/null
+++ b/Web-Clipper/README.md
@@ -0,0 +1,29 @@
+# Docwell Web Clipper
+
+A browser extension (Manifest V3, Chrome, Edge and Firefox 128+) that saves the page you are reading to Docwell as a new page: the article on it (found with Mozilla's Readability), or only what you selected, as Markdown with its links and pictures, under a note saying where it came from.
+
+It reads a page only when you click it, turns it into Markdown inside the extension, and sends it to your Docwell server through the import API (`POST /api/v1/spaces/{id}/import`). It talks to no other server.
+
+## Build
+
+```sh
+npm install
+npm run build -w @docwell/web-clipper
+```
+
+The extension is in `Web-Clipper/dist/`.
+
+- **Chrome / Edge:** open `chrome://extensions`, turn on *Developer mode*, choose *Load unpacked* and pick `dist/`.
+- **Firefox:** open `about:debugging#/runtime/this-firefox`, choose *Load Temporary Add-on…* and pick `dist/manifest.json`. For a lasting install, sign the zipped `dist/` folder through addons.mozilla.org.
+
+## Set up
+
+1. In Docwell, open *Account settings → API tokens* and create a token with *Read and write* access.
+2. Open the clipper's options (right-click its button → *Options*), enter the address you open Docwell at and the token, and choose *Connect*. The browser asks once to let the clipper reach that server.
+3. Pick the workspace and the space new clips go to, and save.
+
+The clipper finds the API through the web app's `/config.json`, so it works when docwell-web and docwell-server have different addresses.
+
+## Use
+
+Click the Docwell button in the toolbar. Check the title and the space, then *Clip article* (or *Clip selection* when text is selected), or *Whole page* to keep everything on the page. When it is saved, *Open in Docwell* opens the new page.
diff --git a/Web-Clipper/package.json b/Web-Clipper/package.json
new file mode 100644
index 0000000..4ab3e69
--- /dev/null
+++ b/Web-Clipper/package.json
@@ -0,0 +1,26 @@
+{
+ "name": "@docwell/web-clipper",
+ "version": "0.1.0",
+ "private": true,
+ "license": "AGPL-3.0-or-later",
+ "type": "module",
+ "description": "Browser extension that saves web pages to Docwell as new pages",
+ "scripts": {
+ "build": "tsc --noEmit && vite build",
+ "typecheck": "tsc --noEmit",
+ "test": "vitest run"
+ },
+ "dependencies": {
+ "@mozilla/readability": "0.6.0",
+ "turndown": "7.2.4",
+ "turndown-plugin-gfm": "1.0.2"
+ },
+ "devDependencies": {
+ "@types/chrome": "0.3.7",
+ "@types/turndown": "5.0.6",
+ "jsdom": "^30.1.3",
+ "typescript": "~5.9.3",
+ "vite": "^8.3.5",
+ "vitest": "^5.0.5"
+ }
+}
diff --git a/Web-Clipper/public/icons/icon-128.png b/Web-Clipper/public/icons/icon-128.png
new file mode 100644
index 0000000..5dcbfd7
Binary files /dev/null and b/Web-Clipper/public/icons/icon-128.png differ
diff --git a/Web-Clipper/public/icons/icon-16.png b/Web-Clipper/public/icons/icon-16.png
new file mode 100644
index 0000000..081cae3
Binary files /dev/null and b/Web-Clipper/public/icons/icon-16.png differ
diff --git a/Web-Clipper/public/icons/icon-32.png b/Web-Clipper/public/icons/icon-32.png
new file mode 100644
index 0000000..7f5d3f8
Binary files /dev/null and b/Web-Clipper/public/icons/icon-32.png differ
diff --git a/Web-Clipper/public/icons/icon-48.png b/Web-Clipper/public/icons/icon-48.png
new file mode 100644
index 0000000..cf4d6fe
Binary files /dev/null and b/Web-Clipper/public/icons/icon-48.png differ
diff --git a/Web-Clipper/public/manifest.json b/Web-Clipper/public/manifest.json
new file mode 100644
index 0000000..e2f568a
--- /dev/null
+++ b/Web-Clipper/public/manifest.json
@@ -0,0 +1,23 @@
+{
+ "manifest_version": 3,
+ "name": "Docwell Web Clipper",
+ "version": "0.1.0",
+ "description": "Save web pages, articles and selections to your Docwell server as new pages.",
+ "action": {
+ "default_title": "Clip to Docwell",
+ "default_popup": "popup.html",
+ "default_icon": { "16": "icons/icon-16.png", "32": "icons/icon-32.png", "48": "icons/icon-48.png" }
+ },
+ "options_ui": { "page": "options.html", "open_in_tab": true },
+ "icons": {
+ "16": "icons/icon-16.png",
+ "32": "icons/icon-32.png",
+ "48": "icons/icon-48.png",
+ "128": "icons/icon-128.png"
+ },
+ "permissions": ["activeTab", "scripting", "storage"],
+ "optional_host_permissions": ["https://*/*", "http://*/*"],
+ "browser_specific_settings": {
+ "gecko": { "id": "web-clipper@docwell.app", "strict_min_version": "128.0" }
+ }
+}
diff --git a/Web-Clipper/src/api.ts b/Web-Clipper/src/api.ts
new file mode 100644
index 0000000..6584603
--- /dev/null
+++ b/Web-Clipper/src/api.ts
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+// The few Docwell API calls the clipper makes, with a personal API token
+// (Account settings → API tokens, "Read and write").
+
+export interface Settings {
+ /** The Docwell web app's address, as people open it. */
+ webUrl: string;
+ /** The API's address, read from the web app's /config.json. */
+ apiUrl: string;
+ token: string;
+ workspace: string;
+ space: string;
+}
+
+export const emptySettings: Settings = { webUrl: "", apiUrl: "", token: "", workspace: "", space: "" };
+
+export async function loadSettings(): Promise {
+ const stored = (await chrome.storage.local.get("settings")) as { settings?: Partial };
+ return { ...emptySettings, ...stored.settings };
+}
+
+export async function saveSettings(s: Settings): Promise {
+ await chrome.storage.local.set({ settings: s });
+}
+
+export class ClipError extends Error {}
+
+/** The address without a trailing slash; https:// is added when missing. */
+export function cleanUrl(raw: string): string {
+ let v = raw.trim();
+ if (v && !/^https?:\/\//i.test(v)) v = `https://${v}`;
+ const u = new URL(v);
+ return `${u.origin}${u.pathname.replace(/\/+$/, "")}`;
+}
+
+/**
+ * Finds the API next to a web app: docwell-web tells it in /config.json
+ * (empty when it serves the API on its own address).
+ */
+export async function findApi(webUrl: string): Promise {
+ try {
+ const res = await fetch(`${webUrl}/config.json`, { headers: { Accept: "application/json" } });
+ if (res.ok) {
+ const cfg = (await res.json()) as { apiUrl?: string };
+ if (cfg.apiUrl) return cleanUrl(new URL(cfg.apiUrl, webUrl).href);
+ }
+ } catch {
+ // Not a docwell-web (or a desktop or server address): use it as is.
+ }
+ return webUrl;
+}
+
+async function call(s: Pick, path: string, init: RequestInit = {}): Promise {
+ let res: Response;
+ try {
+ res = await fetch(`${s.apiUrl}${path}`, {
+ ...init,
+ headers: { Accept: "application/json", Authorization: `Bearer ${s.token}`, ...init.headers },
+ });
+ } catch {
+ throw new ClipError("Docwell could not be reached. Check the address in the options.");
+ }
+ const data = res.headers.get("content-type")?.includes("json") ? await res.json() : null;
+ if (!res.ok) {
+ const msg = (data as { message?: string; fields?: Record } | null) ?? {};
+ const detail = msg.fields ? Object.values(msg.fields)[0] : msg.message;
+ if (res.status === 401) throw new ClipError("The API token was refused. Create a new one in Docwell.");
+ throw new ClipError(detail || `Docwell answered ${res.status}.`);
+ }
+ return data as T;
+}
+
+export interface Me {
+ id: string;
+ name: string;
+ email: string;
+}
+export interface Workspace {
+ id: string;
+ name: string;
+}
+export interface Space {
+ id: string;
+ name: string;
+ role: string;
+ journal: boolean;
+}
+export interface Page {
+ id: string;
+ title: string;
+}
+
+export const me = (s: Settings) => call(s, "/api/v1/auth/me");
+export const workspaces = (s: Settings) => call(s, "/api/v1/workspaces");
+export const spaces = (s: Settings, ws: string) =>
+ call(s, `/api/v1/workspaces/${encodeURIComponent(ws)}/spaces`).then((list) =>
+ list.filter((sp) => sp.role === "editor" || sp.role === "admin"),
+ );
+
+/** Creates a page from a Markdown file; returns it. */
+export async function importMarkdown(s: Settings, filename: string, markdown: string): Promise {
+ const form = new FormData();
+ form.append("file", new File([markdown], filename, { type: "text/markdown" }));
+ const pages = await call(s, `/api/v1/spaces/${encodeURIComponent(s.space)}/import`, {
+ method: "POST",
+ body: form,
+ });
+ const page = pages[0];
+ if (!page) throw new ClipError("Docwell made no page from the clip.");
+ return page;
+}
+
+/** Where the new page opens in the web app. */
+export const pageLink = (s: Settings, id: string) => `${s.webUrl}/p/${encodeURIComponent(id)}`;
diff --git a/Web-Clipper/src/env.d.ts b/Web-Clipper/src/env.d.ts
new file mode 100644
index 0000000..57059ba
--- /dev/null
+++ b/Web-Clipper/src/env.d.ts
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+declare module "turndown-plugin-gfm" {
+ import type TurndownService from "turndown";
+ export const gfm: TurndownService.Plugin;
+}
diff --git a/Web-Clipper/src/extract.test.ts b/Web-Clipper/src/extract.test.ts
new file mode 100644
index 0000000..50a637f
--- /dev/null
+++ b/Web-Clipper/src/extract.test.ts
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { describe, expect, it } from "vitest";
+import { clipFilename, toClip } from "./extract";
+
+const article = `How wells work | Water Weekly
+
+
+ How wells work
+ Groundwater fills the gaps between rocks. This paragraph is long enough for Readability to keep it as the article's
+ body, with a link to aquifers and bold words.
+ A second paragraph keeps going, so the page reads like an article rather than a menu. It mentions pumps, pipes,
+ and the water table, and how deep a well has to be to reach it in a dry summer.
+
+ print("hello")
+
+
+
+
+`;
+
+describe("toClip", () => {
+ const page = {
+ html: article,
+ url: "https://news.example.com/2026/wells",
+ title: "How wells work | Water Weekly",
+ selection: "",
+ };
+
+ it("keeps the article with absolute links and images", () => {
+ const c = toClip(page, "2026-11-16");
+ expect(c.title).toBe("How wells work");
+ expect(
+ c.markdown.startsWith(
+ "# How wells work\n\n> [!NOTE]\n> Clipped from [news.example.com](https://news.example.com/2026/wells) on 2026-11-16",
+ ),
+ ).toBe(true);
+ expect(c.markdown).toContain("[a link to aquifers](https://news.example.com/aquifers)");
+ expect(c.markdown).toContain("**bold words**");
+ expect(c.markdown).toContain("");
+ expect(c.markdown).toContain('```python\nprint("hello")\n```');
+ expect(c.markdown).toMatch(/\| Depth \| Yield \|/);
+ expect(c.markdown).not.toContain("alert(1)");
+ expect(c.markdown).not.toContain("About");
+ // The heading that repeats the title is not kept twice.
+ expect(c.markdown.match(/How wells work/g)?.length).toBe(1);
+ });
+
+ it("clips only the selection when there is one", () => {
+ const c = toClip({ ...page, selection: 'Just this part.
' }, "2026-11-16");
+ expect(c.markdown).toContain("Just [this](https://news.example.com/x) part.");
+ expect(c.markdown).not.toContain("Groundwater");
+ });
+
+ it("drops javascript: links", () => {
+ const c = toClip({ ...page, selection: 'bad ok
' }, "2026-11-16");
+ expect(c.markdown).not.toContain("javascript:");
+ expect(c.markdown).toContain("bad ok");
+ });
+});
+
+describe("clipFilename", () => {
+ it("makes a safe Markdown file name", () => {
+ expect(clipFilename('a/b: "c"?')).toBe("a b c.md");
+ expect(clipFilename("")).toBe("Clip.md");
+ });
+});
diff --git a/Web-Clipper/src/extract.ts b/Web-Clipper/src/extract.ts
new file mode 100644
index 0000000..e1b434e
--- /dev/null
+++ b/Web-Clipper/src/extract.ts
@@ -0,0 +1,149 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+// Turns a web page into the Markdown file Docwell imports: the article
+// Readability finds (or the selection, when there is one) with links and
+// images made absolute, under a title and a note saying where it came from.
+// It runs in the extension's own page on HTML the tab sent, so nothing is
+// injected into the site beyond reading it.
+
+import { Readability } from "@mozilla/readability";
+import TurndownService from "turndown";
+import { gfm } from "turndown-plugin-gfm";
+
+/** What the tab sends: its HTML, address, title and the selected HTML. */
+export interface Grabbed {
+ html: string;
+ url: string;
+ title: string;
+ selection: string;
+}
+
+export interface Clip {
+ title: string;
+ markdown: string;
+}
+
+/** Runs in the tab (chrome.scripting): reads the page and the selection. */
+export function grab(): Grabbed {
+ let selection = "";
+ const sel = window.getSelection();
+ if (sel && sel.rangeCount > 0 && !sel.isCollapsed) {
+ const box = document.createElement("div");
+ for (let i = 0; i < sel.rangeCount; i++) box.appendChild(sel.getRangeAt(i).cloneContents());
+ selection = box.innerHTML;
+ }
+ return { html: document.documentElement.outerHTML, url: location.href, title: document.title, selection };
+}
+
+/** Parses html as a document whose relative links resolve against url. */
+function parse(html: string, url: string): Document {
+ const doc = new DOMParser().parseFromString(html, "text/html");
+ let base = doc.querySelector("base");
+ if (!base) {
+ base = doc.createElement("base");
+ doc.head.prepend(base);
+ }
+ // A page's own may be relative to its address.
+ base.href = new URL(base.getAttribute("href") || url, url).href;
+ return doc;
+}
+
+/** Makes every link and image under root absolute, and drops unsafe ones. */
+function absolutize(root: ParentNode, base: string) {
+ const fix = (v: string | null) => {
+ if (!v) return "";
+ try {
+ const u = new URL(v, base);
+ return u.protocol === "http:" || u.protocol === "https:" || u.protocol === "mailto:" ? u.href : "";
+ } catch {
+ return "";
+ }
+ };
+ for (const a of root.querySelectorAll("a[href]")) {
+ const href = fix(a.getAttribute("href"));
+ if (href) a.setAttribute("href", href);
+ else a.removeAttribute("href");
+ }
+ for (const img of root.querySelectorAll("img")) {
+ // Lazy-loading sites keep the real picture in data-src or srcset.
+ const src =
+ fix(img.getAttribute("data-src")) ||
+ fix(img.getAttribute("src")) ||
+ fix(img.getAttribute("srcset")?.split(",").pop()?.trim().split(/\s+/)[0] ?? null);
+ if (src && !src.startsWith("mailto:")) img.setAttribute("src", src);
+ else img.remove();
+ }
+}
+
+function turndown(): TurndownService {
+ const td = new TurndownService({
+ headingStyle: "atx",
+ codeBlockStyle: "fenced",
+ bulletListMarker: "-",
+ emDelimiter: "*",
+ hr: "---",
+ });
+ td.use(gfm);
+ td.remove(["script", "style", "noscript", "iframe", "form", "button", "select", "input", "textarea"]);
+ // Keep the language of highlighted code blocks.
+ td.addRule("fencedLanguage", {
+ filter: (node) => node.nodeName === "PRE" && !!node.querySelector("code"),
+ replacement: (_content, node) => {
+ const code = (node as HTMLElement).querySelector("code")!;
+ const lang = /(?:language|lang)-([\w+#.-]+)/.exec(code.className)?.[1] ?? "";
+ const text = code.textContent ?? "";
+ const fence = text.includes("```") ? "~~~" : "```";
+ return `\n\n${fence}${lang}\n${text.replace(/\n$/, "")}\n${fence}\n\n`;
+ },
+ });
+ return td;
+}
+
+const mdEscape = (s: string) => s.replace(/([\\[\]()*_`#<>])/g, "\\$1");
+
+/**
+ * The clip of a grabbed page: the selection when there is one, else the
+ * main article, else the whole body. today is the clip's date (YYYY-MM-DD).
+ */
+export function toClip(g: Grabbed, today: string, opts: { whole?: boolean } = {}): Clip {
+ const doc = parse(g.html, g.url);
+ const base = doc.baseURI || g.url;
+ let title = g.title.trim();
+ let body: Element;
+ if (g.selection.trim() && !opts.whole) {
+ body = parse(`${g.selection}`, base).body;
+ } else {
+ const article = new Readability(doc.cloneNode(true) as Document, { keepClasses: true }).parse();
+ if (article?.content) {
+ body = parse(`${article.content}`, base).body;
+ title = article.title?.trim() || title;
+ } else {
+ body = doc.body;
+ }
+ }
+ absolutize(body, base);
+ // The article's own heading beats a tab title with the site's name after
+ // it ("How wells work | Water Weekly"); a heading repeating the title goes.
+ const first = body.querySelector("h1") ?? doc.querySelector("h1");
+ const heading = first?.textContent?.replace(/\s+/g, " ").trim() ?? "";
+ if (heading && title !== heading && title.startsWith(heading)) title = heading;
+ if (first && body.contains(first) && heading === title) first.remove();
+ if (!title) title = new URL(g.url).hostname;
+
+ const content = turndown().turndown(body.innerHTML).trim();
+ const site = new URL(g.url).hostname.replace(/^www\./, "");
+ const source = `> [!NOTE]\n> Clipped from [${mdEscape(site)}](${g.url}) on ${today}`;
+ return { title, markdown: `# ${title.replace(/\n/g, " ")}\n\n${source}\n\n${content}\n` };
+}
+
+/** A file name for the clip (the server takes the title from its heading). */
+export function clipFilename(title: string): string {
+ const name = [...title]
+ .map((ch) => (ch.charCodeAt(0) < 32 ? " " : ch))
+ .join("")
+ .replace(/[\\/:*?"<>|]+/g, " ")
+ .replace(/\s+/g, " ")
+ .trim()
+ .slice(0, 80);
+ return `${name || "Clip"}.md`;
+}
diff --git a/Web-Clipper/src/options.html b/Web-Clipper/src/options.html
new file mode 100644
index 0000000..0515791
--- /dev/null
+++ b/Web-Clipper/src/options.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+ Docwell Web Clipper options
+
+
+
+
Docwell Web Clipper
+
+
+ The clipper reads a page only when you click it, turns the article into Markdown in this extension, and sends it
+ to your Docwell server. It talks to no other server.
+
+
+
+
diff --git a/Web-Clipper/src/options.ts b/Web-Clipper/src/options.ts
new file mode 100644
index 0000000..b748fba
--- /dev/null
+++ b/Web-Clipper/src/options.ts
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { ClipError, cleanUrl, findApi, loadSettings, me, saveSettings, spaces, workspaces, type Settings } from "./api";
+
+const $ = (id: string) => document.getElementById(id) as T;
+const form = $("form");
+const webUrl = $("web-url");
+const token = $("token");
+const status = $("status");
+const pick = $("pick");
+const wsSelect = $("workspace");
+const spaceSelect = $("space");
+
+let settings: Settings;
+
+function say(text: string, kind: "" | "error" | "ok" = "") {
+ status.textContent = text;
+ status.className = `status ${kind}`;
+}
+
+function fill(select: HTMLSelectElement, items: { id: string; name: string }[], selected: string) {
+ select.replaceChildren(
+ ...items.map((i) => {
+ const o = document.createElement("option");
+ o.value = i.id;
+ o.textContent = i.name;
+ o.selected = i.id === selected;
+ return o;
+ }),
+ );
+}
+
+async function loadSpaces() {
+ const list = (await spaces(settings, wsSelect.value)).filter((s) => !s.journal);
+ fill(spaceSelect, list, settings.space);
+ if (!list.length) say("You cannot add pages to any space of this workspace.", "error");
+}
+
+async function connect() {
+ say("Connecting…");
+ const web = cleanUrl(webUrl.value);
+ const api = await findApi(web);
+ // The browser asks once to let the clipper reach this server.
+ const origins = [...new Set([new URL(web).origin, new URL(api).origin])].map((o) => `${o}/*`);
+ const granted = await chrome.permissions.request({ origins });
+ if (!granted) throw new ClipError("The clipper needs permission to reach your Docwell server.");
+ settings = { ...settings, webUrl: web, apiUrl: api, token: token.value.trim() };
+ const who = await me(settings);
+ const list = await workspaces(settings);
+ if (!list.length) throw new ClipError("Your account has no workspaces yet.");
+ fill(wsSelect, list, settings.workspace || list[0]!.id);
+ await loadSpaces();
+ pick.hidden = false;
+ say(`Connected as ${who.name || who.email}.`, "ok");
+}
+
+form.addEventListener("submit", (e) => {
+ e.preventDefault();
+ connect().catch((err: unknown) => say(err instanceof Error ? err.message : String(err), "error"));
+});
+wsSelect.addEventListener("change", () => {
+ loadSpaces().catch((err: unknown) => say(err instanceof Error ? err.message : String(err), "error"));
+});
+$("save").addEventListener("click", async () => {
+ if (!spaceSelect.value) return say("Pick a space.", "error");
+ settings = { ...settings, workspace: wsSelect.value, space: spaceSelect.value };
+ await saveSettings(settings);
+ say("Saved. Click the Docwell button in the toolbar on any page to clip it.", "ok");
+});
+
+void (async () => {
+ settings = await loadSettings();
+ webUrl.value = settings.webUrl;
+ token.value = settings.token;
+ if (settings.webUrl && settings.token) {
+ connect().catch((err: unknown) => say(err instanceof Error ? err.message : String(err), "error"));
+ }
+})();
diff --git a/Web-Clipper/src/popup.html b/Web-Clipper/src/popup.html
new file mode 100644
index 0000000..0e6502e
--- /dev/null
+++ b/Web-Clipper/src/popup.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+ Clip to Docwell
+
+
+
+
Clip to Docwell
+
+
Connect the clipper to your Docwell server first.
+
+
+
+
+
+
+
+
+
+
+
+
Clips your selection.
+
+
+ Options
+
+
+
diff --git a/Web-Clipper/src/popup.ts b/Web-Clipper/src/popup.ts
new file mode 100644
index 0000000..9bf07c1
--- /dev/null
+++ b/Web-Clipper/src/popup.ts
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { ClipError, importMarkdown, loadSettings, pageLink, saveSettings, spaces, type Settings } from "./api";
+import { clipFilename, grab, toClip, type Grabbed } from "./extract";
+
+const $ = (id: string) => document.getElementById(id) as T;
+const status = $("status");
+const titleInput = $("title");
+const spaceSelect = $("space");
+const clipButton = $("clip");
+const wholeButton = $("clip-whole");
+
+function say(text: string, kind: "" | "error" | "ok" = "") {
+ status.textContent = text;
+ status.className = `status ${kind}`;
+}
+const fail = (err: unknown) => say(err instanceof Error ? err.message : String(err), "error");
+
+const openOptions = (e?: Event) => {
+ e?.preventDefault();
+ void chrome.runtime.openOptionsPage();
+};
+$("open-options").addEventListener("click", openOptions);
+$("options-link").addEventListener("click", openOptions);
+
+function today(): string {
+ const d = new Date();
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
+}
+
+let settings: Settings;
+let page: Grabbed | null = null;
+
+async function readTab(): Promise {
+ const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
+ if (!tab?.id || !/^https?:/.test(tab.url ?? "")) throw new ClipError("Only web pages can be clipped.");
+ const [res] = await chrome.scripting.executeScript({ target: { tabId: tab.id }, func: grab });
+ if (!res?.result) throw new ClipError("The page could not be read.");
+ return res.result as Grabbed;
+}
+
+async function clip(whole: boolean) {
+ if (!page) return;
+ clipButton.disabled = wholeButton.disabled = true;
+ say("Clipping…");
+ try {
+ const c = toClip(page, today(), { whole });
+ const title = titleInput.value.trim() || c.title;
+ const markdown = c.markdown.replace(/^# .*\n/, `# ${title.replace(/\n/g, " ")}\n`);
+ settings = { ...settings, space: spaceSelect.value };
+ await saveSettings(settings);
+ const created = await importMarkdown(settings, clipFilename(title), markdown);
+ const link = pageLink(settings, created.id);
+ status.className = "status ok";
+ status.replaceChildren("Saved. ");
+ const a = document.createElement("a");
+ a.href = link;
+ a.textContent = "Open in Docwell";
+ a.addEventListener("click", (e) => {
+ e.preventDefault();
+ void chrome.tabs.create({ url: link });
+ });
+ status.append(a);
+ } catch (err) {
+ fail(err);
+ clipButton.disabled = wholeButton.disabled = false;
+ }
+}
+clipButton.addEventListener("click", () => void clip(false));
+wholeButton.addEventListener("click", () => void clip(true));
+
+void (async () => {
+ settings = await loadSettings();
+ if (!settings.apiUrl || !settings.token || !settings.workspace) {
+ $("setup").hidden = false;
+ return;
+ }
+ $("clipper").hidden = false;
+ try {
+ const [list, grabbed] = await Promise.all([spaces(settings, settings.workspace), readTab()]);
+ page = grabbed;
+ for (const sp of list.filter((s) => !s.journal)) {
+ const o = document.createElement("option");
+ o.value = sp.id;
+ o.textContent = sp.name;
+ o.selected = sp.id === settings.space;
+ spaceSelect.append(o);
+ }
+ $("page-title").textContent = grabbed.title || grabbed.url;
+ $("page-url").textContent = new URL(grabbed.url).hostname;
+ titleInput.value = grabbed.title;
+ if (grabbed.selection.trim()) {
+ $("selection-note").hidden = false;
+ clipButton.textContent = "Clip selection";
+ }
+ } catch (err) {
+ clipButton.disabled = wholeButton.disabled = true;
+ fail(err);
+ }
+})();
diff --git a/Web-Clipper/src/style.css b/Web-Clipper/src/style.css
new file mode 100644
index 0000000..d92c9c7
--- /dev/null
+++ b/Web-Clipper/src/style.css
@@ -0,0 +1,132 @@
+/* SPDX-License-Identifier: AGPL-3.0-or-later */
+/* Docwell's colours (see Packages/ui/src/theme.css), light and dark. */
+:root {
+ --surface: #fbfaf7;
+ --raised: #ffffff;
+ --line: #dfe3df;
+ --ink: #17201e;
+ --muted: #5b6a66;
+ --primary: #12403c;
+ --on-primary: #ffffff;
+ --danger: #b3261e;
+ --success: #2f6b2f;
+ color-scheme: light;
+ font:
+ 14px/1.45 "Inter",
+ system-ui,
+ -apple-system,
+ "Segoe UI",
+ sans-serif;
+}
+@media (prefers-color-scheme: dark) {
+ :root {
+ --surface: #0f1716;
+ --raised: #18221f;
+ --line: #2a3735;
+ --ink: #e8efed;
+ --muted: #a3b3ae;
+ --primary: #5fc4b3;
+ --on-primary: #0b1211;
+ --danger: #ff8a80;
+ --success: #8fd18f;
+ color-scheme: dark;
+ }
+}
+body {
+ margin: 0;
+ background: var(--surface);
+ color: var(--ink);
+}
+.popup {
+ width: 340px;
+ padding: 14px;
+}
+.options {
+ max-width: 560px;
+ margin: 32px auto;
+ padding: 0 16px;
+}
+h1 {
+ font-size: 16px;
+ margin: 0 0 10px;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+h1 img {
+ width: 20px;
+ height: 20px;
+}
+label {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ margin: 10px 0;
+ font-weight: 600;
+ font-size: 13px;
+}
+input,
+select {
+ font: inherit;
+ font-weight: 400;
+ padding: 6px 8px;
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ background: var(--raised);
+ color: var(--ink);
+}
+.hint {
+ color: var(--muted);
+ font-size: 12px;
+ font-weight: 400;
+ margin: 2px 0 0;
+}
+.row {
+ display: flex;
+ gap: 8px;
+ margin-top: 12px;
+}
+button {
+ font: inherit;
+ font-weight: 600;
+ padding: 7px 12px;
+ border-radius: 6px;
+ border: 1px solid var(--line);
+ background: var(--raised);
+ color: var(--ink);
+ cursor: pointer;
+}
+button.primary {
+ background: var(--primary);
+ border-color: var(--primary);
+ color: var(--on-primary);
+ flex: 1;
+}
+button:disabled {
+ opacity: 0.55;
+ cursor: default;
+}
+.status {
+ margin: 10px 0 0;
+ font-size: 13px;
+ min-height: 1em;
+}
+.status.error {
+ color: var(--danger);
+}
+.status.ok {
+ color: var(--success);
+}
+.title {
+ font-weight: 600;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.muted {
+ color: var(--muted);
+ font-size: 12px;
+}
+a {
+ color: var(--primary);
+}
diff --git a/Web-Clipper/tsconfig.json b/Web-Clipper/tsconfig.json
new file mode 100644
index 0000000..480328e
--- /dev/null
+++ b/Web-Clipper/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "extends": "../tsconfig.base.json",
+ "compilerOptions": {
+ "types": ["chrome", "vite/client"]
+ },
+ "include": ["src/**/*.ts"]
+}
diff --git a/Web-Clipper/vite.config.ts b/Web-Clipper/vite.config.ts
new file mode 100644
index 0000000..9cbcd6f
--- /dev/null
+++ b/Web-Clipper/vite.config.ts
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { resolve } from "node:path";
+import { defineConfig } from "vitest/config";
+
+// The extension's pages (popup and options) as ES modules; public/ holds the
+// manifest and icons, copied as they are. Load dist/ as an unpacked extension.
+export default defineConfig({
+ root: "src",
+ publicDir: "../public",
+ base: "./",
+ build: {
+ outDir: "../dist",
+ emptyOutDir: true,
+ target: "es2022",
+ // Extension stores review the code: keep it readable.
+ minify: false,
+ rollupOptions: {
+ input: {
+ popup: resolve(import.meta.dirname, "src/popup.html"),
+ options: resolve(import.meta.dirname, "src/options.html"),
+ },
+ },
+ },
+ test: {
+ root: ".",
+ environment: "jsdom",
+ },
+});
diff --git a/api/openapi.yaml b/api/openapi.yaml
index 1af566d..865a8c1 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -626,6 +626,61 @@ paths:
schema: { $ref: "#/components/schemas/Workspace" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
+ /api/v1/workspaces/{id}/snapshot:
+ parameters:
+ - { name: id, in: path, required: true, schema: { type: string } }
+ get:
+ operationId: exportWorkspaceSnapshot
+ tags: [workspaces]
+ summary: Download a snapshot of the workspace that restores 1:1 (workspace admin or above)
+ description: >-
+ One zip: snapshot.json (the workspace's settings, spaces, pages and their place in the
+ tree, tags, properties, shared collections, comments and the attachments' details),
+ pages/.ydoc (each page's Yjs state), pages/.json (the same document as JSON)
+ and files/ (each attachment). It holds what the caller can open: other people's
+ journals and pages hidden from the caller are left out, as are trashed pages. Members,
+ page sharing, share links, webhooks, AI settings and page history are not included.
+ security: [{ bearer: [] }]
+ responses:
+ "200":
+ description: The zip, streamed as it is built
+ content:
+ application/zip:
+ schema: { type: string, format: binary }
+ "403": { $ref: "#/components/responses/Error" }
+ "404": { $ref: "#/components/responses/Error" }
+ /api/v1/workspaces/restore:
+ post:
+ operationId: restoreWorkspaceSnapshot
+ tags: [workspaces]
+ summary: Make a new workspace from a snapshot (organization admin or superadmin)
+ description: >-
+ Every record gets a new id and old ids are replaced wherever they appear (links,
+ mentions, embedded pages, database relations, property values, collection rules), so
+ a snapshot can be restored next to its original. Pages come back from their Yjs state,
+ so comments stay anchored to their text. People named in the snapshot keep their
+ comments and collections when they exist on this server; everything else is the
+ caller's. On any error nothing is left behind. Up to 4 GB.
+ security: [{ bearer: [] }]
+ requestBody:
+ required: true
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ required: [file]
+ properties:
+ file: { type: string, format: binary }
+ name: { type: string, description: The new workspace's name; empty keeps the snapshot's }
+ organization: { type: string, description: Organization id (required for superadmins) }
+ responses:
+ "201":
+ description: The new workspace
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/Workspace" }
+ "400": { $ref: "#/components/responses/Error" }
+ "403": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
@@ -1835,15 +1890,23 @@ paths:
post:
operationId: importPages
tags: [pages]
- summary: Create pages from Markdown, HTML, Word files or a Notion export (editor)
+ summary: Create pages from Markdown, HTML, Word, CSV, OneNote, Notion, Obsidian or Bear files (editor)
description: >-
One page per Markdown, HTML or Word file (.md, .markdown, .txt, .html, .htm up to
5 MB; .docx up to 25 MB). A leading level-1 heading (a Word title) becomes the title,
- otherwise the file name. A .zip (up to 100 MB) is read as a Notion export, Markdown &
- CSV or HTML: its page tree, links between its pages, images and files are kept, and
- each database becomes a page listing its rows with the row pages under it. At most 20
- files and 2000 pages at once. Content is reduced to what the editor supports; scripts
- and styles are dropped. The response lists the pages created at the parent's level.
+ otherwise the file name. A .csv (up to 5 MB) becomes a page with a database, or, when
+ it is a Readwise export, a "Readwise" page with a page of highlights per book. A .mht or
+ .mhtml web archive (up to 100 MB; OneNote's "Single File Web Page" export) becomes a page
+ per page it holds, with its images. A .zip (up to 100 MB) is read as a Notion export
+ (Markdown & CSV or HTML; each database becomes a page listing its rows with the row pages
+ under it) or as a folder of Markdown notes: an Obsidian vault, Bear TextBundles, or any
+ Markdown with its images, Docwell's own space export included. Folders become pages
+ (a note named like its folder is that page), [[wikilinks]] and ![[embeds]] are found by
+ name, YAML front matter becomes properties (made when missing) and tags, and #tags are
+ added to the page's tags. A Bear backup (.bear2bk) is read the same way. Page trees,
+ links between pages, images and files are kept. At most 20 files and 2000 pages at once.
+ Content is reduced to what the editor supports; scripts and styles are dropped. The
+ response lists the pages created at the parent's level.
security: [{ bearer: [] }]
requestBody:
required: true
@@ -2556,6 +2619,107 @@ paths:
schema: { $ref: "#/components/schemas/Collection" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
+ /api/v1/calendars:
+ get:
+ operationId: listCalendars
+ tags: [calendars]
+ summary: The caller's calendar subscriptions (passwords are never returned)
+ security: [{ bearer: [] }]
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema: { type: array, items: { $ref: "#/components/schemas/CalendarAccount" } }
+ "404": { $ref: "#/components/responses/Error" }
+ post:
+ operationId: createCalendar
+ tags: [calendars]
+ summary: Subscribe to an iCalendar feed or a CalDAV account (read once first, to check it)
+ description: >-
+ kind "ics" reads an .ics or webcal:// address (Google Calendar's secret address in iCal
+ format, Outlook's published calendar, any feed), with an optional user name and password.
+ kind "caldav" reads a CalDAV calendar, or every event calendar of the account when the
+ address is the server or the account's home (Nextcloud, iCloud with an app password,
+ Fastmail…). Addresses follow the webhook rules: loopback and link-local addresses are
+ refused unless DOCWELL_WEBHOOKS_ALLOW_LOCAL is on. At most 20 calendars per person.
+ security: [{ bearer: [] }]
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/CalendarAccountInput" }
+ responses:
+ "201":
+ description: Created
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/CalendarAccount" }
+ "400": { $ref: "#/components/responses/Error" }
+ /api/v1/calendars/{id}:
+ parameters:
+ - { name: id, in: path, required: true, schema: { type: string } }
+ patch:
+ operationId: updateCalendar
+ tags: [calendars]
+ summary: Rename, recolour, turn off or change the address or sign-in of a calendar
+ security: [{ bearer: [] }]
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/CalendarAccountInput" }
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/CalendarAccount" }
+ "400": { $ref: "#/components/responses/Error" }
+ "404": { $ref: "#/components/responses/Error" }
+ delete:
+ operationId: deleteCalendar
+ tags: [calendars]
+ summary: Remove a calendar subscription
+ security: [{ bearer: [] }]
+ responses:
+ "204": { description: Deleted }
+ "404": { $ref: "#/components/responses/Error" }
+ /api/v1/calendars/{id}/refresh:
+ parameters:
+ - { name: id, in: path, required: true, schema: { type: string } }
+ post:
+ operationId: refreshCalendar
+ tags: [calendars]
+ summary: Read a calendar from its source now (events are otherwise kept for 15 minutes)
+ security: [{ bearer: [] }]
+ responses:
+ "200":
+ description: The calendar with its new sync time or error
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/CalendarAccount" }
+ "404": { $ref: "#/components/responses/Error" }
+ /api/v1/calendar/events:
+ get:
+ operationId: listCalendarEvents
+ tags: [calendars]
+ summary: The caller's events between two days, from their enabled calendars
+ description: >-
+ Repeating events are expanded, changed and cancelled occurrences applied. All-day events
+ come first. A calendar that cannot be read is left out (its lastError says why).
+ security: [{ bearer: [] }]
+ parameters:
+ - { name: from, in: query, required: true, schema: { type: string, format: date } }
+ - { name: to, in: query, required: true, description: Inclusive; at most 92 days after from, schema: { type: string, format: date } }
+ - { name: tz, in: query, description: "IANA time zone the days are in (default UTC)", schema: { type: string } }
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema: { type: array, items: { $ref: "#/components/schemas/CalendarEvent" } }
+ "400": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/journals:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
@@ -4420,6 +4584,46 @@ components:
What a value looks like: text and link a string, number a number, checkbox a
boolean, date "YYYY-MM-DD", select an option id, multi_select a list of option
ids, member a list of user ids.
+ CalendarAccount:
+ type: object
+ required: [id, name, kind, url, username, hasPassword, color, enabled, lastSync, lastError, events, created]
+ properties:
+ id: { type: string }
+ name: { type: string }
+ kind: { type: string, enum: [ics, caldav] }
+ url: { type: string }
+ username: { type: string }
+ hasPassword: { type: boolean }
+ color: { $ref: "#/components/schemas/LabelColor" }
+ enabled: { type: boolean, description: Whether its events show on journal pages }
+ lastSync: { type: string, description: When the source was last read }
+ lastError: { type: string, description: Why the last read failed; empty when it worked }
+ events: { type: integer, description: Events the source held then (repeating ones once) }
+ created: { type: string }
+ CalendarAccountInput:
+ type: object
+ properties:
+ name: { type: string, maxLength: 80 }
+ kind: { type: string, enum: [ics, caldav] }
+ url: { type: string, maxLength: 2000, description: "http, https or webcal address" }
+ username: { type: string, maxLength: 200 }
+ password: { type: string, maxLength: 1000, description: Empty keeps the stored one }
+ clearPassword: { type: boolean }
+ color: { $ref: "#/components/schemas/LabelColor" }
+ enabled: { type: boolean }
+ CalendarEvent:
+ type: object
+ required: [id, calendar, title, location, url, start, end, allDay, color]
+ properties:
+ id: { type: string }
+ calendar: { type: string, description: The calendar account's id }
+ title: { type: string }
+ location: { type: string }
+ url: { type: string }
+ start: { type: string, description: "RFC 3339 time, or a date (YYYY-MM-DD) for all-day events" }
+ end: { type: string, description: "Exclusive; a date for all-day events" }
+ allDay: { type: boolean }
+ color: { $ref: "#/components/schemas/LabelColor" }
LabelColor:
type: string
enum: ["", gray, red, orange, yellow, green, teal, blue, purple, pink]
diff --git a/package-lock.json b/package-lock.json
index 80cdb74..533df7e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,8 @@
"Server/admin",
"Web-App/frontend",
"Desktop-App/frontend",
- "Docs-Site"
+ "Docs-Site",
+ "Web-Clipper"
],
"devDependencies": {
"@eslint/js": "^10.0.1",
@@ -735,6 +736,10 @@
"resolved": "Web-App/frontend",
"link": true
},
+ "node_modules/@docwell/web-clipper": {
+ "resolved": "Web-Clipper",
+ "link": true
+ },
"node_modules/@eslint-community/eslint-utils": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz",
@@ -1461,6 +1466,21 @@
"langium": "3.3.1"
}
},
+ "node_modules/@mixmark-io/domino": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@mixmark-io/domino/-/domino-2.2.0.tgz",
+ "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==",
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/@mozilla/readability": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@mozilla/readability/-/readability-0.6.0.tgz",
+ "integrity": "sha512-juG5VWh4qAivzTAeMzvY9xs9HY5rAcr2E4I7tiSSCokRFi7XIZCAu92ZkSTsIj1OPceCifL3cpfteP3pDT9/QQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
"node_modules/@napi-rs/canvas": {
"version": "0.1.100",
"resolved": "https://registry.npmjs.org/@napi-rs/canvas/-/canvas-0.1.100.tgz",
@@ -4230,6 +4250,16 @@
"assertion-error": "^2.0.1"
}
},
+ "node_modules/@types/chrome": {
+ "version": "0.3.7",
+ "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.3.7.tgz",
+ "integrity": "sha512-jWZgbHqWbTL1a5+PoyN0OJutNyejWgyZ5MdcvKo6iJE1TNRtXR3FxsC4WzNl52yZWPidfWC8NV/VUNZf+OFKcA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/har-format": "*"
+ }
+ },
"node_modules/@types/d3": {
"version": "7.4.3",
"resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz",
@@ -4509,6 +4539,13 @@
"integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==",
"license": "MIT"
},
+ "node_modules/@types/har-format": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.16.tgz",
+ "integrity": "sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/hast": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.5.tgz",
@@ -4575,6 +4612,13 @@
"license": "MIT",
"optional": true
},
+ "node_modules/@types/turndown": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/@types/turndown/-/turndown-5.0.6.tgz",
+ "integrity": "sha512-ru00MoyeeouE5BX4gRL+6m/BsDfbRayOskWqUvh7CLGW+UXxHQItqALa38kKnOiZPqJrtzJUgAC2+F0rL1S4Pg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/unist": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
@@ -7116,6 +7160,12 @@
"node": "^22.13.0 || >=24.0.0"
}
},
+ "node_modules/html-to-image": {
+ "version": "1.11.13",
+ "resolved": "https://registry.npmjs.org/html-to-image/-/html-to-image-1.11.13.tgz",
+ "integrity": "sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg==",
+ "license": "MIT"
+ },
"node_modules/html-void-elements": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz",
@@ -9660,6 +9710,25 @@
"zustand": "^4.3.2"
}
},
+ "node_modules/turndown": {
+ "version": "7.2.4",
+ "resolved": "https://registry.npmjs.org/turndown/-/turndown-7.2.4.tgz",
+ "integrity": "sha512-I8yFsfRzmzK0WV1pNNOA4A7y4RDfFxPRxb3t+e3ui14qSGOxGtiSP6GjeX+Y6CHb7HYaFj7ECUD7VE5kQMZWGQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@mixmark-io/domino": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=18",
+ "npm": ">=9"
+ }
+ },
+ "node_modules/turndown-plugin-gfm": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/turndown-plugin-gfm/-/turndown-plugin-gfm-1.0.2.tgz",
+ "integrity": "sha512-vwz9tfvF7XN/jE0dGoBei3FXWuvll78ohzCZQuOb+ZjWrs3a0XhQVomJEb2Qh4VHTPNRO4GPZh0V7VRbiWwkRg==",
+ "license": "MIT"
+ },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -11667,6 +11736,7 @@
"@docwell/editor": "*",
"@docwell/ui": "*",
"dompurify": "^3.4.17",
+ "html-to-image": "^1.11.13",
"marked": "^16.4.2",
"pinia": "^4.1.0",
"vue": "^3.5.44",
@@ -11684,6 +11754,24 @@
"vitest": "^5.0.5",
"vue-tsc": "^3.3.14"
}
+ },
+ "Web-Clipper": {
+ "name": "@docwell/web-clipper",
+ "version": "0.1.0",
+ "license": "AGPL-3.0-or-later",
+ "dependencies": {
+ "@mozilla/readability": "0.6.0",
+ "turndown": "7.2.4",
+ "turndown-plugin-gfm": "1.0.2"
+ },
+ "devDependencies": {
+ "@types/chrome": "0.3.7",
+ "@types/turndown": "5.0.6",
+ "jsdom": "^30.1.3",
+ "typescript": "~5.9.3",
+ "vite": "^8.3.5",
+ "vitest": "^5.0.5"
+ }
}
}
}
diff --git a/package.json b/package.json
index 8546e5b..27e9bd7 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,8 @@
"Server/admin",
"Web-App/frontend",
"Desktop-App/frontend",
- "Docs-Site"
+ "Docs-Site",
+ "Web-Clipper"
],
"scripts": {
"build:packages": "npm run build -w @docwell/api-client",
@@ -26,7 +27,8 @@
"format": "prettier --write .",
"format:check": "prettier --check .",
"dev:docs": "npm run dev -w @docwell/docs",
- "build:docs": "npm run build -w @docwell/docs"
+ "build:docs": "npm run build -w @docwell/docs",
+ "build:clipper": "npm run build -w @docwell/web-clipper"
},
"engines": {
"node": ">=22"