@tom2012/cc-web 2026.5.8-a → 2026.5.11-b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/dist/flows/runner.d.ts +44 -0
- package/backend/dist/flows/runner.d.ts.map +1 -0
- package/backend/dist/flows/runner.js +656 -0
- package/backend/dist/flows/runner.js.map +1 -0
- package/backend/dist/flows/store.d.ts +31 -0
- package/backend/dist/flows/store.d.ts.map +1 -0
- package/backend/dist/flows/store.js +201 -0
- package/backend/dist/flows/store.js.map +1 -0
- package/backend/dist/flows/types.d.ts +100 -0
- package/backend/dist/flows/types.d.ts.map +1 -0
- package/backend/dist/flows/types.js +9 -0
- package/backend/dist/flows/types.js.map +1 -0
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +7 -0
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/routes/flows.d.ts +3 -0
- package/backend/dist/routes/flows.d.ts.map +1 -0
- package/backend/dist/routes/flows.js +244 -0
- package/backend/dist/routes/flows.js.map +1 -0
- package/frontend/dist/assets/{ChatOverlay-Dewml63P.js → ChatOverlay-DOPyrrXA.js} +2 -2
- package/frontend/dist/assets/{GraphPreview-DKqon8iY.js → GraphPreview-CKjnNwAU.js} +1 -1
- package/frontend/dist/assets/{MobilePage-0yihNWS5.js → MobilePage-Cv3IL4tK.js} +3 -3
- package/frontend/dist/assets/{OfficePreview-CLoz-Kzs.js → OfficePreview-C1KT27Ss.js} +2 -2
- package/frontend/dist/assets/{PdfPreview-ceFK86bz.js → PdfPreview-DPO8NU-g.js} +1 -1
- package/frontend/dist/assets/{ProjectPage-Dx8ti9Xg.js → ProjectPage-CCE5a09C.js} +5 -5
- package/frontend/dist/assets/SettingsPage-CSsVqoPw.js +13 -0
- package/frontend/dist/assets/{SkillHubPage-0i_Vbges.js → SkillHubPage-DTWHYFS5.js} +1 -1
- package/frontend/dist/assets/{chevron-down-CabXIthZ.js → chevron-down-Br-a5rS0.js} +1 -1
- package/frontend/dist/assets/{index-PkEuCOb6.js → index-BjokCGs1.js} +2 -2
- package/frontend/dist/assets/{index-DKiLzICV.js → index-CIhDjRmt.js} +1 -1
- package/frontend/dist/assets/{index-QPAdq047.js → index-Ci2OcLAl.js} +1 -1
- package/frontend/dist/assets/index-nnLME6Go.css +1 -0
- package/frontend/dist/assets/{jszip.min-C5eqdtGO.js → jszip.min-CNWZX5Wv.js} +1 -1
- package/frontend/dist/assets/{search-CO9hGSbE.js → search-B92cpQPd.js} +1 -1
- package/frontend/dist/assets/select-Bk7v5W9n.js +13 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/SettingsPage-DqXMFZN7.js +0 -13
- package/frontend/dist/assets/index-BJDTvhqr.css +0 -1
- package/frontend/dist/assets/index-DFmoROkt.js +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{c as e,r as s,$ as t,aX as a,j as n,a1 as c,a0 as l,W as i,d as r,aE as o,aG as d,aY as h,t as m,al as x,I as u,B as p,aM as g,X as j,D as b,aZ as y,a_ as f,a$ as _,b0 as v,u as k,b1 as N,T as w,b2 as C,b3 as S,b4 as M,b5 as E,b6 as T,aF as R,b7 as I,b8 as P,h as H,S as F,b9 as L,aI as z,K as q,s as V,ba as A}from"./index-BjokCGs1.js";import{u as G,o as U,i as O,j as B,k as $,l as D,m as W,S as Q,U as X,n as Z,T as K,a as Y,b as J,c as ee}from"./select-Bk7v5W9n.js";import{a as se}from"./index-Ci2OcLAl.js";import"./chevron-down-Br-a5rS0.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.309.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const te=e("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]),ae=e("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]),ne=e("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]),ce=e("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),le=e("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]),ie=e("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]),re=e("UploadCloud",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]]);
|
|
8
|
+
/**
|
|
9
|
+
* @license lucide-react v0.309.0 - ISC
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the ISC license.
|
|
12
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/var oe="Switch",[de]=i(oe),[he,me]=de(oe),xe=s.forwardRef((e,i)=>{const{__scopeSwitch:r,name:o,checked:d,defaultChecked:h,required:m,disabled:x,value:u="on",onCheckedChange:p,form:g,...j}=e,[b,y]=s.useState(null),f=t(i,e=>y(e)),_=s.useRef(!1),v=!b||(g||!!b.closest("form")),[k,N]=a({prop:d,defaultProp:h??!1,onChange:p,caller:oe});return n.jsxs(he,{scope:r,checked:k,disabled:x,children:[n.jsx(c.button,{type:"button",role:"switch","aria-checked":k,"aria-required":m,"data-state":je(k),"data-disabled":x?"":void 0,disabled:x,value:u,...j,ref:f,onClick:l(e.onClick,e=>{N(e=>!e),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&n.jsx(ge,{control:b,bubbles:!_.current,name:o,value:u,checked:k,required:m,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});xe.displayName=oe;var ue="SwitchThumb",pe=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...a}=e,l=me(ue,t);return n.jsx(c.span,{"data-state":je(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s})});pe.displayName=ue;var ge=s.forwardRef(({__scopeSwitch:e,control:a,checked:c,bubbles:l=!0,...i},r)=>{const o=s.useRef(null),d=t(o,r),h=G(c),m=U(a);return s.useEffect(()=>{const e=o.current;if(!e)return;const s=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(s,"checked").set;if(h!==c&&t){const s=new Event("click",{bubbles:l});t.call(e,c),e.dispatchEvent(s)}},[h,c,l]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...i,tabIndex:-1,ref:d,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function je(e){return e?"checked":"unchecked"}ge.displayName="SwitchBubbleInput";var be=xe,ye=pe;const fe=s.forwardRef(({className:e,...s},t)=>n.jsx(be,{className:r("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:t,children:n.jsx(ye,{className:r("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));fe.displayName=be.displayName;function _e(){const{t:e}=o(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(!1),[k,N]=s.useState(!1),[w,C]=s.useState(!1),[S,M]=s.useState(!1),[E,T]=s.useState(null),[R,I]=s.useState(0),[P,H]=s.useState(""),[F,L]=s.useState("");d({onStart:e=>{T(e.projectId),I(0)},onProgress:e=>{T(e.projectId),I(e.filesTransferred)},onDone:()=>{T(null),I(0)}}),s.useEffect(()=>{let s=!1;return h().then(e=>{s||(a(e),L(e.defaultExcludes.join("\n")))}).catch(s=>m.error(e("sync_section.load_failed",{message:s.message}))).finally(()=>{s||l(!1)}),()=>{s=!0}},[e]);const z=(e,s)=>{a(t=>t?{...t,[e]:s}:t)};return c||!t?n.jsx("div",{className:"text-sm text-muted-foreground",children:e("sync_section.loading")}):n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.server_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-host",children:e("sync_section.host")}),n.jsx(u,{id:"sync-host",value:t.host,onChange:e=>z("host",e.target.value),placeholder:"example.com"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-port",children:e("sync_section.port")}),n.jsx(u,{id:"sync-port",type:"number",value:t.port,onChange:e=>z("port",Number(e.target.value)||22)})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-user",children:e("sync_section.user")}),n.jsx(u,{id:"sync-user",value:t.user,onChange:e=>z("user",e.target.value),placeholder:"tom"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-remote",children:e("sync_section.remote_root")}),n.jsx(u,{id:"sync-remote",value:t.remoteRoot,onChange:e=>z("remoteRoot",e.target.value),placeholder:"/data/projects"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.remote_root_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.auth_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.auth_method")}),n.jsxs(O,{value:t.authMethod,onValueChange:e=>z("authMethod",e),children:[n.jsx(B,{children:n.jsx($,{})}),n.jsxs(D,{children:[n.jsx(W,{value:"key",children:"SSH key"}),n.jsx(W,{value:"password",children:e("sync_section.auth_password")})]})]})]}),"key"===t.authMethod?n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-key",children:e("sync_section.key_path")}),n.jsx(u,{id:"sync-key",value:t.keyPath??"",onChange:e=>z("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-pw",children:e("sync_section.password")}),n.jsx(u,{id:"sync-pw",type:"password",value:P,onChange:e=>H(e.target.value),placeholder:t.passwordSet?e("sync_section.password_set_placeholder"):e("sync_section.password_unset_placeholder")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.sshpass_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.strategy_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.direction")}),n.jsxs(O,{value:t.direction,onValueChange:e=>z("direction",e),children:[n.jsx(B,{children:n.jsx($,{})}),n.jsxs(D,{children:[n.jsx(W,{value:"push",children:e("sync_section.push_label")}),n.jsx(W,{value:"pull",children:e("sync_section.pull_label")}),n.jsx(W,{value:"bidirectional",children:e("sync_section.bidirectional_label")})]})]})]}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx(x,{htmlFor:"sync-cron",children:e("sync_section.cron_label")}),n.jsx(u,{id:"sync-cron",value:t.schedule.cron,onChange:e=>z("schedule",{...t.schedule,cron:e.target.value}),placeholder:"0 3 * * *"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.cron_hint")}})]}),n.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[n.jsx(fe,{checked:t.schedule.enabled,onCheckedChange:e=>z("schedule",{...t.schedule,enabled:e})}),n.jsx("span",{className:"text-xs text-muted-foreground",children:e("sync_section.enable_label")})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.exclude_section")}),n.jsx("textarea",{value:F,onChange:e=>L(e.target.value),rows:6,className:"w-full font-mono text-xs p-2 rounded border border-input bg-background resize-y",placeholder:"node_modules/\n.git/objects/\n*.log"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.exclude_hint")}})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[n.jsxs(p,{onClick:()=>{(async()=>{if(t){r(!0);try{const s=F.split("\n").map(e=>e.trim()).filter(Boolean),n={host:t.host,port:t.port,user:t.user,authMethod:t.authMethod,keyPath:t.keyPath,remoteRoot:t.remoteRoot,direction:t.direction,defaultExcludes:s,schedule:t.schedule};P&&"__keep__"!==P&&(n.password=P);const c=await y(n);a(c),L(c.defaultExcludes.join("\n")),H(""),m.success(e("sync_section.saved"))}catch(s){m.error(e("sync_section.save_failed",{message:s.message}))}finally{r(!1)}}})()},disabled:i,children:[i?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.save_button")]}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{N(!0);try{const s=await f();s.ok?m.success(s.message||e("sync_section.test_ok")):m.error(s.message||e("sync_section.test_failed"))}catch(s){m.error(e("sync_section.test_failed_with_reason",{message:s.message}))}finally{N(!1)}})()},disabled:k,children:[k?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.test_button")]}),n.jsx("div",{className:"flex-1"}),w&&E&&n.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:R>0?e("sync_section.syncing_with_files",{project:E,files:R}):e("sync_section.syncing_no_files",{project:E})}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{C(!0);try{const s=await _(),t=s.results.filter(e=>e.ok).length,a=s.results.filter(e=>e.skipped).length,n=s.results.filter(e=>"cancelled"===e.reason).length,c=s.total-t-a-n;n>0?m.info(e("sync_section.bulk_cancelled_toast",{ok:t,skipped:a,cancelled:n,failed:c})):m.success(e("sync_section.bulk_done_toast",{ok:t,skipped:a,failed:c}))}catch(s){m.error(e("sync_section.bulk_failed_toast",{message:s.message}))}finally{C(!1),M(!1),T(null),I(0)}})()},disabled:w,title:e("sync_section.sync_all_title"),children:[w?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(X,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.sync_all_button")]}),w&&n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{if(w&&!S){M(!0);try{await v(),m.info(e("sync_section.cancel_requested"))}catch(s){m.error(e("sync_section.cancel_failed",{message:s.message})),M(!1)}}})()},disabled:S,title:e("sync_section.cancel_button_title"),children:[S?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(j,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.cancel_button")]})]}),n.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["Per-project push/pull: from inside a project, click the ",n.jsx(X,{className:"inline h-3 w-3"})," / ",n.jsx(b,{className:"inline h-3 w-3"})," buttons in the header. Or call ",n.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",n.jsx("code",{children:'{ "direction": "push" }'}),"."]})]})}function ve(){const e=k(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(""),[o,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return N().then(s=>{e||a(s)}).catch(()=>{e||a({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',n.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),c?n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[n.jsx(g,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"rounded-md border px-3 py-2.5 text-xs flex items-center gap-2",children:(null==t?void 0:t.configured)?n.jsxs(n.Fragment,{children:[n.jsx(se,{className:"h-4 w-4 text-green-500 shrink-0"}),n.jsx("span",{children:"已配置 token,可直接提交"}),n.jsx("div",{className:"flex-1"}),n.jsxs(p,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await C(),a({configured:!1,needsReset:!1}),m.success("已清除")}catch(s){m.error(`清除失败: ${s.message}`)}})()},children:[n.jsx(w,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?n.jsxs(n.Fragment,{children:[n.jsx(Z,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Z,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("span",{children:"尚未配置 token"})]})}),n.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[n.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:["打开"," ",n.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline inline-flex items-center gap-0.5",children:["GitHub fine-grained PAT",n.jsx(ne,{className:"h-3 w-3"})]})," ","创建页"]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',n.jsx("code",{children:"zbc0315/ccweb-hub"})]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),n.jsx("li",{children:"其余权限保持默认(全部无访问)"}),n.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(x,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&n.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),n.jsx(u,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:i,onChange:e=>r(e.target.value),autoComplete:"off",spellCheck:!1}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",n.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),n.jsx("div",{className:"flex gap-2 pt-2 border-t",children:n.jsxs(p,{onClick:()=>{(async()=>{const e=i.trim();if(e){d(!0);try{const s=await S(e);a(s),r(""),m.success("已保存")}catch(s){m.error(`保存失败: ${s.message}`)}finally{d(!1)}}else m.error("请输入 token")})()},disabled:o||!i.trim(),children:[o?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ke(){const{t:e,i18n:s}=o();return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs(O,{value:s.language,onValueChange:async t=>{if(M.includes(t)){try{localStorage.setItem(E,t)}catch{}await s.changeLanguage(t);try{await T(t)}catch{m.error(e("language.switch_failed"))}}},children:[n.jsx(B,{className:"w-40",children:n.jsx($,{})}),n.jsxs(D,{children:[n.jsx(W,{value:"zh",children:e("language.zh")}),n.jsx(W,{value:"en",children:e("language.en")})]})]})]})}function Ne(){const{t:e}=o(),t=R(),[a]=I(),c=a.get("tab")||"sync",[l,i]=s.useState(()=>P()),[r,d]=s.useState(!1),[h,g]=s.useState({webhookEnabled:!1}),[j,b]=s.useState(""),[y,f]=s.useState(!1),[_,v]=s.useState(()=>H(F.usageMonitorTool,"claude"));s.useEffect(()=>{L().then(e=>{g(e),b(e.webhookUrl??"")}).catch(()=>{})},[]);const k=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(i(s=>({...s,[e]:t})),d(!0))};return n.jsx("div",{className:"min-h-screen bg-background",children:n.jsxs("div",{className:"max-w-3xl mx-auto p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsxs(p,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[n.jsx(z,{className:"h-4 w-4 mr-1"}),e("common.back")]}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),n.jsxs(K,{defaultValue:c,children:[n.jsxs(Y,{className:"mb-4",children:[n.jsxs(J,{value:"sync",children:[n.jsx(re,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),n.jsxs(J,{value:"hub",children:[n.jsx(ce,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),n.jsxs(J,{value:"notifications",children:[n.jsx(ae,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),n.jsxs(J,{value:"pomodoro",children:[n.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),n.jsxs(J,{value:"usage",children:[n.jsx(te,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),n.jsxs(J,{value:"language",children:[n.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),n.jsx(ee,{value:"sync",children:n.jsx(_e,{})}),n.jsx(ee,{value:"hub",children:n.jsx(ve,{})}),n.jsx(ee,{value:"notifications",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),n.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:"Webhook URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(u,{placeholder:"https://hooks.slack.com/...",value:j,onChange:e=>b(e.target.value),className:"font-mono text-xs"}),n.jsx(p,{size:"sm",onClick:()=>{(async()=>{f(!0);try{const s=await A({webhookEnabled:j.trim().length>0,webhookUrl:j.trim()||void 0});g(s),m.success(e("settings.webhook.saved"))}catch{m.error(e("settings.webhook.save_failed"))}finally{f(!1)}})()},disabled:y,children:e(y?"common.saving":"common.save")})]}),h.webhookEnabled&&h.webhookUrl&&n.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",h.webhookUrl]})]})]})]})}),n.jsx(ee,{value:"pomodoro",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),n.jsx(u,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>k("workMinutes",e.target.value),className:"w-full"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),n.jsx(u,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>k("breakMinutes",e.target.value),className:"w-full"})]})]}),r&&n.jsxs(p,{size:"sm",onClick:()=>{V(F.pomodoroConfig,l,!0),d(!1),m.success(e("settings.pomodoro.saved"))},children:[n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx(q,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),n.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),n.jsx(ee,{value:"usage",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),n.jsx("div",{className:"grid gap-3 max-w-md",children:[{key:"claude",label:"Claude Code",desc:e("settings.usage.tool_claude_desc")},{key:"codex",label:"Codex",desc:e("settings.usage.tool_codex_desc")},{key:"opencode",label:"OpenCode",desc:e("settings.usage.tool_opencode_desc")},{key:"qwen",label:"Qwen Code",desc:e("settings.usage.tool_qwen_desc")},{key:"gemini",label:"Gemini CLI",desc:e("settings.usage.tool_gemini_desc")}].map(s=>n.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(_===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[n.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:_===s.key,onChange:()=>{v(s.key),V(F.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),m.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:s.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsx("li",{children:e("settings.usage.info_item_1")}),n.jsx("li",{children:e("settings.usage.info_item_2")}),n.jsx("li",{children:e("settings.usage.info_item_3")}),n.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),n.jsx(ee,{value:"language",children:n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsx("div",{children:n.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),n.jsx(ke,{})]})})})]})]})})}export{Ne as SettingsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,aF as s,r as t,be as a,bf as r,t as n,bg as l,bh as i,bi as c,ab as d,bj as o,j as m,B as x,aI as u,d as p,I as h,T as g,p as f,D as j,aB as b,aC as N,A as y,an as v,at as k}from"./index-
|
|
1
|
+
import{c as e,aF as s,r as t,be as a,bf as r,t as n,bg as l,bh as i,bi as c,ab as d,bj as o,j as m,B as x,aI as u,d as p,I as h,T as g,p as f,D as j,aB as b,aC as N,A as y,an as v,at as k}from"./index-BjokCGs1.js";import{S as w}from"./search-B92cpQPd.js";import{C}from"./chevron-down-Br-a5rS0.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.309.0 - ISC
|
|
4
4
|
*
|