Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: use function for editor meta as proxies don't seem to work

Brendan Allan72af2c1de4a1
diff --git a/Cargo.lock b/Cargo.lock
index f06085c82..7237130f6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -929,7 +929,7 @@ dependencies = [
[[package]]
name = "cap-desktop"
-version = "0.3.44"
+version = "0.3.45"
dependencies = [
"anyhow",
"axum",
diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml
index b2d70e398..a8b83fedf 100644
--- a/apps/desktop/src-tauri/Cargo.toml
+++ b/apps/desktop/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cap-desktop"
-version = "0.3.44"
+version = "0.3.45"
description = "Beautiful screen recordings, owned by you."
authors = ["you"]
edition = "2021"
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
index 4acbab2f2..7e6eb3c29 100644
--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx
+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
@@ -243,7 +243,9 @@ export function ConfigSidebar() {
{
id: TAB_IDS.cursor,
icon: IconCapCursor,
- disabled: !(meta.type === "multiple" && meta.segments[0].cursor),
+ disabled: !(
+ meta().type === "multiple" && (meta() as any).segments[0].cursor
+ ),
},
// { id: "hotkeys" as const, icon: IconCapHotkeys },
]}
@@ -378,7 +380,7 @@ export function ConfigSidebar() {
</Subfield>
</ComingSoonTooltip> */}
</Field>
- {meta.hasMicrophone && (
+ {meta().hasMicrophone && (
<Field
name="Microphone Volume"
icon={<IconCapMicrophone class="size-4" />}
@@ -396,7 +398,7 @@ export function ConfigSidebar() {
/>
</Field>
)}
- {meta.hasSystemAudio && (
+ {meta().hasSystemAudio && (
<Field
name="System Audio Volume"
icon={<IconLucideMonitor class="size-4" />}
diff --git a/apps/desktop/src/routes/editor/Editor.tsx b/apps/desktop/src/routes/editor/Editor.tsx
index 875f6b8a8..b8cf044a4 100644
--- a/apps/desktop/src/routes/editor/Editor.tsx
+++ b/apps/desktop/src/routes/editor/Editor.tsx
@@ -54,14 +54,14 @@ export function Editor() {
return {
editorInstance,
- meta: mergeProps(() => {
+ meta() {
const d = ctx.metaQuery.data;
if (!d)
throw new Error(
"metaQuery.data is undefined - how did this happen?"
);
return d;
- }),
+ },
refetchMeta: async () => {
await ctx.metaQuery.refetch();
},
diff --git a/apps/desktop/src/routes/editor/ExportDialog.tsx b/apps/desktop/src/routes/editor/ExportDialog.tsx
index f3da47f7d..617117858 100644
--- a/apps/desktop/src/routes/editor/ExportDialog.tsx
+++ b/apps/desktop/src/routes/editor/ExportDialog.tsx
@@ -199,7 +199,7 @@ export function ExportDialog() {
const savePath = await saveDialog({
filters: [{ name: "mp4 filter", extensions: ["mp4"] }],
- defaultPath: `~/Desktop/${meta?.prettyName}.mp4`,
+ defaultPath: `~/Desktop/${meta().prettyName}.mp4`,
});
if (!savePath) {
setExportState(reconcile({ type: "idle" }));
@@ -300,7 +300,7 @@ export function ExportDialog() {
setExportState({ type: "uploading", progress: 0 });
// Now proceed with upload
- const result = meta?.sharing
+ const result = meta().sharing
? await commands.uploadExportedVideo(projectPath, "Reupload")
: await commands.uploadExportedVideo(projectPath, {
Initial: { pre_created_video: null },
@@ -316,11 +316,13 @@ export function ExportDialog() {
unlisten();
}
},
- onSuccess: () => {
+ onSuccess: async () => {
const d = dialog();
if ("type" in d && d.type === "export") setDialog({ ...d, open: true });
- refetchMeta();
+ await refetchMeta();
+
+ console.log(meta().sharing);
setExportState({ type: "done" });
},
@@ -797,7 +799,7 @@ export function ExportDialog() {
>
<div class="relative">
<a
- href={meta.sharing?.link}
+ href={meta().sharing!.link}
target="_blank"
rel="noreferrer"
class="block"
@@ -808,7 +810,7 @@ export function ExportDialog() {
setTimeout(() => {
setCopyPressed(false);
}, 2000);
- navigator.clipboard.writeText(meta.sharing?.link!);
+ navigator.clipboard.writeText(meta().sharing!.link!);
}}
variant="lightdark"
class="flex gap-2 justify-center items-center"
diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsx
index 650823425..3aa739d10 100644
--- a/apps/desktop/src/routes/editor/Header.tsx
+++ b/apps/desktop/src/routes/editor/Header.tsx
@@ -82,7 +82,7 @@ export function Header() {
/>
<p class="text-sm text-gray-500">
- {meta.prettyName}
+ {meta().prettyName}
<span class="text-sm text-gray-400">.cap</span>
</p>
{/* <ErrorBoundary fallback={<></>}>
diff --git a/apps/desktop/src/routes/editor/ShareButton.tsx b/apps/desktop/src/routes/editor/ShareButton.tsx
index dd3acb52a..79cb0e05e 100644
--- a/apps/desktop/src/routes/editor/ShareButton.tsx
+++ b/apps/desktop/src/routes/editor/ShareButton.tsx
@@ -86,7 +86,7 @@ function ShareButton() {
setUploadState({ type: "uploading", progress: 0 });
// Now proceed with upload
- const result = meta.sharing
+ const result = meta().sharing
? await commands.uploadExportedVideo(projectPath, "Reupload")
: await commands.uploadExportedVideo(projectPath, {
Initial: { pre_created_video: null },
@@ -136,7 +136,7 @@ function ShareButton() {
return (
<div class="relative">
- <Show when={meta.sharing}>
+ <Show when={meta().sharing}>
{(sharing) => {
const url = () => new URL(sharing().link);
diff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.ts
index d9f8bcd4a..b1b134db9 100644
--- a/apps/desktop/src/routes/editor/context.ts
+++ b/apps/desktop/src/routes/editor/context.ts
@@ -54,7 +54,7 @@ export type RenderState =
export const [EditorContextProvider, useEditorContext] = createContextProvider(
(props: {
- meta: TransformedMeta;
+ meta: () => TransformedMeta;
editorInstance: SerializedEditorInstance;
refetchMeta(): Promise<void>;
}) => {
@@ -197,7 +197,9 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
return {
...editorInstanceContext,
- meta: props.meta,
+ meta() {
+ return props.meta();
+ },
refetchMeta: () => props.refetchMeta(),
editorInstance: props.editorInstance,
dialog,
diff --git a/scripts/env-cli.js b/scripts/env-cli.js
index 9dda89777..b5bf05d7b 100644
--- a/scripts/env-cli.js
+++ b/scripts/env-cli.js
@@ -168,8 +168,8 @@ async function main() {
if (!hasWeb)
return text({
message: "VITE_SERVER_URL",
- placeholder: "http://cap.so",
- defaultValue: "http://cap.so",
+ placeholder: "https://cap.so",
+ defaultValue: "https://cap.so",
});
},
VITE_VERCEL_AUTOMATION_BYPASS_SECRET: () => {