文档归位:雪猫 README 门面 + 公告/制作文档/发布工具并入仓库根
Release Tag / validate-version (push) Waiting to run

This commit is contained in:
天天的鸟蛋蛋 committed 2026-11-12 06:29:38 +08:00
1 parent b9655a5ab1
commit e292824161
122 files changed
+90002 -69

No files matched your search

@@ -0,0 +1 @@
import{r as n,j as e}from"./react-vendor-jWT2yUdV.js";import{u as F,k as O,b as v,W as h}from"./index-DiaaLdUu.js";import{c as R}from"./chunk-5PILOUBS-KHYNqMZE.js";import{c as z}from"./chunk-D5XJWRAV-DVN21qSw.js";import{i as L}from"./chunk-MLPFQTYO-DSnBqIsb.js";import{i as I}from"./chunk-2QAN2V2R-B2qCPZrG.js";import{n as g}from"./react-hot-toast-cGcFZPSt.js";import{I as H,a as _}from"./index-FvTxWQTZ.js";import{l as W}from"./logo-kBMoCJob.js";import{P as V,H as B,T as K}from"./pure-XNiwTrk_.js";import{m as J}from"./proxy-BsRmjYPH.js";import{u as M}from"./react-router-dom-C6k78GT4.js";import"./qface-BZLvZXJ8.js";import"./index-BsnVex0g.js";import"./chunk-SLABUSGS-Cmz8sGrU.js";import"./useFocusable-DA5Croun.js";import"./chunk-M3MASYO7-B4fjH-eW.js";import"./iconBase-B7bT1FlI.js";import"./chunk-EN4B57RQ-Ief8qCCd.js";import"./chunk-UX7UMZL5-CMHjUaC_.js";import"./useToggle-B3ZYBe5S.js";import"./usePress-BrNwsdVw.js";import"./icons-C0t6aNgu.js";import"./chunk-OPTZHMJX-CY9g90YL.js";import"./chunk-6LIX6LVT-B246pOuK.js";import"./chunk-WQVQ7P2I-BJd1EiqP.js";import"./useHover-DC1o5-bm.js";import"./gestures-BHfQC-M8.js";import"./layout-Buao20KT.js";function Ce(){const j=new URLSearchParams(window.location.search).get("token"),x=M(),[l,C]=n.useState(j||""),[o,d]=n.useState(!1),[m,N]=n.useState(!0),[,f]=F(O.token,""),[b,S]=n.useState(!1),[c,P]=n.useState(""),[D,A]=n.useState("");function T(t){const r=t.replace(/-/g,"+").replace(/_/g,"/"),a=atob(r),s=new Uint8Array(a.length);for(let i=0;i<a.length;i++)s[i]=a.charCodeAt(i);return s}function p(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}const q=async()=>{var t;if(!(!navigator.credentials||!navigator.credentials.get)){try{const r=await h.generatePasskeyAuthenticationOptions(),a=await navigator.credentials.get({publicKey:{challenge:T(r.challenge),allowCredentials:(t=r.allowCredentials)==null?void 0:t.map(k=>({id:T(k.id),type:k.type,transports:k.transports})),userVerification:r.userVerification}});if(!a)throw new Error("Passkey authentication cancelled");const s=a.response,i={id:a.id,rawId:p(new Uint8Array(a.rawId)),response:{authenticatorData:p(new Uint8Array(s.authenticatorData)),clientDataJSON:p(new Uint8Array(s.clientDataJSON)),signature:p(new Uint8Array(s.signature)),userHandle:s.userHandle?p(new Uint8Array(s.userHandle)):null},type:a.type},y=await h.verifyPasskeyAuthentication(i);if(y&&y.Credential)return f(y.Credential),x("/qq_login",{replace:!0}),!0}catch(r){console.log("Passkey login failed or not available:",r)}return!1}},u=async()=>{if(!l){g.error("请输入token");return}d(!0);try{const t=await h.loginWithToken(l);if(t){if(t.require2FA){S(!0),A(l),d(!1);return}t.Credential&&f(t.Credential),x("/qq_login",{replace:!0})}}catch(t){g.error(t.message)}finally{d(!1)}},w=async()=>{if(!c||c.length!==6){g.error("Please enter 6-digit code");return}d(!0);try{const t=await h.loginWithToken(D,c);t&&t.Credential&&(f(t.Credential),x("/qq_login",{replace:!0}))}catch(t){g.error(t.message)}finally{d(!1)}},E=()=>{S(!1),P(""),A("")},U=t=>{t.key==="Enter"&&!o&&!m&&(b?w():u())};return n.useEffect(()=>(document.addEventListener("keydown",U),()=>{document.removeEventListener("keydown",U)}),[l,c,o,m,b]),n.useEffect(()=>{if(j){N(!1),u();return}q().finally(()=>{N(!1)})},[]),e.jsxs(e.Fragment,{children:[e.jsx("title",{children:"WebUI登录 - SnowCat WebUI"}),e.jsx(V,{children:e.jsx(J.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},transition:{duration:.5,type:"spring",stiffness:120,damping:20},className:"w-[608px] max-w-full py-8 px-2 md:px-8 overflow-hidden",children:e.jsxs(B,{className:"items-center gap-4 pt-0 pb-6 rounded-3xl border border-white/70 dark:border-white/10 bg-white/70 dark:bg-white/[0.05] shadow-2xl shadow-primary-900/10",maxXRotation:3,maxYRotation:3,children:[e.jsxs(z,{className:"inline-block max-w-lg text-center justify-center",children:[e.jsxs("div",{className:"flex items-center justify-center w-full gap-3 pt-9",children:[e.jsx(L,{alt:"logo",height:"5.5em",src:W,className:"drop-shadow-md"}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"text-2xl font-bold tracking-tight bg-gradient-to-r from-primary-500 to-secondary-400 bg-clip-text text-transparent",children:"SnowCat"}),e.jsx("div",{className:"text-tiny tracking-[0.28em] text-default-400 uppercase",children:"雪猫控制台"})]})]}),e.jsx(K,{className:"absolute right-4 top-4"})]}),e.jsxs(R,{className:"flex gap-5 py-5 px-5 md:px-10",children:[m&&e.jsx("div",{className:"text-center text-small text-default-600 dark:text-default-400 px-2",children:"🔐 正在检查Passkey..."}),b?e.jsxs(e.Fragment,{children:[e.jsx(v,{isIconOnly:!0,variant:"light",className:"self-start -ml-2",onPress:E,children:e.jsx(H,{size:20})}),e.jsx("div",{className:"text-center text-default-600 dark:text-default-400",children:"请输入Authenticator中的验证码"}),e.jsx("form",{onSubmit:t=>{t.preventDefault(),w()},children:e.jsx(I,{type:"text",inputModeLine truncated