diff options
| author | enkei64 <imenkei64@gmail.com> | 2025-08-15 10:11:21 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-15 02:11:21 +0200 |
| commit | c3f3345d7b1ac820b411a5adbca3172378642953 (patch) | |
| tree | 6d80ca38eb908574ab97a2b1e1d30166a72b8b76 /apps/web/src/lib/storage | |
| parent | defff2fc46978072f2ead822cf8bbd34f7629192 (diff) | |
| download | opencut-c3f3345d7b1ac820b411a5adbca3172378642953.tar.gz | |
feat: stickers panel (#539)
* Stickers panel base complete
* Improve dark mode stickers background for visibility
* Prevent stickers from being too small or too big
* Improve UI, added credit for Iconify API
* Allow manually loading more collections
* Add a maximum width of 200px so stickers aren't too big
* cleanup
* style: hover state of button
* refactor: input component
* fix: mark input component as client
* so much stuff
---------
Co-authored-by: Maze Winther <mazewinther@gmail.com>
Diffstat (limited to 'apps/web/src/lib/storage')
| -rw-r--r-- | apps/web/src/lib/storage/storage-service.ts | 21 | ||||
| -rw-r--r-- | apps/web/src/lib/storage/types.ts | 2 |
2 files changed, 20 insertions, 3 deletions
diff --git a/apps/web/src/lib/storage/storage-service.ts b/apps/web/src/lib/storage/storage-service.ts index 00d60c47..b3376a5f 100644 --- a/apps/web/src/lib/storage/storage-service.ts +++ b/apps/web/src/lib/storage/storage-service.ts @@ -142,6 +142,7 @@ class StorageService { width: mediaItem.width, height: mediaItem.height, duration: mediaItem.duration, + ephemeral: mediaItem.ephemeral, }; await mediaMetadataAdapter.set(mediaItem.id, metadata); @@ -161,8 +162,22 @@ class StorageService { if (!file || !metadata) return null; - // Create new object URL for the file - const url = URL.createObjectURL(file); + let url: string; + if (metadata.type === "image" && (!file.type || file.type === "")) { + try { + const text = await file.text(); + if (text.trim().startsWith("<svg")) { + const svgBlob = new Blob([text], { type: "image/svg+xml" }); + url = URL.createObjectURL(svgBlob); + } else { + url = URL.createObjectURL(file); + } + } catch { + url = URL.createObjectURL(file); + } + } else { + url = URL.createObjectURL(file); + } return { id: metadata.id, @@ -173,7 +188,7 @@ class StorageService { width: metadata.width, height: metadata.height, duration: metadata.duration, - // thumbnailUrl would need to be regenerated or cached separately + ephemeral: metadata.ephemeral, }; } diff --git a/apps/web/src/lib/storage/types.ts b/apps/web/src/lib/storage/types.ts index 127b1690..8f593867 100644 --- a/apps/web/src/lib/storage/types.ts +++ b/apps/web/src/lib/storage/types.ts @@ -18,6 +18,8 @@ export interface MediaFileData { width?: number; height?: number; duration?: number; + ephemeral?: boolean; + sourceStickerIconName?: string; // File will be stored separately in OPFS } |
