文档归位:雪猫 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,9 @@
import{r as A,j as r,R}from"./react-vendor-jWT2yUdV.js";import{N as Ue,s as Oe,b as L}from"./index-DiaaLdUu.js";import{i as le}from"./chunk-2QAN2V2R-B2qCPZrG.js";import{d as k}from"./chunk-IHO36JMK-DJPUeGG0.js";import{c as _}from"./chunk-NAV3ZXLI-ChbUTMf0.js";import{a as ce,l as ue}from"./chunk-KVDW62ZT-CGYYmJoP.js";import{z as E}from"./react-hot-toast-cGcFZPSt.js";import{h as re,i as ee,j as de,k as fe,l as he,m as me}from"./index-DE7yoXMZ.js";import{g as Be}from"./qface-BZLvZXJ8.js";import{Q as D}from"./qq_manager-BfRTEAby.js";import{u as Fe}from"./use-dialog-CRIMuzeE.js";var Te=Ue();const xe=Be(Te),ot=({showRestart:h=!0,compact:l=!1})=>{const i=Fe(),[u,C]=A.useState(""),x=u==="win32",j=u==="darwin",w=u!==""&&u!=="win32"&&u!=="darwin",e=u!=="",[s,t]=A.useState(""),[n,a]=A.useState(""),[d,o]=A.useState([]),[f,m]=A.useState(""),[v,N]=A.useState(""),[g,y]=A.useState(""),[P,Y]=A.useState([]),[Z,U]=A.useState(!1),[X,B]=A.useState(!1),[S,J]=A.useState(!1),Q=c=>/^[0-9a-fA-F]{32}$/.test(c),b=c=>/^[0-9a-fA-F]{2}(-[0-9a-fA-F]{2}){5}$/.test(c.trim().toLowerCase()),z=A.useMemo(()=>{if(!w)return"";const c=v.trim().toLowerCase();return!g&&!c?"":xe(g+c).toString()},[w,g,v]),F=A.useMemo(()=>!w||!f?"":xe(g+f).toString(),[w,g,f]),T=A.useCallback(async()=>{try{const c=await D.getPlatformInfo();C(c.platform)}catch{C("win32")}},[]),$=A.useCallback(async()=>{U(!0);try{const c=await D.getDeviceGUID();t(c.guid),a(c.guid)}catch(c){const M=c.message;t(""),a(""),M.includes("not found")||E.error(`获取 GUID 失败: ${M}`)}finally{U(!1)}},[]),O=A.useCallback(async()=>{try{const c=await D.getGUIDBackups();o(c)}catch{}},[]),H=A.useCallback(async()=>{U(!0);try{const[c,M]=await Promise.all([D.getLinuxMAC().catch(()=>({mac:""})),D.getLinuxMachineId().catch(()=>({machineId:""}))]);m(c.mac),N(c.mac),y(M.machineId)}catch(c){const M=c.message;E.error(`获取设备信息失败: ${M}`)}finally{U(!1)}},[]),G=A.useCallback(async()=>{try{const c=await D.getLinuxMachineInfoBackups();Y(c)}catch{}},[]);A.useEffect(()=>{T()},[T]),A.useEffect(()=>{e&&(x?($(),O()):(H(),G()))},[e,x,$,O,H,G]);const q=()=>{const c=w?F:s;c&&(navigator.clipboard.writeText(c),E.success("已复制到剪贴板"))},se=async()=>{if(!Q(n)){E.error("GUID 格式无效,需要 32 位十六进制字符");return}B(!0);try{await D.setDeviceGUID(n),t(n),E.success("GUID 已设置,重启后生效"),await O()}catch(c){const M=c.message;E.error(`设置 GUID 失败: ${M}`)}finally{B(!1)}},ne=()=>{i.confirm({title:"确认删除",content:"删除 Registry20 后,QQ 将在下次启动时生成新的设备标识。确定要删除吗?",confirmText:"删除",cancelText:"取消",onConfirm:async()=>{try{await D.resetDeviceID(),t(""),a(""),E.success("已删除,重启后生效"),await O()}catch(c){const M=c.message;E.error(`删除失败: ${M}`)}}})},Re=async()=>{try{await D.createGUIDBackup(),E.success("备份已创建"),await O()}catch(c){const M=c.message;E.error(`备份失败: ${M}`)}},De=c=>{i.confirm({title:"确认恢复",content:`确定要从备份 "${c}" 恢复吗?当前的 Registry20 将被覆盖。`,confirmText:"恢复",cancelText:"取消",onConfirm:async()=>{try{await D.restoreGUIDBackup(c),E.success("已恢复,重启后生效"),await $(),await O()}catch(M){const K=M.message;E.error(`恢复失败: ${K}`)}}})},Pe=async()=>{const c=v.trim().toLowerCase();if(!b(c)){E.error("MAC 格式无效,需要 xx-xx-xx-xx-xx-xx 格式");return}B(!0);try{await D.setLinuxMAC(c),m(c),E.success("MAC 已设置,重启后生效"),await G()}catch(M){const K=M.message;E.error(`设置 MAC 失败: ${K}`)}finally{B(!1)}},Se=()=>{f&&(navigator.clipboard.writeText(f),E.success("MAC 已复制到剪贴板"))},be=()=>{i.confirm({title:"确认删除",content:"删除 machine-info 后,QQ 将在下次启动时生成新的设备标识。确定要删除吗?",confirmText:"删除",cancelText:"取消",onConfirm:async()=>{try{await D.resetLinuxDeviceID(),m(""),N(""),E.success("已删除,重启后生效"),await G()}catch(c){const M=c.message;E.error(`删除失败: ${M}`)}}})},Le=async()=>{try{await D.createLinuxMachineInfoBackup(),E.success("备份已创建"),await G()}catch(c){const M=c.message;E.error(`备份失败: ${M}`)}},ze=c=>{i.confirm({title:"确认恢复",content:`确定要从备份 "${c}" 恢复吗?当前的 machine-info 将被覆盖。`,confirmText:"恢复",cancelText:"取消",onConfirm:async()=>{try{await D.restoreLinuxMachineInfoBackup(c),E.success("已恢复,重启后生效"),await H(),await G()}catch(M){const K=M.message;E.error(`恢复失败: ${K}`)}}})},oe=()=>{i.confirm({title:"确认重启",content:"确定要重启 SnowCat 吗?这将导致当前连接断开。",confirmText:"重启",cancelText:"取消",onConfirm:async()=>{J(!0);try{await D.restartSnowCat(),E.success("重启指令已发送")}catch(c){const M=c.message;E.error(`重启失败: ${M}`)}finally{J(!1)}}})};return Z||!e?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Oe,{label:"加载中..."})}):j?r.jsLine truncated
* @license QR Code generator library (TypeScript)
* Copyright (c) Project Nayuki.
* SPDX-License-Identifier: MIT
*/var V;(h=>{const l=class p{constructor(e,s,t,n){if(this.version=e,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],e<p.MIN_VERSION||e>p.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let a=[];for(let o=0;o<this.size;o++)a.push(!1);for(let o=0;o<this.size;o++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(t);if(this.drawCodewords(d),n==-1){let o=1e9;for(let f=0;f<8;f++){this.applyMask(f),this.drawFormatBits(f);const m=this.getPenaltyScore();m<o&&(n=f,o=m),this.applyMask(f)}}C(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,s){const t=h.QrSegment.makeSegments(e);return p.encodeSegments(t,s)}static encodeBinary(e,s){const t=h.QrSegment.makeBytes(e);return p.encodeSegments([t],s)}static encodeSegments(e,s,t=1,n=40,a=-1,d=!0){if(!(p.MIN_VERSION<=t&&t<=n&&n<=p.MAX_VERSION)||a<-1||a>7)throw new RangeError("Invalid value");let o,f;for(o=t;;o++){const g=p.getNumDataCodewords(o,s)*8,y=j.getTotalBits(e,o);if(y<=g){f=y;break}if(o>=n)throw new RangeError("Data too long")}for(const g of[p.Ecc.MEDIUM,p.Ecc.QUARTILE,p.Ecc.HIGH])d&&f<=p.getNumDataCodewords(o,g)*8&&(s=g);let m=[];for(const g of e){i(g.mode.modeBits,4,m),i(g.numChars,g.mode.numCharCountBits(o),m);for(const y of g.getData())m.push(y)}C(m.length==f);const v=p.getNumDataCodewords(o,s)*8;C(m.length<=v),i(0,Math.min(4,v-m.length),m),i(0,(8-m.length%8)%8,m),C(m.length%8==0);for(let g=236;m.length<v;g^=253)i(g,8,m);let N=[];for(;N.length*8<m.length;)N.push(0);return m.forEach((g,y)=>N[y>>>3]|=g<<7-(y&7)),new p(o,s,N,a)}getModule(e,s){return 0<=e&&e<this.size&&0<=s&&s<this.size&&this.modules[s][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),s=e.length;for(let t=0;t<s;t++)for(let n=0;n<s;n++)t==0&&n==0||t==0&&n==s-1||t==s-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const s=this.errorCorrectionLevel.formatBits<<3|e;let t=s;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;const n=(s<<10|t)^21522;C(n>>>15==0);for(let a=0;a<=5;a++)this.setFunctionModule(8,a,u(n,a));this.setFunctionModule(8,7,u(n,6)),this.setFunctionModule(8,8,u(n,7)),this.setFunctionModule(7,8,u(n,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,u(n,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,u(n,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,u(n,a));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;const s=this.version<<12|e;C(s>>>18==0);for(let t=0;t<18;t++){const n=u(s,t),a=this.size-11+t%3,d=Math.floor(t/3);this.setFunctionModule(a,d,n),this.setFunctionModule(d,a,n)}}drawFinderPattern(e,s){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const a=Math.max(Math.abs(n),Math.abs(t)),d=e+n,o=s+t;0<=d&&d<this.size&&0<=o&&o<this.size&&this.setFunctionModule(d,o,a!=2&&a!=4)}}drawAlignmentPattern(e,s){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,s+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,s,t){this.modules[s][e]=t,this.isFunction[s][e]=!0}addEccAndInterleave(e){const s=this.version,t=this.errorCorrectionLevel;if(e.length!=p.getNumDataCodewords(s,t))throw new RangeError("Invalid argument");const n=p.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][s],a=p.ECC_CODEWORDS_PER_BLOCK[t.ordinal][s],d=Math.floor(p.getNumRawDataModules(s)/8),o=n-d%n,f=Math.floor(d/n);let m=[];const v=p.reedSolomonComputeDivisor(a);for(let g=0,y=0;g<n;g++){let P=e.slice(y,y+f-a+(g<o?0:1));y+=P.length;const Y=p.reedSolomonComputeRemainder(P,v);g<o&&P.push(0),m.push(P.concat(Y))}let N=[];for(let g=0;g<m[0].length;g++)m.forEach((y,P)=>{(g!=f-a||P>=o)&&N.push(y[g])});return C(N.length==d),N}drawCodewords(e){if(e.length!=Math.floor(p.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let n=0;n<this.size;n++)for(let a=0;a<2;a++){const d=t-a,f=(t+1&2)==0?this.size-1-n:n;!this.isFunction[f][d]&&s<e.length*8&&(this.modules[f][d]=u(e[s>>>3],7-(s&7)),s++)}}C(s==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+s)%2==0;break;case 1:n=s%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+s)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(s/2))%2==0;break;case 5:n=t*s%2+t*s%3==0;break;case 6:n=(t*s%2+t*s%3)%2==0;break;case 7:n=((t+s)%2+t*s%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[s][t]&&n&&(this.modules[s][t]=!this.modules[Line truncated
* @license qrcode.react
* Copyright (c) Paul O'Shannessy
* SPDX-License-Identifier: ISC
*/var ke={L:W.QrCode.Ecc.LOW,M:W.QrCode.Ecc.MEDIUM,Q:W.QrCode.Ecc.QUARTILE,H:W.QrCode.Ecc.HIGH},we=128,ve="L",Me="#FFFFFF",Ee="#000000",Ne=!1,Ie=1,_e=4,Qe=0,$e=.1;function ye(h,l=0){const i=[];return h.forEach(function(u,C){let x=null;u.forEach(function(j,w){if(!j&&x!==null){i.push(`M${x+l} ${C+l}h${w-x}v1H${x+l}z`),x=null;return}if(w===u.length-1){if(!j)return;x===null?i.push(`M${w+l},${C+l} h1v1H${w+l}z`):i.push(`M${x+l},${C+l} h${w+1-x}v1H${x+l}z`);return}j&&x===null&&(x=w)})}),i.join("")}function Ae(h,l){return h.slice().map((i,u)=>u<l.y||u>=l.y+l.h?i:i.map((C,x)=>x<l.x||x>=l.x+l.w?C:!1))}function He(h,l,i,u){if(u==null)return null;const C=h.length+i*2,x=Math.floor(l*$e),j=C/l,w=(u.width||x)*j,e=(u.height||x)*j,s=u.x==null?h.length/2-w/2:u.x*j,t=u.y==null?h.length/2-e/2:u.y*j,n=u.opacity==null?1:u.opacity;let a=null;if(u.excavate){let o=Math.floor(s),f=Math.floor(t),m=Math.ceil(w+s-o),v=Math.ceil(e+t-f);a={x:o,y:f,w:m,h:v}}const d=u.crossOrigin;return{x:s,y:t,h:e,w,excavation:a,opacity:n,crossOrigin:d}}function Ve(h,l){return l!=null?Math.max(Math.floor(l),0):h?_e:Qe}function je({value:h,level:l,minVersion:i,includeMargin:u,marginSize:C,imageSettings:x,size:j,boostLevel:w}){let e=R.useMemo(()=>{const o=(Array.isArray(h)?h:[h]).reduce((f,m)=>(f.push(...W.QrSegment.makeSegments(m)),f),[]);return W.QrCode.encodeSegments(o,ke[l],i,void 0,void 0,w)},[h,l,i,w]);const{cells:s,margin:t,numCells:n,calculatedImageSettings:a}=R.useMemo(()=>{let d=e.getModules();const o=Ve(u,C),f=d.length+o*2,m=He(d,j,o,x);return{cells:d,margin:o,numCells:f,calculatedImageSettings:m}},[e,j,x,u,C]);return{qrcode:e,margin:t,cells:s,numCells:n,calculatedImageSettings:a}}var Ye=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Xe=R.forwardRef(function(l,i){const u=l,{value:C,size:x=we,level:j=ve,bgColor:w=Me,fgColor:e=Ee,includeMargin:s=Ne,minVersion:t=Ie,boostLevel:n,marginSize:a,imageSettings:d}=u,f=ie(u,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:m}=f,v=ie(f,["style"]),N=d==null?void 0:d.src,g=R.useRef(null),y=R.useRef(null),P=R.useCallback(b=>{g.current=b,typeof i=="function"?i(b):i&&(i.current=b)},[i]),[Y,Z]=R.useState(!1),{margin:U,cells:X,numCells:B,calculatedImageSettings:S}=je({value:C,level:j,minVersion:t,boostLevel:n,includeMargin:s,marginSize:a,imageSettings:d,size:x});R.useEffect(()=>{if(g.current!=null){const b=g.current,z=b.getContext("2d");if(!z)return;let F=X;const T=y.current,$=S!=null&&T!==null&&T.complete&&T.naturalHeight!==0&&T.naturalWidth!==0;$&&S.excavation!=null&&(F=Ae(X,S.excavation));const O=window.devicePixelRatio||1;b.height=b.width=x*O;const H=x/B*O;z.scale(H,H),z.fillStyle=w,z.fillRect(0,0,B,B),z.fillStyle=e,Ye?z.fill(new Path2D(ye(F,U))):X.forEach(function(G,q){G.forEach(function(se,ne){se&&z.fillRect(ne+U,q+U,1,1)})}),S&&(z.globalAlpha=S.opacity),$&&z.drawImage(T,S.x+U,S.y+U,S.w,S.h)}}),R.useEffect(()=>{Z(!1)},[N]);const J=ae({height:x,width:x},m);let Q=null;return N!=null&&(Q=R.createElement("img",{src:N,key:N,style:{display:"none"},onLoad:()=>{Z(!0)},ref:y,crossOrigin:S==null?void 0:S.crossOrigin})),R.createElement(R.Fragment,null,R.createElement("canvas",ae({style:J,height:x,width:x,ref:P,role:"img"},v)),Q)});Xe.displayName="QRCodeCanvas";var We=R.forwardRef(function(l,i){const u=l,{value:C,size:x=we,level:j=ve,bgColor:w=Me,fgColor:e=Ee,includeMargin:s=Ne,minVersion:t=Ie,boostLevel:n,title:a,marginSize:d,imageSettings:o}=u,f=ie(u,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:m,cells:v,numCells:N,calculatedImageSettings:g}=je({value:C,level:j,minVersion:t,boostLevel:n,includeMargin:s,marginSize:d,imageSettings:o,size:x});let y=v,P=null;o!=null&&g!=null&&(g.excavation!=null&&(y=Ae(v,g.excavation)),P=R.createElement("image",{href:o.src,height:g.h,width:g.w,x:g.x+m,y:g.y+m,preserveAspectRatio:"none",opacity:g.opacity,crossOrigin:g.crossOrigin}));const Y=ye(y,m);return R.createElement("svg",ae({height:x,width:x,viewBox:`0 0 ${N} ${N}`,ref:i,role:"img"},f),!!a&&R.createElement("title",null,a),R.createElement("path",{fill:w,d:`M0,0 h${N}v${N}H0z`,shapeRendering:"crispEdges"}),R.createElement("path",{fill:e,d:Y,shapeRendering:"crispEdges"}),P)});We.displayName="QRCodeSVG";export{ot as G,We as Q};