PageSourceSearch

https://musebox.ai/assets/PanelKeys-YhTFpjKf.js

js musebox.ai collected 2026-10-05 13:38:26 UTC 8,002 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-ui--86-bCAR.js";import{a as n}from"./vendor-react-dh0YdBDl.js";import{c as f,E as B,S as H,P as W,N as v,B as i,L as G,F as j,I as b,b as Y,d as U}from"./console-DleDeunt.js";import{u as w}from"./index-phOctNbv.js";import{T as q}from"./Trans-9VQ7M9XV.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"ef0ac31441b1214a02bb8e808c37bed3a480a90b"};var l=new s.Error().stack;l&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[l]="760102c9-fb5d-4b59-90ea-6e747a353193",s._sentryDebugIdIdentifier="sentry-dbid-760102c9-fb5d-4b59-90ea-6e747a353193")}catch{}})();function ee(){const{t:s}=w("api-console"),[l,o]=n.useState(null),[t,x]=n.useState(""),[y,u]=n.useState(!1),[d,p]=n.useState(null),m=n.useCallback(()=>{f.get("/keys").then(o).catch(r=>x(r.message))},[]);if(n.useEffect(m,[m]),t)return e.jsx(B,{children:t});if(!l)return e.jsx(H,{});const c=l.live>=l.max;return e.jsxs("div",{className:"flex flex-col gap-4",children:[d&&e.jsxs(W,{title:s("keys.copyNow"),children:[e.jsx(v,{tone:"alarm",children:s("keys.onlyTimeShown")}),e.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[e.jsx(D,{label:s("keys.apiKey"),value:d.fullKey}),e.jsx(D,{label:s("keys.signingSecret"),value:d.webhookSecret})]}),e.jsx("div",{className:"mt-3",children:e.jsx(i,{onClick:()=>p(null),children:s("keys.haveCopied")})})]}),e.jsxs(W,{title:s("keys.panelTitle",{live:l.live,max:l.max}),right:e.jsx(i,{kind:"primary",onClick:()=>u(!0),disabled:c,children:s("keys.create")}),children:[c&&e.jsx("div",{className:"mb-3",children:e.jsx(v,{tone:"info",children:s("keys.atCap",{max:l.max})})}),y&&e.jsx("div",{className:"mb-4",children:e.jsx(J,{onCancel:()=>u(!1),onCreated:r=>{u(!1),p(r),m()}})}),l.keys.length===0?e.jsx(B,{children:s("keys.noKeys")}):e.jsx("div",{className:"flex flex-col gap-3",children:l.keys.map(r=>e.jsx(M,{k:r,liveCount:l.live,onChanged:m},r.id))})]})]})}function D({label:s,value:l}){const{t:o}=w("api-console"),[t,x]=n.useState(!1);return e.jsxs("div",{children:[e.jsx(G,{children:s}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"mc-mono flex-1 px-2.5 py-2 rounded-sm mc-scroll-x",style:{fontSize:12.5,background:"var(--mc-panel-raised)",border:"1px solid var(--mc-line-strong)",whiteSpace:"nowrap"},children:l}),e.jsx(i,{onClick:()=>{navigator.clipboard.writeText(l).then(()=>{x(!0),setTimeout(()=>x(!1),1600)})},children:o(t?"copied":"copy")})]})]})}function J({onCancel:s,onCreated:l}){const{t:o}=w("api-console"),[t,x]=n.useState(""),[y,u]=n.useState(""),[d,p]=n.useState(!1),[m,c]=n.useState("");return e.jsxs("form",{className:"flex flex-col gap-3 p-3 rounded-sm",style:{border:"1px solid var(--mc-line-strong)",background:"var(--mc-panel-raised)"},onSubmit:r=>{r.preventDefault(),p(!0),c(""),f.post("/keys",{name:t,password:y}).then(l).catch(h=>c(h.message)).finally(()=>p(!1))},children:[e.jsx(j,{label:o("keys.name"),hint:o("keys.nameHint"),children:e.jsx(b,{value:t,onChange:r=>x(r.target.value),maxLength:60,autoFocus:!0})}),e.jsx(j,{label:o("keys.consolePassword"),children:e.jsx(b,{type:"password",value:y,onChange:r=>u(r.target.value),autoComplete:"current-password"})}),m&&e.jsx(v,{tone:"alarm",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{kind:"primary",type:"submit",disabled:d||!t.trim()||!y,children:o(d?"keys.creating":"keys.create")}),e.jsx(i,{onClick:s,children:o("cancel")})]})]})}function M({k:s,liveCount:l,onChanged:o}){const{t}=w("api-console"),{date:x,dateTime:y}=Y(),[u,d]=n.useState(!1),[p,m]=n.useState(s.webhookUrl??""),[c,r]=n.useState(""),[h,L]=n.useState(!1),[I,K]=n.useState(""),[N,A]=n.useState(null),[R,_]=n.useState(""),[z,C]=n.useState(!1),[E,T]=n.useState(""),k=!!s.revokedAt,F=!k&&l<=1,g=(a,P)=>{L(!0),K(""),A(null),a.then(()=>{P==null||P(),o()}).catch($=>K($.message)).finally(()=>L(!1))};return e.jsxs("div",{className:"rounded-sm p-3",style:{border:"1px solid var(--mc-line)",opacity:k?.6:1},children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mc-mono",style:{fontSize:14},children:s.name}),e.jsxs("div",{className:"mc-mono mt-1",style:{fontSize:12,color:"var(--mc-ink-faint)"},children:[s.keyPrefix,"…"]})]}),e.jsx("div",{className:"flex items-center gap-2",children:k?e.jsx(U,{tone:"idle",children:t("keys.pillRevoked")}):s.lastUsedAt?e.jsx(U,{tone:"ok",children:t("keys.pillInUse")}):e.jsx(U,{tone:"idle",children:t("keys.pillNeverUsed")})})]}
1),e.jsxs("dl",{className:"mt-3 grid gap-1",style:{fontSize:12,color:"var(--mc-ink-dim)"},children:[e.jsx(S,{k:t("keys.created"),v:x(s.createdAt)}),e.jsx(S,{k:t("keys.lastUsed"),v:s.lastUsedAt?y(s.lastUsedAt):t("never")}),e.jsx(S,{k:t("keys.resultsGoTo"),v:s.webhookUrl||t("keys.resultsNowhere")}),e.jsx(S,{k:t("keys.signingSecret"),v:s.hasWebhookSecret?t("keys.secretSet"):t("keys.secretNotSet")})]}),!k&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(i,{onClick:()=>d(a=>!a),children:u?t("close"):s.webhookUrl?t("keys.changeDestination"):t("keys.setDestination")}),s.webhookUrl&&e.jsx(i,{disabled:h,onClick:()=>g(f.post(`/keys/${s.id}/webhook/test`).then(a=>{A(a.delivered?{tone:"ok",text:t("keys.testWorked",{status:a.httpStatus})}:{tone:"alarm",text:a.error||t("keys.testFailed",{status:a.httpStatus})})})),children:t("keys.sendTest")}),e.jsx(i,{kind:"danger",disabled:h||F,onClick:()=>C(a=>!a),children:t(z?"keys.keepKey":"keys.revoke")}),F&&e.jsx("span",{style:{fontSize:12,color:"var(--mc-ink-dim)",alignSelf:"center"},children:t("keys.lastKeyWarning")})]}),u&&!k&&e.jsxs("form",{className:"mt-3 flex flex-col gap-3 p-3 rounded-sm",style:{border:"1px solid var(--mc-line-strong)",background:"var(--mc-panel-raised)"},onSubmit:a=>{a.preventDefault(),g(f.put(`/keys/${s.id}/webhook`,{webhookUrl:p.trim(),password:c}),()=>{d(!1),r("")})},children:[e.jsx(j,{label:t("keys.destinationLabel"),hint:t("keys.destinationHint"),children:e.jsx(b,{value:p,onChange:a=>m(a.target.value),placeholder:"https://your-app.example/hooks/render"})}),e.jsx(j,{label:t("keys.consolePassword"),children:e.jsx(b,{type:"password",value:c,onChange:a=>r(a.target.value),autoComplete:"current-password"})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(i,{kind:"primary",type:"submit",disabled:h||!c,children:t("save")}),e.jsx(i,{disabled:h||!c,onClick:()=>g(f.post(`/keys/${s.id}/webhook/rotate-secret`,{password:c}).then(a=>_(a.webhookSecret))),children:t("keys.rotateSecret")})]}),R&&e.jsxs("div",{children:[e.jsx(v,{tone:"alarm",children:t("keys.newSecretWarning")}),e.jsx("div",{className:"mt-2",children:e.jsx(D,{label:t("keys.newSigningSecret"),value:R})})]})]}),z&&!k&&e.jsxs("form",{className:"mt-3 flex flex-col gap-3 p-3 rounded-sm",style:{border:"1px solid var(--mc-alarm)",background:"var(--mc-panel-raised)"},onSubmit:a=>{a.preventDefault(),g(f.post(`/keys/${s.id}/revoke`,{password:E}),()=>{C(!1),T("")})},children:[e.jsx("p",{style:{fontSize:13},children:e.jsx(q,{i18nKey:"keys.revokeConfirm",ns:"api-console",values:{name:s.name},components:[e.jsx("span",{className:"mc-mono"},"0")]})}),e.jsx(j,{label:t("keys.consolePassword"),children:e.jsx(b,{type:"password",value:E,onChange:a=>T(a.target.value),autoComplete:"current-password",autoFocus:!0})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{kind:"danger",type:"submit",disabled:h||!E,children:t(h?"keys.revoking":"keys.revokeSubmit")}),e.jsx(i,{onClick:()=>{C(!1),T("")},children:t("cancel")})]})]}),N&&e.jsx("div",{className:"mt-3",children:e.jsx(v,{tone:N.tone,children:N.text})}),I&&e.jsx("div",{className:"mt-3",children:e.jsx(v,{tone:"alarm",children:I})})]})}function S({k:s,v:l}){return e.jsxs("div",{className:"flex flex-wrap gap-x-2",children:[e.jsx("dt",{style:{minWidth:150},children:s}),e.jsx("dd",{className:"mc-mono",style:{color:"var(--mc-ink)",wordBreak:"break-all"},children:l})]})}export{ee 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.