π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Keep Space video helpers private
Anand Baburajan56cd8cdae507
diff --git a/web/apps/space/src/utils/post-video.ts b/web/apps/space/src/utils/post-video.tsindex 3435b0232f..baed5bc577 100644--- a/web/apps/space/src/utils/post-video.ts+++ b/web/apps/space/src/utils/post-video.ts@@ -22,7 +22,7 @@ export interface SpaceVideoInfo {export const maxSpaceVideoDuration = 10;-export const useSoftwareVideoFrames = () =>+const useSoftwareVideoFrames = () =>navigator.userAgent.includes("Android") &&navigator.userAgent.includes("Firefox/");@@ -76,7 +76,7 @@ const waitForVideo = (if (signal?.aborted) abort();});-export const openSpaceVideo = async (file: Blob, signal?: AbortSignal) => {+const openSpaceVideo = async (file: Blob, signal?: AbortSignal) => {signal?.throwIfAborted();const video = document.createElement("video");const url = URL.createObjectURL(file);@@ -101,7 +101,7 @@ export const openSpaceVideo = async (file: Blob, signal?: AbortSignal) => {}};-export const seekSpaceVideo = async (+const seekSpaceVideo = async (video: HTMLVideoElement,time: number,signal?: AbortSignal,diff --git a/web/apps/space/tests/video-cover.test.ts b/web/apps/space/tests/video-cover.test.tsindex 98a414c285..35487d9bc8 100644--- a/web/apps/space/tests/video-cover.test.ts+++ b/web/apps/space/tests/video-cover.test.ts@@ -3,7 +3,6 @@ import {spaceVideoCover,spaceVideoFrames,spaceVideoInfo,- useSoftwareVideoFrames,} from "../src/utils/post-video";const mocks = vi.hoisted(() => ({@@ -78,9 +77,27 @@ test.each([],])("selects software frames only for Firefox Android (%s)",- (userAgent, expected) => {+ async (userAgent, software) => {vi.stubGlobal("navigator", { userAgent });- expect(useSoftwareVideoFrames()).toBe(expected);+ if (!software) {+ vi.stubGlobal("window", { setTimeout, clearTimeout });+ const video = Object.assign(new EventTarget(), {+ duration: 3.45,+ videoWidth: 540,+ videoHeight: 960,+ currentTime: 0,+ pause: vi.fn(),+ removeAttribute: vi.fn(),+ load: () => video.dispatchEvent(new Event("loadeddata")),+ });+ createElement.mockImplementationOnce(() => video);+ }+ const file = new Blob(["video"]);+ expect(await spaceVideoFrames(file, [0], 960)).toHaveLength(1);+ expect(mocks.frames).toHaveBeenCalledTimes(software ? 1 : 0);+ expect(createElement).toHaveBeenCalledWith(+ software ? "canvas" : "video",+ );},);