@@ -35,33 +35,33 @@ export default function Download() {
3535 ) ;
3636}
3737
38- function detectPlatformAndArch ( ) {
39- // 检测操作系统
40- const platform = navigator . platform ;
41- let os ;
42- if ( platform . includes ( "Win" ) ) {
43- os = "windows" ;
44- } else if ( platform . includes ( "Mac" ) ) {
45- os = "darwin" ;
46- } else if ( platform . includes ( "Linux" ) ) {
47- os = "linux" ;
48- } else {
49- os = "unknown" ;
50- }
38+ // function detectPlatformAndArch() {
39+ // // 检测操作系统
40+ // const platform = navigator.platform;
41+ // let os;
42+ // if (platform.includes("Win")) {
43+ // os = "windows";
44+ // } else if (platform.includes("Mac")) {
45+ // os = "darwin";
46+ // } else if (platform.includes("Linux")) {
47+ // os = "linux";
48+ // } else {
49+ // os = "unknown";
50+ // }
5151
52- // 检测CPU架构(间接推断)
53- const userAgent = navigator . userAgent ;
54- let arch = "unknown" ;
55- if ( / a a r c h 6 4 | a r m 6 4 / i. test ( userAgent ) ) {
56- arch = "aarch64" ;
57- } else if ( / x 8 6 _ 6 4 | x 6 4 | w i n 6 4 | w o w 6 4 / i. test ( userAgent ) ) {
58- arch = "x86_64" ;
59- } else if ( / x 8 6 | i 3 8 6 | i 6 8 6 | w i n 3 2 / i. test ( userAgent ) ) {
60- arch = "x86" ;
61- }
52+ // // 检测CPU架构(间接推断)
53+ // const userAgent = navigator.userAgent;
54+ // let arch = "unknown";
55+ // if (/aarch64|arm64/i.test(userAgent)) {
56+ // arch = "aarch64";
57+ // } else if (/x86_64|x64|win64|wow64/i.test(userAgent)) {
58+ // arch = "x86_64";
59+ // } else if (/x86|i386|i686|win32/i.test(userAgent)) {
60+ // arch = "x86";
61+ // }
6262
63- return `${ os } -${ arch } ` ;
64- }
63+ // return `${os}-${arch}`;
64+ // }
6565
6666const platformMap = {
6767 "windows-x86_64" : "Windows" ,
@@ -76,7 +76,7 @@ const formatMap = {
7676function Downloads ( { data } : { data : Record < string , Record < string , string > > } ) {
7777 return (
7878 < div className = "flex flex-col gap-3" >
79- < div className = "flex flex-wrap gap-3" >
79+ { /* <div className="flex flex-wrap gap-3">
8080 {Object.entries(data[detectPlatformAndArch()]).map(([format, url]) => (
8181 <a
8282 key={format}
@@ -90,10 +90,10 @@ function Downloads({ data }: { data: Record<string, Record<string, string>> }) {
9090 </div>
9191 </a>
9292 ))}
93- </ div >
93+ </div> */ }
9494 < div className = "flex flex-wrap gap-3" >
9595 { Object . entries ( data )
96- . filter ( ( [ key ] ) => key !== detectPlatformAndArch ( ) )
96+ // .filter(([key]) => key !== detectPlatformAndArch())
9797 . map ( ( [ platform , formats ] ) =>
9898 Object . entries ( formats ) . map ( ( [ format , url ] ) => (
9999 < a
0 commit comments