PageSourceSearch

https://swarmsec.ai/assets/GithubConfirm-CUuXozgr.js

js swarmsec.ai collected 2026-10-05 13:57:32 UTC 3,766 bytes, 1 lines download raw bytes

1import{d as j,r as p,j as t}from"./app-p2CaXbEC.js";import{g as S}from"./index-CyJFzISS.js";import{B as m}from"./Button-Du9JXjM3.js";import"./Textarea-DvHPPDgP.js";import{N as g}from"./Notice-D0nf9y5u.js";import{S as C}from"./StandaloneShell-BEMLQc7h.js";import{M as y}from"./MarketingLayout-_lEwIomH.js";import{t as w}from"./credential-paths-BbVP-e-U.js";import{u as _,A as h}from"./api-DV4vq0In.js";/* empty css                */import"./client-D5LGltgS.js";import"./AppTopBar-BJImsY_w.js";import"./Card-D_FurgZc.js";import"./StatusBadge-B22vzsh1.js";import"./AuthSwarmScene-DsIm4788.js";import"./telemetry-IvUomjEH.js";import"./api-base-DwRyaKIg.js";import"./arrow-left-De8mKXci.js";function k(i){return i!==null&&/^\d{1,20}$/.test(i)}function f(i){return i!==null&&i.length>0&&i.length<=4096}function F(){const[i]=j(),[s]=p.useState(()=>{const e=w();return e?new URLSearchParams(e):null}),o=e=>i.get(e)??(s==null?void 0:s.get(e))??null,u=o("token"),r=o("state"),c=o("installation_id"),d=o("popup")==="1",a=f(u)?{token:u}:f(r)&&k(c)?{state:r,installation_id:c}:null;return a?t.jsx(G,{payload:a,isPopup:d}):t.jsx(x,{children:t.jsxs(g,{title:"Invalid request",tone:"warning",children:["This page finishes connecting a GitHub installation and needs a valid install link. Start again from ",t.jsx("strong",{children:"Repos"})," in the dashboard."]})})}function G({payload:i,isPopup:s}){const{organization:o}=S(),{post:u}=_(),[r,c]=p.useState(!1),[d,a]=p.useState(null);async function e(){c(!0),a(null);try{const{accountLogin:n}=await u("/api/github/confirm-install",i),l=new URLSearchParams({connected:n});s&&l.set("popup","1"),window.location.assign(`/app/repos?${l.toString()}`)}catch(n){if(c(!1),n instanceof h&&n.status===403){a("This installation was started from a different organization. Switch to that organization, then reconnect from Repos.");return}if(n instanceof h&&n.status===409){a("That GitHub installation is already connected to another organization.");return}if(n instanceof h&&n.status===400){a("This install link has expired. Start again from Repos in the dashboard.");return}a(n instanceof Error?n.message:"Could not connect the GitHub installation.")}}function b(){const n=new URLSearchParams;s&&(n.set("popup","1"),n.set("error","cancelled"));const l=n.toString();window.location.assign(`/app/repos${l?`?${l}`:""}`)}return t.jsxs(x,{children:[t.jsx("p",{className:"cli-auth__eyebrow",children:"Connect GitHub"}),t.jsx("h1",{className:"cli-auth__title",children:"Confirm this GitHub connection"}),t.jsx("p",{className:"cli-auth__lead",children:"Connect the GitHub App installation you just approved to this organization. Swarm mints a short-lived, read-only token scoped to a single repository at engagement time, so nothing is stored on our side."}),t.jsx("dl",{className:"cli-auth__meta",children:t.jsxs("div",{children:[t.jsx("dt",{children:"Connecting to"}),t.jsx("dd",{children:(o==null?void 0:o.name)??"Your organization"})]})}),d&&t.jsx(g,{title:"Could not connect",tone:"danger",children:d}),t.jsxs("div",{className:"cli-auth__actions",children:[t.jsx(m,{variant:"primary",onClick:()=>void e(),disabled:r,children:r?"Connecting...":"Connect GitHub"}),t.jsx(m,{variant:"ghost",onClick:b,disabled:r,children:"Cancel"})]}),t.jsx("p",{className:"cli-auth__footnote",children:"Only confirm if you just installed the Swarm GitHub App. The connection binds to the organization shown above; if that is not the right one, switch organizations first."})]})}function x({children:i}){return t.jsx(y,{title:"Confirm GitHub connection | Swarm",noindex:!0,children:t.jsx(C,{context:"Repository connection",status:"GitHub",backHref:"/app/repos",backLabel:"Repositories",children:t.jsx("div",{className:"cli-auth",children:i})})})}export{F as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.