flex-mcp 1.1.11 → 1.1.13
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/dist/web/assets/Blank-BHJQs5sx.js +1 -0
- package/dist/web/assets/Configs-ClEYNzO5.js +1 -0
- package/dist/web/assets/{Dashboard-DG4KlU_v.js → Dashboard-CnyNQRgh.js} +4 -4
- package/dist/web/assets/InitScriptEditor-BFTWTD26.js +499 -0
- package/dist/web/assets/Layout-B9iGlIQE.js +1 -0
- package/dist/web/assets/Layout-Da7GFkga.js +1 -0
- package/dist/web/assets/Login-BWlz3FI1.js +1 -0
- package/dist/web/assets/Login-DXNFmh7b.js +1 -0
- package/dist/web/assets/Users-DGRVEG-v.js +1 -0
- package/dist/web/assets/index-CmiEbWrJ.js +2 -0
- package/dist/web/assets/monaco-editor-BXWd1EVR.js +11 -0
- package/dist/web/assets/naive-ui-BwyHI4J3.js +7313 -0
- package/dist/web/assets/style-CrcCgeaU.css +1 -0
- package/dist/web/assets/vendor-DpXl860f.js +58 -0
- package/dist/web/index.html +5 -2
- package/package.json +1 -1
- package/dist/web/assets/Blank-DnwEW0VT.js +0 -1
- package/dist/web/assets/Configs-Bq1LRu7c.js +0 -1
- package/dist/web/assets/InitScriptEditor-BpsNM3mj.js +0 -509
- package/dist/web/assets/Layout-CZunjis7.js +0 -1
- package/dist/web/assets/Layout-DuBl1mVJ.js +0 -1
- package/dist/web/assets/Login-CV4pyxSI.js +0 -1
- package/dist/web/assets/Login-Drzps0QW.js +0 -1
- package/dist/web/assets/Users-zsruR1wp.js +0 -1
- package/dist/web/assets/index-mIcNgFiY.js +0 -7371
- package/dist/web/assets/style-BdM4weEm.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as t,q as B,r as L,s as _,c6 as H,o as j,c0 as i,c1 as o,c2 as z,bW as v,c7 as a,bs as m,bV as h,F as I,bN as A,bT as F,bU as r,bm as S,c5 as G,bS as g,c8 as C,T as N,c3 as P}from"./vendor-DpXl860f.js";import{u as T,a as q}from"./index-CmiEbWrJ.js";import{B as D}from"./naive-ui-BwyHI4J3.js";import{_ as R}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./monaco-editor-BXWd1EVR.js";const U=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),t("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),t("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),t("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"})]),O=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),W=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M4 7h3m13 0h-3m-2 4l-2 5l-2-5m9-4l-3 8l-3-8m-6 11h3m0 0h3m-3 0V10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),Z=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("polyline",{points:"16 18 22 12 16 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("polyline",{points:"8 6 2 12 8 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),$=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h7v2H7v-2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),E=()=>t("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("path",{d:"M14 2v6h6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("path",{d:"M16 13H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),t("path",{d:"M16 17H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),t("path",{d:"M10 9H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})]),x=[{label:"MCP 组件",key:"section-components",icon:U,description:"管理 MCP 服务组件"},{label:"自定义工具",key:"section-tools",icon:O,description:"创建和编辑工具"},{label:"变量管理",key:"section-variables",icon:W,description:"配置环境变量",hideForAdmin:!0},{label:"初始化脚本",key:"section-init",icon:Z,description:"编写启动脚本"},{label:"数据管理",key:"section-tables",icon:$,description:"创建和管理数据表",hideForAdmin:!0},{label:"提示词管理",key:"section-prompts",icon:E,description:"创建和管理提示词模板"}],J={class:"app-shell"},K={class:"app-header"},Q={class:"app-header__container"},X={class:"app-header__right"},Y={class:"user-info"},oo={class:"user-email"},to={class:"app-body"},eo={class:"app-sidebar"},so={class:"sidebar-nav"},no=["onClick"],ro={class:"nav-item__icon"},io={class:"nav-item__content"},ao={class:"nav-item__label"},lo={class:"nav-item__description"},co={key:0,class:"nav-item__indicator"},po={class:"app-content"},uo={class:"content-wrapper"},vo={class:"app-footer"},ho={class:"version-info"},ko={class:"version-text"},fo=B({__name:"Layout",setup(wo){const d=P(),l=H(),c=T(),p=L("..."),k=_(()=>l.name==="UserDashboard"?`section-${l.query.section||"components"}`:l.name),y=_(()=>{var s;return((s=c.user)==null?void 0:s.role)==="admin"?x.filter(u=>!u.hideForAdmin):x});function b(e){if(e.startsWith("section-")){const s=e.replace("section-","");d.push({name:"UserDashboard",query:{section:s}});return}d.push({name:e})}function M(){c.userLogout(),d.push("/user/login")}async function V(){try{const e=await q.get("/update/version");e.data.success&&(p.value=e.data.version)}catch(e){console.error("获取版本失败:",e),p.value="unknown"}}return j(()=>{V()}),(e,s)=>{var f;const u=F("router-view");return r(),i("div",J,[o("header",K,[o("div",Q,[s[2]||(s[2]=z('<div class="app-header__left" data-v-d9fd6813><div class="app-logo" data-v-d9fd6813><div class="logo-icon" data-v-d9fd6813><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d9fd6813><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#gradient1)" data-v-d9fd6813></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#gradient2)" data-v-d9fd6813></path><defs data-v-d9fd6813><linearGradient id="gradient1" x1="2" y1="2" x2="22" y2="12" data-v-d9fd6813><stop offset="0%" stop-color="#6366f1" data-v-d9fd6813></stop><stop offset="100%" stop-color="#8b5cf6" data-v-d9fd6813></stop></linearGradient><linearGradient id="gradient2" x1="2" y1="12" x2="22" y2="22" data-v-d9fd6813><stop offset="0%" stop-color="#8b5cf6" data-v-d9fd6813></stop><stop offset="100%" stop-color="#ec4899" data-v-d9fd6813></stop></linearGradient></defs></svg></div><div class="logo-text" data-v-d9fd6813><div class="logo-title" data-v-d9fd6813>Flex MCP</div><div class="logo-subtitle" data-v-d9fd6813>MCP 服务运营平台</div></div></div></div>',1)),o("div",X,[o("div",Y,[s[0]||(s[0]=o("div",{class:"user-avatar"},[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("circle",{cx:"12",cy:"8",r:"4",fill:"currentColor",opacity:"0.3"}),o("path",{d:"M6 21C6 17.686 8.686 15 12 15C15.314 15 18 17.686 18 21",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})])],-1)),o("span",oo,a(((f=m(c).user)==null?void 0:f.email)||"用户"),1)]),v(m(D),{class:"logout-btn",quaternary:"",circle:"",onClick:M},{icon:h(()=>[...s[1]||(s[1]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M9 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M16 17L21 12L16 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M21 12H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1})])])]),o("div",to,[o("aside",eo,[o("nav",so,[(r(!0),i(I,null,A(y.value,n=>(r(),i("div",{key:n.key,class:S(["nav-item",{"nav-item--active":k.value===n.key}]),onClick:w=>b(n.key)},[o("div",ro,[(r(),g(C(n.icon)))]),o("div",io,[o("div",ao,a(n.label),1),o("div",lo,a(n.description),1)]),k.value===n.key?(r(),i("div",co)):G("",!0)],10,no))),128))])]),o("main",po,[o("div",uo,[v(u,null,{default:h(({Component:n,route:w})=>[v(N,{name:"page-fade",mode:"out-in"},{default:h(()=>[(r(),g(C(n),{key:w.path}))]),_:2},1024)]),_:1})])])]),o("footer",vo,[o("div",ho,[o("span",ko,"v"+a(p.value),1)])])])}}}),yo=R(fo,[["__scopeId","data-v-d9fd6813"]]);export{yo as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as j,s as T,c6 as A,r as u,o as N,c0 as v,c1 as e,c2 as S,bW as f,bV as _,bs as F,F as G,bN as I,bT as H,c7 as h,G as a,bU as i,bm as D,c5 as P,bS as w,c8 as y,T as R,c3 as $}from"./vendor-DpXl860f.js";import{u as q,a as m}from"./index-CmiEbWrJ.js";import{u as Z,z as E,B as O}from"./naive-ui-BwyHI4J3.js";import{_ as W}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./monaco-editor-BXWd1EVR.js";const J={class:"app-shell"},K={class:"app-header"},Q={class:"app-header__container"},X={class:"app-header__right"},Y={class:"app-body"},ee={class:"app-sidebar"},te={class:"sidebar-nav"},oe=["onClick"],se={class:"nav-item__icon admin-nav-icon"},ae={class:"nav-item__content"},ne={class:"nav-item__label"},re={class:"nav-item__description"},ie={key:0,class:"nav-item__indicator admin-indicator"},ce={class:"app-content"},de={class:"content-wrapper"},le={class:"app-footer"},pe={class:"version-info"},ue={class:"version-text"},ve=j({__name:"Layout",setup(fe){const g=$(),x=A(),C=q(),r=Z(),b=E(),k=T(()=>x.name),d=u(!1),l=u(!1),p=u("..."),M=[{label:"用户管理",key:"AdminUsers",icon:()=>a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),description:"管理系统用户和权限"},{label:"配置管理",key:"AdminConfigs",icon:()=>a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),description:"管理用户的 MCP 配置"}];function L(o){g.push({name:o})}function V(){C.adminLogout(),g.push("/admin/login")}async function B(){if(!d.value){d.value=!0;try{const t=(await m.get("/update/check")).data;t.success&&t.hasUpdate&&b.warning({title:"发现新版本",content:()=>a("div",[a("p",{style:"margin-bottom: 12px;"},`当前版本: ${t.currentVersion}`),a("p",{style:"margin-bottom: 12px;"},`最新版本: ${t.latestVersion}`),a("p",{style:"color: #666; font-size: 14px;"},"是否立即更新?更新后系统将自动重启。")]),positiveText:"立即更新",negativeText:"稍后提醒",onPositiveClick:async()=>{await z()},onNegativeClick:()=>{}})}catch(o){console.error("检查更新失败:",o)}finally{d.value=!1}}}async function z(){var t,c;if(l.value)return;l.value=!0;const o=r.loading("正在更新,请稍候...",{duration:0});try{const n=(await m.post("/update/execute")).data;o.destroy(),n.success?n.restartFailed?r.warning("更新成功,但重启失败,请手动重启服务",{duration:5e3}):(r.success("更新成功,系统正在重启...",{duration:3e3}),setTimeout(()=>{window.location.reload()},3e3)):r.error(n.error||"更新失败",{duration:5e3})}catch(s){o.destroy();const n=((c=(t=s.response)==null?void 0:t.data)==null?void 0:c.error)||s.message||"更新失败";r.error(n,{duration:5e3})}finally{l.value=!1}}async function U(){try{const o=await m.get("/update/version");o.data.success&&(p.value=o.data.version)}catch(o){console.error("获取版本失败:",o),p.value="unknown"}}return N(()=>{U(),setTimeout(()=>{B()},2e3)}),(o,t)=>{const c=H("router-view");return i(),v("div",J,[e("header",K,[e("div",Q,[t[2]||(t[2]=S('<div class="app-header__left" data-v-01543ff6><div class="app-logo" data-v-01543ff6><div class="logo-icon admin-theme" data-v-01543ff6><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-01543ff6><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#admin-gradient1)" data-v-01543ff6></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#admin-gradient2)" data-v-01543ff6></path><defs data-v-01543ff6><linearGradient id="admin-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-01543ff6><stop offset="0%" stop-color="#dc2626" data-v-01543ff6></stop><stop offset="100%" stop-color="#ea580c" data-v-01543ff6></stop></linearGradient><linearGradient id="admin-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-01543ff6><stop offset="0%" stop-color="#ea580c" data-v-01543ff6></stop><stop offset="100%" stop-color="#f59e0b" data-v-01543ff6></stop></linearGradient></defs></svg></div><div class="logo-text" data-v-01543ff6><div class="logo-title admin-title" data-v-01543ff6>Flex MCP Admin</div><div class="logo-subtitle" data-v-01543ff6>管理员控制台</div></div></div></div>',1)),e("div",X,[t[1]||(t[1]=e("div",{class:"admin-badge"},[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"管理员")],-1)),f(F(O),{class:"logout-btn",quaternary:"",circle:"",onClick:V},{icon:_(()=>[...t[0]||(t[0]=[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M16 17L21 12L16 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M21 12H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1})])])]),e("div",Y,[e("aside",ee,[e("nav",te,[(i(),v(G,null,I(M,s=>e("div",{key:s.key,class:D(["nav-item",{"nav-item--active":k.value===s.key}]),onClick:n=>L(s.key)},[e("div",se,[(i(),w(y(s.icon)))]),e("div",ae,[e("div",ne,h(s.label),1),e("div",re,h(s.description),1)]),k.value===s.key?(i(),v("div",ie)):P("",!0)],10,oe)),64))])]),e("main",ce,[e("div",de,[f(c,null,{default:_(({Component:s,route:n})=>[f(R,{name:"page-fade",mode:"out-in"},{default:_(()=>[(i(),w(y(s),{key:n.path}))]),_:2},1024)]),_:1})])])]),e("footer",le,[e("div",pe,[e("span",ue,"v"+h(p.value),1)])])])}}}),xe=W(ve,[["__scopeId","data-v-01543ff6"]]);export{xe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as C,r as v,c0 as c,c1 as a,c2 as f,bW as r,bV as t,bs as n,l as w,bU as m,c4 as g,c5 as B,c3 as z}from"./vendor-DpXl860f.js";import{u as j}from"./index-CmiEbWrJ.js";import{u as L,c as V,d as h,e as k,B as A}from"./naive-ui-BwyHI4J3.js";import{_ as N}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./monaco-editor-BXWd1EVR.js";const _={class:"auth-bg admin-theme"},H={class:"login-container"},G={class:"form-section"},q={class:"form-card"},F={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},I=C({__name:"Login",setup(K){const x=z(),p=L(),b=j(),u=v(),l=v(!1),s=v({username:"",password:""}),M={username:{required:!0,message:"请输入管理员用户名",trigger:"blur"},password:{required:!0,message:"请输入管理员密码",trigger:"blur"}};async function i(){var d,e,o;try{await((d=u.value)==null?void 0:d.validate()),l.value=!0,await b.loginAdmin(s.value.username,s.value.password),p.success("登录成功"),x.push("/admin/users")}catch(y){p.error(((o=(e=y.response)==null?void 0:e.data)==null?void 0:o.error)||"登录失败,请检查您的凭据")}finally{l.value=!1}}return(d,e)=>(m(),c("div",_,[e[11]||(e[11]=a("div",{class:"floating-shapes"},[a("div",{class:"shape shape-1"}),a("div",{class:"shape shape-2"}),a("div",{class:"shape shape-3"})],-1)),a("div",H,[e[10]||(e[10]=f('<div class="brand-section admin-gradient" data-v-332e576e><div class="brand-content" data-v-332e576e><div class="brand-logo" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#admin-logo-gradient1)" data-v-332e576e></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#admin-logo-gradient2)" data-v-332e576e></path><defs data-v-332e576e><linearGradient id="admin-logo-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-332e576e><stop offset="0%" stop-color="#ffffff" data-v-332e576e></stop><stop offset="100%" stop-color="#fef3c7" data-v-332e576e></stop></linearGradient><linearGradient id="admin-logo-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-332e576e><stop offset="0%" stop-color="#fef3c7" data-v-332e576e></stop><stop offset="100%" stop-color="#ffffff" data-v-332e576e></stop></linearGradient></defs></svg></div><h1 class="brand-title" data-v-332e576e>Flex MCP Admin</h1><p class="brand-subtitle" data-v-332e576e>超级管理员控制台</p><div class="brand-features" data-v-332e576e><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>全面的用户管理</span></div><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path><path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>灵活的配置管理</span></div><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>强大的权限控制</span></div></div></div></div>',1)),a("div",G,[a("div",q,[e[8]||(e[8]=f('<div class="form-header" data-v-332e576e><div class="admin-badge" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg><span data-v-332e576e>管理员登录</span></div><h2 class="form-title" data-v-332e576e>系统管理后台</h2><p class="form-description" data-v-332e576e>使用管理员凭据访问控制面板</p></div>',1)),r(n(V),{ref_key:"formRef",ref:u,model:s.value,rules:M,size:"large"},{default:t(()=>[r(n(h),{path:"username"},{label:t(()=>[...e[2]||(e[2]=[a("div",{class:"input-label"},[a("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("span",null,"管理员账号")],-1)])]),default:t(()=>[r(n(k),{value:s.value.username,"onUpdate:value":e[0]||(e[0]=o=>s.value.username=o),placeholder:"输入管理员用户名",class:"modern-input",onKeyup:g(i,["enter"])},{prefix:t(()=>[...e[3]||(e[3]=[a("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),r(n(h),{path:"password"},{label:t(()=>[...e[4]||(e[4]=[a("div",{class:"input-label"},[a("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("span",null,"管理员密码")],-1)])]),default:t(()=>[r(n(k),{value:s.value.password,"onUpdate:value":e[1]||(e[1]=o=>s.value.password=o),type:"password",placeholder:"输入管理员密码",class:"modern-input","show-password-on":"click",onKeyup:g(i,["enter"])},{prefix:t(()=>[...e[5]||(e[5]=[a("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),r(n(A),{type:"primary",size:"large",block:"",loading:l.value,class:"login-button admin-login-btn",onClick:i},{icon:t(()=>[l.value?B("",!0):(m(),c("svg",F,[...e[6]||(e[6]=[a("path",{d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:t(()=>[e[7]||(e[7]=w(" 进入管理后台 ",-1))]),_:1},8,["loading"])]),_:1},8,["model"]),e[9]||(e[9]=a("div",{class:"form-footer"},[a("p",{class:"help-text"},[a("svg",{class:"help-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),w(" 仅限授权管理员访问,未经授权的访问将被记录 ")])],-1))])])])]))}}),P=N(I,[["__scopeId","data-v-332e576e"]]);export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as C,r as v,c0 as u,c1 as e,c2 as M,bW as d,bV as t,bs as r,l as w,bU as f,c3 as B,c4 as m,c5 as L}from"./vendor-DpXl860f.js";import{u as V}from"./index-CmiEbWrJ.js";import{u as K,c as j,d as g,e as h,B as z}from"./naive-ui-BwyHI4J3.js";import{_ as N}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./monaco-editor-BXWd1EVR.js";const I={class:"auth-bg"},P={class:"login-container"},A={class:"form-section"},H={class:"form-card"},_={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G=C({__name:"Login",setup(U){const b=B(),p=K(),k=V(),c=v(),l=v(!1),o=v({email:"",apiKey:""}),x={email:{required:!0,message:"请输入邮箱地址",trigger:"blur"},apiKey:{required:!0,message:"请输入 API Key",trigger:"blur"}};async function n(){var i,a,s;try{await((i=c.value)==null?void 0:i.validate()),l.value=!0,await k.loginUser(o.value.email,o.value.apiKey),p.success("登录成功"),b.push("/user/dashboard")}catch(y){p.error(((s=(a=y.response)==null?void 0:a.data)==null?void 0:s.error)||"登录失败,请检查您的凭据")}finally{l.value=!1}}return(i,a)=>(f(),u("div",I,[a[11]||(a[11]=e("div",{class:"floating-shapes"},[e("div",{class:"shape shape-1"}),e("div",{class:"shape shape-2"}),e("div",{class:"shape shape-3"})],-1)),e("div",P,[a[10]||(a[10]=M('<div class="brand-section" data-v-d6d8ce7b><div class="brand-content" data-v-d6d8ce7b><div class="brand-logo" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#logo-gradient1)" data-v-d6d8ce7b></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#logo-gradient2)" data-v-d6d8ce7b></path><defs data-v-d6d8ce7b><linearGradient id="logo-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-d6d8ce7b><stop offset="0%" stop-color="#6366f1" data-v-d6d8ce7b></stop><stop offset="100%" stop-color="#8b5cf6" data-v-d6d8ce7b></stop></linearGradient><linearGradient id="logo-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-d6d8ce7b><stop offset="0%" stop-color="#8b5cf6" data-v-d6d8ce7b></stop><stop offset="100%" stop-color="#ec4899" data-v-d6d8ce7b></stop></linearGradient></defs></svg></div><h1 class="brand-title" data-v-d6d8ce7b>Flex MCP</h1><p class="brand-subtitle" data-v-d6d8ce7b>MCP 服务运营平台</p><div class="brand-features" data-v-d6d8ce7b><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>统一管理 MCP 组件</span></div><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M13 10V3L4 14h7v7l9-11h-7z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>快速创建自定义工具</span></div><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>安全的 API 密钥管理</span></div></div></div></div>',1)),e("div",A,[e("div",H,[a[8]||(a[8]=e("div",{class:"form-header"},[e("h2",{class:"form-title"},"欢迎回来"),e("p",{class:"form-description"},"使用您的账户凭据登录系统")],-1)),d(r(j),{ref_key:"formRef",ref:c,model:o.value,rules:x,size:"large"},{default:t(()=>[d(r(g),{path:"email"},{label:t(()=>[...a[2]||(a[2]=[e("div",{class:"input-label"},[e("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"邮箱地址")],-1)])]),default:t(()=>[d(r(h),{value:o.value.email,"onUpdate:value":a[0]||(a[0]=s=>o.value.email=s),placeholder:"your@email.com",class:"modern-input",onKeyup:m(n,["enter"])},{prefix:t(()=>[...a[3]||(a[3]=[e("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),d(r(g),{path:"apiKey"},{label:t(()=>[...a[4]||(a[4]=[e("div",{class:"input-label"},[e("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"API 密钥")],-1)])]),default:t(()=>[d(r(h),{value:o.value.apiKey,"onUpdate:value":a[1]||(a[1]=s=>o.value.apiKey=s),type:"password",placeholder:"输入您的 API Key",class:"modern-input","show-password-on":"click",onKeyup:m(n,["enter"])},{prefix:t(()=>[...a[5]||(a[5]=[e("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),d(r(z),{type:"primary",size:"large",block:"",loading:l.value,class:"login-button",onClick:n},{icon:t(()=>[l.value?L("",!0):(f(),u("svg",_,[...a[6]||(a[6]=[e("path",{d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:t(()=>[a[7]||(a[7]=w(" 登录系统 ",-1))]),_:1},8,["loading"])]),_:1},8,["model"]),a[9]||(a[9]=e("div",{class:"form-footer"},[e("p",{class:"help-text"},[e("svg",{class:"help-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),w(" 首次使用?请联系管理员获取账户信息 ")])],-1))])])])]))}}),E=N(G,[["__scopeId","data-v-d6d8ce7b"]]);export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as y}from"./index-CmiEbWrJ.js";import{u as V,z as D,B as p,f as L,g as C,c as q,d as M,e as z,o as O,m as E,A as F,q as G}from"./naive-ui-BwyHI4J3.js";import{q as J,r as n,o as R,c0 as W,c1 as o,bW as a,bV as s,bs as r,bU as Q,l as v,G as B}from"./vendor-DpXl860f.js";import{_ as X}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./monaco-editor-BXWd1EVR.js";const Y={class:"users-page"},Z={class:"page-header"},_={class:"users-card"},ee={class:"modal-footer"},oe={class:"apikey-section"},se={class:"mcp-config-section"},le=J({__name:"Users",setup(te){const d=V(),N=D(),g=n(!1),f=n(!1),c=n(!1),w=n(!1),m=n(""),b=n(""),h=n([]),x=n(),i=n({email:"",role:"user"}),A={pageSize:10,showSizePicker:!0,pageSizes:[10,20,50]},j=t=>({style:"cursor: pointer; transition: all 0.2s ease;",onMouseenter:e=>{e.currentTarget.style.backgroundColor="rgba(99, 102, 241, 0.04)"},onMouseleave:e=>{e.currentTarget.style.backgroundColor=""}}),U=[{label:"普通用户",value:"user"},{label:"管理员",value:"admin"}],P={email:{required:!0,message:"请输入邮箱地址",trigger:"blur"},role:{required:!0,message:"请选择用户角色",trigger:"change"}},$=[{title:"邮箱",key:"email",ellipsis:{tooltip:!0}},{title:"角色",key:"role",width:120,render(t){return B(G,{type:t.role==="admin"?"error":"info",round:!0},{default:()=>t.role==="admin"?"管理员":"普通用户"})}},{title:"创建时间",key:"createdAt",width:180},{title:"操作",key:"actions",width:100,render(t){return B(p,{type:"error",size:"small",secondary:!0,onClick:()=>H(t)},{default:()=>"删除"})}}];async function k(){g.value=!0;try{const t=await y.get("/users");h.value=t.data.data}catch{d.error("加载用户列表失败")}finally{g.value=!1}}async function T(){var t,e,l;try{await((t=x.value)==null?void 0:t.validate()),f.value=!0;const u=await y.post("/users",i.value);u.data.data&&u.data.data.apiKey?(m.value=u.data.data.apiKey,b.value=i.value.email,w.value=!0):d.success("创建成功"),c.value=!1,i.value={email:"",role:"user"},await k()}catch(u){d.error(((l=(e=u.response)==null?void 0:e.data)==null?void 0:l.error)||"创建失败")}finally{f.value=!1}}function H(t){N.warning({title:"确认删除",content:`确定要删除用户 ${t.email} 吗?此操作不可恢复。`,positiveText:"删除",negativeText:"取消",onPositiveClick:async()=>{var e,l;try{await y.delete(`/users/${t.id}`),d.success("删除成功"),await k()}catch(u){d.error(((l=(e=u.response)==null?void 0:e.data)==null?void 0:l.error)||"删除失败")}}})}function I(){navigator.clipboard.writeText(m.value),d.success("已复制到剪贴板")}function K(){const t=window.location.hostname,l=["5173","5174"].includes(window.location.port)?"3000":window.location.port,S={mcpServers:{"flex-mcp":{url:`${`${window.location.protocol}//${t}${l?`:${l}`:""}`}/mcp/sse`,headers:{email:b.value,apiKey:m.value}}}};navigator.clipboard.writeText(JSON.stringify(S,null,2)),d.success("MCP 配置已复制到剪贴板")}return R(()=>{k()}),(t,e)=>(Q(),W("div",Y,[o("div",Z,[e[9]||(e[9]=o("div",null,[o("h1",{class:"page-title"},"用户管理"),o("p",{class:"page-description"},"创建和管理系统用户,分配权限和 API 密钥")],-1)),a(r(p),{type:"primary",size:"large",class:"create-btn",onClick:e[0]||(e[0]=l=>c.value=!0)},{icon:s(()=>[...e[7]||(e[7]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:s(()=>[e[8]||(e[8]=v(" 创建用户 ",-1))]),_:1})]),o("div",_,[a(r(L),{columns:$,data:h.value,loading:g.value,pagination:A,"row-props":j,class:"modern-table"},null,8,["data","loading"])]),a(r(C),{show:c.value,"onUpdate:show":e[4]||(e[4]=l=>c.value=l),preset:"card",title:"创建新用户",class:"create-modal",bordered:!1,size:"huge"},{header:s(()=>[...e[10]||(e[10]=[o("div",{class:"modal-header"},[o("div",{class:"modal-icon"},[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),o("div",null,[o("h3",{class:"modal-title"},"创建新用户"),o("p",{class:"modal-subtitle"},"为新用户设置邮箱和角色权限")])],-1)])]),footer:s(()=>[o("div",ee,[a(r(p),{size:"large",onClick:e[3]||(e[3]=l=>c.value=!1)},{default:s(()=>[...e[13]||(e[13]=[v("取消",-1)])]),_:1}),a(r(p),{type:"primary",size:"large",loading:f.value,class:"submit-btn",onClick:T},{icon:s(()=>[...e[14]||(e[14]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M5 13l4 4L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:s(()=>[e[15]||(e[15]=v(" 创建用户 ",-1))]),_:1},8,["loading"])])]),default:s(()=>[a(r(q),{ref_key:"formRef",ref:x,model:i.value,rules:P,size:"large"},{default:s(()=>[a(r(M),{path:"email"},{label:s(()=>[...e[11]||(e[11]=[o("div",{class:"form-label"},[o("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),o("span",null,"用户邮箱")],-1)])]),default:s(()=>[a(r(z),{value:i.value.email,"onUpdate:value":e[1]||(e[1]=l=>i.value.email=l),placeholder:"user@example.com","input-props":{type:"email"}},null,8,["value"])]),_:1}),a(r(M),{path:"role"},{label:s(()=>[...e[12]||(e[12]=[o("div",{class:"form-label"},[o("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),o("span",null,"用户角色")],-1)])]),default:s(()=>[a(r(O),{value:i.value.role,"onUpdate:value":e[2]||(e[2]=l=>i.value.role=l),options:U,placeholder:"选择用户角色"},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["show"]),a(r(C),{show:w.value,"onUpdate:show":e[6]||(e[6]=l=>w.value=l),preset:"card",title:"用户创建成功",closable:!1,"mask-closable":!1,class:"apikey-modal",bordered:!1,size:"huge"},{header:s(()=>[...e[16]||(e[16]=[o("div",{class:"success-header"},[o("div",{class:"success-icon"},[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),o("div",null,[o("h3",{class:"success-title"},"用户创建成功!"),o("p",{class:"success-subtitle"},"请妥善保管以下信息")])],-1)])]),footer:s(()=>[a(r(p),{type:"primary",size:"large",block:"",class:"confirm-btn",onClick:e[5]||(e[5]=l=>w.value=!1)},{default:s(()=>[...e[25]||(e[25]=[v(" 我已保存,关闭窗口 ",-1)])]),_:1})]),default:s(()=>[a(r(E),{type:"warning",class:"warning-alert"},{icon:s(()=>[...e[17]||(e[17]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:s(()=>[e[18]||(e[18]=o("div",{class:"warning-content"},[o("strong",null,"重要提示"),o("p",null,"API Key 只会显示一次,请立即复制并妥善保存!丢失后需要重新创建用户。")],-1))]),_:1}),o("div",oe,[e[21]||(e[21]=o("div",{class:"section-label"},[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),o("span",null,"API 密钥")],-1)),a(r(F),{class:"apikey-input-group"},{default:s(()=>[a(r(z),{value:m.value,readonly:"",placeholder:"API Key",size:"large",class:"apikey-input"},null,8,["value"]),a(r(p),{type:"primary",size:"large",class:"copy-btn",onClick:I},{icon:s(()=>[...e[19]||(e[19]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:s(()=>[e[20]||(e[20]=v(" 复制 ",-1))]),_:1})]),_:1})]),o("div",se,[e[24]||(e[24]=o("div",{class:"section-label"},[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),o("span",null,"MCP 配置 (用于 Cursor / Claude)")],-1)),a(r(p),{type:"primary",size:"large",block:"",class:"copy-config-btn",onClick:K},{icon:s(()=>[...e[22]||(e[22]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:s(()=>[e[23]||(e[23]=v(" 复制 MCP 配置 JSON ",-1))]),_:1})])]),_:1},8,["show"])]))}}),de=X(le,[["__scopeId","data-v-8c8c351d"]]);export{de as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-DXNFmh7b.js","assets/vendor-DpXl860f.js","assets/naive-ui-BwyHI4J3.js","assets/_plugin-vue_export-helper-DlAUqK2U.js","assets/monaco-editor-BXWd1EVR.js","assets/Login-BWlz3FI1.js","assets/Layout-B9iGlIQE.js","assets/Dashboard-CnyNQRgh.js","assets/InitScriptEditor-BFTWTD26.js","assets/Blank-BHJQs5sx.js","assets/Layout-Da7GFkga.js","assets/Users-DGRVEG-v.js","assets/Configs-ClEYNzO5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{q as T,r as g,bS as O,bs as y,bT as C,bU as D,bV as A,bW as b,bX as U,bY as R,bZ as N,b_ as q,br as V,b$ as M}from"./vendor-DpXl860f.js";import{N as B,a as W,b as $,n as j}from"./naive-ui-BwyHI4J3.js";import{l as F}from"./monaco-editor-BXWd1EVR.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))s(t);new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(t){const r={};return t.integrity&&(r.integrity=t.integrity),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?r.credentials="include":t.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(t){if(t.ep)return;t.ep=!0;const r=n(t);fetch(t.href,r)}})();const x=T({__name:"App",setup(e){const a=g(null);return(n,s)=>{const t=C("router-view");return D(),O(y(B),{theme:a.value},{default:A(()=>[b(y(W),null,{default:A(()=>[b(y($),null,{default:A(()=>[b(t)]),_:1})]),_:1})]),_:1},8,["theme"])}}}),z="modulepreload",H=function(e){return"/"+e},L={},d=function(a,n,s){let t=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));t=Promise.allSettled(n.map(c=>{if(c=H(c),c in L)return;L[c]=!0;const p=c.endsWith(".css"),u=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const i=document.createElement("link");if(i.rel=p?"stylesheet":z,p||(i.as="script"),i.crossOrigin="",i.href=c,l&&i.setAttribute("nonce",l),document.head.appendChild(i),p)return new Promise((h,m)=>{i.addEventListener("load",h),i.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return t.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return a().catch(r)})};let E=null,f=null,S=!1;function v(){return S&&E?Promise.resolve(E):f||(f=F.init().then(e=>(E=e,S=!0,f=null,e)).catch(e=>{throw f=null,e}),f)}function Q(){return E}function ee(){return S&&E!==null}const K=[{path:"/",redirect:"/user/login"},{path:"/user/login",name:"UserLogin",component:()=>d(()=>import("./Login-DXNFmh7b.js"),__vite__mapDeps([0,1,2,3,4]))},{path:"/admin/login",name:"AdminLogin",component:()=>d(()=>import("./Login-BWlz3FI1.js"),__vite__mapDeps([5,1,2,3,4]))},{path:"/user",name:"UserLayout",component:()=>d(()=>import("./Layout-B9iGlIQE.js"),__vite__mapDeps([6,1,2,3,4])),meta:{requiresAuth:!0,role:"user"},children:[{path:"dashboard",name:"UserDashboard",component:()=>d(()=>import("./Dashboard-CnyNQRgh.js"),__vite__mapDeps([7,1,8,2,3,4]))},{path:"blank",name:"UserBlank",component:()=>d(()=>import("./Blank-BHJQs5sx.js"),__vite__mapDeps([9,1,3]))}]},{path:"/admin",name:"AdminLayout",component:()=>d(()=>import("./Layout-Da7GFkga.js"),__vite__mapDeps([10,1,2,3,4])),meta:{requiresAuth:!0,role:"admin"},children:[{path:"users",name:"AdminUsers",component:()=>d(()=>import("./Users-DGRVEG-v.js"),__vite__mapDeps([11,2,1,3,4]))},{path:"configs",name:"AdminConfigs",component:()=>d(()=>import("./Configs-ClEYNzO5.js"),__vite__mapDeps([12,8,1,2,3,4]))}]}],I=U({history:R(),routes:K});I.beforeEach(async(e,a,n)=>{if(e.meta.requiresAuth){if(e.meta.role==="admin"){if(!localStorage.getItem("admin_token"))return n("/admin/login")}else if(!localStorage.getItem("user_token"))return n("/user/login");(e.name==="UserDashboard"||e.name==="AdminConfigs")&&v().catch(s=>{console.warn("Monaco Editor 预加载失败:",s)})}n()});const w=N.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});w.interceptors.request.use(e=>{const n=window.location.pathname.startsWith("/admin")?localStorage.getItem("admin_token"):localStorage.getItem("user_token");return n&&(e.headers.Authorization=`Bearer ${n}`),e});w.interceptors.response.use(e=>e,e=>{var n,s,t;if(!e.response&&e.request&&(e.code==="ECONNREFUSED"||((n=e.message)==null?void 0:n.includes("ECONNREFUSED"))||((s=e.message)==null?void 0:s.includes("Network Error"))||e.request.readyState===4&&e.request.status===0)){const r=window.__lastConnectionErrorTime||0,o=Date.now();o-r>5e3&&(window.__lastConnectionErrorTime=o,console.error("❌ 无法连接到后端服务器"),console.error(" 请确保后端服务器正在运行在 http://localhost:3000"),console.error("💡 启动方法:"),console.error(" - 开发模式: pnpm dev (同时启动前后端)"),console.error(" - 仅后端: pnpm --filter server dev"),console.error(" - 生产模式: pnpm start"))}return((t=e.response)==null?void 0:t.status)===401&&(window.location.pathname.startsWith("/admin")?(localStorage.removeItem("admin_token"),window.location.pathname.includes("/login")||(window.location.href="/admin/login")):(localStorage.removeItem("user_token"),window.location.pathname.includes("/login")||(window.location.href="/user/login"))),Promise.reject(e)});const X=q("auth",()=>{const e=g(null),a=g(localStorage.getItem("user_token")),n=g(null),s=g(localStorage.getItem("admin_token"));async function t(u,i){const h=await w.post("/auth/user/login",{email:u,apiKey:i}),{token:m,user:_}=h.data.data;return a.value=m,e.value=_,localStorage.setItem("user_token",m),v().catch(P=>{console.warn("Monaco Editor 预加载失败:",P)}),{token:m,user:_}}async function r(u,i){const h=await w.post("/auth/admin/login",{username:u,password:i}),{token:m,role:_}=h.data.data;return s.value=m,n.value=_,localStorage.setItem("admin_token",m),v().catch(P=>{console.warn("Monaco Editor 预加载失败:",P)}),{token:m,role:_}}function o(){e.value=null,a.value=null,localStorage.removeItem("user_token")}function l(){n.value=null,s.value=null,localStorage.removeItem("admin_token")}function c(){o(),l()}async function p(){if(a.value&&!e.value)try{const u=await w.get("/auth/user/me");e.value=u.data.data,v().catch(i=>{console.warn("Monaco Editor 预加载失败:",i)})}catch{a.value=null,localStorage.removeItem("user_token")}s.value&&v().catch(u=>{console.warn("Monaco Editor 预加载失败:",u)})}return{user:e,userToken:a,adminRole:n,adminToken:s,loginUser:t,loginAdmin:r,userLogout:o,adminLogout:l,logout:c,initUser:p}}),k=V(x);k.use(M());k.use(I);k.use(j);const Y=X();Y.initUser();k.mount("#app");export{w as a,Q as g,ee as i,v as p,X as u};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{i as P}from"./vendor-DpXl860f.js";function v(n,r){(r==null||r>n.length)&&(r=n.length);for(var e=0,t=Array(r);e<r;e++)t[e]=n[e];return t}function S(n){if(Array.isArray(n))return n}function I(n,r,e){return(r=L(r))in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}function A(n,r){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var t,o,i,a,u=[],c=!0,p=!1;try{if(i=(e=e.call(n)).next,r!==0)for(;!(c=(t=i.call(e)).done)&&(u.push(t.value),u.length!==r);c=!0);}catch(O){p=!0,o=O}finally{try{if(!c&&e.return!=null&&(a=e.return(),Object(a)!==a))return}finally{if(p)throw o}}return u}}function E(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d(n,r){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);r&&(t=t.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),e.push.apply(e,t)}return e}function g(n){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?arguments[r]:{};r%2?d(Object(e),!0).forEach(function(t){I(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):d(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function T(n,r){if(n==null)return{};var e,t,o=C(n,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(t=0;t<i.length;t++)e=i[t],r.indexOf(e)===-1&&{}.propertyIsEnumerable.call(n,e)&&(o[e]=n[e])}return o}function C(n,r){if(n==null)return{};var e={};for(var t in n)if({}.hasOwnProperty.call(n,t)){if(r.indexOf(t)!==-1)continue;e[t]=n[t]}return e}function z(n,r){return S(n)||A(n,r)||M(n,r)||E()}function D(n,r){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var t=e.call(n,r);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(n)}function L(n){var r=D(n,"string");return typeof r=="symbol"?r:r+""}function M(n,r){if(n){if(typeof n=="string")return v(n,r);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?v(n,r):void 0}}var _={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function q(n){return function r(){for(var e=this,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return o.length>=n.length?n.apply(this,o):function(){for(var a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return r.apply(e,[].concat(o,u))}}}function x(n){return{}.toString.call(n).includes("Object")}function $(n){return n||b("configIsRequired"),x(n)||b("configType"),n.urls?(R(),{paths:{vs:n.urls.monacoBase}}):n}function R(){console.warn(y.deprecation)}function N(n,r){throw new Error(n[r]||n.default)}var y={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
|
+
You are using deprecated way of configuration.
|
|
4
|
+
|
|
5
|
+
Instead of using
|
|
6
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
7
|
+
use
|
|
8
|
+
monaco.config({ paths: { vs: '...' } })
|
|
9
|
+
|
|
10
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
11
|
+
`},b=q(N)(y),W={config:$},B=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(o){return e.reduceRight(function(i,a){return a(i)},o)}};function h(n,r){return Object.keys(r).forEach(function(e){r[e]instanceof Object&&n[e]&&Object.assign(r[e],h(n[e],r[e]))}),g(g({},n),r)}var H={type:"cancelation",msg:"operation is manually canceled"};function s(n){var r=!1,e=new Promise(function(t,o){n.then(function(i){return r?o(H):t(i)}),n.catch(o)});return e.cancel=function(){return r=!0},e}var K=["monaco"],F=P.create({config:_,isInitialized:!1,resolve:null,reject:null,monaco:null}),j=z(F,2),f=j[0],l=j[1];function G(n){var r=W.config(n),e=r.monaco,t=T(r,K);l(function(o){return{config:h(o.config,t),monaco:e}})}function U(){var n=f(function(r){var e=r.monaco,t=r.isInitialized,o=r.resolve;return{monaco:e,isInitialized:t,resolve:o}});if(!n.isInitialized){if(l({isInitialized:!0}),n.monaco)return n.resolve(n.monaco),s(m);if(window.monaco&&window.monaco.editor)return w(window.monaco),n.resolve(window.monaco),s(m);B(Y,Q)(V)}return s(m)}function Y(n){return document.body.appendChild(n)}function J(n){var r=document.createElement("script");return n&&(r.src=n),r}function Q(n){var r=f(function(t){var o=t.config,i=t.reject;return{config:o,reject:i}}),e=J("".concat(r.config.paths.vs,"/loader.js"));return e.onload=function(){return n()},e.onerror=r.reject,e}function V(){var n=f(function(e){var t=e.config,o=e.resolve,i=e.reject;return{config:t,resolve:o,reject:i}}),r=window.require;r.config(n.config),r(["vs/editor/editor.main"],function(e){var t=e.m||e;w(t),n.resolve(t)},function(e){n.reject(e)})}function w(n){f().monaco||l({monaco:n})}function X(){return f(function(n){var r=n.monaco;return r})}var m=new Promise(function(n,r){return l({resolve:n,reject:r})}),k={config:G,init:U,__getMonacoInstance:X};export{k as l};
|