PageSourceSearch

https://www.enconvo.ai/_next/static/chunks/pages/device-4fffd77bb9135f4b.js

js enconvo.ai collected 2026-10-05 12:02:13 UTC 12,543 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7201,952],{6941:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/device",function(){return n(6333)}])},952:function(e,t,n){"use strict";n.r(t),n.d(t,{supabase:function(){return a}});var s=n(1289);let a=(0,s.createClientComponentClient)()},6333:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSG:function(){return T},default:function(){return A}});var s=n(1527),a=n(4777),i=n(3460),l=n(959),r=n(348),o=n.n(r),d=n(7627),c=n.n(d),u=n(15),x=n(616);let m=(0,x.Z)("ShieldAlert",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",key:"3xmgem"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var h=n(9999),p=n(2195),g=n(459),f=n(2318),v=n(602),j=n(1072),b=n(1355),N=n(952),w=n(5803);let y=/^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$/;function k(e){let t=e.toUpperCase().replace(/[^A-Z]/g,"");if(8!==t.length)return null;let n=`${t.slice(0,4)}-${t.slice(4)}`;return y.test(n)?n:null}function S(e,t,n){return(0,w.H1)(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)})}let C={code_not_found:"This code isn't valid or has expired. Run enconvo login on your device again for a new one.",already_decided:"This sign-in request has already been answered."};function _(e){let{tone:t,title:n,children:a}=e,i="warning"===t?m:h.Z;return(0,s.jsxs)("div",{role:"error"===t?"alert":"note",className:"mt-8 flex max-w-xl items-start gap-3 rounded-lg border border-hairline bg-surface-card p-4",children:[(0,s.jsx)(i,{className:"mt-0.5 h-5 w-5 flex-none text-signal-yellow","aria-hidden":"true"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-content",children:n}),(0,s.jsx)("p",{className:"mt-1 text-sm leading-6 text-content-muted",children:a})]})]})}function Z(e){let{initial:t}=e,{t:n}=(0,i.Q)(),a=(0,u.useRouter)(),[r,o]=(0,l.useState)(t),[d,c]=(0,l.useState)(!!t);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:j.tH,children:n("Sign in a device")}),(0,s.jsx)("h1",{className:"mt-4 max-w-2xl text-4xl font-semibold leading-tight sm:text-5xl sm:leading-[1.1]",children:n("Enter the code from your device")}),(0,s.jsx)("p",{className:"mt-5 max-w-xl text-base leading-7 text-content-body",children:n("Run enconvo login on the device you want to sign in, such as a Linux server, and enter the code it shows.")}),(0,s.jsxs)("form",{onSubmit:function(e){e.preventDefault();let t=k(r);if(!t){c(!0);return}a.replace({pathname:"/device",query:{code:t}})},className:"mt-8 flex max-w-xl flex-col gap-3 sm:flex-row",noValidate:!0,children:[(0,s.jsx)("label",{htmlFor:"device-code",className:"sr-only",children:n("Code")}),(0,s.jsx)("input",{id:"device-code",value:r,onChange:e=>{o(e.target.value),c(!1)},placeholder:"BCDF-GHJK",autoComplete:"off",autoCapitalize:"characters",spellCheck:!1,"aria-invalid":d,"aria-describedby":d?"device-code-error":void 0,className:"min-h-[48px] flex-1 rounded-lg border border-hairline bg-surface-card px-4 font-mono text-base uppercase tracking-[0.12em] text-content placeholder:text-content-ash focus:border-hairline-strong focus:outline-none"}),(0,s.jsxs)("button",{type:"submit",className:j.ud,children:[n("Continue"),(0,s.jsx)(p.Z,{className:"h-4 w-4","aria-hidden":"true"})]})]}),d&&(0,s.jsx)("p",{id:"device-code-error",role:"alert",className:"mt-3 text-sm text-signal-yellow",children:n("Codes have 8 letters, like BCDF-GHJK.")})]})}function E(e){let{tone:t,label:n,title:a,body:l}=e,{t:r}=(0,i.Q)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:["done"===t?(0,s.jsx)(g.Z,{className:"h-5 w-5 text-signal-green","aria-hidden":"true"}):(0,s.jsx)(h.Z,{className:"h-5 w-5 text-content-muted","aria-hidden":"true"}),(0,s.jsx)("span",{className:j.tH,children:n})]}),(0,s.jsx)("h1",{className:"mt-6 max-w-2xl text-4xl font-semibold leading-tight sm:text-5xl sm:leading-[1.1]",children:a}),(0,s.jsx)("p",{className:"mt-5 max-w-xl text-lg leading-8 text-content-body",children:l}),"stopped"===t&&(0,s.jsx)("div",{className:"mt-8",children:(0,s.jsx)(c(),{href:"/device",className:j.O0,children:r("Enter another code")})})]})}var T=!0;function A(){let e;let{t,locale:n}=(0,i.Q)(),r=(0,u.useRouter)(),d="string"==typeof r.query.code?r.query.code:"",x=k(d),[m,h]=(0,l.useState)(null),[g,w]=(0,l.useState)(!1),[y,T]=(0,l.useState)(null),[A,H]=(0,l.useState)(null),[R,F]=(0,l.useState)(null),[L,O]=(0,l.useState)(null),[q,D]=(0,l.useState)(null),M=encodeURIComponent(`/device?code=${x??""}`);function $(e,t){401===e?h(null):C[t]?H(C[t]):D(0===e?"Could not reach Enconvo. Check your connection and try again.":"Something went wrong. Please try again.")}async function P(e){if(!x)return;D(null),O(e?"approve":"deny");let{data:t}=await N.supabase.auth.getSession();if(!t.session){h(null),O(null);return}let n=await S("/api/device/approve",t.session.access_token,{user_code:x,approve:e});O(null),n.ok?F(n.data.status):$(n.status,n.reason)}(0,l.useEffect)(()=>{let e=!1;N.supabase.auth.getSession().then(t=>{let{data:n}=t;e||(h(n.session?.user.email??null),w(!0))});let{data:t}=N.supabase.auth.onAuthStateChange((e,t)=>{h(t?.user.email??null)});return()=>{e=!0,t.subscription.unsubscribe()}},[]),(0,l.useEffect)(()=>
1{if(T(null),H(null),F(null),D(null),!x||!m)return;let e=!1;return O("load"),(async()=>{let{data:t}=await N.supabase.auth.getSession();if(e)return;if(!t.session){h(null),O(null);return}let n=await S("/api/device/inspect",t.session.access_token,{user_code:x});if(!e){if(O(null),n.ok){"pending"===n.data.status?T(n.data):H(C.already_decided);return}$(n.status,n.reason)}})(),()=>{e=!0}},[x,m]);let U=y?.device.name||t("Unknown device"),z=y?new Date(y.created_at).toLocaleTimeString(n,{hour:"numeric",minute:"2-digit"}):"";return e=r.isReady&&g?x?"approved"===R?(0,s.jsx)(E,{tone:"done",label:t("Device signed in"),title:(0,s.jsx)(a.N,{source:"{p0} is signing in",values:{p0:(0,s.jsx)("span",{className:"break-words",children:U})}}),body:t("Go back to your terminal: Enconvo finishes signing in there within a few seconds. You can close this page.")}):"denied"===R?(0,s.jsx)(E,{tone:"stopped",label:t("Sign-in denied"),title:t("The device was not signed in"),body:t("If you didn't start this sign-in, nothing else is needed: the code no longer works.")}):A?(0,s.jsx)(E,{tone:"stopped",label:t("Sign in a device"),title:t("This code can't be used"),body:t(A)}):m?y?(0,s.jsxs)("div",{className:"grid gap-12 lg:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)] lg:items-start lg:gap-16",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:j.tH,children:t("Sign in a device")}),(0,s.jsx)("h1",{className:"mt-4 max-w-xl text-4xl font-semibold leading-tight sm:text-5xl sm:leading-[1.1]",children:t("Approve this sign-in?")}),(0,s.jsx)("p",{className:"mt-5 max-w-xl text-base leading-7 text-content-body",children:t("Check that your device shows this same code:")}),(0,s.jsx)("p",{className:"mt-3 inline-block rounded-md border border-hairline-strong bg-surface-card px-4 py-2 font-mono text-2xl tracking-[0.16em] text-content",children:x}),(0,s.jsx)(_,{tone:"warning",title:t("Only approve a sign-in you started"),children:t("Approving lets this device use your Enconvo account and its Cloud points. If someone sent you this link or code, deny it.")}),q&&(0,s.jsx)(_,{tone:"error",title:t("Couldn't answer the request"),children:t(q)}),(0,s.jsxs)("div",{className:"mt-8 flex flex-col gap-3 sm:flex-row",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>void P(!0),disabled:!!L,className:j.ud,children:["approve"===L?(0,s.jsx)(f.Z,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):null,t("Approve")]}),(0,s.jsxs)("button",{type:"button",onClick:()=>void P(!1),disabled:!!L,className:j.O0,children:["deny"===L?(0,s.jsx)(f.Z,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):null,t("Deny")]})]}),(0,s.jsxs)("p",{className:"mt-4 text-sm text-content-muted",children:[(0,s.jsx)(a.N,{source:"Approving as {p0}.",values:{p0:(0,s.jsx)("span",{className:"text-content",children:m})}})," ",(0,s.jsx)("button",{type:"button",onClick:()=>void N.supabase.auth.signOut({scope:"local"}),className:"text-content underline decoration-hairline-strong underline-offset-4",children:t("Use another account")})]})]}),(0,s.jsxs)("div",{className:"rounded-[10px] border border-hairline-strong bg-surface-elevated p-6",children:[(0,s.jsx)("h2",{className:j.tH,children:t("The device")}),(0,s.jsxs)("dl",{className:"mt-5 divide-y divide-hairline text-sm",children:[(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-4 pb-4",children:[(0,s.jsx)("dt",{className:"text-content-muted",children:t("Name")}
1),(0,s.jsx)("dd",{className:"min-w-0 break-words text-right font-semibold text-content",children:U})]}),y.device.platform&&(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-4 py-4",children:[(0,s.jsx)("dt",{className:"text-content-muted",children:t("Platform")}),(0,s.jsx)("dd",{className:"min-w-0 break-words text-right font-mono text-content",children:y.device.platform})]}),y.device.version&&(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-4 py-4",children:[(0,s.jsx)("dt",{className:"text-content-muted",children:t("Enconvo version")}),(0,s.jsx)("dd",{className:"min-w-0 break-words text-right font-mono text-content",children:y.device.version})]}),(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-4 py-4",children:[(0,s.jsx)("dt",{className:"text-content-muted",children:t("Location")}),(0,s.jsx)("dd",{className:"min-w-0 break-words text-right text-content",children:y.location||t("Unknown")})]}),(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-4 pt-4",children:[(0,s.jsx)("dt",{className:"text-content-muted",children:t("Requested")}),(0,s.jsx)("dd",{className:"text-content",children:z})]})]}),(0,s.jsx)("p",{className:"mt-5 text-xs leading-5 text-content-ash",children:t("The device reports its own name, platform and version. The location is approximate, from the network it used.")})]})]}):q?(0,s.jsx)(_,{tone:"error",title:t("Couldn't load the sign-in request"),children:t(q)}):(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin text-content-muted","aria-label":t("Loading")}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:j.tH,children:t("Sign in a device")}),(0,s.jsx)("h1",{className:"mt-4 max-w-2xl text-4xl font-semibold leading-tight sm:text-5xl sm:leading-[1.1]",children:t("Sign in to approve this device")}),(0,s.jsx)("p",{className:"mt-5 max-w-xl text-base leading-7 text-content-body",children:(0,s.jsx)(a.N,{source:"Your device asked to sign in with the code {p0}. Sign in to the Enconvo account you want it to use.",values:{p0:(0,s.jsx)("span",{className:"font-mono text-content",children:x})}})}),(0,s.jsxs)("div",{className:"mt-8 flex flex-col gap-3 sm:flex-row",children:[(0,s.jsxs)(c(),{href:`/login?returnUrl=${M}`,className:j.ud,children:[t("Sign in"),(0,s.jsx)(p.Z,{className:"h-4 w-4","aria-hidden":"true"})]}),(0,s.jsx)(c(),{href:`/register?returnUrl=${M}`,className:j.O0,children:t("Create your account")})]})]}):(0,s.jsx)(Z,{initial:d},d):(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin text-content-muted","aria-label":t("Loading")}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o(),{children:[(0,s.jsx)("title",{children:t("Sign in a device - Enconvo")}),(0,s.jsx)("meta",{name:"description",content:t("Approve an Enconvo sign-in that started on another device, such as a Linux server.")})]}),(0,s.jsxs)("div",{className:"min-h-screen bg-canvas text-content",children:[(0,s.jsx)(b.h,{}),(0,s.jsx)("main",{className:"mx-auto max-w-[1240px] px-6 pb-24 pt-36 lg:px-12",children:e}),(0,s.jsx)(v.$,{})]})]})}},2195:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var s=n(616);let a=(0,s.Z)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},459:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var s=n(616);let a=(0,s.Z)("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},2318:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var s=n(616);let a=(0,s.Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])}},function(e){e.O(0,[1289,5621,4131,9774,2888,179],function(){return e(e.s=6941)}),_N_E=e.O()}]);

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.