Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat: add asset library and animated gif compression

tianmaf1202eef204e
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 41a60b60..155565f6 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -15,6 +15,8 @@ import {
type MemoSummary,
type Notebook,
type Resource,
+ type ResourceListItem,
+ type ResourceStorageSummary,
type TiptapDoc,
} from "@edgeever/shared";
import { zValidator } from "@hono/zod-validator";
@@ -117,6 +119,19 @@ type ResourceRow = {
updated_at: string;
};
+type ResourceListRow = ResourceRow & {
+ memo_title: string | null;
+ memo_excerpt: string | null;
+ memo_is_deleted: number | null;
+};
+
+type ResourceStatsRow = {
+ total_count: number;
+ total_bytes: number;
+ image_count: number;
+ attachment_count: number;
+};
+
type AppContext = Context<{ Bindings: Bindings; Variables: { auth: AuthContext } }>;
const SESSION_COOKIE = "edgeever_session";
@@ -426,6 +441,38 @@ app.get("/api/v1/memos/:id", async (c) => {
return c.json({ memo });
});
+app.get("/api/v1/resources", async (c) => {
+ const limit = clampNumber(Number(c.req.query("limit") ?? 500), 1, 500);
+ const [rows, stats] = await Promise.all([
+ c.env.DB.prepare(
+ `SELECT r.id, r.memo_id, r.original_memo_id, r.bucket_name, r.object_key, r.kind,
+ r.mime_type, r.filename, r.byte_size, r.sha256, r.width, r.height,
+ r.created_at, r.updated_at, m.title AS memo_title, m.excerpt AS memo_excerpt,
+ m.is_deleted AS memo_is_deleted
+ FROM resources r
+ LEFT JOIN memos m ON m.id = r.memo_id
+ WHERE r.is_deleted = 0
+ ORDER BY r.created_at DESC
+ LIMIT ?`
+ )
+ .bind(limit)
+ .all<ResourceListRow>(),
+ c.env.DB.prepare(
+ `SELECT COUNT(*) AS total_count,
+ COALESCE(SUM(byte_size), 0) AS total_bytes,
+ COALESCE(SUM(CASE WHEN kind = 'image' THEN 1 ELSE 0 END), 0) AS image_count,
+ COALESCE(SUM(CASE WHEN kind = 'attachment' THEN 1 ELSE 0 END), 0) AS attachment_count
+ FROM resources
+ WHERE is_deleted = 0`
+ ).first<ResourceStatsRow>(),
+ ]);
+
+ return c.json({
+ resources: rows.results.map(mapResourceListItem),
+ summary: mapResourceStorageSummary(stats),
+ });
+});
+
app.post("/api/v1/memos/:id/resources", async (c) => {
const memoId = c.req.param("id");
const memo = await getMemoDetail(c.env.DB, memoId);
@@ -1125,6 +1172,20 @@ const mapResource = (row: ResourceRow): Resource => ({
url: `/api/v1/resources/${row.id}/blob`,
});
+const mapResourceListItem = (row: ResourceListRow): ResourceListItem => ({
+ ...mapResource(row),
+ memoTitle: row.memo_title,
+ memoExcerpt: row.memo_excerpt,
+ memoDeleted: Boolean(row.memo_is_deleted),
+});
+
+const mapResourceStorageSummary = (row: ResourceStatsRow | null): ResourceStorageSummary => ({
+ totalCount: row?.total_count ?? 0,
+ totalBytes: row?.total_bytes ?? 0,
+ imageCount: row?.image_count ?? 0,
+ attachmentCount: row?.attachment_count ?? 0,
+});
+
const getNotebook = async (db: D1Database, id: string): Promise<Notebook | null> => {
const row = await db
.prepare(
diff --git a/apps/web/src/app/App.tsx b/apps/web/src/app/App.tsx
index c26c1088..2e4cddca 100644
--- a/apps/web/src/app/App.tsx
+++ b/apps/web/src/app/App.tsx
@@ -9,8 +9,12 @@ import {
CheckSquare,
ChevronDown,
ChevronRight,
+ ExternalLink,
+ File as FileIcon,
FilePlus2,
Folder,
+ HardDrive,
+ ImageIcon,
Inbox,
LayoutList,
LockKeyhole,
@@ -24,6 +28,7 @@ import {
Sparkles,
Tags,
Trash2,
+ X,
} from "lucide-react";
import { useCallback, useEffect, useMemo, useRef, useState, type FormEvent, type MouseEvent } from "react";
import { api } from "@/lib/api";
@@ -121,6 +126,7 @@ const WorkspaceApp = ({
const [selectedMemoIds, setSelectedMemoIds] = useState<Set<string>>(new Set());
const [multiSelectKeyDown, setMultiSelectKeyDown] = useState(false);
const [imageCompressionEnabled, setImageCompressionEnabled] = useState(readImageCompressionPreference);
+ const [assetsOpen, setAssetsOpen] = useState(false);
const [search, setSearch] = useState("");
const notebooksQuery = useQuery({
@@ -290,6 +296,7 @@ const WorkspaceApp = ({
isLoggingOut={isLoggingOut}
imageCompressionEnabled={imageCompressionEnabled}
onImageCompressionChange={setImageCompressionEnabled}
+ onOpenAssets={() => setAssetsOpen(true)}
/>
</aside>
@@ -343,6 +350,7 @@ const WorkspaceApp = ({
</section>
</main>
</div>
+ {assetsOpen ? <AssetsDialog onClose={() => setAssetsOpen(false)} /> : null}
</div>
);
};
@@ -465,6 +473,7 @@ const NotebookPane = ({
isLoggingOut,
imageCompressionEnabled,
onImageCompressionChange,
+ onOpenAssets,
}: {
authRequired: boolean;
user: AuthUser | null;
@@ -478,6 +487,7 @@ const NotebookPane = ({
isLoggingOut: boolean;
imageCompressionEnabled: boolean;
onImageCompressionChange: (enabled: boolean) => void;
+ onOpenAssets: () => void;
}) => {
const tree = useMemo(() => buildNotebookTree(notebooks), [notebooks]);
@@ -538,7 +548,7 @@ const NotebookPane = ({
<Button size="icon" variant="ghost" title="标签">
<Tags className="h-4 w-4" />
</Button>
- <Button size="icon" variant="ghost" title="资产">
+ <Button size="icon" variant="ghost" title="资产" onClick={onOpenAssets}>
<Archive className="h-4 w-4" />
</Button>
<Button size="icon" variant="ghost" title="设置">
@@ -861,6 +871,99 @@ const getImageFilesFromDataTransfer = (dataTransfer: DataTransfer | null) => {
return files.filter((file) => SUPPORTED_PASTE_IMAGE_TYPES.has(file.type));
};
+const AssetsDialog = ({ onClose }: { onClose: () => void }) => {
+ const resourcesQuery = useQuery({
+ queryKey: ["resources"],
+ queryFn: () => api.listResources(),
+ });
+ const resources = resourcesQuery.data?.resources ?? [];
+ const summary = resourcesQuery.data?.summary ?? {
+ totalCount: 0,
+ totalBytes: 0,
+ imageCount: 0,
+ attachmentCount: 0,
+ };
+
+ return (
+ <div className="fixed inset-0 z-50 flex items-end bg-slate-950/35 p-0 sm:items-center sm:justify-center sm:p-6">
+ <section className="flex max-h-[88dvh] w-full flex-col rounded-t-md bg-white shadow-panel sm:max-w-[760px] sm:rounded-md">
+ <header className="flex shrink-0 items-center justify-between gap-3 border-b border-emerald-100 px-4 py-3 sm:px-5">
+ <div className="min-w-0">
+ <div className="flex items-center gap-2 text-base font-semibold text-slate-950">
+ <Archive className="h-4 w-4 text-emerald-700" />
+ 附件
+ </div>
+ <div className="mt-1 flex flex-wrap items-center gap-2 text-xs text-slate-500">
+ <span className="inline-flex items-center gap-1">
+ <HardDrive className="h-3.5 w-3.5" />
+ {formatBytes(summary.totalBytes)}
+ </span>
+ <span>{summary.totalCount} files</span>
+ <span>{summary.imageCount} images</span>
+ </div>
+ </div>
+ <Button size="icon" variant="ghost" title="关闭" onClick={onClose}>
+ <X className="h-4 w-4" />
+ </Button>
+ </header>
+
+ <div className="min-h-0 flex-1 overflow-y-auto p-3 sm:p-4">
+ {resourcesQuery.isLoading ? (
+ <div className="px-2 py-8 text-center text-sm text-slate-500">加载中</div>
+ ) : resources.length === 0 ? (
+ <div className="rounded-md border border-dashed border-slate-300 px-4 py-8 text-center text-sm text-slate-500">
+ 暂无附件
+ </div>
+ ) : (
+ <div className="space-y-2">
+ {resources.map((resource) => (
+ <a
+ key={resource.id}
+ className="flex min-h-16 items-center gap-3 rounded-md border border-emerald-100 bg-emerald-50/30 px-3 py-2 text-left transition hover:border-emerald-200 hover:bg-emerald-50"
+ href={resource.url}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <span className="flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-emerald-100 bg-white text-emerald-700">
+ {resource.kind === "image" ? <ImageIcon className="h-5 w-5" /> : <FileIcon className="h-5 w-5" />}
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-sm font-medium text-slate-950">
+ {resource.filename || resource.id}
+ </span>
+ <span className="mt-1 block truncate text-xs text-slate-500">
+ {formatBytes(resource.byteSize)} · {resource.mimeType ?? resource.kind} ·{" "}
+ {formatDateTime(resource.createdAt)}
+ </span>
+ <span className="mt-1 block truncate text-xs text-slate-400">
+ {resource.memoDeleted
+ ? "已删除笔记"
+ : resource.memoTitle || resource.memoExcerpt || resource.memoId}
+ </span>
+ </span>
+ <ExternalLink className="h-4 w-4 shrink-0 text-slate-400" />
+ </a>
+ ))}
+ </div>
+ )}
+ </div>
+ </section>
+ </div>
+ );
+};
+
+const formatBytes = (bytes: number) => {
+ if (!Number.isFinite(bytes) || bytes <= 0) {
+ return "0 B";
+ }
+
+ const units = ["B", "KB", "MB", "GB", "TB"];
+ const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
+ const value = bytes / 1024 ** exponent;
+
+ return `${exponent === 0 ? value.toFixed(0) : value.toFixed(value >= 10 ? 1 : 2)} ${units[exponent]}`;
+};
+
const EditorPane = ({
memo,
notebooks,
@@ -878,6 +981,7 @@ const EditorPane = ({
onSaved: (memo: MemoDetail) => Promise<void>;
onDeleted: (memoId: string) => Promise<void>;
}) => {
+ const queryClient = useQueryClient();
const [title, setTitle] = useState("");
const [tagsText, setTagsText] = useState("");
const [saveState, setSaveState] = useState<"idle" | "saving" | "saved">("idle");
@@ -906,6 +1010,7 @@ const EditorPane = ({
setImageUploadState("uploading");
const { resource } = await api.uploadMemoResource(targetMemoId, uploadFile);
+ void queryClient.invalidateQueries({ queryKey: ["resources"] });
if (memoRef.current?.id !== targetMemoId || !editorRef.current) {
setImageUploadState("idle");
@@ -929,7 +1034,7 @@ const EditorPane = ({
window.setTimeout(() => setImageUploadState("idle"), 2200);
}
})();
- }, []);
+ }, [queryClient]);
const editor = useEditor({
extensions: [
StarterKit,
diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts
index 9fdbbcea..a312046f 100644
--- a/apps/web/src/lib/api.ts
+++ b/apps/web/src/lib/api.ts
@@ -1,4 +1,13 @@
-import type { AuthSession, MemoDetail, MemoSummary, Notebook, Resource, TiptapDoc } from "@edgeever/shared";
+import type {
+ AuthSession,
+ MemoDetail,
+ MemoSummary,
+ Notebook,
+ Resource,
+ ResourceListItem,
+ ResourceStorageSummary,
+ TiptapDoc,
+} from "@edgeever/shared";
type ListNotebooksResponse = {
notebooks: Notebook[];
@@ -8,6 +17,11 @@ type ListMemosResponse = {
memos: MemoSummary[];
};
+type ListResourcesResponse = {
+ resources: ResourceListItem[];
+ summary: ResourceStorageSummary;
+};
+
type MemoResponse = {
memo: MemoDetail;
};
@@ -108,6 +122,8 @@ export const api = {
getMemo: (memoId: string) => request<MemoResponse>(`/api/v1/memos/${memoId}`),
+ listResources: () => request<ListResourcesResponse>("/api/v1/resources"),
+
uploadMemoResource: (memoId: string, file: File) => {
const form = new FormData();
form.append("file", file);
diff --git a/apps/web/src/lib/image-compression.ts b/apps/web/src/lib/image-compression.ts
index 03d60061..48de3ee4 100644
--- a/apps/web/src/lib/image-compression.ts
+++ b/apps/web/src/lib/image-compression.ts
@@ -1,8 +1,14 @@
-const COMPRESSIBLE_IMAGE_TYPES = new Set(["image/png", "image/jpeg", "image/webp", "image/avif"]);
+import type { ParsedFrame } from "gifuct-js";
+import type { WebPAnimationFrame } from "wasm-webp";
+
+const COMPRESSIBLE_IMAGE_TYPES = new Set(["image/png", "image/jpeg", "image/webp", "image/avif", "image/gif"]);
const COMPRESSED_IMAGE_TYPE = "image/webp";
const COMPRESSED_IMAGE_EXTENSION = ".webp";
const MAX_COMPRESSED_IMAGE_EDGE = 2560;
const IMAGE_COMPRESSION_QUALITY = 0.82;
+const ANIMATED_IMAGE_COMPRESSION_QUALITY = 76;
+const MAX_ANIMATED_GIF_FRAMES = 320;
+const MIN_ANIMATION_FRAME_DURATION_MS = 20;
export type ImageCompressionResult = {
file: File;
@@ -17,6 +23,10 @@ export const compressImageForUpload = async (file: File): Promise<ImageCompressi
}
try {
+ if (file.type === "image/gif") {
+ return compressAnimatedGifForUpload(file);
+ }
+
const image = await loadImage(file);
const width = image.naturalWidth;
const height = image.naturalHeight;
@@ -58,6 +68,124 @@ export const compressImageForUpload = async (file: File): Promise<ImageCompressi
}
};
+const compressAnimatedGifForUpload = async (file: File): Promise<ImageCompressionResult> => {
+ const [{ parseGIF, decompressFrames }, { encodeAnimation }] = await Promise.all([
+ import("gifuct-js"),
+ import("wasm-webp"),
+ ]);
+ const parsedGif = parseGIF(await file.arrayBuffer());
+ const frames = decompressFrames(parsedGif, true);
+
+ if (frames.length === 0 || frames.length > MAX_ANIMATED_GIF_FRAMES) {
+ return unchanged(file);
+ }
+
+ const sourceWidth = parsedGif.lsd.width;
+ const sourceHeight = parsedGif.lsd.height;
+
+ if (sourceWidth <= 0 || sourceHeight <= 0) {
+ return unchanged(file);
+ }
+
+ const scale = Math.min(1, MAX_COMPRESSED_IMAGE_EDGE / Math.max(sourceWidth, sourceHeight));
+ const outputWidth = Math.max(1, Math.round(sourceWidth * scale));
+ const outputHeight = Math.max(1, Math.round(sourceHeight * scale));
+ const animationFrames = renderGifFramesForWebp(frames, sourceWidth, sourceHeight, outputWidth, outputHeight);
+
+ if (animationFrames.length === 0) {
+ return unchanged(file);
+ }
+
+ const data = await encodeAnimation(outputWidth, outputHeight, true, animationFrames);
+
+ if (!data || data.byteLength >= file.size) {
+ return unchanged(file);
+ }
+
+ const blob = new Blob([toArrayBuffer(data)], { type: COMPRESSED_IMAGE_TYPE });
+
+ return {
+ file: new File([blob], toCompressedFilename(file.name), {
+ type: COMPRESSED_IMAGE_TYPE,
+ lastModified: file.lastModified,
+ }),
+ compressed: true,
+ originalSize: file.size,
+ outputSize: blob.size,
+ };
+};
+
+const renderGifFramesForWebp = (
+ frames: ParsedFrame[],
+ sourceWidth: number,
+ sourceHeight: number,
+ outputWidth: number,
+ outputHeight: number
+): WebPAnimationFrame[] => {
+ const gifCanvas = document.createElement("canvas");
+ gifCanvas.width = sourceWidth;
+ gifCanvas.height = sourceHeight;
+ const gifContext = gifCanvas.getContext("2d", { alpha: true });
+ const patchCanvas = document.createElement("canvas");
+ const patchContext = patchCanvas.getContext("2d", { alpha: true });
+ const outputCanvas = document.createElement("canvas");
+ outputCanvas.width = outputWidth;
+ outputCanvas.height = outputHeight;
+ const outputContext = outputCanvas.getContext("2d", { alpha: true });
+
+ if (!gifContext || !patchContext || !outputContext) {
+ return [];
+ }
+
+ const outputFrames: WebPAnimationFrame[] = [];
+
+ for (const frame of frames) {
+ const previousFrame =
+ frame.disposalType === 3 ? gifContext.getImageData(0, 0, sourceWidth, sourceHeight) : null;
+
+ drawGifPatch(frame, patchCanvas, patchContext, gifContext);
+
+ outputContext.clearRect(0, 0, outputWidth, outputHeight);
+ outputContext.drawImage(gifCanvas, 0, 0, outputWidth, outputHeight);
+
+ const imageData = outputContext.getImageData(0, 0, outputWidth, outputHeight);
+ outputFrames.push({
+ data: new Uint8Array(imageData.data),
+ duration: Math.max(frame.delay || 100, MIN_ANIMATION_FRAME_DURATION_MS),
+ config: {
+ lossless: 0,
+ quality: ANIMATED_IMAGE_COMPRESSION_QUALITY,
+ },
+ });
+
+ if (frame.disposalType === 2) {
+ gifContext.clearRect(frame.dims.left, frame.dims.top, frame.dims.width, frame.dims.height);
+ } else if (previousFrame) {
+ gifContext.putImageData(previousFrame, 0, 0);
+ }
+ }
+
+ return outputFrames;
+};
+
+const drawGifPatch = (
+ frame: ParsedFrame,
+ patchCanvas: HTMLCanvasElement,
+ patchContext: CanvasRenderingContext2D,
+ gifContext: CanvasRenderingContext2D
+) => {
+ const { dims } = frame;
+
+ patchCanvas.width = dims.width;
+ patchCanvas.height = dims.height;
+ patchContext.clearRect(0, 0, dims.width, dims.height);
+ patchContext.putImageData(new ImageData(new Uint8ClampedArray(toArrayBuffer(frame.patch)), dims.width, dims.height), 0, 0);
+ gifContext.drawImage(patchCanvas, dims.left, dims.top);
+};
+
+const toArrayBuffer = (bytes: Uint8Array | Uint8ClampedArray) =>
+ bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
+
const unchanged = (file: File): ImageCompressionResult => ({
file,
compressed: false,
diff --git a/bun.lock b/bun.lock
index 1824cc29..035967b9 100644
--- a/bun.lock
+++ b/bun.lock
@@ -15,11 +15,13 @@
"class-variance-authority": "latest",
"clsx": "latest",
"dexie": "latest",
+ "gifuct-js": "^2.1.2",
"hono": "latest",
"lucide-react": "latest",
"react": "latest",
"react-dom": "latest",
"tailwind-merge": "latest",
+ "wasm-webp": "^0.1.0",
"zod": "latest",
},
"devDependencies": {
@@ -415,6 +417,8 @@
"get-east-asian-width": ["[email protected]", "", {}, "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA=="],
+ "gifuct-js": ["[email protected]", "", { "dependencies": { "js-binary-schema-parser": "^2.0.3" } }, "sha512-rI2asw77u0mGgwhV3qA+OEgYqaDn5UNqgs+Bx0FGwSpuqfYn+Ir6RQY5ENNQ8SbIiG/m5gVa7CD5RriO4f4Lsg=="],
+
"glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],
"hasown": ["[email protected]", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A=="],
@@ -433,6 +437,8 @@
"jiti": ["[email protected]", "", { "bin": { "jiti": "bin/jiti.js" } }, "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A=="],
+ "js-binary-schema-parser": ["[email protected]", "", {}, "sha512-xezGJmOb4lk/M1ZZLTR/jaBHQ4gG/lqQnJqdIv4721DMggsa1bDVlHXNeHYogaIEHD9vCRv0fcL4hMA+Coarkg=="],
+
"kleur": ["[email protected]", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],
"lightningcss": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="],
@@ -619,6 +625,8 @@
"w3c-keyname": ["[email protected]", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="],
+ "wasm-webp": ["[email protected]", "", {}, "sha512-Z1Sop+mLKogzDK3vJzSPfSxRF1yj/zbmn+XJuU9+7fvarxcuGhGkeLBqJr5H8LdgWuAwEKuZelCzx7ujztfhVQ=="],
+
"workerd": ["[email protected]", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20260625.1", "@cloudflare/workerd-darwin-arm64": "1.20260625.1", "@cloudflare/workerd-linux-64": "1.20260625.1", "@cloudflare/workerd-linux-arm64": "1.20260625.1", "@cloudflare/workerd-windows-64": "1.20260625.1" }, "bin": { "workerd": "bin/workerd" } }, "sha512-GApQvFX52SDM6L4u0+RRnUDB1wJOnEwoXjinkmOPtIyofWBxrlZckdegJSYc1leg++lLZ3+DQ4zMVmBqYVtzfA=="],
"wrangler": ["[email protected]", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.5.0", "@cloudflare/unenv-preset": "2.16.1", "blake3-wasm": "2.1.5", "esbuild": "0.28.1", "miniflare": "4.20260625.0", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.24", "workerd": "1.20260625.1" }, "optionalDependencies": { "fsevents": "2.3.3" }, "peerDependencies": { "@cloudflare/workers-types": "^4.20260625.1" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "cf-wrangler": "bin/cf-wrangler.js", "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js" } }, "sha512-7dXFH6OLj1Fv0y6ZeRPUxFTkp+duWD7/xxVi/1c0vfOeEYwIFKWB7cdqnY05DvY1Ta3BnqAwRkXfLs8PDj538g=="],
diff --git a/package.json b/package.json
index 52045183..9e0475b1 100644
--- a/package.json
+++ b/package.json
@@ -44,11 +44,13 @@
"class-variance-authority": "latest",
"clsx": "latest",
"dexie": "latest",
+ "gifuct-js": "^2.1.2",
"hono": "latest",
"lucide-react": "latest",
"react": "latest",
"react-dom": "latest",
"tailwind-merge": "latest",
+ "wasm-webp": "^0.1.0",
"zod": "latest"
},
"devDependencies": {
diff --git a/packages/shared/src/types.ts b/packages/shared/src/types.ts
index 696035a6..834b0e5f 100644
--- a/packages/shared/src/types.ts
+++ b/packages/shared/src/types.ts
@@ -52,6 +52,19 @@ export type Resource = {
url: string;
};
+export type ResourceListItem = Resource & {
+ memoTitle: string | null;
+ memoExcerpt: string | null;
+ memoDeleted: boolean;
+};
+
+export type ResourceStorageSummary = {
+ totalCount: number;
+ totalBytes: number;
+ imageCount: number;
+ attachmentCount: number;
+};
+
export type AuthUser = {
id: string;
username: string;