Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: https share links (#719)

Ameer Al Ashhaba35a3c55dea9
diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx
index 6c10d7f69..0266c4578 100644
--- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx
@@ -34,9 +34,10 @@ export const CapCardButtons: React.FC<CapCardButtonsProps> = ({
customDomain,
domainVerified,
}) => {
+ const { webUrl } = usePublicEnv();
return (
<>
- {buttons(capId, copyPressed, isDownloading, handleCopy, handleDownload, customDomain, domainVerified).map((button, index) => (
+ {buttons(capId, copyPressed, isDownloading, handleCopy, handleDownload, webUrl, customDomain, domainVerified).map((button, index) => (
<Tooltip key={index} content={button.tooltipContent}>
<Button
onClick={button.onClick}
@@ -61,6 +62,7 @@ const buttons = (
isDownloading: boolean,
handleCopy: (url: string) => void,
handleDownload: () => void,
+ webUrl: string,
customDomain?: string | null,
domainVerified?: boolean,
): ButtonConfig[] => [
@@ -68,19 +70,16 @@ const buttons = (
tooltipContent: "Copy link",
onClick: (e: React.MouseEvent) => {
e.stopPropagation();
-
- const { webUrl } = usePublicEnv();
-
const getVideoLink = () => {
if (NODE_ENV === "development" && customDomain && domainVerified) {
- return `${customDomain}/s/${capId}`;
+ return `https://${customDomain}/s/${capId}`;
} else if (NODE_ENV === "development" && !customDomain && !domainVerified) {
return `${webUrl}/s/${capId}`;
} else if (buildEnv.NEXT_PUBLIC_IS_CAP && customDomain && domainVerified) {
- return `${customDomain}/s/${capId}`;
+ return `https://${customDomain}/s/${capId}`;
} else if (buildEnv.NEXT_PUBLIC_IS_CAP && !customDomain && !domainVerified) {
- return `cap.link/${capId}`;
+ return `https://cap.link/${capId}`;
} else {
return `${webUrl}/s/${capId}`;
}
diff --git a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx
index 9c50451d7..ab343a6c3 100644
--- a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx
+++ b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx
@@ -89,6 +89,20 @@ export const ShareHeader = ({
};
const getVideoLink = () => {
+ if (NODE_ENV === "development" && customDomain && domainVerified) {
+ return `https://${customDomain}/s/${data.id}`;
+ } else if (NODE_ENV === "development" && !customDomain && !domainVerified) {
+ return `${webUrl}/s/${data.id}`;
+ } else if (buildEnv.NEXT_PUBLIC_IS_CAP && customDomain && domainVerified) {
+ return `https://${customDomain}/s/${data.id}`;
+ } else if (buildEnv.NEXT_PUBLIC_IS_CAP && !customDomain && !domainVerified) {
+ return `https://cap.link/${data.id}`;
+ } else {
+ return `${webUrl}/s/${data.id}`;
+ }
+ };
+
+ const getDisplayLink = () => {
if (NODE_ENV === "development" && customDomain && domainVerified) {
return `${customDomain}/s/${data.id}`;
} else if (NODE_ENV === "development" && !customDomain && !domainVerified) {
@@ -206,7 +220,7 @@ export const ShareHeader = ({
toast.success("Link copied to clipboard!");
}}
>
- {getVideoLink()}
+ {getDisplayLink()}
<Copy className="ml-2 w-4 h-4" />
</Button>
</div>