diff options
| author | Evan Sharp <evan@packetmonkey.org> | 2025-08-22 10:00:26 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-22 11:00:26 +0100 |
| commit | f1662b820f45a7ee89503448fc6a77085e87dc64 (patch) | |
| tree | 65f6411b57d32d814f5e9a607395a52dbe52837d | |
| parent | 7bdc8b2c3e6a21a773f713e61957ef388fc7439e (diff) | |
| download | karakeep-f1662b820f45a7ee89503448fc6a77085e87dc64.tar.zst | |
feat: Support video uploads and attachments (#1847)
This commit allows the following mime types to be uploaded and attached
as video assets on bookmarks.
- video/mp4
- video/webm
- video/x-matroska
| -rw-r--r-- | packages/shared/assetdb.ts | 10 | ||||
| -rw-r--r-- | packages/trpc/lib/attachments.ts | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/packages/shared/assetdb.ts b/packages/shared/assetdb.ts index 7653ca15..7eda80ef 100644 --- a/packages/shared/assetdb.ts +++ b/packages/shared/assetdb.ts @@ -26,9 +26,18 @@ export const enum ASSET_TYPES { IMAGE_WEBP = "image/webp", APPLICATION_PDF = "application/pdf", TEXT_HTML = "text/html", + VIDEO_MP4 = "video/mp4", + VIDEO_WEBM = "video/webm", + VIDEO_MKV = "video/x-matroska", } +export const VIDEO_ASSET_TYPES: Set<string> = new Set<string>([ + ASSET_TYPES.VIDEO_MP4, + ASSET_TYPES.VIDEO_WEBM, + ASSET_TYPES.VIDEO_MKV, +]); + export const IMAGE_ASSET_TYPES: Set<string> = new Set<string>([ ASSET_TYPES.IMAGE_JPEG, ASSET_TYPES.IMAGE_PNG, @@ -38,6 +47,7 @@ export const IMAGE_ASSET_TYPES: Set<string> = new Set<string>([ // The assets that we allow the users to upload export const SUPPORTED_UPLOAD_ASSET_TYPES: Set<string> = new Set<string>([ ...IMAGE_ASSET_TYPES, + ...VIDEO_ASSET_TYPES, ASSET_TYPES.TEXT_HTML, ASSET_TYPES.APPLICATION_PDF, ]); diff --git a/packages/trpc/lib/attachments.ts b/packages/trpc/lib/attachments.ts index e886b821..af484462 100644 --- a/packages/trpc/lib/attachments.ts +++ b/packages/trpc/lib/attachments.ts @@ -60,7 +60,7 @@ export function isAllowedToAttachAsset(type: ZAssetType) { fullPageArchive: false, precrawledArchive: true, bannerImage: true, - video: false, + video: true, bookmarkAsset: false, linkHtmlContent: false, unknown: false, |
