From 1a9eeb760ff0f9fcc8b7fd510ac3be7db889e95d Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Sat, 13 Apr 2024 13:22:19 +0100
Subject: [Embeds] Add ref_url (#3533)

* get outer location and pass in to the iframe

* enable post.html in dev

* only add ref_url if starts with http

* Revert "enable post.html in dev"

This reverts commit 6f224c6e2c4a016f7ea17ff998c4b4e56b9a4f9b.

---------

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
---
 bskyembed/src/components/link.tsx | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'bskyembed/src/components/link.tsx')

diff --git a/bskyembed/src/components/link.tsx b/bskyembed/src/components/link.tsx
index db752542b..64c2c9a83 100644
--- a/bskyembed/src/components/link.tsx
+++ b/bskyembed/src/components/link.tsx
@@ -8,8 +8,14 @@ export function Link({
   href: string
   className?: string
 } & h.JSX.HTMLAttributes<HTMLAnchorElement>) {
+  const searchParam = new URLSearchParams(window.location.search)
+  const ref_url = searchParam.get('ref_url')
+
   const newSearchParam = new URLSearchParams()
   newSearchParam.set('ref_src', 'embed')
+  if (ref_url) {
+    newSearchParam.set('ref_url', ref_url)
+  }
 
   return (
     <a
-- 
cgit 1.4.1

