Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Implement site movement functionality in admin panel

Bill Yang1d8e751ed3ed
diff --git a/client/messages/cs.json b/client/messages/cs.json
index 196abbda5..79f2b44b8 100644
--- a/client/messages/cs.json
+++ b/client/messages/cs.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Metrika Web Vitals pro měření výkonu webu.",
"O8lxEI": "Podívej se na dokumentaci Web Vitals od Google pro prahové hodnoty.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "Přehrávání relací je vypnuto",
"Tb0/AL": "Přehrávání relací zvětší analytický skript",
"CRjhOx": "8× více",
@@ -801,6 +801,14 @@
"G7giEo": "Průměr 30d",
"NUXhb8": "Žádná data o předplatném k dispozici",
"sMjIBZ": "Došlo k chybě. Zkus to prosím později.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Vyber organizaci",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "ID webu",
"uhu5aG": "Veřejný",
"viXE32": "Soukromý",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Vytvořit organizaci",
"sFoGzO": "Žádné organizace",
"IH2vI2": "Načítám organizace...",
- "MPQ0kS": "Vyber organizaci",
"gb6dSb": "Žádné organizace k dispozici",
"ZICvpo": "Načítám {items}...",
"7aQjYn": "Zobrazeno {from} až {to} z {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "Doména používaná pro sledování",
"asd4Px": "Soukromí a zabezpečení",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Smazat web",
"v5ykbS": "Jsi si opravdu jistý?",
"ckBJVF": "Tuto akci nelze vrátit zpět. Tím trvale smažete web \"{siteName}\" a veškerá jeho analytická data.",
diff --git a/client/messages/de.json b/client/messages/de.json
index 59be82840..aaefe4511 100644
--- a/client/messages/de.json
+++ b/client/messages/de.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Web Vitals-Metrik zur Messung der Website-Leistung.",
"O8lxEI": "Prüfen Sie die Web Vitals-Dokumentation von Google für Schwellenwerte.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "Session Replay ist deaktiviert",
"Tb0/AL": "Session Replay macht das Analytics-Skript",
"CRjhOx": "8x größer",
@@ -801,6 +801,14 @@
"G7giEo": "Durchschn. 30d",
"NUXhb8": "Keine Abonnementdaten verfügbar",
"sMjIBZ": "Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Organisation auswählen",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "Website-ID",
"uhu5aG": "Öffentlich",
"viXE32": "Privat",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Organisation erstellen",
"sFoGzO": "Keine Organisationen",
"IH2vI2": "Organisationen werden geladen...",
- "MPQ0kS": "Organisation auswählen",
"gb6dSb": "Keine Organisationen verfügbar",
"ZICvpo": "{items} werden geladen...",
"7aQjYn": "Zeige {from} bis {to} von {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "Die für das Tracking verwendete Domain",
"asd4Px": "Datenschutz & Sicherheit",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Website löschen",
"v5ykbS": "Sind Sie absolut sicher?",
"ckBJVF": "Diese Aktion kann nicht rückgängig gemacht werden. Dadurch wird die Website \"{siteName}\" und alle zugehörigen Analysedaten dauerhaft gelöscht.",
diff --git a/client/messages/en.json b/client/messages/en.json
index aa36f3e8b..5b19bfba2 100644
--- a/client/messages/en.json
+++ b/client/messages/en.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Web Vitals metric for measuring website performance.",
"O8lxEI": "Check Google's Web Vitals documentation for thresholds.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "What do you want to query?",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "Session Replay is Disabled",
"Tb0/AL": "Session replay will make the analytics script",
"CRjhOx": "8x larger",
@@ -801,6 +801,14 @@
"G7giEo": "Avg 30d",
"NUXhb8": "No subscription data available",
"sMjIBZ": "An error occurred. Please try again later.",
+ "up5jqD": "Site moved successfully",
+ "/0tjRq": "Failed to move site",
+ "UMbBzo": "Move",
+ "kscC4K": "Move Site",
+ "6Lp70G": "Move \"{siteName}\" to another organization. Team and restricted member access for this site will be reset.",
+ "MPQ0kS": "Select an organization",
+ "ZrO1i3": "Moving...",
+ "RYG5QH": "Move site",
"Qzul6+": "Site ID",
"uhu5aG": "Public",
"viXE32": "Private",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Create an Organization",
"sFoGzO": "No organizations",
"IH2vI2": "Loading organizations...",
- "MPQ0kS": "Select an organization",
"gb6dSb": "No organizations available",
"ZICvpo": "Loading {items}...",
"7aQjYn": "Showing {from} to {to} of {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "The bundle or package identifier used for tracking",
"I7l2wK": "The domain used for tracking",
"asd4Px": "Privacy & Security",
+ "xk+UaC": "Move to Organization",
+ "7GCMTs": "Transfer this site to another organization you administer. Team and restricted member access for this site will be reset.",
+ "gueAQ1": "Move this site?",
+ "oSPhwu": "This will move \"{siteName}\" to {orgName}. Team and restricted member access for this site will be reset, and members of the current organization may lose access.",
+ "54Ob9x": "Yes, move site",
"gI1OXG": "Delete Site",
"v5ykbS": "Are you absolutely sure?",
"ckBJVF": "This action cannot be undone. This will permanently delete the site \"{siteName}\" and all of its analytics data.",
diff --git a/client/messages/es.json b/client/messages/es.json
index f5db901af..70b448f1f 100644
--- a/client/messages/es.json
+++ b/client/messages/es.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Métrica de Web Vitals para medir el rendimiento del sitio web.",
"O8lxEI": "Consulta la documentación de Web Vitals de Google para los umbrales.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "La repetición de sesión está desactivada",
"Tb0/AL": "La repetición de sesión hará que el script de analíticas sea",
"CRjhOx": "8x más grande",
@@ -801,6 +801,14 @@
"G7giEo": "Promedio 30d",
"NUXhb8": "No hay datos de suscripción disponibles",
"sMjIBZ": "Ocurrió un error. Inténtalo de nuevo más tarde.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Selecciona una organización",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "ID del sitio",
"uhu5aG": "Público",
"viXE32": "Privado",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Crear una organización",
"sFoGzO": "No hay organizaciones",
"IH2vI2": "Cargando organizaciones...",
- "MPQ0kS": "Selecciona una organización",
"gb6dSb": "No hay organizaciones disponibles",
"ZICvpo": "Cargando {items}...",
"7aQjYn": "Mostrando {from} a {to} de {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "El dominio utilizado para el seguimiento",
"asd4Px": "Privacidad y Seguridad",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Eliminar Sitio",
"v5ykbS": "¿Estás completamente seguro?",
"ckBJVF": "Esta acción no se puede deshacer. Esto eliminará permanentemente el sitio \"{siteName}\" y todos sus datos de análisis.",
diff --git a/client/messages/fr.json b/client/messages/fr.json
index 33d494eea..455600606 100644
--- a/client/messages/fr.json
+++ b/client/messages/fr.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Métrique Web Vitals pour mesurer la performance du site web.",
"O8lxEI": "Consultez la documentation Web Vitals de Google pour les seuils.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "Le Session Replay est désactivé",
"Tb0/AL": "Le Session Replay rendra le script analytique",
"CRjhOx": "8x plus grand",
@@ -801,6 +801,14 @@
"G7giEo": "Moy. 30j",
"NUXhb8": "Aucune donnée d'abonnement disponible",
"sMjIBZ": "Une erreur est survenue. Veuillez réessayer plus tard.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Sélectionner une organisation",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "ID du site",
"uhu5aG": "Public",
"viXE32": "Privé",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Créer une organisation",
"sFoGzO": "Aucune organisation",
"IH2vI2": "Chargement des organisations...",
- "MPQ0kS": "Sélectionner une organisation",
"gb6dSb": "Aucune organisation disponible",
"ZICvpo": "Chargement de {items}...",
"7aQjYn": "Affichage de {from} à {to} sur {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "Le domaine utilisé pour le suivi",
"asd4Px": "Confidentialité et sécurité",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Supprimer le site",
"v5ykbS": "Êtes-vous absolument sûr ?",
"ckBJVF": "Cette action est irréversible. Le site \"{siteName}\" et toutes ses données analytiques seront définitivement supprimés.",
diff --git a/client/messages/it.json b/client/messages/it.json
index ef41e0567..35fbcac7d 100644
--- a/client/messages/it.json
+++ b/client/messages/it.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Metrica Web Vitals per misurare le prestazioni del sito web.",
"O8lxEI": "Controlla la documentazione Web Vitals di Google per le soglie.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "La riproduzione della sessione è Disabilitata",
"Tb0/AL": "La riproduzione della sessione renderà lo script di analisi",
"CRjhOx": "8x più grande",
@@ -801,6 +801,14 @@
"G7giEo": "Media 30g",
"NUXhb8": "Nessun dato di abbonamento disponibile",
"sMjIBZ": "Si è verificato un errore. Riprova più tardi.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Seleziona un'organizzazione",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "ID Sito",
"uhu5aG": "Pubblico",
"viXE32": "Privato",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Crea un'Organizzazione",
"sFoGzO": "Nessuna organizzazione",
"IH2vI2": "Caricamento organizzazioni...",
- "MPQ0kS": "Seleziona un'organizzazione",
"gb6dSb": "Nessuna organizzazione disponibile",
"ZICvpo": "Caricamento {items}...",
"7aQjYn": "Mostrando da {from} a {to} di {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "Il dominio utilizzato per il tracciamento",
"asd4Px": "Privacy & Sicurezza",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Elimina Sito",
"v5ykbS": "Sei assolutamente sicuro?",
"ckBJVF": "Questa azione non può essere annullata. Il sito \"{siteName}\" e tutti i suoi dati analitici verranno eliminati definitivamente.",
diff --git a/client/messages/ja.json b/client/messages/ja.json
index 3e2685760..d62f23f8a 100644
--- a/client/messages/ja.json
+++ b/client/messages/ja.json
@@ -683,8 +683,6 @@
"4Urwt8": "ウェブ バイタル",
"/Vcvr8": "Webサイトパフォーマンス測定用のWeb Vitals指標。",
"O8lxEI": "しきい値についてはGoogleのWeb Vitalsドキュメントをご確認ください。",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "セッションリプレイは無効です",
"Tb0/AL": "セッションリプレイを有効にすると、アナリティクススクリプトが",
"CRjhOx": "8倍大きく",
@@ -801,6 +801,14 @@
"G7giEo": "平均30日間",
"NUXhb8": "サブスクリプションデータがありません",
"sMjIBZ": "エラーが発生しました。後でもう一度お試しください。",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "組織を選択",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "サイトID",
"uhu5aG": "公開",
"viXE32": "非公開",
@@ -1225,7 +1233,6 @@
"YgZGCW": "組織を作成",
"sFoGzO": "組織なし",
"IH2vI2": "組織を読み込み中...",
- "MPQ0kS": "組織を選択",
"gb6dSb": "利用可能な組織がありません",
"ZICvpo": "{items}を読み込み中...",
"7aQjYn": "{total}{items}中{from}〜{to}を表示",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "トラッキングに使用するドメイン",
"asd4Px": "プライバシーとセキュリティ",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "サイトを削除",
"v5ykbS": "本当によろしいですか?",
"ckBJVF": "この操作は元に戻せません。サイト「{siteName}」とすべての分析データが完全に削除されます。",
diff --git a/client/messages/ko.json b/client/messages/ko.json
index c08d38698..b3ca9dbab 100644
--- a/client/messages/ko.json
+++ b/client/messages/ko.json
@@ -683,8 +683,6 @@
"4Urwt8": "웹 바이탈",
"/Vcvr8": "웹사이트 성능을 측정하는 Web Vitals 지표.",
"O8lxEI": "임계값은 Google의 Web Vitals 문서를 확인하세요.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "세션 리플레이가 비활성화됨",
"Tb0/AL": "세션 리플레이는 분석 스크립트를",
"CRjhOx": "8배 더 크게",
@@ -801,6 +801,14 @@
"G7giEo": "평균 30일",
"NUXhb8": "사용 가능한 구독 데이터 없음",
"sMjIBZ": "오류가 발생했습니다. 나중에 다시 시도해 주세요.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "조직 선택",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "사이트 ID",
"uhu5aG": "공개",
"viXE32": "비공개",
@@ -1225,7 +1233,6 @@
"YgZGCW": "조직 만들기",
"sFoGzO": "조직 없음",
"IH2vI2": "조직 로딩 중...",
- "MPQ0kS": "조직 선택",
"gb6dSb": "사용 가능한 조직 없음",
"ZICvpo": "{items} 로딩 중...",
"7aQjYn": "{total}개 {items} 중 {from}~{to} 표시",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "추적에 사용되는 도메인",
"asd4Px": "개인정보 및 보안",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "사이트 삭제",
"v5ykbS": "정말로 확실하신가요?",
"ckBJVF": "이 작업은 취소할 수 없습니다. 사이트 \"{siteName}\"과 모든 분석 데이터가 영구적으로 삭제됩니다.",
diff --git a/client/messages/pl.json b/client/messages/pl.json
index bcd633d93..6031161f6 100644
--- a/client/messages/pl.json
+++ b/client/messages/pl.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Metryka Web Vitals do mierzenia wydajności strony.",
"O8lxEI": "Sprawdź dokumentację Google Web Vitals, aby poznać progi.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "Odtwarzanie sesji jest wyłączone",
"Tb0/AL": "Odtwarzanie sesji spowoduje, że skrypt analityczny będzie",
"CRjhOx": "8x większy",
@@ -801,6 +801,14 @@
"G7giEo": "Śr. 30d",
"NUXhb8": "Brak dostępnych danych subskrypcji",
"sMjIBZ": "Wystąpił błąd. Spróbuj ponownie później.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Wybierz organizację",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "ID strony",
"uhu5aG": "Publiczna",
"viXE32": "Prywatna",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Utwórz organizację",
"sFoGzO": "Brak organizacji",
"IH2vI2": "Ładowanie organizacji...",
- "MPQ0kS": "Wybierz organizację",
"gb6dSb": "Brak dostępnych organizacji",
"ZICvpo": "Ładowanie {items}...",
"7aQjYn": "Wyświetlanie {from} do {to} z {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "Domena używana do śledzenia",
"asd4Px": "Prywatność i bezpieczeństwo",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Usuń stronę",
"v5ykbS": "Czy jesteś absolutnie pewien?",
"ckBJVF": "Tej akcji nie można cofnąć. Spowoduje to trwałe usunięcie witryny \"{siteName}\" i wszystkich jej danych analitycznych.",
diff --git a/client/messages/pt.json b/client/messages/pt.json
index b62bbf82d..8a94c9bb4 100644
--- a/client/messages/pt.json
+++ b/client/messages/pt.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Métrica Web Vitals para medir o desempenho do site.",
"O8lxEI": "Consulte a documentação de Web Vitals do Google para os limites.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "Replay de Sessão Desativado",
"Tb0/AL": "O replay de sessão tornará o script de análise",
"CRjhOx": "8x maior",
@@ -801,6 +801,14 @@
"G7giEo": "Média 30d",
"NUXhb8": "Nenhum dado de assinatura disponível",
"sMjIBZ": "Ocorreu um erro. Por favor, tente novamente mais tarde.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Selecione uma organização",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "ID do Site",
"uhu5aG": "Público",
"viXE32": "Privado",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Criar uma Organização",
"sFoGzO": "Sem organizações",
"IH2vI2": "Carregando organizações...",
- "MPQ0kS": "Selecione uma organização",
"gb6dSb": "Nenhuma organização disponível",
"ZICvpo": "Carregando {items}...",
"7aQjYn": "Mostrando {from} a {to} de {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "O domínio usado para rastreamento",
"asd4Px": "Privacidade e Segurança",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Excluir Site",
"v5ykbS": "Tem certeza absoluta?",
"ckBJVF": "Esta ação não pode ser desfeita. Isso excluirá permanentemente o site \"{siteName}\" e todos os seus dados de análise.",
diff --git a/client/messages/uk.json b/client/messages/uk.json
index b6f24a7e8..48d46ffba 100644
--- a/client/messages/uk.json
+++ b/client/messages/uk.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vital",
"/Vcvr8": "Метрика Web Vitals для вимірювання продуктивності вебсайту.",
"O8lxEI": "Перевірте документацію Google Web Vitals для отримання порогових значень.",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "Відтворення сеансів вимкнено",
"Tb0/AL": "Відтворення сеансів зробить аналітичний скрипт",
"CRjhOx": "у 8 разів більшим",
@@ -801,6 +801,14 @@
"G7giEo": "Сер. за 30 днів",
"NUXhb8": "Дані про підписки недоступні",
"sMjIBZ": "Сталася помилка. Будь ласка, спробуйте пізніше.",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "Виберіть організацію",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "ID сайту",
"uhu5aG": "Публічний",
"viXE32": "Приватний",
@@ -1225,7 +1233,6 @@
"YgZGCW": "Створити організацію",
"sFoGzO": "Немає організацій",
"IH2vI2": "Завантаження організацій...",
- "MPQ0kS": "Виберіть організацію",
"gb6dSb": "Немає доступних організацій",
"ZICvpo": "Завантаження {items}...",
"7aQjYn": "Показано від {from} до {to} із {total} {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "Домен, що використовується для відстеження",
"asd4Px": "Конфіденційність та безпека",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "Видалити сайт",
"v5ykbS": "Ви абсолютно впевнені?",
"ckBJVF": "Цю дію не можна скасувати. Це назавжди видалить сайт \"{siteName}\" та всі його аналітичні дані.",
diff --git a/client/messages/zh.json b/client/messages/zh.json
index b6f3477e6..39e31bc57 100644
--- a/client/messages/zh.json
+++ b/client/messages/zh.json
@@ -683,8 +683,6 @@
"4Urwt8": "Web Vitals",
"/Vcvr8": "用于衡量网站性能的 Web Vitals 指标。",
"O8lxEI": "检查 Google 的 Web Vitals 文档了解阈值。",
- "k1sXXZ": "Failed to generate query",
- "SyINSq": "Failed to run query",
"Vn7Wtu": "",
"Pc+tM3": "Generate",
"yaMHMB": "Results",
@@ -692,6 +690,8 @@
"0eYAOP": "Not run",
"uDXLhQ": "No rows returned",
"ICdFJO": "Run a query",
+ "k1sXXZ": "Failed to generate query",
+ "SyINSq": "Failed to run query",
"4h8Ert": "会话回放已禁用",
"Tb0/AL": "会话回放将使分析脚本",
"CRjhOx": "大 8 倍",
@@ -801,6 +801,14 @@
"G7giEo": "平均 30天",
"NUXhb8": "无可用订阅数据",
"sMjIBZ": "发生错误。请稍后重试。",
+ "up5jqD": "",
+ "/0tjRq": "",
+ "UMbBzo": "",
+ "kscC4K": "",
+ "6Lp70G": "",
+ "MPQ0kS": "选择一个组织",
+ "ZrO1i3": "",
+ "RYG5QH": "",
"Qzul6+": "网站 ID",
"uhu5aG": "公开",
"viXE32": "私有",
@@ -1225,7 +1233,6 @@
"YgZGCW": "创建一个组织",
"sFoGzO": "没有组织",
"IH2vI2": "正在加载组织...",
- "MPQ0kS": "选择一个组织",
"gb6dSb": "没有可用的组织",
"ZICvpo": "正在加载 {items}...",
"7aQjYn": "显示第 {from} 到 {to} 条,共 {total} 条 {items}",
@@ -1335,6 +1342,11 @@
"zoRFJV": "",
"I7l2wK": "用于跟踪的域名",
"asd4Px": "隐私与安全",
+ "xk+UaC": "",
+ "7GCMTs": "",
+ "gueAQ1": "",
+ "oSPhwu": "",
+ "54Ob9x": "",
"gI1OXG": "删除网站",
"v5ykbS": "您绝对确定吗?",
"ckBJVF": "此操作无法撤销。这将永久删除网站\"{siteName}\"及其所有分析数据。",
diff --git a/client/src/api/admin/endpoints/adminSites.ts b/client/src/api/admin/endpoints/adminSites.ts
index d5fd57973..319e31f90 100644
--- a/client/src/api/admin/endpoints/adminSites.ts
+++ b/client/src/api/admin/endpoints/adminSites.ts
@@ -5,6 +5,7 @@ export interface AdminSiteData {
name: string;
type: "web" | "mobile" | null;
domain: string;
+ organizationId: string | null;
createdAt: string;
public: boolean;
eventsLast24Hours: number;
@@ -22,3 +23,10 @@ export interface AdminSiteData {
export function getAdminSites() {
return authedFetch<AdminSiteData[]>("/admin/sites");
}
+
+export function adminMoveSite(siteId: number, organizationId: string) {
+ return authedFetch<{ success: boolean; organizationId: string }>(`/admin/sites/${siteId}/move`, undefined, {
+ method: "PUT",
+ data: { organizationId },
+ });
+}
diff --git a/client/src/api/admin/endpoints/index.ts b/client/src/api/admin/endpoints/index.ts
index 0ab76df56..eaefe11de 100644
--- a/client/src/api/admin/endpoints/index.ts
+++ b/client/src/api/admin/endpoints/index.ts
@@ -2,6 +2,7 @@
export {
addSite,
deleteSite,
+ moveSite,
updateSiteConfig,
fetchSite,
fetchSitesFromOrg,
@@ -30,7 +31,7 @@ export { getAdminOrganizations } from "./adminOrganizations";
export type { AdminOrganizationData } from "./adminOrganizations";
// Admin Sites endpoints
-export { getAdminSites } from "./adminSites";
+export { getAdminSites, adminMoveSite } from "./adminSites";
export type { AdminSiteData } from "./adminSites";
// Admin Service Event Count endpoints
diff --git a/client/src/api/admin/endpoints/sites.ts b/client/src/api/admin/endpoints/sites.ts
index e045a3e35..6deceeef3 100644
--- a/client/src/api/admin/endpoints/sites.ts
+++ b/client/src/api/admin/endpoints/sites.ts
@@ -106,6 +106,13 @@ export function deleteSite(siteId: number) {
});
}
+export function moveSite(siteId: number, organizationId: string) {
+ return authedFetch<{ success: boolean; organizationId: string }>(`/sites/${siteId}/move`, undefined, {
+ method: "PUT",
+ data: { organizationId },
+ });
+}
+
// Consolidated function to update any site configuration
export function updateSiteConfig(
siteId: number,
diff --git a/client/src/app/admin/components/sites/Sites.tsx b/client/src/app/admin/components/sites/Sites.tsx
index afc1f898f..988dc62a1 100644
--- a/client/src/app/admin/components/sites/Sites.tsx
+++ b/client/src/app/admin/components/sites/Sites.tsx
@@ -1,10 +1,24 @@
"use client";
import { useMemo, useState } from "react";
+import { useQueryClient } from "@tanstack/react-query";
import { useAdminSites } from "@/api/admin/hooks/useAdminSites";
-import { AdminSiteData } from "@/api/admin/endpoints";
+import { useAdminOrganizations } from "@/api/admin/hooks/useAdminOrganizations";
+import { adminMoveSite, AdminSiteData } from "@/api/admin/endpoints";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "@/components/ui/dialog";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import { toast } from "@/components/ui/sonner";
import { Skeleton } from "@/components/ui/skeleton";
import { formatDistanceToNow } from "date-fns";
import {
@@ -29,6 +43,76 @@ import { parseUtcTimestamp } from "../../../../lib/dateTimeUtils";
import { formatter } from "../../../../lib/utils";
import { useExtracted } from "next-intl";
+function MoveSiteCell({ site }: { site: AdminSiteData }) {
+ const t = useExtracted();
+ const queryClient = useQueryClient();
+ const { data: organizations } = useAdminOrganizations();
+ const [open, setOpen] = useState(false);
+ const [targetOrgId, setTargetOrgId] = useState("");
+ const [isMoving, setIsMoving] = useState(false);
+
+ const targets = (organizations ?? []).filter(org => org.id !== site.organizationId);
+
+ const handleMove = async () => {
+ if (!targetOrgId) return;
+ try {
+ setIsMoving(true);
+ await adminMoveSite(site.siteId, targetOrgId);
+ toast.success(t("Site moved successfully"));
+ queryClient.invalidateQueries({ queryKey: ["admin-sites"] });
+ queryClient.invalidateQueries({ queryKey: ["admin-organizations"] });
+ setTargetOrgId("");
+ setOpen(false);
+ } catch (error) {
+ console.error("Error moving site:", error);
+ toast.error(error instanceof Error ? error.message : t("Failed to move site"));
+ } finally {
+ setIsMoving(false);
+ }
+ };
+
+ return (
+ <Dialog open={open} onOpenChange={setOpen}>
+ <DialogTrigger asChild>
+ <Button variant="outline" size="sm">
+ {t("Move")}
+ </Button>
+ </DialogTrigger>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{t("Move Site")}</DialogTitle>
+ <DialogDescription>
+ {t(
+ 'Move "{siteName}" to another organization. Team and restricted member access for this site will be reset.',
+ { siteName: site.name }
+ )}
+ </DialogDescription>
+ </DialogHeader>
+ <Select value={targetOrgId} onValueChange={setTargetOrgId}>
+ <SelectTrigger>
+ <SelectValue placeholder={t("Select an organization")} />
+ </SelectTrigger>
+ <SelectContent>
+ {targets.map(org => (
+ <SelectItem key={org.id} value={org.id}>
+ {org.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setOpen(false)} disabled={isMoving}>
+ {t("Cancel")}
+ </Button>
+ <Button onClick={handleMove} disabled={!targetOrgId || isMoving}>
+ {isMoving ? t("Moving...") : t("Move site")}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
+
export function Sites() {
const { data: sites, isLoading, isError } = useAdminSites();
const t = useExtracted();
@@ -140,6 +224,11 @@ export function Sites() {
header: ({ column }) => <SortableHeader column={column}>{t("Owner Email")}</SortableHeader>,
cell: ({ row }) => <div>{row.getValue("organizationOwnerEmail") || "-"}</div>,
},
+ {
+ id: "actions",
+ header: () => <span>{t("Actions")}</span>,
+ cell: ({ row }) => <MoveSiteCell site={row.original} />,
+ },
],
[]
);
@@ -228,6 +317,9 @@ export function Sites() {
<TableCell>
<Skeleton className="h-5 w-40" />
</TableCell>
+ <TableCell>
+ <Skeleton className="h-5 w-16" />
+ </TableCell>
</TableRow>
))
) : table.getRowModel().rows.length === 0 ? (
diff --git a/client/src/components/SiteSettings/GeneralTab.tsx b/client/src/components/SiteSettings/GeneralTab.tsx
index c5b0cdbcb..885a49437 100644
--- a/client/src/components/SiteSettings/GeneralTab.tsx
+++ b/client/src/components/SiteSettings/GeneralTab.tsx
@@ -1,5 +1,6 @@
"use client";
+import { useQueryClient } from "@tanstack/react-query";
import { AlertTriangle } from "lucide-react";
import { useExtracted } from "next-intl";
import { useRouter } from "next/navigation";
@@ -20,9 +21,17 @@ import {
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
-import { deleteSite, updateSiteConfig, SiteResponse } from "@/api/admin/endpoints";
+import { deleteSite, moveSite, updateSiteConfig, SiteResponse } from "@/api/admin/endpoints";
+import { useUserOrganizations } from "@/api/admin/hooks/useOrganizations";
import { useGetSitesFromOrg } from "@/api/admin/hooks/useSites";
import { normalizeDomain } from "@/lib/utils";
@@ -48,6 +57,8 @@ interface ToggleConfig {
export function GeneralTab({ siteMetadata, disabled = false, onClose, onPublicChange }: GeneralTabProps) {
const t = useExtracted();
const { refetch } = useGetSitesFromOrg(siteMetadata?.organizationId ?? "");
+ const { data: userOrganizations } = useUserOrganizations();
+ const queryClient = useQueryClient();
const router = useRouter();
const isMobileSite = siteMetadata.type === "mobile";
const identifierLabel = isMobileSite ? t("App Identifier") : t("Domain");
@@ -57,6 +68,14 @@ export function GeneralTab({ siteMetadata, disabled = false, onClose, onPublicCh
const [newDomain, setNewDomain] = useState(siteMetadata.domain);
const [isChangingDomain, setIsChangingDomain] = useState(false);
const [isDeleting, setIsDeleting] = useState(false);
+ const [targetOrgId, setTargetOrgId] = useState("");
+ const [isMoving, setIsMoving] = useState(false);
+
+ // Organizations the user can move the site into: those they administer,
+ // excluding the site's current organization.
+ const moveTargets = (userOrganizations ?? []).filter(
+ org => (org.role === "admin" || org.role === "owner") && org.id !== siteMetadata.organizationId
+ );
const [toggleStates, setToggleStates] = useState({
public: siteMetadata.public || false,
@@ -155,6 +174,28 @@ export function GeneralTab({ siteMetadata, disabled = false, onClose, onPublicCh
}
};
+ const handleMove = async () => {
+ if (!targetOrgId) {
+ return;
+ }
+
+ try {
+ setIsMoving(true);
+ await moveSite(siteMetadata.siteId, targetOrgId);
+ toast.success(t("Site moved successfully"));
+ queryClient.invalidateQueries({ queryKey: ["get-sites-from-org"] });
+ queryClient.invalidateQueries({ queryKey: ["get-site", siteMetadata.siteId] });
+ setTargetOrgId("");
+ router.refresh();
+ refetch();
+ } catch (error) {
+ console.error("Error moving site:", error);
+ toast.error(error instanceof Error ? error.message : t("Failed to move site"));
+ } finally {
+ setIsMoving(false);
+ }
+ };
+
const privacyToggles: ToggleConfig[] = [
{
id: "public",
@@ -267,6 +308,60 @@ export function GeneralTab({ siteMetadata, disabled = false, onClose, onPublicCh
))}
</div>
+ {!disabled && moveTargets.length > 0 && (
+ <div className="space-y-3">
+ <div>
+ <h4 className="text-sm font-semibold text-foreground">{t("Move to Organization")}</h4>
+ <p className="text-xs text-muted-foreground">
+ {t(
+ "Transfer this site to another organization you administer. Team and restricted member access for this site will be reset."
+ )}
+ </p>
+ </div>
+ <div className="flex space-x-2">
+ <Select value={targetOrgId} onValueChange={setTargetOrgId}>
+ <SelectTrigger className="flex-1">
+ <SelectValue placeholder={t("Select an organization")} />
+ </SelectTrigger>
+ <SelectContent>
+ {moveTargets.map(org => (
+ <SelectItem key={org.id} value={org.id}>
+ {org.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <AlertDialog>
+ <AlertDialogTrigger asChild>
+ <Button variant="outline" disabled={!targetOrgId || isMoving}>
+ {isMoving ? t("Moving...") : t("Move")}
+ </Button>
+ </AlertDialogTrigger>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>{t("Move this site?")}</AlertDialogTitle>
+ <AlertDialogDescription>
+ {t(
+ 'This will move "{siteName}" to {orgName}. Team and restricted member access for this site will be reset, and members of the current organization may lose access.',
+ {
+ siteName: siteMetadata.name,
+ orgName: moveTargets.find(org => org.id === targetOrgId)?.name ?? "",
+ }
+ )}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>{t("Cancel")}</AlertDialogCancel>
+ <AlertDialogAction onClick={handleMove} disabled={isMoving}>
+ {isMoving ? t("Moving...") : t("Yes, move site")}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </div>
+ </div>
+ )}
+
<div className="space-y-3 pt-3">
<h4 className="text-sm font-semibold text-destructive">{t("Danger Zone")}</h4>
<AlertDialog>
diff --git a/server/src/api/admin/adminMoveSite.ts b/server/src/api/admin/adminMoveSite.ts
new file mode 100644
index 000000000..a668862e0
--- /dev/null
+++ b/server/src/api/admin/adminMoveSite.ts
@@ -0,0 +1,57 @@
+import { eq } from "drizzle-orm";
+import { FastifyReply, FastifyRequest } from "fastify";
+import { z } from "zod";
+import { db } from "../../db/postgres/postgres.js";
+import { organization, sites } from "../../db/postgres/schema.js";
+import { applySiteMove } from "../sites/applySiteMove.js";
+
+const adminMoveSiteSchema = z.object({
+ organizationId: z.string().min(1),
+});
+
+/**
+ * Moves a site to any organization. Restricted to system admins via the
+ * `adminOnly` middleware, so it intentionally skips the per-organization
+ * admin/owner and site-limit checks that the org-scoped move endpoint enforces.
+ */
+export async function adminMoveSite(
+ request: FastifyRequest<{ Params: { siteId: string }; Body: { organizationId: string } }>,
+ reply: FastifyReply
+) {
+ const siteId = parseInt(request.params.siteId, 10);
+ if (isNaN(siteId) || siteId <= 0) {
+ return reply.status(400).send({ error: "Invalid site ID: must be a positive integer" });
+ }
+
+ const validation = adminMoveSiteSchema.safeParse(request.body);
+ if (!validation.success) {
+ return reply.status(400).send({ error: "Invalid request data", details: validation.error.flatten() });
+ }
+
+ const targetOrganizationId = validation.data.organizationId;
+
+ try {
+ const site = await db.query.sites.findFirst({ where: eq(sites.siteId, siteId) });
+ if (!site) {
+ return reply.status(404).send({ error: "Site not found" });
+ }
+
+ if (site.organizationId === targetOrganizationId) {
+ return reply.status(400).send({ error: "Site is already in this organization" });
+ }
+
+ const targetOrg = await db.query.organization.findFirst({
+ where: eq(organization.id, targetOrganizationId),
+ });
+ if (!targetOrg) {
+ return reply.status(404).send({ error: "Target organization not found" });
+ }
+
+ await applySiteMove(siteId, site.organizationId, targetOrganizationId);
+
+ return reply.status(200).send({ success: true, organizationId: targetOrganizationId });
+ } catch (error) {
+ console.error("Error moving site (admin):", error);
+ return reply.status(500).send({ error: "Failed to move site" });
+ }
+}
diff --git a/server/src/api/admin/getAdminSites.ts b/server/src/api/admin/getAdminSites.ts
index 6aa28f3d6..d3ac36e56 100644
--- a/server/src/api/admin/getAdminSites.ts
+++ b/server/src/api/admin/getAdminSites.ts
@@ -127,6 +127,7 @@ export async function getAdminSites(request: FastifyRequest, reply: FastifyReply
name: site.name,
type: site.type || "web",
domain: site.domain || "",
+ organizationId: site.organizationId,
createdAt: site.createdAt,
public: site.public,
eventsLast24Hours: siteEventMap24h.get(site.siteId) || 0,
diff --git a/server/src/api/admin/index.ts b/server/src/api/admin/index.ts
index f099cf1aa..3dcff72f6 100644
--- a/server/src/api/admin/index.ts
+++ b/server/src/api/admin/index.ts
@@ -1,4 +1,5 @@
// Admin
+export { adminMoveSite } from "./adminMoveSite.js";
export { collectTelemetry } from "./collectTelemetry.js";
export { getAdminOrganizations } from "./getAdminOrganizations.js";
export { getAdminServiceEventCount } from "./getAdminServiceEventCount.js";
diff --git a/server/src/api/sites/applySiteMove.ts b/server/src/api/sites/applySiteMove.ts
new file mode 100644
index 000000000..d263ae306
--- /dev/null
+++ b/server/src/api/sites/applySiteMove.ts
@@ -0,0 +1,37 @@
+import { eq } from "drizzle-orm";
+import { db } from "../../db/postgres/postgres.js";
+import { memberSiteAccess, sites, teamSiteAccess } from "../../db/postgres/schema.js";
+import { invalidateSitesAccessCache } from "../../lib/auth-utils.js";
+
+/**
+ * Reassigns a site to a different organization and clears the access grants
+ * (restricted member access and team access) tied to the old organization,
+ * which no longer apply in the target organization. Also invalidates the
+ * sites-access cache for members of both organizations so the change is
+ * reflected immediately.
+ *
+ * Permission checks are the caller's responsibility.
+ */
+export async function applySiteMove(
+ siteId: number,
+ sourceOrganizationId: string | null,
+ targetOrganizationId: string
+) {
+ await db.transaction(async tx => {
+ await tx
+ .update(sites)
+ .set({ organizationId: targetOrganizationId, updatedAt: new Date().toISOString() })
+ .where(eq(sites.siteId, siteId));
+ await tx.delete(memberSiteAccess).where(eq(memberSiteAccess.siteId, siteId));
+ await tx.delete(teamSiteAccess).where(eq(teamSiteAccess.siteId, siteId));
+ });
+
+ const orgIds = sourceOrganizationId ? [sourceOrganizationId, targetOrganizationId] : [targetOrganizationId];
+ const affectedMembers = await db.query.member.findMany({
+ where: (m, { inArray }) => inArray(m.organizationId, orgIds),
+ columns: { userId: true },
+ });
+ for (const { userId } of affectedMembers) {
+ invalidateSitesAccessCache(userId);
+ }
+}
diff --git a/server/src/api/sites/index.ts b/server/src/api/sites/index.ts
index 91e023463..4696946c7 100644
--- a/server/src/api/sites/index.ts
+++ b/server/src/api/sites/index.ts
@@ -6,6 +6,7 @@ export { getSiteHasData } from "./getSiteHasData.js";
export { getSiteIsPublic } from "./getSiteIsPublic.js";
export { getEmbedStats } from "./getEmbedStats.js";
export { getSitesFromOrg } from "./getSitesFromOrg.js";
+export { moveSite } from "./moveSite.js";
export { updateSiteConfig } from "./updateSiteConfig.js";
// Site Configuration
diff --git a/server/src/api/sites/moveSite.ts b/server/src/api/sites/moveSite.ts
new file mode 100644
index 000000000..0ef06a140
--- /dev/null
+++ b/server/src/api/sites/moveSite.ts
@@ -0,0 +1,97 @@
+import { and, eq } from "drizzle-orm";
+import { FastifyReply, FastifyRequest } from "fastify";
+import { z } from "zod";
+import { db } from "../../db/postgres/postgres.js";
+import { member, organization, sites } from "../../db/postgres/schema.js";
+import { IS_CLOUD } from "../../lib/const.js";
+import { getSubscriptionInner } from "../stripe/getSubscription.js";
+import { applySiteMove } from "./applySiteMove.js";
+
+const moveSiteSchema = z.object({
+ organizationId: z.string().min(1),
+});
+
+/**
+ * Moves a site to a different organization.
+ *
+ * The `adminSite` middleware guarantees the caller is an admin/owner of the
+ * site's current organization. Here we additionally require admin/owner access
+ * to the target organization before reassigning ownership.
+ */
+export async function moveSite(
+ request: FastifyRequest<{ Params: { siteId: string }; Body: { organizationId: string } }>,
+ reply: FastifyReply
+) {
+ const siteId = parseInt(request.params.siteId, 10);
+ if (isNaN(siteId) || siteId <= 0) {
+ return reply.status(400).send({ error: "Invalid site ID: must be a positive integer" });
+ }
+
+ const validation = moveSiteSchema.safeParse(request.body);
+ if (!validation.success) {
+ return reply.status(400).send({ error: "Invalid request data", details: validation.error.flatten() });
+ }
+
+ const targetOrganizationId = validation.data.organizationId;
+ const userId = request.user?.id;
+ if (!userId) {
+ return reply.status(401).send({ error: "Unauthorized" });
+ }
+
+ try {
+ const site = await db.query.sites.findFirst({ where: eq(sites.siteId, siteId) });
+ if (!site) {
+ return reply.status(404).send({ error: "Site not found" });
+ }
+
+ const sourceOrganizationId = site.organizationId;
+ if (sourceOrganizationId === targetOrganizationId) {
+ return reply.status(400).send({ error: "Site is already in this organization" });
+ }
+
+ // Target organization must exist.
+ const targetOrg = await db.query.organization.findFirst({
+ where: eq(organization.id, targetOrganizationId),
+ });
+ if (!targetOrg) {
+ return reply.status(404).send({ error: "Target organization not found" });
+ }
+
+ // Caller must be an admin/owner of the target organization.
+ const targetMembership = await db.query.member.findFirst({
+ where: and(eq(member.userId, userId), eq(member.organizationId, targetOrganizationId)),
+ });
+ if (!targetMembership) {
+ return reply.status(403).send({ error: "You are not a member of the target organization" });
+ }
+ if (targetMembership.role !== "admin" && targetMembership.role !== "owner") {
+ return reply.status(403).send({ error: "You must be an admin or owner of the target organization" });
+ }
+
+ // Enforce the target organization's site limit on cloud.
+ if (IS_CLOUD) {
+ const subscription = await getSubscriptionInner(targetOrganizationId);
+ const siteLimit = subscription?.siteLimit ?? null;
+ if (siteLimit !== null) {
+ const existingSites = await db
+ .select({ siteId: sites.siteId })
+ .from(sites)
+ .where(eq(sites.organizationId, targetOrganizationId));
+ if (existingSites.length >= siteLimit) {
+ return reply.status(403).send({
+ error: `The target organization has reached its limit of ${siteLimit} website${
+ siteLimit === 1 ? "" : "s"
+ }. Please upgrade it to add more.`,
+ });
+ }
+ }
+ }
+
+ await applySiteMove(siteId, sourceOrganizationId, targetOrganizationId);
+
+ return reply.status(200).send({ success: true, organizationId: targetOrganizationId });
+ } catch (error) {
+ console.error("Error moving site:", error);
+ return reply.status(500).send({ error: "Failed to move site" });
+ }
+}
diff --git a/server/src/index.ts b/server/src/index.ts
index 5efa8d788..03dd3d4c8 100644
--- a/server/src/index.ts
+++ b/server/src/index.ts
@@ -6,6 +6,7 @@ import Fastify, { type FastifyInstance, type FastifyReply, type FastifyRequest }
import { dirname, join } from "path";
import { fileURLToPath } from "url";
import {
+ adminMoveSite,
collectTelemetry,
getAdminOrganizations,
getAdminServiceEventCount,
@@ -112,6 +113,7 @@ import {
getSitePrivateLinkConfig,
getSitesFromOrg,
getTrackingConfig,
+ moveSite,
updateSiteConfig,
updateSitePrivateLinkConfig,
verifyScript,
@@ -335,6 +337,7 @@ async function sitesRoutes(fastify: FastifyInstance) {
// Sites
fastify.get("/sites/:siteId", publicSite, getSite);
fastify.put("/sites/:siteId/config", adminSite, updateSiteConfig);
+ fastify.put("/sites/:siteId/move", adminSite, moveSite);
fastify.delete("/sites/:siteId", adminSite, deleteSite);
fastify.get("/sites/:siteId/private-link-config", adminSite, getSitePrivateLinkConfig);
fastify.post("/sites/:siteId/private-link-config", adminSite, updateSitePrivateLinkConfig);
@@ -403,6 +406,7 @@ async function stripeAdminRoutes(fastify: FastifyInstance) {
fastify.get("/admin/clickhouse-stats", adminOnly, getClickhouseStats);
fastify.get("/admin/clickhouse-query-log", adminOnly, getClickhouseQueryLog);
fastify.get("/admin/sites", adminOnly, getAdminSites);
+ fastify.put("/admin/sites/:siteId/move", adminOnly, adminMoveSite);
fastify.get("/admin/organizations", adminOnly, getAdminOrganizations);
fastify.get("/admin/service-event-count", adminOnly, getAdminServiceEventCount);
fastify.post("/admin/telemetry", collectTelemetry); // Public - telemetry collection