Files
claude-relay-service/web/admin-spa/dist/assets/index-15K8yWyh.js
shaw 19cab40b77 feat(admin-spa): 添加构建后的dist目录并更新.gitignore
- 添加 admin-spa 构建后的 dist 目录
- 从 .gitignore 中移除 dist 忽略规则
- 确保 /admin-next 路由可以正常访问

现在访问 /admin-next/api-stats 将能正确加载新版管理界面

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 12:48:15 +08:00

3 lines
12 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LoginView-CIYqZE9h.js","assets/vue-vendor-YmkKLAOK.js","assets/element-plus-D-FTEVKS.js","assets/vendor-BDiMbLwQ.js","assets/element-plus-CPnoEkWW.css","assets/LoginView-tn0RQdqM.css","assets/LogoTitle-DN1tf4fC.css","assets/MainLayout-Dnl8xkCL.js","assets/toast-BvwA7Mwb.js","assets/LogoTitle-D39YWWT1.js","assets/MainLayout-DUdrWfaX.css","assets/DashboardView-hAxli_Sq.js","assets/chart-Cor9iTVD.js","assets/DashboardView-BNhlTn49.css","assets/ApiKeysView-CFE7iYPf.js","assets/ApiKeysView-BobNZX5h.css","assets/AccountsView-BJCyk-bV.js","assets/AccountsView-CoHkroG1.css","assets/TutorialView-CqshllxF.js","assets/TutorialView-DrYIAHe5.css","assets/SettingsView-Ctsr5DQE.js","assets/SettingsView-rXAPQgqk.css","assets/ApiStatsView-CRrn8ZgA.js","assets/ApiStatsView-onZNVLml.css"])))=>i.map(i=>d[i]);
import{aP as K,aQ as W,aR as F,r as _,c as I,q as V,V as D,I as q,z as f,x as T,ac as M,Q as G,a5 as N,y,C as S,L as P,P as b,Y as U,B as H,R as k,J,T as Q,O as X,av as Y,aM as Z,aS as ee}from"./vue-vendor-YmkKLAOK.js";import{i as te,z as oe}from"./element-plus-D-FTEVKS.js";import"./vendor-BDiMbLwQ.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))t(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const n of a.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&t(n)}).observe(document,{childList:!0,subtree:!0});function e(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function t(s){if(s.ep)return;s.ep=!0;const a=e(s);fetch(s.href,a)}})();const se="modulepreload",ne=function(r){return"/admin-next/"+r},$={},w=function(o,e,t){let s=Promise.resolve();if(e&&e.length>0){document.getElementsByTagName("link");const n=document.querySelector("meta[property=csp-nonce]"),m=(n==null?void 0:n.nonce)||(n==null?void 0:n.getAttribute("nonce"));s=Promise.allSettled(e.map(c=>{if(c=ne(c),c in $)return;$[c]=!0;const l=c.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const i=document.createElement("link");if(i.rel=l?"stylesheet":se,l||(i.as="script"),i.crossOrigin="",i.href=c,m&&i.setAttribute("nonce",m),document.head.appendChild(i),l)return new Promise((h,d)=>{i.addEventListener("load",h),i.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(n){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=n,window.dispatchEvent(m),!m.defaultPrevented)throw n}return s.then(n=>{for(const m of n||[])m.status==="rejected"&&a(m.reason);return o().catch(a)})},R={basePath:"/admin-next/",apiPrefix:""};function ae(r=""){return r&&!r.startsWith("/")&&(r="/"+r),R.basePath+(r.startsWith("#")?r:"#"+r)}function re(){return ae("/login")}const ie=()=>w(()=>import("./LoginView-CIYqZE9h.js"),__vite__mapDeps([0,1,2,3,4,5,6])),E=()=>w(()=>import("./MainLayout-Dnl8xkCL.js"),__vite__mapDeps([7,1,8,9,6,2,3,4,10])),ce=()=>w(()=>import("./DashboardView-hAxli_Sq.js"),__vite__mapDeps([11,2,1,3,4,8,12,13])),le=()=>w(()=>import("./ApiKeysView-CFE7iYPf.js"),__vite__mapDeps([14,2,1,3,4,8,15])),ue=()=>w(()=>import("./AccountsView-BJCyk-bV.js"),__vite__mapDeps([16,1,8,2,3,4,17])),de=()=>w(()=>import("./TutorialView-CqshllxF.js"),__vite__mapDeps([18,1,2,3,4,19])),fe=()=>w(()=>import("./SettingsView-Ctsr5DQE.js"),__vite__mapDeps([20,1,8,2,3,4,21])),he=()=>w(()=>import("./ApiStatsView-CRrn8ZgA.js"),__vite__mapDeps([22,1,9,6,3,18,2,4,19,23])),me=[{path:"/",redirect:"/api-stats"},{path:"/login",name:"Login",component:ie,meta:{requiresAuth:!1}},{path:"/api-stats",name:"ApiStats",component:he,meta:{requiresAuth:!1}},{path:"/dashboard",component:E,meta:{requiresAuth:!0},children:[{path:"",name:"Dashboard",component:ce}]},{path:"/api-keys",component:E,meta:{requiresAuth:!0},children:[{path:"",name:"ApiKeys",component:le}]},{path:"/accounts",component:E,meta:{requiresAuth:!0},children:[{path:"",name:"Accounts",component:ue}]},{path:"/tutorial",component:E,meta:{requiresAuth:!0},children:[{path:"",name:"Tutorial",component:de}]},{path:"/settings",component:E,meta:{requiresAuth:!0},children:[{path:"",name:"Settings",component:fe}]}],x=K({history:W(R.basePath),routes:me});x.beforeEach((r,o,e)=>{const t=B();console.log("路由导航:",{to:r.path,from:o.path,requiresAuth:r.meta.requiresAuth,isAuthenticated:t.isAuthenticated}),r.path==="/api-stats"||r.path.startsWith("/api-stats")?e():r.meta.requiresAuth&&!t.isAuthenticated?e("/login"):r.path==="/login"&&t.isAuthenticated?e("/dashboard"):e()});const z=R.apiPrefix;function A(r){return r.startsWith("/")||(r="/"+r),z+r}class pe{constructor(){this.baseURL=z}getAuthToken(){return localStorage.getItem("authToken")||null}buildConfig(o={}){const e={headers:{"Content-Type":"application/json",...o.headers},...o},t=this.getAuthToken();return t&&(e.headers.Authorization=`Bearer ${t}`),e}async handleResponse(o){if(o.status===401){const t=window.location.pathname+window.location.hash;throw t.includes("/login")||t.endsWith("/")||(localStorage.removeItem("authToken"),window.location.href=re()),new Error("Unauthorized")}const e=o.headers.get("content-type");if(e&&e.includes("application/json")){const t=await o.json();if(!o.ok)throw new Error(t.message||`HTTP ${o.status}`);return t}if(!o.ok)throw new Error(`HTTP ${o.status}: ${o.statusText}`);return o}async get(o,e={}){const t=A(o),s=this.buildConfig({...e,method:"GET"});try{const a=await fetch(t,s);return await this.handleResponse(a)}catch(a){throw console.error("API GET Error:",a),a}}async post(o,e=null,t={}){const s=A(o),a=this.buildConfig({...t,method:"POST",body:e?JSON.stringify(e):void 0});try{const n=await fetch(s,a);return await this.handleResponse(n)}catch(n){throw console.error("API POST Error:",n),n}}async put(o,e=null,t={}){const s=A(o),a=this.buildConfig({...t,method:"PUT",body:e?JSON.stringify(e):void 0});try{const n=await fetch(s,a);return await this.handleResponse(n)}catch(n){throw console.error("API PUT Error:",n),n}}async delete(o,e={}){const t=A(o),s=this.buildConfig({...e,method:"DELETE"});try{const a=await fetch(t,s);return await this.handleResponse(a)}catch(a){throw console.error("API DELETE Error:",a),a}}}const L=new pe,B=F("auth",()=>{const r=_(!1),o=_(localStorage.getItem("authToken")||""),e=_(""),t=_(""),s=_(!1),a=_({siteName:"Claude Relay Service",siteIcon:"",siteIconData:"",faviconData:""}),n=_(!0),m=I(()=>!!o.value&&r.value),c=I(()=>o.value),l=I(()=>({username:e.value}));async function u(p){s.value=!0,t.value="";try{const v=await L.post("/web/auth/login",p);v.success?(o.value=v.token,e.value=p.username,r.value=!0,localStorage.setItem("authToken",v.token),await x.push("/dashboard")):t.value=v.message||"登录失败"}catch(v){t.value=v.message||"登录失败,请检查用户名和密码"}finally{s.value=!1}}function i(){r.value=!1,o.value="",e.value="",localStorage.removeItem("authToken"),x.push("/login")}function h(){o.value&&(r.value=!0,d())}async function d(){try{(await L.get("/admin/dashboard")).success||i()}catch{i()}}async function g(){n.value=!0;try{const p=await L.get("/admin/oem-settings");if(p.success&&p.data){if(a.value={...a.value,...p.data},p.data.faviconData){const v=document.querySelector("link[rel*='icon']")||document.createElement("link");v.type="image/x-icon",v.rel="shortcut icon",v.href=p.data.faviconData,document.getElementsByTagName("head")[0].appendChild(v)}p.data.siteName&&(document.title=`${p.data.siteName} - 管理后台`)}}catch(p){console.error("加载OEM设置失败:",p)}finally{n.value=!1}}return{isLoggedIn:r,authToken:o,username:e,loginError:t,loginLoading:s,oemSettings:a,oemLoading:n,isAuthenticated:m,token:c,user:l,login:u,logout:i,checkAuth:h,loadOemSettings:g}}),O=(r,o)=>{const e=r.__vccOpts||r;for(const[t,s]of o)e[t]=s;return e},_e={class:"toast-container"},ve=["onClick"],ge={class:"toast-content"},ye={class:"toast-icon"},we={class:"toast-body"},Te={key:0,class:"toast-title"},be={class:"toast-message"},Ee=["onClick"],Ae={__name:"ToastNotification",setup(r,{expose:o}){const e=_([]);let t=0;const s=l=>{const u={success:"fas fa-check-circle",error:"fas fa-exclamation-circle",warning:"fas fa-exclamation-triangle",info:"fas fa-info-circle"};return u[l]||u.info},a=(l,u="info",i=null,h=5e3)=>{const d=++t,g={id:d,message:l,type:u,title:i,duration:h,isVisible:!1};return e.value.push(g),setTimeout(()=>{g.isVisible=!0},10),h>0&&setTimeout(()=>{n(d)},h),d},n=l=>{const u=e.value.findIndex(i=>i.id===l);if(u>-1){const i=e.value[u];i.isVisible=!1,setTimeout(()=>{const h=e.value.findIndex(d=>d.id===l);h>-1&&e.value.splice(h,1)},300)}},m=()=>{e.value.forEach(l=>{l.isVisible=!1}),setTimeout(()=>{e.value.length=0},300)},c=(l,u="info",i=null,h=5e3)=>a(l,u,i,h);return V(()=>{window.showToast=c}),D(()=>{window.showToast===c&&delete window.showToast}),o({showToast:c,removeToast:n,clearAllToasts:m}),(l,u)=>(y(),q(N,{to:"body"},[f("div",_e,[(y(!0),T(G,null,M(e.value,i=>(y(),T("div",{key:i.id,class:S(["toast",`toast-${i.type}`,i.isVisible?"toast-show":"toast-hide"]),onClick:h=>n(i.id)},[f("div",ge,[f("div",ye,[f("i",{class:S(s(i.type))},null,2)]),f("div",we,[i.title?(y(),T("div",Te,b(i.title),1)):P("",!0),f("div",be,b(i.message),1)]),f("button",{class:"toast-close",onClick:U(h=>n(i.id),["stop"])},u[0]||(u[0]=[f("i",{class:"fas fa-times"},null,-1)]),8,Ee)]),i.duration>0?(y(),T("div",{key:0,class:"toast-progress",style:H({animationDuration:`${i.duration}ms`})},null,4)):P("",!0)],10,ve))),128))])]))}},ke=O(Ae,[["__scopeId","data-v-383c6781"]]),Pe={class:"modal-content w-full max-w-md p-6 mx-auto"},xe={class:"flex items-start gap-4 mb-6"},Ce={class:"flex-1"},Ie={class:"text-lg font-semibold text-gray-900 mb-2"},Le={class:"text-gray-600 leading-relaxed whitespace-pre-line"},Se={class:"flex items-center justify-end gap-3"},Ve=["disabled"],Re=["disabled"],Oe={key:0,class:"loading-spinner mr-2"},$e={__name:"ConfirmDialog",setup(r,{expose:o}){const e=_(!1),t=_(!1),s=_(""),a=_(""),n=_("确认"),m=_("取消");let c=null;const l=(d,g,p="确认",v="取消")=>new Promise(j=>{s.value=d,a.value=g,n.value=p,m.value=v,e.value=!0,t.value=!1,c=j}),u=()=>{t.value||(t.value=!0,setTimeout(()=>{e.value=!1,t.value=!1,c&&(c(!0),c=null)},200))},i=()=>{t.value||(e.value=!1,c&&(c(!1),c=null))},h=d=>{e.value&&(d.key==="Escape"?i():d.key==="Enter"&&!d.shiftKey&&!d.ctrlKey&&!d.altKey&&u())};return V(()=>{window.showConfirm=l,document.addEventListener("keydown",h)}),D(()=>{window.showConfirm===l&&delete window.showConfirm,document.removeEventListener("keydown",h)}),o({showConfirm:l}),(d,g)=>(y(),q(N,{to:"body"},[k(Q,{name:"modal",appear:""},{default:J(()=>[e.value?(y(),T("div",{key:0,class:"fixed inset-0 modal z-50 flex items-center justify-center p-4",onClick:U(i,["self"])},[f("div",Pe,[f("div",xe,[g[0]||(g[0]=f("div",{class:"flex-shrink-0 w-12 h-12 bg-gradient-to-br from-red-500 to-red-600 rounded-xl flex items-center justify-center"},[f("i",{class:"fas fa-exclamation-triangle text-white text-lg"})],-1)),f("div",Ce,[f("h3",Ie,b(s.value),1),f("div",Le,b(a.value),1)])]),f("div",Se,[f("button",{onClick:i,class:"btn bg-gray-100 text-gray-700 hover:bg-gray-200 px-6 py-3",disabled:t.value},b(m.value),9,Ve),f("button",{onClick:u,class:S(["btn btn-danger px-6 py-3",{"opacity-50 cursor-not-allowed":t.value}]),disabled:t.value},[t.value?(y(),T("div",Oe)):P("",!0),X(" "+b(n.value),1)],10,Re)])])])):P("",!0)]),_:1})]))}},De=O($e,[["__scopeId","data-v-16560808"]]),qe={id:"app"},Ne={__name:"App",setup(r){const o=B(),e=_(),t=_();return V(()=>{o.checkAuth()}),(s,a)=>{const n=Y("router-view");return y(),T("div",qe,[k(n),k(ke,{ref_key:"toastRef",ref:e},null,512),k(De,{ref_key:"confirmRef",ref:t},null,512)])}}},Ue=O(Ne,[["__scopeId","data-v-806bb611"]]),C=Z(Ue),ze=ee();C.use(ze);C.use(x);C.use(te,{locale:oe});C.mount("#app");export{O as _,L as a,B as u};