@@ -3,6 +3,7 @@ window.runtime = {
3
3
EventsOnMultiple ( id , fn ) { } ,
4
4
WindowIsMaximised ( ) { } ,
5
5
WindowIsMinimised ( ) { } ,
6
+ EventsOff ( ) { } ,
6
7
WindowReloadApp ( ) {
7
8
window . location . reload ( ) ;
8
9
} ,
@@ -39,6 +40,7 @@ window.go = {
39
40
GetEnv ( ) {
40
41
return {
41
42
os : "darwin" ,
43
+ arch : "arm64" ,
42
44
basePath : window . location . pathname . slice ( 0 , - 1 ) ,
43
45
} ;
44
46
} ,
@@ -49,21 +51,33 @@ window.go = {
49
51
return true ;
50
52
} ,
51
53
async Requests ( method , url , headers , body , options ) {
54
+ if (
55
+ url ==
56
+ "https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/version.txt"
57
+ ) {
58
+ return {
59
+ flag : true ,
60
+ status : 200 ,
61
+ headers : { } ,
62
+ body : "alpha-xxxxxxx" ,
63
+ } ;
64
+ }
52
65
const res = await fetch ( url , {
53
66
method,
54
67
headers,
55
68
body : [ "HEAD" , "GET" ] . includes ( method ) ? null : JSON . stringify ( body ) ,
56
69
} ) ;
57
- let respBody ;
58
- if ( res . headers [ "Content-Type" ] ?. includes ( "application/json" ) ) {
59
- respBody = await res . json ( ) ;
60
- } else {
61
- respBody = await res . text ( ) ;
62
- }
70
+ let respBody = await res . text ( ) ;
71
+
63
72
return {
64
73
flag : true ,
65
74
status : res . status ,
66
- headers : res . headers ,
75
+ headers : {
76
+ ...res . headers ,
77
+ ...( url . includes ( "api.github.com" )
78
+ ? { "Content-Type" : "application/json" }
79
+ : { } ) ,
80
+ } ,
67
81
body : respBody ,
68
82
} ;
69
83
} ,
@@ -76,7 +90,44 @@ window.go = {
76
90
path = window . location . pathname + path ;
77
91
return { flag : true , data : localStorage . getItem ( path ) } ;
78
92
} ,
79
- Exec ( ) {
93
+ Removefile ( ) { } ,
94
+ Exec ( path , args ) {
95
+ if ( path == "bash" ) {
96
+ return { flag : true , data : "" } ;
97
+ }
98
+
99
+ if ( path == "data/mihomo/mihomo-darwin-arm64" && args . includes ( "-v" ) ) {
100
+ return {
101
+ flag : true ,
102
+ data : "Mihomo Meta v1.19.1 darwin arm64 with go1.23.4 Tue Dec 31 16:58:41 UTC 2024\nUse tags: with_gvisor" ,
103
+ } ;
104
+ }
105
+ if (
106
+ path == "data/mihomo/mihomo-darwin-arm64-alpha" &&
107
+ args . includes ( "-v" )
108
+ ) {
109
+ return {
110
+ flag : true ,
111
+ data : "Mihomo Meta alpha-xxxxxxx darwin arm64 with go1.23.4 Tue Jan 7 00:00:00 UTC 2025\nUse tags: with_gvisor" ,
112
+ } ;
113
+ }
114
+
115
+ if ( path == "data/sing-box/sing-box" && args . includes ( "version" ) ) {
116
+ return {
117
+ flag : true ,
118
+ data : "sing-box version 1.10.7\n\nEnvironment: go1.23.4 darwin/arm64\nTags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api\nRevision: 253b41936ecd6ae17948d49d9c510d7100830927\nCGO: disabled" ,
119
+ } ;
120
+ }
121
+
122
+ if (
123
+ path == "data/sing-box/sing-box-latest" &&
124
+ args . includes ( "version" )
125
+ ) {
126
+ return {
127
+ flag : true ,
128
+ data : "sing-box version 1.11.0-beta.24\n\nEnvironment: go1.23.4 windows/amd64\nTags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api\nRevision: 8cc7734a921bf6c24d52d3b8dc40a553a88d7f5a\nCGO: disabled" ,
129
+ } ;
130
+ }
80
131
return { flag : false , data : "Web端不支持" } ;
81
132
} ,
82
133
ExecBackground ( path , args , out , end ) {
@@ -88,6 +139,9 @@ window.go = {
88
139
AddScheduledTask ( ) {
89
140
return { flag : false , data : "Web端不支持" } ;
90
141
} ,
142
+ AbsolutePath ( path ) {
143
+ return { flag : true , data : path } ;
144
+ } ,
91
145
} ,
92
146
} ,
93
147
} ;
0 commit comments