Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: clear mobile app typecheck
Richie McIlroy91c99610549b
diff --git a/apps/desktop/src/routes/screenshot-editor/context.tsx b/apps/desktop/src/routes/screenshot-editor/context.tsxindex dc5710a71..3e4e8aedc 100644--- a/apps/desktop/src/routes/screenshot-editor/context.tsx+++ b/apps/desktop/src/routes/screenshot-editor/context.tsx@@ -365,7 +365,10 @@ function createScreenshotEditorContext() {setIsRenderReady(true);try {- const imageData = new ImageData(processedData, width, height);+ const imageBuffer = new ArrayBuffer(processedData.byteLength);+ const imagePixels = new Uint8ClampedArray(imageBuffer);+ imagePixels.set(processedData);+ const imageData = new ImageData(imagePixels, width, height);const bitmap = await createImageBitmap(imageData);const existing = latestFrame();if (existing?.bitmap && existing.bitmap !== bitmap) {diff --git a/apps/desktop/src/vite-env.d.ts b/apps/desktop/src/vite-env.d.tsindex 3d6189d1c..39e8621ec 100644--- a/apps/desktop/src/vite-env.d.ts+++ b/apps/desktop/src/vite-env.d.ts@@ -1,4 +1,4 @@-/// <reference types="vinxi/client" />+/// <reference types="vinxi/types/client" />interface ImportMetaEnv {readonly VITE_SERVER_URL: string;diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.jsonindex a1c4b56f2..faa3ffe3a 100644--- a/apps/desktop/tsconfig.json+++ b/apps/desktop/tsconfig.json@@ -16,7 +16,7 @@"jsxImportSource": "solid-js","types": ["vite/client",- "vinxi/client",+ "vinxi/types/client","@cap/ui-solid/types","vitest/importMeta","@webgpu/types"diff --git a/apps/web/__tests__/unit/caption-tracks.test.ts b/apps/web/__tests__/unit/caption-tracks.test.tsindex 74b208b8d..0aaf0cc97 100644--- a/apps/web/__tests__/unit/caption-tracks.test.ts+++ b/apps/web/__tests__/unit/caption-tracks.test.ts@@ -98,7 +98,7 @@ describe("bindCaptionTrackCueText", () => {cueTexts.push(text);});- video.dispatch("loadedmetadata");+ (video as unknown as FakeVideo).dispatch("loadedmetadata");textTracks.addSilently(captionTrack);trackElement.readyState = 2;trackElement.dispatch("load");diff --git a/apps/web/__tests__/unit/mp4-level-patch.test.ts b/apps/web/__tests__/unit/mp4-level-patch.test.tsindex 026f75eeb..3a15b84c8 100644--- a/apps/web/__tests__/unit/mp4-level-patch.test.ts+++ b/apps/web/__tests__/unit/mp4-level-patch.test.ts@@ -13,6 +13,12 @@ type BuiltAvcCFixture = {spsLevelOffset: number;};+const toArrayBuffer = (bytes: Uint8Array): ArrayBuffer => {+ const buffer = new ArrayBuffer(bytes.byteLength);+ new Uint8Array(buffer).set(bytes);+ return buffer;+};+function buildAvcCFixture(level: number): BuiltAvcCFixture {const prefix = [0x00, 0x00, 0x00, 0x30];const fourcc = [0x61, 0x76, 0x63, 0x43];@@ -152,7 +158,7 @@ describe("probeAvcLevelFromUrl", () => {it("reads the level from a Range response", async () => {const { bytes } = buildAvcCFixture(0x3d);const fetchImpl = vi.fn(async () => {- return new Response(bytes, {+ return new Response(toArrayBuffer(bytes), {status: 206,headers: { "content-range": `bytes 0-${bytes.byteLength - 1}/99999` },});diff --git a/apps/web/app/(site)/Footer.tsx b/apps/web/app/(site)/Footer.tsxindex a86ce383d..3c375d7bb 100644--- a/apps/web/app/(site)/Footer.tsx+++ b/apps/web/app/(site)/Footer.tsx@@ -1,7 +1,6 @@"use client";import { Logo } from "@cap/ui";-import type { IconDefinition } from "@fortawesome/fontawesome-svg-core";import {faDiscord,faLinkedinIn,@@ -113,15 +112,20 @@ const footerLinks = {] as FooterLink[],};-const socialLinks: { label: string; href: string; icon: IconDefinition }[] = [- { label: "X (@Cap)", href: "https://x.com/cap", icon: faXTwitter },- { label: "Discord", href: "https://discord.gg/y8gdQ3WRN3", icon: faDiscord },- {- label: "LinkedIn",- href: "https://www.linkedin.com/company/caprecorder/",- icon: faLinkedinIn,- },-];+const socialLinks: { label: string; href: string; icon: typeof faXTwitter }[] =+ [+ { label: "X (@Cap)", href: "https://x.com/cap", icon: faXTwitter },+ {+ label: "Discord",+ href: "https://discord.gg/y8gdQ3WRN3",+ icon: faDiscord,+ },+ {+ label: "LinkedIn",+ href: "https://www.linkedin.com/company/caprecorder/",+ icon: faLinkedinIn,+ },+ ];const complianceBadges: { label: string; content: ReactNode }[] = [{diff --git a/apps/web/app/api/mobile/[...route]/route.ts b/apps/web/app/api/mobile/[...route]/route.tsindex b144c0e22..a5e263d7a 100644--- a/apps/web/app/api/mobile/[...route]/route.ts+++ b/apps/web/app/api/mobile/[...route]/route.ts@@ -539,12 +539,43 @@ const getRootFolders = Effect.fn("Mobile.getRootFolders")(function* (return rows satisfies MobileFolder[];});-const assertOrganizationAccess = Effect.fn("Mobile.assertOrganizationAccess")(+const hasOrganizationAccess = Effect.fn("Mobile.hasOrganizationAccess")(function* (organizationId: Organisation.OrganisationId) {const user = yield* CurrentUser;- const organizations = yield* getAccessibleOrganizations(user.id);- const hasAccess = organizations.some((org) => org.id === organizationId);- if (!hasAccess) return yield* Effect.fail(new HttpApiError.Forbidden());+ const database = yield* Database;+ const [row] = yield* database.use((db) =>+ db+ .select({ id: Db.organizations.id })+ .from(Db.organizations)+ .leftJoin(+ Db.organizationMembers,+ and(+ eq(Db.organizationMembers.organizationId, Db.organizations.id),+ eq(Db.organizationMembers.userId, user.id),+ ),+ )+ .where(+ and(+ eq(Db.organizations.id, organizationId),+ isNull(Db.organizations.tombstoneAt),+ or(+ eq(Db.organizations.ownerId, user.id),+ eq(Db.organizationMembers.userId, user.id),+ ),+ ),+ )+ .limit(1),+ );++ return Boolean(row);+ },+);++const assertOrganizationAccess = Effect.fn("Mobile.assertOrganizationAccess")(+ function* (organizationId: Organisation.OrganisationId) {+ if (!(yield* hasOrganizationAccess(organizationId))) {+ return yield* Effect.fail(new HttpApiError.Forbidden());+ }},);@@ -872,14 +903,10 @@ const assertCanCreateFeedback = Effect.fn("Mobile.assertCanCreateFeedback")(if (!row) return yield* Effect.fail(new HttpApiError.NotFound());if (row.ownerId === user.id) return;- if (row.sharedOrganizationId) {- yield* assertOrganizationAccess(row.sharedOrganizationId).pipe(- Effect.catchAll((error) =>- error instanceof HttpApiError.Forbidden- ? Effect.fail(new HttpApiError.NotFound())- : Effect.fail(error),- ),- );+ if (+ row.sharedOrganizationId &&+ (yield* hasOrganizationAccess(row.sharedOrganizationId))+ ) {return;}diff --git a/apps/web/app/api/tools/loom-download/route.ts b/apps/web/app/api/tools/loom-download/route.tsindex fe3f7f989..193a40573 100644--- a/apps/web/app/api/tools/loom-download/route.ts+++ b/apps/web/app/api/tools/loom-download/route.ts@@ -306,8 +306,9 @@ export async function GET(request: NextRequest) {try {const mp4Buffer = await convertRemoteVideoToMp4Buffer(cdnUrl);+ const body = new Uint8Array(mp4Buffer).buffer;- return new NextResponse(mp4Buffer, {+ return new NextResponse(body, {headers: {"Content-Type": "video/mp4","Content-Disposition": `attachment; filename="${mp4Filename}"`,diff --git a/packages/database/crypto.ts b/packages/database/crypto.tsindex d5db0c510..1282da103 100644--- a/packages/database/crypto.ts+++ b/packages/database/crypto.ts@@ -32,7 +32,7 @@ const ENCRYPTION_KEY = () => {return key;};-async function deriveKey(salt: Uint8Array): Promise<CryptoKey> {+async function deriveKey(salt: Uint8Array<ArrayBuffer>): Promise<CryptoKey> {const key = ENCRYPTION_KEY();if (!key) throw new Error("Encryption key is not available");diff --git a/packages/web-backend/src/Storage/index.ts b/packages/web-backend/src/Storage/index.tsindex 4f94ca092..b53dfe781 100644--- a/packages/web-backend/src/Storage/index.ts+++ b/packages/web-backend/src/Storage/index.ts@@ -558,12 +558,14 @@ const makeGoogleDriveAccess = ({},tokenStore,).pipe(mapStorageError);+ const uploadBody =+ body instanceof Uint8Array ? new Uint8Array(body).buffer : body;const response = yield* Effect.tryPromise({try: () =>fetch(uploadUrl, {method: "PUT",headers: getGoogleDriveUploadHeaders(contentType, contentLength),- body,+ body: uploadBody,}),catch: (cause) => new StorageDomain.StorageError({ cause }),});