pake-cli 2.0.7 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/cli.js +646 -2410
- package/package.json +6 -4
- package/src-tauri/Cargo.lock +100 -157
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/info.plist +9 -0
- package/src-tauri/src/inject/event.js +20 -16
- /package/src-tauri/{cn_config.bak → rust_proxy.toml} +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,2113 +1,195 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { program } from 'commander';
|
|
1
|
+
import ora from 'ora';
|
|
3
2
|
import log from 'loglevel';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
import prompts from 'prompts';
|
|
3
|
+
import { InvalidArgumentError, program } from 'commander';
|
|
4
|
+
import fsExtra from 'fs-extra';
|
|
8
5
|
import path from 'path';
|
|
9
|
-
import fs$1 from 'fs/promises';
|
|
10
|
-
import fs2 from 'fs-extra';
|
|
11
|
-
import chalk from 'chalk';
|
|
12
|
-
import crypto from 'crypto';
|
|
13
6
|
import axios from 'axios';
|
|
14
|
-
import { fileTypeFromBuffer } from 'file-type';
|
|
15
7
|
import { dir } from 'tmp-promise';
|
|
16
|
-
import
|
|
8
|
+
import { fileTypeFromBuffer } from 'file-type';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import psl from 'psl';
|
|
12
|
+
import isUrl from 'is-url';
|
|
13
|
+
import crypto from 'crypto';
|
|
14
|
+
import prompts from 'prompts';
|
|
17
15
|
import shelljs from 'shelljs';
|
|
18
|
-
import { promisify } from 'util';
|
|
19
16
|
import dns from 'dns';
|
|
20
17
|
import http from 'http';
|
|
18
|
+
import { promisify } from 'util';
|
|
21
19
|
import updateNotifier from 'update-notifier';
|
|
20
|
+
import fs from 'fs';
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
41
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const DEFAULT_PAKE_OPTIONS = {
|
|
51
|
-
icon: '',
|
|
52
|
-
height: 780,
|
|
53
|
-
width: 1200,
|
|
54
|
-
fullscreen: false,
|
|
55
|
-
resizable: true,
|
|
56
|
-
transparent: false,
|
|
57
|
-
userAgent: '',
|
|
58
|
-
showMenu: false,
|
|
59
|
-
showSystemTray: false,
|
|
60
|
-
multiArch: false,
|
|
61
|
-
targets: 'deb',
|
|
62
|
-
iterCopyFile: false,
|
|
63
|
-
systemTrayIcon: '',
|
|
64
|
-
debug: false,
|
|
22
|
+
const logger = {
|
|
23
|
+
info(...msg) {
|
|
24
|
+
log.info(...msg.map((m) => chalk.blue.bold(m)));
|
|
25
|
+
},
|
|
26
|
+
debug(...msg) {
|
|
27
|
+
log.debug(...msg);
|
|
28
|
+
},
|
|
29
|
+
error(...msg) {
|
|
30
|
+
log.error(...msg.map((m) => chalk.red.bold(m)));
|
|
31
|
+
},
|
|
32
|
+
warn(...msg) {
|
|
33
|
+
log.info(...msg.map((m) => chalk.yellow.bold(m)));
|
|
34
|
+
},
|
|
35
|
+
success(...msg) {
|
|
36
|
+
log.info(...msg.map((m) => chalk.green.bold(m)));
|
|
37
|
+
}
|
|
65
38
|
};
|
|
66
39
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"abb",
|
|
72
|
-
"abbott",
|
|
73
|
-
"abbvie",
|
|
74
|
-
"abc",
|
|
75
|
-
"able",
|
|
76
|
-
"abogado",
|
|
77
|
-
"abudhabi",
|
|
78
|
-
"ac",
|
|
79
|
-
"academy",
|
|
80
|
-
"accenture",
|
|
81
|
-
"accountant",
|
|
82
|
-
"accountants",
|
|
83
|
-
"aco",
|
|
84
|
-
"actor",
|
|
85
|
-
"ad",
|
|
86
|
-
"adac",
|
|
87
|
-
"ads",
|
|
88
|
-
"adult",
|
|
89
|
-
"ae",
|
|
90
|
-
"aeg",
|
|
91
|
-
"aero",
|
|
92
|
-
"aetna",
|
|
93
|
-
"af",
|
|
94
|
-
"afl",
|
|
95
|
-
"africa",
|
|
96
|
-
"ag",
|
|
97
|
-
"agakhan",
|
|
98
|
-
"agency",
|
|
99
|
-
"ai",
|
|
100
|
-
"aig",
|
|
101
|
-
"airbus",
|
|
102
|
-
"airforce",
|
|
103
|
-
"airtel",
|
|
104
|
-
"akdn",
|
|
105
|
-
"al",
|
|
106
|
-
"alfaromeo",
|
|
107
|
-
"alibaba",
|
|
108
|
-
"alipay",
|
|
109
|
-
"allfinanz",
|
|
110
|
-
"allstate",
|
|
111
|
-
"ally",
|
|
112
|
-
"alsace",
|
|
113
|
-
"alstom",
|
|
114
|
-
"am",
|
|
115
|
-
"amazon",
|
|
116
|
-
"americanexpress",
|
|
117
|
-
"americanfamily",
|
|
118
|
-
"amex",
|
|
119
|
-
"amfam",
|
|
120
|
-
"amica",
|
|
121
|
-
"amsterdam",
|
|
122
|
-
"analytics",
|
|
123
|
-
"android",
|
|
124
|
-
"anquan",
|
|
125
|
-
"anz",
|
|
126
|
-
"ao",
|
|
127
|
-
"aol",
|
|
128
|
-
"apartments",
|
|
129
|
-
"app",
|
|
130
|
-
"apple",
|
|
131
|
-
"aq",
|
|
132
|
-
"aquarelle",
|
|
133
|
-
"ar",
|
|
134
|
-
"arab",
|
|
135
|
-
"aramco",
|
|
136
|
-
"archi",
|
|
137
|
-
"army",
|
|
138
|
-
"arpa",
|
|
139
|
-
"art",
|
|
140
|
-
"arte",
|
|
141
|
-
"as",
|
|
142
|
-
"asda",
|
|
143
|
-
"asia",
|
|
144
|
-
"associates",
|
|
145
|
-
"at",
|
|
146
|
-
"athleta",
|
|
147
|
-
"attorney",
|
|
148
|
-
"au",
|
|
149
|
-
"auction",
|
|
150
|
-
"audi",
|
|
151
|
-
"audible",
|
|
152
|
-
"audio",
|
|
153
|
-
"auspost",
|
|
154
|
-
"author",
|
|
155
|
-
"auto",
|
|
156
|
-
"autos",
|
|
157
|
-
"avianca",
|
|
158
|
-
"aw",
|
|
159
|
-
"aws",
|
|
160
|
-
"ax",
|
|
161
|
-
"axa",
|
|
162
|
-
"az",
|
|
163
|
-
"azure",
|
|
164
|
-
"ba",
|
|
165
|
-
"baby",
|
|
166
|
-
"baidu",
|
|
167
|
-
"banamex",
|
|
168
|
-
"bananarepublic",
|
|
169
|
-
"band",
|
|
170
|
-
"bank",
|
|
171
|
-
"bar",
|
|
172
|
-
"barcelona",
|
|
173
|
-
"barclaycard",
|
|
174
|
-
"barclays",
|
|
175
|
-
"barefoot",
|
|
176
|
-
"bargains",
|
|
177
|
-
"baseball",
|
|
178
|
-
"basketball",
|
|
179
|
-
"bauhaus",
|
|
180
|
-
"bayern",
|
|
181
|
-
"bb",
|
|
182
|
-
"bbc",
|
|
183
|
-
"bbt",
|
|
184
|
-
"bbva",
|
|
185
|
-
"bcg",
|
|
186
|
-
"bcn",
|
|
187
|
-
"bd",
|
|
188
|
-
"be",
|
|
189
|
-
"beats",
|
|
190
|
-
"beauty",
|
|
191
|
-
"beer",
|
|
192
|
-
"bentley",
|
|
193
|
-
"berlin",
|
|
194
|
-
"best",
|
|
195
|
-
"bestbuy",
|
|
196
|
-
"bet",
|
|
197
|
-
"bf",
|
|
198
|
-
"bg",
|
|
199
|
-
"bh",
|
|
200
|
-
"bharti",
|
|
201
|
-
"bi",
|
|
202
|
-
"bible",
|
|
203
|
-
"bid",
|
|
204
|
-
"bike",
|
|
205
|
-
"bing",
|
|
206
|
-
"bingo",
|
|
207
|
-
"bio",
|
|
208
|
-
"biz",
|
|
209
|
-
"bj",
|
|
210
|
-
"black",
|
|
211
|
-
"blackfriday",
|
|
212
|
-
"blockbuster",
|
|
213
|
-
"blog",
|
|
214
|
-
"bloomberg",
|
|
215
|
-
"blue",
|
|
216
|
-
"bm",
|
|
217
|
-
"bms",
|
|
218
|
-
"bmw",
|
|
219
|
-
"bn",
|
|
220
|
-
"bnpparibas",
|
|
221
|
-
"bo",
|
|
222
|
-
"boats",
|
|
223
|
-
"boehringer",
|
|
224
|
-
"bofa",
|
|
225
|
-
"bom",
|
|
226
|
-
"bond",
|
|
227
|
-
"boo",
|
|
228
|
-
"book",
|
|
229
|
-
"booking",
|
|
230
|
-
"bosch",
|
|
231
|
-
"bostik",
|
|
232
|
-
"boston",
|
|
233
|
-
"bot",
|
|
234
|
-
"boutique",
|
|
235
|
-
"box",
|
|
236
|
-
"br",
|
|
237
|
-
"bradesco",
|
|
238
|
-
"bridgestone",
|
|
239
|
-
"broadway",
|
|
240
|
-
"broker",
|
|
241
|
-
"brother",
|
|
242
|
-
"brussels",
|
|
243
|
-
"bs",
|
|
244
|
-
"bt",
|
|
245
|
-
"build",
|
|
246
|
-
"builders",
|
|
247
|
-
"business",
|
|
248
|
-
"buy",
|
|
249
|
-
"buzz",
|
|
250
|
-
"bv",
|
|
251
|
-
"bw",
|
|
252
|
-
"by",
|
|
253
|
-
"bz",
|
|
254
|
-
"bzh",
|
|
255
|
-
"ca",
|
|
256
|
-
"cab",
|
|
257
|
-
"cafe",
|
|
258
|
-
"cal",
|
|
259
|
-
"call",
|
|
260
|
-
"calvinklein",
|
|
261
|
-
"cam",
|
|
262
|
-
"camera",
|
|
263
|
-
"camp",
|
|
264
|
-
"canon",
|
|
265
|
-
"capetown",
|
|
266
|
-
"capital",
|
|
267
|
-
"capitalone",
|
|
268
|
-
"car",
|
|
269
|
-
"caravan",
|
|
270
|
-
"cards",
|
|
271
|
-
"care",
|
|
272
|
-
"career",
|
|
273
|
-
"careers",
|
|
274
|
-
"cars",
|
|
275
|
-
"casa",
|
|
276
|
-
"case",
|
|
277
|
-
"cash",
|
|
278
|
-
"casino",
|
|
279
|
-
"cat",
|
|
280
|
-
"catering",
|
|
281
|
-
"catholic",
|
|
282
|
-
"cba",
|
|
283
|
-
"cbn",
|
|
284
|
-
"cbre",
|
|
285
|
-
"cbs",
|
|
286
|
-
"cc",
|
|
287
|
-
"cd",
|
|
288
|
-
"center",
|
|
289
|
-
"ceo",
|
|
290
|
-
"cern",
|
|
291
|
-
"cf",
|
|
292
|
-
"cfa",
|
|
293
|
-
"cfd",
|
|
294
|
-
"cg",
|
|
295
|
-
"ch",
|
|
296
|
-
"chanel",
|
|
297
|
-
"channel",
|
|
298
|
-
"charity",
|
|
299
|
-
"chase",
|
|
300
|
-
"chat",
|
|
301
|
-
"cheap",
|
|
302
|
-
"chintai",
|
|
303
|
-
"christmas",
|
|
304
|
-
"chrome",
|
|
305
|
-
"church",
|
|
306
|
-
"ci",
|
|
307
|
-
"cipriani",
|
|
308
|
-
"circle",
|
|
309
|
-
"cisco",
|
|
310
|
-
"citadel",
|
|
311
|
-
"citi",
|
|
312
|
-
"citic",
|
|
313
|
-
"city",
|
|
314
|
-
"cityeats",
|
|
315
|
-
"ck",
|
|
316
|
-
"cl",
|
|
317
|
-
"claims",
|
|
318
|
-
"cleaning",
|
|
319
|
-
"click",
|
|
320
|
-
"clinic",
|
|
321
|
-
"clinique",
|
|
322
|
-
"clothing",
|
|
323
|
-
"cloud",
|
|
324
|
-
"club",
|
|
325
|
-
"clubmed",
|
|
326
|
-
"cm",
|
|
327
|
-
"cn",
|
|
328
|
-
"co",
|
|
329
|
-
"coach",
|
|
330
|
-
"codes",
|
|
331
|
-
"coffee",
|
|
332
|
-
"college",
|
|
333
|
-
"cologne",
|
|
334
|
-
"com",
|
|
335
|
-
"comcast",
|
|
336
|
-
"commbank",
|
|
337
|
-
"community",
|
|
338
|
-
"company",
|
|
339
|
-
"compare",
|
|
340
|
-
"computer",
|
|
341
|
-
"comsec",
|
|
342
|
-
"condos",
|
|
343
|
-
"construction",
|
|
344
|
-
"consulting",
|
|
345
|
-
"contact",
|
|
346
|
-
"contractors",
|
|
347
|
-
"cooking",
|
|
348
|
-
"cookingchannel",
|
|
349
|
-
"cool",
|
|
350
|
-
"coop",
|
|
351
|
-
"corsica",
|
|
352
|
-
"country",
|
|
353
|
-
"coupon",
|
|
354
|
-
"coupons",
|
|
355
|
-
"courses",
|
|
356
|
-
"cpa",
|
|
357
|
-
"cr",
|
|
358
|
-
"credit",
|
|
359
|
-
"creditcard",
|
|
360
|
-
"creditunion",
|
|
361
|
-
"cricket",
|
|
362
|
-
"crown",
|
|
363
|
-
"crs",
|
|
364
|
-
"cruise",
|
|
365
|
-
"cruises",
|
|
366
|
-
"cu",
|
|
367
|
-
"cuisinella",
|
|
368
|
-
"cv",
|
|
369
|
-
"cw",
|
|
370
|
-
"cx",
|
|
371
|
-
"cy",
|
|
372
|
-
"cymru",
|
|
373
|
-
"cyou",
|
|
374
|
-
"cz",
|
|
375
|
-
"dabur",
|
|
376
|
-
"dad",
|
|
377
|
-
"dance",
|
|
378
|
-
"data",
|
|
379
|
-
"date",
|
|
380
|
-
"dating",
|
|
381
|
-
"datsun",
|
|
382
|
-
"day",
|
|
383
|
-
"dclk",
|
|
384
|
-
"dds",
|
|
385
|
-
"de",
|
|
386
|
-
"deal",
|
|
387
|
-
"dealer",
|
|
388
|
-
"deals",
|
|
389
|
-
"degree",
|
|
390
|
-
"delivery",
|
|
391
|
-
"dell",
|
|
392
|
-
"deloitte",
|
|
393
|
-
"delta",
|
|
394
|
-
"democrat",
|
|
395
|
-
"dental",
|
|
396
|
-
"dentist",
|
|
397
|
-
"desi",
|
|
398
|
-
"design",
|
|
399
|
-
"dev",
|
|
400
|
-
"dhl",
|
|
401
|
-
"diamonds",
|
|
402
|
-
"diet",
|
|
403
|
-
"digital",
|
|
404
|
-
"direct",
|
|
405
|
-
"directory",
|
|
406
|
-
"discount",
|
|
407
|
-
"discover",
|
|
408
|
-
"dish",
|
|
409
|
-
"diy",
|
|
410
|
-
"dj",
|
|
411
|
-
"dk",
|
|
412
|
-
"dm",
|
|
413
|
-
"dnp",
|
|
414
|
-
"do",
|
|
415
|
-
"docs",
|
|
416
|
-
"doctor",
|
|
417
|
-
"dog",
|
|
418
|
-
"domains",
|
|
419
|
-
"dot",
|
|
420
|
-
"download",
|
|
421
|
-
"drive",
|
|
422
|
-
"dtv",
|
|
423
|
-
"dubai",
|
|
424
|
-
"dunlop",
|
|
425
|
-
"dupont",
|
|
426
|
-
"durban",
|
|
427
|
-
"dvag",
|
|
428
|
-
"dvr",
|
|
429
|
-
"dz",
|
|
430
|
-
"earth",
|
|
431
|
-
"eat",
|
|
432
|
-
"ec",
|
|
433
|
-
"eco",
|
|
434
|
-
"edeka",
|
|
435
|
-
"edu",
|
|
436
|
-
"education",
|
|
437
|
-
"ee",
|
|
438
|
-
"eg",
|
|
439
|
-
"email",
|
|
440
|
-
"emerck",
|
|
441
|
-
"energy",
|
|
442
|
-
"engineer",
|
|
443
|
-
"engineering",
|
|
444
|
-
"enterprises",
|
|
445
|
-
"epson",
|
|
446
|
-
"equipment",
|
|
447
|
-
"er",
|
|
448
|
-
"ericsson",
|
|
449
|
-
"erni",
|
|
450
|
-
"es",
|
|
451
|
-
"esq",
|
|
452
|
-
"estate",
|
|
453
|
-
"et",
|
|
454
|
-
"etisalat",
|
|
455
|
-
"eu",
|
|
456
|
-
"eurovision",
|
|
457
|
-
"eus",
|
|
458
|
-
"events",
|
|
459
|
-
"exchange",
|
|
460
|
-
"expert",
|
|
461
|
-
"exposed",
|
|
462
|
-
"express",
|
|
463
|
-
"extraspace",
|
|
464
|
-
"fage",
|
|
465
|
-
"fail",
|
|
466
|
-
"fairwinds",
|
|
467
|
-
"faith",
|
|
468
|
-
"family",
|
|
469
|
-
"fan",
|
|
470
|
-
"fans",
|
|
471
|
-
"farm",
|
|
472
|
-
"farmers",
|
|
473
|
-
"fashion",
|
|
474
|
-
"fast",
|
|
475
|
-
"fedex",
|
|
476
|
-
"feedback",
|
|
477
|
-
"ferrari",
|
|
478
|
-
"ferrero",
|
|
479
|
-
"fi",
|
|
480
|
-
"fiat",
|
|
481
|
-
"fidelity",
|
|
482
|
-
"fido",
|
|
483
|
-
"film",
|
|
484
|
-
"final",
|
|
485
|
-
"finance",
|
|
486
|
-
"financial",
|
|
487
|
-
"fire",
|
|
488
|
-
"firestone",
|
|
489
|
-
"firmdale",
|
|
490
|
-
"fish",
|
|
491
|
-
"fishing",
|
|
492
|
-
"fit",
|
|
493
|
-
"fitness",
|
|
494
|
-
"fj",
|
|
495
|
-
"fk",
|
|
496
|
-
"flickr",
|
|
497
|
-
"flights",
|
|
498
|
-
"flir",
|
|
499
|
-
"florist",
|
|
500
|
-
"flowers",
|
|
501
|
-
"fly",
|
|
502
|
-
"fm",
|
|
503
|
-
"fo",
|
|
504
|
-
"foo",
|
|
505
|
-
"food",
|
|
506
|
-
"foodnetwork",
|
|
507
|
-
"football",
|
|
508
|
-
"ford",
|
|
509
|
-
"forex",
|
|
510
|
-
"forsale",
|
|
511
|
-
"forum",
|
|
512
|
-
"foundation",
|
|
513
|
-
"fox",
|
|
514
|
-
"fr",
|
|
515
|
-
"free",
|
|
516
|
-
"fresenius",
|
|
517
|
-
"frl",
|
|
518
|
-
"frogans",
|
|
519
|
-
"frontdoor",
|
|
520
|
-
"frontier",
|
|
521
|
-
"ftr",
|
|
522
|
-
"fujitsu",
|
|
523
|
-
"fun",
|
|
524
|
-
"fund",
|
|
525
|
-
"furniture",
|
|
526
|
-
"futbol",
|
|
527
|
-
"fyi",
|
|
528
|
-
"ga",
|
|
529
|
-
"gal",
|
|
530
|
-
"gallery",
|
|
531
|
-
"gallo",
|
|
532
|
-
"gallup",
|
|
533
|
-
"game",
|
|
534
|
-
"games",
|
|
535
|
-
"gap",
|
|
536
|
-
"garden",
|
|
537
|
-
"gay",
|
|
538
|
-
"gb",
|
|
539
|
-
"gbiz",
|
|
540
|
-
"gd",
|
|
541
|
-
"gdn",
|
|
542
|
-
"ge",
|
|
543
|
-
"gea",
|
|
544
|
-
"gent",
|
|
545
|
-
"genting",
|
|
546
|
-
"george",
|
|
547
|
-
"gf",
|
|
548
|
-
"gg",
|
|
549
|
-
"ggee",
|
|
550
|
-
"gh",
|
|
551
|
-
"gi",
|
|
552
|
-
"gift",
|
|
553
|
-
"gifts",
|
|
554
|
-
"gives",
|
|
555
|
-
"giving",
|
|
556
|
-
"gl",
|
|
557
|
-
"glass",
|
|
558
|
-
"gle",
|
|
559
|
-
"global",
|
|
560
|
-
"globo",
|
|
561
|
-
"gm",
|
|
562
|
-
"gmail",
|
|
563
|
-
"gmbh",
|
|
564
|
-
"gmo",
|
|
565
|
-
"gmx",
|
|
566
|
-
"gn",
|
|
567
|
-
"godaddy",
|
|
568
|
-
"gold",
|
|
569
|
-
"goldpoint",
|
|
570
|
-
"golf",
|
|
571
|
-
"goo",
|
|
572
|
-
"goodyear",
|
|
573
|
-
"goog",
|
|
574
|
-
"google",
|
|
575
|
-
"gop",
|
|
576
|
-
"got",
|
|
577
|
-
"gov",
|
|
578
|
-
"gp",
|
|
579
|
-
"gq",
|
|
580
|
-
"gr",
|
|
581
|
-
"grainger",
|
|
582
|
-
"graphics",
|
|
583
|
-
"gratis",
|
|
584
|
-
"green",
|
|
585
|
-
"gripe",
|
|
586
|
-
"grocery",
|
|
587
|
-
"group",
|
|
588
|
-
"gs",
|
|
589
|
-
"gt",
|
|
590
|
-
"gu",
|
|
591
|
-
"guardian",
|
|
592
|
-
"gucci",
|
|
593
|
-
"guge",
|
|
594
|
-
"guide",
|
|
595
|
-
"guitars",
|
|
596
|
-
"guru",
|
|
597
|
-
"gw",
|
|
598
|
-
"gy",
|
|
599
|
-
"hair",
|
|
600
|
-
"hamburg",
|
|
601
|
-
"hangout",
|
|
602
|
-
"haus",
|
|
603
|
-
"hbo",
|
|
604
|
-
"hdfc",
|
|
605
|
-
"hdfcbank",
|
|
606
|
-
"health",
|
|
607
|
-
"healthcare",
|
|
608
|
-
"help",
|
|
609
|
-
"helsinki",
|
|
610
|
-
"here",
|
|
611
|
-
"hermes",
|
|
612
|
-
"hgtv",
|
|
613
|
-
"hiphop",
|
|
614
|
-
"hisamitsu",
|
|
615
|
-
"hitachi",
|
|
616
|
-
"hiv",
|
|
617
|
-
"hk",
|
|
618
|
-
"hkt",
|
|
619
|
-
"hm",
|
|
620
|
-
"hn",
|
|
621
|
-
"hockey",
|
|
622
|
-
"holdings",
|
|
623
|
-
"holiday",
|
|
624
|
-
"homedepot",
|
|
625
|
-
"homegoods",
|
|
626
|
-
"homes",
|
|
627
|
-
"homesense",
|
|
628
|
-
"honda",
|
|
629
|
-
"horse",
|
|
630
|
-
"hospital",
|
|
631
|
-
"host",
|
|
632
|
-
"hosting",
|
|
633
|
-
"hot",
|
|
634
|
-
"hoteles",
|
|
635
|
-
"hotels",
|
|
636
|
-
"hotmail",
|
|
637
|
-
"house",
|
|
638
|
-
"how",
|
|
639
|
-
"hr",
|
|
640
|
-
"hsbc",
|
|
641
|
-
"ht",
|
|
642
|
-
"hu",
|
|
643
|
-
"hughes",
|
|
644
|
-
"hyatt",
|
|
645
|
-
"hyundai",
|
|
646
|
-
"ibm",
|
|
647
|
-
"icbc",
|
|
648
|
-
"ice",
|
|
649
|
-
"icu",
|
|
650
|
-
"id",
|
|
651
|
-
"ie",
|
|
652
|
-
"ieee",
|
|
653
|
-
"ifm",
|
|
654
|
-
"ikano",
|
|
655
|
-
"il",
|
|
656
|
-
"im",
|
|
657
|
-
"imamat",
|
|
658
|
-
"imdb",
|
|
659
|
-
"immo",
|
|
660
|
-
"immobilien",
|
|
661
|
-
"in",
|
|
662
|
-
"inc",
|
|
663
|
-
"industries",
|
|
664
|
-
"infiniti",
|
|
665
|
-
"info",
|
|
666
|
-
"ing",
|
|
667
|
-
"ink",
|
|
668
|
-
"institute",
|
|
669
|
-
"insurance",
|
|
670
|
-
"insure",
|
|
671
|
-
"int",
|
|
672
|
-
"international",
|
|
673
|
-
"intuit",
|
|
674
|
-
"investments",
|
|
675
|
-
"io",
|
|
676
|
-
"ipiranga",
|
|
677
|
-
"iq",
|
|
678
|
-
"ir",
|
|
679
|
-
"irish",
|
|
680
|
-
"is",
|
|
681
|
-
"ismaili",
|
|
682
|
-
"ist",
|
|
683
|
-
"istanbul",
|
|
684
|
-
"it",
|
|
685
|
-
"itau",
|
|
686
|
-
"itv",
|
|
687
|
-
"jaguar",
|
|
688
|
-
"java",
|
|
689
|
-
"jcb",
|
|
690
|
-
"je",
|
|
691
|
-
"jeep",
|
|
692
|
-
"jetzt",
|
|
693
|
-
"jewelry",
|
|
694
|
-
"jio",
|
|
695
|
-
"jll",
|
|
696
|
-
"jm",
|
|
697
|
-
"jmp",
|
|
698
|
-
"jnj",
|
|
699
|
-
"jo",
|
|
700
|
-
"jobs",
|
|
701
|
-
"joburg",
|
|
702
|
-
"jot",
|
|
703
|
-
"joy",
|
|
704
|
-
"jp",
|
|
705
|
-
"jpmorgan",
|
|
706
|
-
"jprs",
|
|
707
|
-
"juegos",
|
|
708
|
-
"juniper",
|
|
709
|
-
"kaufen",
|
|
710
|
-
"kddi",
|
|
711
|
-
"ke",
|
|
712
|
-
"kerryhotels",
|
|
713
|
-
"kerrylogistics",
|
|
714
|
-
"kerryproperties",
|
|
715
|
-
"kfh",
|
|
716
|
-
"kg",
|
|
717
|
-
"kh",
|
|
718
|
-
"ki",
|
|
719
|
-
"kia",
|
|
720
|
-
"kids",
|
|
721
|
-
"kim",
|
|
722
|
-
"kinder",
|
|
723
|
-
"kindle",
|
|
724
|
-
"kitchen",
|
|
725
|
-
"kiwi",
|
|
726
|
-
"km",
|
|
727
|
-
"kn",
|
|
728
|
-
"koeln",
|
|
729
|
-
"komatsu",
|
|
730
|
-
"kosher",
|
|
731
|
-
"kp",
|
|
732
|
-
"kpmg",
|
|
733
|
-
"kpn",
|
|
734
|
-
"kr",
|
|
735
|
-
"krd",
|
|
736
|
-
"kred",
|
|
737
|
-
"kuokgroup",
|
|
738
|
-
"kw",
|
|
739
|
-
"ky",
|
|
740
|
-
"kyoto",
|
|
741
|
-
"kz",
|
|
742
|
-
"la",
|
|
743
|
-
"lacaixa",
|
|
744
|
-
"lamborghini",
|
|
745
|
-
"lamer",
|
|
746
|
-
"lancaster",
|
|
747
|
-
"lancia",
|
|
748
|
-
"land",
|
|
749
|
-
"landrover",
|
|
750
|
-
"lanxess",
|
|
751
|
-
"lasalle",
|
|
752
|
-
"lat",
|
|
753
|
-
"latino",
|
|
754
|
-
"latrobe",
|
|
755
|
-
"law",
|
|
756
|
-
"lawyer",
|
|
757
|
-
"lb",
|
|
758
|
-
"lc",
|
|
759
|
-
"lds",
|
|
760
|
-
"lease",
|
|
761
|
-
"leclerc",
|
|
762
|
-
"lefrak",
|
|
763
|
-
"legal",
|
|
764
|
-
"lego",
|
|
765
|
-
"lexus",
|
|
766
|
-
"lgbt",
|
|
767
|
-
"li",
|
|
768
|
-
"lidl",
|
|
769
|
-
"life",
|
|
770
|
-
"lifeinsurance",
|
|
771
|
-
"lifestyle",
|
|
772
|
-
"lighting",
|
|
773
|
-
"like",
|
|
774
|
-
"lilly",
|
|
775
|
-
"limited",
|
|
776
|
-
"limo",
|
|
777
|
-
"lincoln",
|
|
778
|
-
"linde",
|
|
779
|
-
"link",
|
|
780
|
-
"lipsy",
|
|
781
|
-
"live",
|
|
782
|
-
"living",
|
|
783
|
-
"lk",
|
|
784
|
-
"llc",
|
|
785
|
-
"llp",
|
|
786
|
-
"loan",
|
|
787
|
-
"loans",
|
|
788
|
-
"locker",
|
|
789
|
-
"locus",
|
|
790
|
-
"loft",
|
|
791
|
-
"lol",
|
|
792
|
-
"london",
|
|
793
|
-
"lotte",
|
|
794
|
-
"lotto",
|
|
795
|
-
"love",
|
|
796
|
-
"lpl",
|
|
797
|
-
"lplfinancial",
|
|
798
|
-
"lr",
|
|
799
|
-
"ls",
|
|
800
|
-
"lt",
|
|
801
|
-
"ltd",
|
|
802
|
-
"ltda",
|
|
803
|
-
"lu",
|
|
804
|
-
"lundbeck",
|
|
805
|
-
"luxe",
|
|
806
|
-
"luxury",
|
|
807
|
-
"lv",
|
|
808
|
-
"ly",
|
|
809
|
-
"ma",
|
|
810
|
-
"macys",
|
|
811
|
-
"madrid",
|
|
812
|
-
"maif",
|
|
813
|
-
"maison",
|
|
814
|
-
"makeup",
|
|
815
|
-
"man",
|
|
816
|
-
"management",
|
|
817
|
-
"mango",
|
|
818
|
-
"map",
|
|
819
|
-
"market",
|
|
820
|
-
"marketing",
|
|
821
|
-
"markets",
|
|
822
|
-
"marriott",
|
|
823
|
-
"marshalls",
|
|
824
|
-
"maserati",
|
|
825
|
-
"mattel",
|
|
826
|
-
"mba",
|
|
827
|
-
"mc",
|
|
828
|
-
"mckinsey",
|
|
829
|
-
"md",
|
|
830
|
-
"me",
|
|
831
|
-
"med",
|
|
832
|
-
"media",
|
|
833
|
-
"meet",
|
|
834
|
-
"melbourne",
|
|
835
|
-
"meme",
|
|
836
|
-
"memorial",
|
|
837
|
-
"men",
|
|
838
|
-
"menu",
|
|
839
|
-
"merckmsd",
|
|
840
|
-
"mg",
|
|
841
|
-
"mh",
|
|
842
|
-
"miami",
|
|
843
|
-
"microsoft",
|
|
844
|
-
"mil",
|
|
845
|
-
"mini",
|
|
846
|
-
"mint",
|
|
847
|
-
"mit",
|
|
848
|
-
"mitsubishi",
|
|
849
|
-
"mk",
|
|
850
|
-
"ml",
|
|
851
|
-
"mlb",
|
|
852
|
-
"mls",
|
|
853
|
-
"mm",
|
|
854
|
-
"mma",
|
|
855
|
-
"mn",
|
|
856
|
-
"mo",
|
|
857
|
-
"mobi",
|
|
858
|
-
"mobile",
|
|
859
|
-
"moda",
|
|
860
|
-
"moe",
|
|
861
|
-
"moi",
|
|
862
|
-
"mom",
|
|
863
|
-
"monash",
|
|
864
|
-
"money",
|
|
865
|
-
"monster",
|
|
866
|
-
"mormon",
|
|
867
|
-
"mortgage",
|
|
868
|
-
"moscow",
|
|
869
|
-
"moto",
|
|
870
|
-
"motorcycles",
|
|
871
|
-
"mov",
|
|
872
|
-
"movie",
|
|
873
|
-
"mp",
|
|
874
|
-
"mq",
|
|
875
|
-
"mr",
|
|
876
|
-
"ms",
|
|
877
|
-
"msd",
|
|
878
|
-
"mt",
|
|
879
|
-
"mtn",
|
|
880
|
-
"mtr",
|
|
881
|
-
"mu",
|
|
882
|
-
"museum",
|
|
883
|
-
"music",
|
|
884
|
-
"mutual",
|
|
885
|
-
"mv",
|
|
886
|
-
"mw",
|
|
887
|
-
"mx",
|
|
888
|
-
"my",
|
|
889
|
-
"mz",
|
|
890
|
-
"na",
|
|
891
|
-
"nab",
|
|
892
|
-
"nagoya",
|
|
893
|
-
"name",
|
|
894
|
-
"natura",
|
|
895
|
-
"navy",
|
|
896
|
-
"nba",
|
|
897
|
-
"nc",
|
|
898
|
-
"ne",
|
|
899
|
-
"nec",
|
|
900
|
-
"net",
|
|
901
|
-
"netbank",
|
|
902
|
-
"netflix",
|
|
903
|
-
"network",
|
|
904
|
-
"neustar",
|
|
905
|
-
"new",
|
|
906
|
-
"news",
|
|
907
|
-
"next",
|
|
908
|
-
"nextdirect",
|
|
909
|
-
"nexus",
|
|
910
|
-
"nf",
|
|
911
|
-
"nfl",
|
|
912
|
-
"ng",
|
|
913
|
-
"ngo",
|
|
914
|
-
"nhk",
|
|
915
|
-
"ni",
|
|
916
|
-
"nico",
|
|
917
|
-
"nike",
|
|
918
|
-
"nikon",
|
|
919
|
-
"ninja",
|
|
920
|
-
"nissan",
|
|
921
|
-
"nissay",
|
|
922
|
-
"nl",
|
|
923
|
-
"no",
|
|
924
|
-
"nokia",
|
|
925
|
-
"northwesternmutual",
|
|
926
|
-
"norton",
|
|
927
|
-
"now",
|
|
928
|
-
"nowruz",
|
|
929
|
-
"nowtv",
|
|
930
|
-
"np",
|
|
931
|
-
"nr",
|
|
932
|
-
"nra",
|
|
933
|
-
"nrw",
|
|
934
|
-
"ntt",
|
|
935
|
-
"nu",
|
|
936
|
-
"nyc",
|
|
937
|
-
"nz",
|
|
938
|
-
"obi",
|
|
939
|
-
"observer",
|
|
940
|
-
"office",
|
|
941
|
-
"okinawa",
|
|
942
|
-
"olayan",
|
|
943
|
-
"olayangroup",
|
|
944
|
-
"oldnavy",
|
|
945
|
-
"ollo",
|
|
946
|
-
"om",
|
|
947
|
-
"omega",
|
|
948
|
-
"one",
|
|
949
|
-
"ong",
|
|
950
|
-
"onl",
|
|
951
|
-
"online",
|
|
952
|
-
"ooo",
|
|
953
|
-
"open",
|
|
954
|
-
"oracle",
|
|
955
|
-
"orange",
|
|
956
|
-
"org",
|
|
957
|
-
"organic",
|
|
958
|
-
"origins",
|
|
959
|
-
"osaka",
|
|
960
|
-
"otsuka",
|
|
961
|
-
"ott",
|
|
962
|
-
"ovh",
|
|
963
|
-
"pa",
|
|
964
|
-
"page",
|
|
965
|
-
"panasonic",
|
|
966
|
-
"paris",
|
|
967
|
-
"pars",
|
|
968
|
-
"partners",
|
|
969
|
-
"parts",
|
|
970
|
-
"party",
|
|
971
|
-
"passagens",
|
|
972
|
-
"pay",
|
|
973
|
-
"pccw",
|
|
974
|
-
"pe",
|
|
975
|
-
"pet",
|
|
976
|
-
"pf",
|
|
977
|
-
"pfizer",
|
|
978
|
-
"pg",
|
|
979
|
-
"ph",
|
|
980
|
-
"pharmacy",
|
|
981
|
-
"phd",
|
|
982
|
-
"philips",
|
|
983
|
-
"phone",
|
|
984
|
-
"photo",
|
|
985
|
-
"photography",
|
|
986
|
-
"photos",
|
|
987
|
-
"physio",
|
|
988
|
-
"pics",
|
|
989
|
-
"pictet",
|
|
990
|
-
"pictures",
|
|
991
|
-
"pid",
|
|
992
|
-
"pin",
|
|
993
|
-
"ping",
|
|
994
|
-
"pink",
|
|
995
|
-
"pioneer",
|
|
996
|
-
"pizza",
|
|
997
|
-
"pk",
|
|
998
|
-
"pl",
|
|
999
|
-
"place",
|
|
1000
|
-
"play",
|
|
1001
|
-
"playstation",
|
|
1002
|
-
"plumbing",
|
|
1003
|
-
"plus",
|
|
1004
|
-
"pm",
|
|
1005
|
-
"pn",
|
|
1006
|
-
"pnc",
|
|
1007
|
-
"pohl",
|
|
1008
|
-
"poker",
|
|
1009
|
-
"politie",
|
|
1010
|
-
"porn",
|
|
1011
|
-
"post",
|
|
1012
|
-
"pr",
|
|
1013
|
-
"pramerica",
|
|
1014
|
-
"praxi",
|
|
1015
|
-
"press",
|
|
1016
|
-
"prime",
|
|
1017
|
-
"pro",
|
|
1018
|
-
"prod",
|
|
1019
|
-
"productions",
|
|
1020
|
-
"prof",
|
|
1021
|
-
"progressive",
|
|
1022
|
-
"promo",
|
|
1023
|
-
"properties",
|
|
1024
|
-
"property",
|
|
1025
|
-
"protection",
|
|
1026
|
-
"pru",
|
|
1027
|
-
"prudential",
|
|
1028
|
-
"ps",
|
|
1029
|
-
"pt",
|
|
1030
|
-
"pub",
|
|
1031
|
-
"pw",
|
|
1032
|
-
"pwc",
|
|
1033
|
-
"py",
|
|
1034
|
-
"qa",
|
|
1035
|
-
"qpon",
|
|
1036
|
-
"quebec",
|
|
1037
|
-
"quest",
|
|
1038
|
-
"racing",
|
|
1039
|
-
"radio",
|
|
1040
|
-
"re",
|
|
1041
|
-
"read",
|
|
1042
|
-
"realestate",
|
|
1043
|
-
"realtor",
|
|
1044
|
-
"realty",
|
|
1045
|
-
"recipes",
|
|
1046
|
-
"red",
|
|
1047
|
-
"redstone",
|
|
1048
|
-
"redumbrella",
|
|
1049
|
-
"rehab",
|
|
1050
|
-
"reise",
|
|
1051
|
-
"reisen",
|
|
1052
|
-
"reit",
|
|
1053
|
-
"reliance",
|
|
1054
|
-
"ren",
|
|
1055
|
-
"rent",
|
|
1056
|
-
"rentals",
|
|
1057
|
-
"repair",
|
|
1058
|
-
"report",
|
|
1059
|
-
"republican",
|
|
1060
|
-
"rest",
|
|
1061
|
-
"restaurant",
|
|
1062
|
-
"review",
|
|
1063
|
-
"reviews",
|
|
1064
|
-
"rexroth",
|
|
1065
|
-
"rich",
|
|
1066
|
-
"richardli",
|
|
1067
|
-
"ricoh",
|
|
1068
|
-
"ril",
|
|
1069
|
-
"rio",
|
|
1070
|
-
"rip",
|
|
1071
|
-
"ro",
|
|
1072
|
-
"rocher",
|
|
1073
|
-
"rocks",
|
|
1074
|
-
"rodeo",
|
|
1075
|
-
"rogers",
|
|
1076
|
-
"room",
|
|
1077
|
-
"rs",
|
|
1078
|
-
"rsvp",
|
|
1079
|
-
"ru",
|
|
1080
|
-
"rugby",
|
|
1081
|
-
"ruhr",
|
|
1082
|
-
"run",
|
|
1083
|
-
"rw",
|
|
1084
|
-
"rwe",
|
|
1085
|
-
"ryukyu",
|
|
1086
|
-
"sa",
|
|
1087
|
-
"saarland",
|
|
1088
|
-
"safe",
|
|
1089
|
-
"safety",
|
|
1090
|
-
"sakura",
|
|
1091
|
-
"sale",
|
|
1092
|
-
"salon",
|
|
1093
|
-
"samsclub",
|
|
1094
|
-
"samsung",
|
|
1095
|
-
"sandvik",
|
|
1096
|
-
"sandvikcoromant",
|
|
1097
|
-
"sanofi",
|
|
1098
|
-
"sap",
|
|
1099
|
-
"sarl",
|
|
1100
|
-
"sas",
|
|
1101
|
-
"save",
|
|
1102
|
-
"saxo",
|
|
1103
|
-
"sb",
|
|
1104
|
-
"sbi",
|
|
1105
|
-
"sbs",
|
|
1106
|
-
"sc",
|
|
1107
|
-
"sca",
|
|
1108
|
-
"scb",
|
|
1109
|
-
"schaeffler",
|
|
1110
|
-
"schmidt",
|
|
1111
|
-
"scholarships",
|
|
1112
|
-
"school",
|
|
1113
|
-
"schule",
|
|
1114
|
-
"schwarz",
|
|
1115
|
-
"science",
|
|
1116
|
-
"scot",
|
|
1117
|
-
"sd",
|
|
1118
|
-
"se",
|
|
1119
|
-
"search",
|
|
1120
|
-
"seat",
|
|
1121
|
-
"secure",
|
|
1122
|
-
"security",
|
|
1123
|
-
"seek",
|
|
1124
|
-
"select",
|
|
1125
|
-
"sener",
|
|
1126
|
-
"services",
|
|
1127
|
-
"ses",
|
|
1128
|
-
"seven",
|
|
1129
|
-
"sew",
|
|
1130
|
-
"sex",
|
|
1131
|
-
"sexy",
|
|
1132
|
-
"sfr",
|
|
1133
|
-
"sg",
|
|
1134
|
-
"sh",
|
|
1135
|
-
"shangrila",
|
|
1136
|
-
"sharp",
|
|
1137
|
-
"shaw",
|
|
1138
|
-
"shell",
|
|
1139
|
-
"shia",
|
|
1140
|
-
"shiksha",
|
|
1141
|
-
"shoes",
|
|
1142
|
-
"shop",
|
|
1143
|
-
"shopping",
|
|
1144
|
-
"shouji",
|
|
1145
|
-
"show",
|
|
1146
|
-
"showtime",
|
|
1147
|
-
"si",
|
|
1148
|
-
"silk",
|
|
1149
|
-
"sina",
|
|
1150
|
-
"singles",
|
|
1151
|
-
"site",
|
|
1152
|
-
"sj",
|
|
1153
|
-
"sk",
|
|
1154
|
-
"ski",
|
|
1155
|
-
"skin",
|
|
1156
|
-
"sky",
|
|
1157
|
-
"skype",
|
|
1158
|
-
"sl",
|
|
1159
|
-
"sling",
|
|
1160
|
-
"sm",
|
|
1161
|
-
"smart",
|
|
1162
|
-
"smile",
|
|
1163
|
-
"sn",
|
|
1164
|
-
"sncf",
|
|
1165
|
-
"so",
|
|
1166
|
-
"soccer",
|
|
1167
|
-
"social",
|
|
1168
|
-
"softbank",
|
|
1169
|
-
"software",
|
|
1170
|
-
"sohu",
|
|
1171
|
-
"solar",
|
|
1172
|
-
"solutions",
|
|
1173
|
-
"song",
|
|
1174
|
-
"sony",
|
|
1175
|
-
"soy",
|
|
1176
|
-
"spa",
|
|
1177
|
-
"space",
|
|
1178
|
-
"sport",
|
|
1179
|
-
"spot",
|
|
1180
|
-
"sr",
|
|
1181
|
-
"srl",
|
|
1182
|
-
"ss",
|
|
1183
|
-
"st",
|
|
1184
|
-
"stada",
|
|
1185
|
-
"staples",
|
|
1186
|
-
"star",
|
|
1187
|
-
"statebank",
|
|
1188
|
-
"statefarm",
|
|
1189
|
-
"stc",
|
|
1190
|
-
"stcgroup",
|
|
1191
|
-
"stockholm",
|
|
1192
|
-
"storage",
|
|
1193
|
-
"store",
|
|
1194
|
-
"stream",
|
|
1195
|
-
"studio",
|
|
1196
|
-
"study",
|
|
1197
|
-
"style",
|
|
1198
|
-
"su",
|
|
1199
|
-
"sucks",
|
|
1200
|
-
"supplies",
|
|
1201
|
-
"supply",
|
|
1202
|
-
"support",
|
|
1203
|
-
"surf",
|
|
1204
|
-
"surgery",
|
|
1205
|
-
"suzuki",
|
|
1206
|
-
"sv",
|
|
1207
|
-
"swatch",
|
|
1208
|
-
"swiss",
|
|
1209
|
-
"sx",
|
|
1210
|
-
"sy",
|
|
1211
|
-
"sydney",
|
|
1212
|
-
"systems",
|
|
1213
|
-
"sz",
|
|
1214
|
-
"tab",
|
|
1215
|
-
"taipei",
|
|
1216
|
-
"talk",
|
|
1217
|
-
"taobao",
|
|
1218
|
-
"target",
|
|
1219
|
-
"tatamotors",
|
|
1220
|
-
"tatar",
|
|
1221
|
-
"tattoo",
|
|
1222
|
-
"tax",
|
|
1223
|
-
"taxi",
|
|
1224
|
-
"tc",
|
|
1225
|
-
"tci",
|
|
1226
|
-
"td",
|
|
1227
|
-
"tdk",
|
|
1228
|
-
"team",
|
|
1229
|
-
"tech",
|
|
1230
|
-
"technology",
|
|
1231
|
-
"tel",
|
|
1232
|
-
"temasek",
|
|
1233
|
-
"tennis",
|
|
1234
|
-
"teva",
|
|
1235
|
-
"tf",
|
|
1236
|
-
"tg",
|
|
1237
|
-
"th",
|
|
1238
|
-
"thd",
|
|
1239
|
-
"theater",
|
|
1240
|
-
"theatre",
|
|
1241
|
-
"tiaa",
|
|
1242
|
-
"tickets",
|
|
1243
|
-
"tienda",
|
|
1244
|
-
"tiffany",
|
|
1245
|
-
"tips",
|
|
1246
|
-
"tires",
|
|
1247
|
-
"tirol",
|
|
1248
|
-
"tj",
|
|
1249
|
-
"tjmaxx",
|
|
1250
|
-
"tjx",
|
|
1251
|
-
"tk",
|
|
1252
|
-
"tkmaxx",
|
|
1253
|
-
"tl",
|
|
1254
|
-
"tm",
|
|
1255
|
-
"tmall",
|
|
1256
|
-
"tn",
|
|
1257
|
-
"to",
|
|
1258
|
-
"today",
|
|
1259
|
-
"tokyo",
|
|
1260
|
-
"tools",
|
|
1261
|
-
"top",
|
|
1262
|
-
"toray",
|
|
1263
|
-
"toshiba",
|
|
1264
|
-
"total",
|
|
1265
|
-
"tours",
|
|
1266
|
-
"town",
|
|
1267
|
-
"toyota",
|
|
1268
|
-
"toys",
|
|
1269
|
-
"tr",
|
|
1270
|
-
"trade",
|
|
1271
|
-
"trading",
|
|
1272
|
-
"training",
|
|
1273
|
-
"travel",
|
|
1274
|
-
"travelchannel",
|
|
1275
|
-
"travelers",
|
|
1276
|
-
"travelersinsurance",
|
|
1277
|
-
"trust",
|
|
1278
|
-
"trv",
|
|
1279
|
-
"tt",
|
|
1280
|
-
"tube",
|
|
1281
|
-
"tui",
|
|
1282
|
-
"tunes",
|
|
1283
|
-
"tushu",
|
|
1284
|
-
"tv",
|
|
1285
|
-
"tvs",
|
|
1286
|
-
"tw",
|
|
1287
|
-
"tz",
|
|
1288
|
-
"ua",
|
|
1289
|
-
"ubank",
|
|
1290
|
-
"ubs",
|
|
1291
|
-
"ug",
|
|
1292
|
-
"uk",
|
|
1293
|
-
"unicom",
|
|
1294
|
-
"university",
|
|
1295
|
-
"uno",
|
|
1296
|
-
"uol",
|
|
1297
|
-
"ups",
|
|
1298
|
-
"us",
|
|
1299
|
-
"uy",
|
|
1300
|
-
"uz",
|
|
1301
|
-
"va",
|
|
1302
|
-
"vacations",
|
|
1303
|
-
"vana",
|
|
1304
|
-
"vanguard",
|
|
1305
|
-
"vc",
|
|
1306
|
-
"ve",
|
|
1307
|
-
"vegas",
|
|
1308
|
-
"ventures",
|
|
1309
|
-
"verisign",
|
|
1310
|
-
"vermögensberater",
|
|
1311
|
-
"vermögensberatung",
|
|
1312
|
-
"versicherung",
|
|
1313
|
-
"vet",
|
|
1314
|
-
"vg",
|
|
1315
|
-
"vi",
|
|
1316
|
-
"viajes",
|
|
1317
|
-
"video",
|
|
1318
|
-
"vig",
|
|
1319
|
-
"viking",
|
|
1320
|
-
"villas",
|
|
1321
|
-
"vin",
|
|
1322
|
-
"vip",
|
|
1323
|
-
"virgin",
|
|
1324
|
-
"visa",
|
|
1325
|
-
"vision",
|
|
1326
|
-
"viva",
|
|
1327
|
-
"vivo",
|
|
1328
|
-
"vlaanderen",
|
|
1329
|
-
"vn",
|
|
1330
|
-
"vodka",
|
|
1331
|
-
"volkswagen",
|
|
1332
|
-
"volvo",
|
|
1333
|
-
"vote",
|
|
1334
|
-
"voting",
|
|
1335
|
-
"voto",
|
|
1336
|
-
"voyage",
|
|
1337
|
-
"vu",
|
|
1338
|
-
"vuelos",
|
|
1339
|
-
"wales",
|
|
1340
|
-
"walmart",
|
|
1341
|
-
"walter",
|
|
1342
|
-
"wang",
|
|
1343
|
-
"wanggou",
|
|
1344
|
-
"watch",
|
|
1345
|
-
"watches",
|
|
1346
|
-
"weather",
|
|
1347
|
-
"weatherchannel",
|
|
1348
|
-
"webcam",
|
|
1349
|
-
"weber",
|
|
1350
|
-
"website",
|
|
1351
|
-
"wed",
|
|
1352
|
-
"wedding",
|
|
1353
|
-
"weibo",
|
|
1354
|
-
"weir",
|
|
1355
|
-
"wf",
|
|
1356
|
-
"whoswho",
|
|
1357
|
-
"wien",
|
|
1358
|
-
"wiki",
|
|
1359
|
-
"williamhill",
|
|
1360
|
-
"win",
|
|
1361
|
-
"windows",
|
|
1362
|
-
"wine",
|
|
1363
|
-
"winners",
|
|
1364
|
-
"wme",
|
|
1365
|
-
"wolterskluwer",
|
|
1366
|
-
"woodside",
|
|
1367
|
-
"work",
|
|
1368
|
-
"works",
|
|
1369
|
-
"world",
|
|
1370
|
-
"wow",
|
|
1371
|
-
"ws",
|
|
1372
|
-
"wtc",
|
|
1373
|
-
"wtf",
|
|
1374
|
-
"xbox",
|
|
1375
|
-
"xerox",
|
|
1376
|
-
"xfinity",
|
|
1377
|
-
"xihuan",
|
|
1378
|
-
"xin",
|
|
1379
|
-
"xxx",
|
|
1380
|
-
"xyz",
|
|
1381
|
-
"yachts",
|
|
1382
|
-
"yahoo",
|
|
1383
|
-
"yamaxun",
|
|
1384
|
-
"yandex",
|
|
1385
|
-
"ye",
|
|
1386
|
-
"yodobashi",
|
|
1387
|
-
"yoga",
|
|
1388
|
-
"yokohama",
|
|
1389
|
-
"you",
|
|
1390
|
-
"youtube",
|
|
1391
|
-
"yt",
|
|
1392
|
-
"yun",
|
|
1393
|
-
"za",
|
|
1394
|
-
"zappos",
|
|
1395
|
-
"zara",
|
|
1396
|
-
"zero",
|
|
1397
|
-
"zip",
|
|
1398
|
-
"zm",
|
|
1399
|
-
"zone",
|
|
1400
|
-
"zuerich",
|
|
1401
|
-
"zw",
|
|
1402
|
-
"ελ",
|
|
1403
|
-
"ευ",
|
|
1404
|
-
"бг",
|
|
1405
|
-
"бел",
|
|
1406
|
-
"дети",
|
|
1407
|
-
"ею",
|
|
1408
|
-
"католик",
|
|
1409
|
-
"ком",
|
|
1410
|
-
"мкд",
|
|
1411
|
-
"мон",
|
|
1412
|
-
"москва",
|
|
1413
|
-
"онлайн",
|
|
1414
|
-
"орг",
|
|
1415
|
-
"рус",
|
|
1416
|
-
"рф",
|
|
1417
|
-
"сайт",
|
|
1418
|
-
"срб",
|
|
1419
|
-
"укр",
|
|
1420
|
-
"қаз",
|
|
1421
|
-
"հայ",
|
|
1422
|
-
"ישראל",
|
|
1423
|
-
"קום",
|
|
1424
|
-
"ابوظبي",
|
|
1425
|
-
"اتصالات",
|
|
1426
|
-
"ارامكو",
|
|
1427
|
-
"الاردن",
|
|
1428
|
-
"البحرين",
|
|
1429
|
-
"الجزائر",
|
|
1430
|
-
"السعودية",
|
|
1431
|
-
"العليان",
|
|
1432
|
-
"المغرب",
|
|
1433
|
-
"امارات",
|
|
1434
|
-
"ایران",
|
|
1435
|
-
"بارت",
|
|
1436
|
-
"بازار",
|
|
1437
|
-
"بيتك",
|
|
1438
|
-
"بھارت",
|
|
1439
|
-
"تونس",
|
|
1440
|
-
"سودان",
|
|
1441
|
-
"سورية",
|
|
1442
|
-
"شبكة",
|
|
1443
|
-
"عراق",
|
|
1444
|
-
"عرب",
|
|
1445
|
-
"عمان",
|
|
1446
|
-
"فلسطين",
|
|
1447
|
-
"قطر",
|
|
1448
|
-
"كاثوليك",
|
|
1449
|
-
"كوم",
|
|
1450
|
-
"مصر",
|
|
1451
|
-
"مليسيا",
|
|
1452
|
-
"موريتانيا",
|
|
1453
|
-
"موقع",
|
|
1454
|
-
"همراه",
|
|
1455
|
-
"پاکستان",
|
|
1456
|
-
"ڀارت",
|
|
1457
|
-
"कॉम",
|
|
1458
|
-
"नेट",
|
|
1459
|
-
"भारत",
|
|
1460
|
-
"भारतम्",
|
|
1461
|
-
"भारोत",
|
|
1462
|
-
"संगठन",
|
|
1463
|
-
"বাংলা",
|
|
1464
|
-
"ভারত",
|
|
1465
|
-
"ভাৰত",
|
|
1466
|
-
"ਭਾਰਤ",
|
|
1467
|
-
"ભારત",
|
|
1468
|
-
"ଭାରତ",
|
|
1469
|
-
"இந்தியா",
|
|
1470
|
-
"இலங்கை",
|
|
1471
|
-
"சிங்கப்பூர்",
|
|
1472
|
-
"భారత్",
|
|
1473
|
-
"ಭಾರತ",
|
|
1474
|
-
"ഭാരതം",
|
|
1475
|
-
"ලංකා",
|
|
1476
|
-
"คอม",
|
|
1477
|
-
"ไทย",
|
|
1478
|
-
"ລາວ",
|
|
1479
|
-
"გე",
|
|
1480
|
-
"みんな",
|
|
1481
|
-
"アマゾン",
|
|
1482
|
-
"クラウド",
|
|
1483
|
-
"グーグル",
|
|
1484
|
-
"コム",
|
|
1485
|
-
"ストア",
|
|
1486
|
-
"セール",
|
|
1487
|
-
"ファッション",
|
|
1488
|
-
"ポイント",
|
|
1489
|
-
"世界",
|
|
1490
|
-
"中信",
|
|
1491
|
-
"中国",
|
|
1492
|
-
"中國",
|
|
1493
|
-
"中文网",
|
|
1494
|
-
"亚马逊",
|
|
1495
|
-
"企业",
|
|
1496
|
-
"佛山",
|
|
1497
|
-
"信息",
|
|
1498
|
-
"健康",
|
|
1499
|
-
"八卦",
|
|
1500
|
-
"公司",
|
|
1501
|
-
"公益",
|
|
1502
|
-
"台湾",
|
|
1503
|
-
"台灣",
|
|
1504
|
-
"商城",
|
|
1505
|
-
"商店",
|
|
1506
|
-
"商标",
|
|
1507
|
-
"嘉里",
|
|
1508
|
-
"嘉里大酒店",
|
|
1509
|
-
"在线",
|
|
1510
|
-
"大拿",
|
|
1511
|
-
"天主教",
|
|
1512
|
-
"娱乐",
|
|
1513
|
-
"家電",
|
|
1514
|
-
"广东",
|
|
1515
|
-
"微博",
|
|
1516
|
-
"慈善",
|
|
1517
|
-
"我爱你",
|
|
1518
|
-
"手机",
|
|
1519
|
-
"招聘",
|
|
1520
|
-
"政务",
|
|
1521
|
-
"政府",
|
|
1522
|
-
"新加坡",
|
|
1523
|
-
"新闻",
|
|
1524
|
-
"时尚",
|
|
1525
|
-
"書籍",
|
|
1526
|
-
"机构",
|
|
1527
|
-
"淡马锡",
|
|
1528
|
-
"游戏",
|
|
1529
|
-
"澳門",
|
|
1530
|
-
"点看",
|
|
1531
|
-
"移动",
|
|
1532
|
-
"组织机构",
|
|
1533
|
-
"网址",
|
|
1534
|
-
"网店",
|
|
1535
|
-
"网站",
|
|
1536
|
-
"网络",
|
|
1537
|
-
"联通",
|
|
1538
|
-
"诺基亚",
|
|
1539
|
-
"谷歌",
|
|
1540
|
-
"购物",
|
|
1541
|
-
"通販",
|
|
1542
|
-
"集团",
|
|
1543
|
-
"電訊盈科",
|
|
1544
|
-
"飞利浦",
|
|
1545
|
-
"食品",
|
|
1546
|
-
"餐厅",
|
|
1547
|
-
"香格里拉",
|
|
1548
|
-
"香港",
|
|
1549
|
-
"닷넷",
|
|
1550
|
-
"닷컴",
|
|
1551
|
-
"삼성",
|
|
1552
|
-
"한국",
|
|
1553
|
-
];
|
|
40
|
+
// Convert the current module URL to a file path
|
|
41
|
+
const currentModulePath = fileURLToPath(import.meta.url);
|
|
42
|
+
// Resolve the parent directory of the current module
|
|
43
|
+
const npmDirectory = path.join(path.dirname(currentModulePath), '..');
|
|
1554
44
|
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
parts.shift();
|
|
1560
|
-
}
|
|
1561
|
-
var ln = parts.length, i = ln, minLength = parts[parts.length - 1].length, part;
|
|
1562
|
-
// iterate backwards
|
|
1563
|
-
while ((part = parts[--i])) {
|
|
1564
|
-
// stop when we find a non-TLD part
|
|
1565
|
-
if (i === 0 || // 'asia.com' (last remaining must be the SLD)
|
|
1566
|
-
i < ln - 2 || // TLDs only span 2 levels
|
|
1567
|
-
part.length < minLength || // 'www.cn.com' (valid TLD as second-level domain)
|
|
1568
|
-
tlds.indexOf(part) < 0 // officialy not a TLD
|
|
1569
|
-
) {
|
|
1570
|
-
return part;
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
function appendProtocol(inputUrl) {
|
|
1575
|
-
const parsed = url.parse(inputUrl);
|
|
1576
|
-
if (!parsed.protocol) {
|
|
1577
|
-
const urlWithProtocol = `https://${inputUrl}`;
|
|
1578
|
-
return urlWithProtocol;
|
|
1579
|
-
}
|
|
1580
|
-
return inputUrl;
|
|
1581
|
-
}
|
|
1582
|
-
function normalizeUrl(urlToNormalize) {
|
|
1583
|
-
const urlWithProtocol = appendProtocol(urlToNormalize);
|
|
1584
|
-
if (isurl(urlWithProtocol)) {
|
|
1585
|
-
return urlWithProtocol;
|
|
1586
|
-
}
|
|
1587
|
-
else {
|
|
1588
|
-
throw new Error(`Your url "${urlWithProtocol}" is invalid`);
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
45
|
+
const { platform: platform$2 } = process;
|
|
46
|
+
const IS_MAC = platform$2 === 'darwin';
|
|
47
|
+
const IS_WIN = platform$2 === 'win32';
|
|
48
|
+
const IS_LINUX = platform$2 === 'linux';
|
|
1591
49
|
|
|
1592
|
-
function
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
50
|
+
async function handleIcon(options) {
|
|
51
|
+
if (options.icon) {
|
|
52
|
+
if (options.icon.startsWith('http')) {
|
|
53
|
+
return downloadIcon(options.icon);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return path.resolve(options.icon);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
logger.info('No app icon provided, default icon used. Use --icon option to assign an icon.');
|
|
61
|
+
const iconPath = IS_WIN ? 'src-tauri/png/icon_256.ico' : IS_LINUX ? 'src-tauri/png/icon_512.png' : 'src-tauri/icons/icon.icns';
|
|
62
|
+
return path.join(npmDirectory, iconPath);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function downloadIcon(iconUrl) {
|
|
66
|
+
try {
|
|
67
|
+
const iconResponse = await axios.get(iconUrl, { responseType: 'arraybuffer' });
|
|
68
|
+
const iconData = await iconResponse.data;
|
|
69
|
+
if (!iconData) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const fileDetails = await fileTypeFromBuffer(iconData);
|
|
73
|
+
if (!fileDetails) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const { path: tempPath } = await dir();
|
|
77
|
+
const iconPath = `${tempPath}/icon.${fileDetails.ext}`;
|
|
78
|
+
await fsExtra.outputFile(iconPath, iconData);
|
|
79
|
+
return iconPath;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (error.response && error.response.status === 404) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
1611
87
|
}
|
|
1612
88
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1651
|
-
const { width, height, fullscreen, transparent, resizable, userAgent, showMenu, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, } = options;
|
|
1652
|
-
const tauriConfWindowOptions = {
|
|
1653
|
-
width,
|
|
1654
|
-
height,
|
|
1655
|
-
fullscreen,
|
|
1656
|
-
transparent,
|
|
1657
|
-
resizable,
|
|
1658
|
-
};
|
|
1659
|
-
// Package name is valid ?
|
|
1660
|
-
// for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other
|
|
1661
|
-
if (process.platform === "linux") {
|
|
1662
|
-
const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/);
|
|
1663
|
-
if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
|
|
1664
|
-
logger.error("package name is illegal, it must be lowercase letters, numbers, dashes, and it must contain the lowercase letters.");
|
|
1665
|
-
logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read");
|
|
1666
|
-
process.exit();
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
if (process.platform === "win32" || process.platform === "darwin") {
|
|
1670
|
-
const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
|
|
1671
|
-
if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
|
|
1672
|
-
logger.error("package name is illegal, it must be letters, numbers, and it must contain the letters");
|
|
1673
|
-
logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead");
|
|
1674
|
-
process.exit();
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
// logger.warn(JSON.stringify(tauriConf.pake.windows, null, 4));
|
|
1678
|
-
Object.assign(tauriConf.pake.windows[0], Object.assign({ url }, tauriConfWindowOptions));
|
|
1679
|
-
tauriConf.package.productName = name;
|
|
1680
|
-
tauriConf.tauri.bundle.identifier = identifier;
|
|
1681
|
-
// 判断一下url类型,是文件还是网站
|
|
1682
|
-
// 如果是文件,并且开启了递归拷贝功能,则需要将该文件以及所在文件夹下的所有文件拷贝到src目录下,否则只拷贝单个文件。
|
|
1683
|
-
const url_exists = yield fs$1.stat(url)
|
|
1684
|
-
.then(() => true)
|
|
1685
|
-
.catch(() => false);
|
|
1686
|
-
if (url_exists) {
|
|
1687
|
-
logger.warn("you input may a local file");
|
|
1688
|
-
tauriConf.pake.windows[0].url_type = "local";
|
|
1689
|
-
const file_name = path.basename(url);
|
|
1690
|
-
const dir_name = path.dirname(url);
|
|
1691
|
-
if (!iterCopyFile) {
|
|
1692
|
-
const url_path = path.join(npmDirectory, "dist/", file_name);
|
|
1693
|
-
yield fs$1.copyFile(url, url_path);
|
|
1694
|
-
}
|
|
1695
|
-
else {
|
|
1696
|
-
const old_dir = path.join(npmDirectory, "dist/");
|
|
1697
|
-
const new_dir = path.join(npmDirectory, "dist_bak/");
|
|
1698
|
-
fs2.moveSync(old_dir, new_dir, { "overwrite": true });
|
|
1699
|
-
fs2.copySync(dir_name, old_dir, { "overwrite": true });
|
|
1700
|
-
// logger.warn("dir name", dir_name);
|
|
1701
|
-
// 将dist_bak里面的cli.js和about_pake.html拷贝回去
|
|
1702
|
-
const cli_path = path.join(new_dir, "cli.js");
|
|
1703
|
-
const cli_path_target = path.join(old_dir, "cli.js");
|
|
1704
|
-
const about_pake_path = path.join(new_dir, "about_pake.html");
|
|
1705
|
-
const about_pake_path_target = path.join(old_dir, "about_pake.html");
|
|
1706
|
-
fs$1.copyFile(cli_path, cli_path_target);
|
|
1707
|
-
fs$1.copyFile(about_pake_path, about_pake_path_target);
|
|
1708
|
-
}
|
|
1709
|
-
tauriConf.pake.windows[0].url = file_name;
|
|
1710
|
-
tauriConf.pake.windows[0].url_type = "local";
|
|
1711
|
-
}
|
|
1712
|
-
else {
|
|
1713
|
-
tauriConf.pake.windows[0].url_type = "web";
|
|
1714
|
-
}
|
|
1715
|
-
// 处理user-agent
|
|
1716
|
-
if (userAgent.length > 0) {
|
|
1717
|
-
if (process.platform === "win32") {
|
|
1718
|
-
tauriConf.pake.user_agent.windows = userAgent;
|
|
1719
|
-
}
|
|
1720
|
-
if (process.platform === "linux") {
|
|
1721
|
-
tauriConf.pake.user_agent.linux = userAgent;
|
|
1722
|
-
}
|
|
1723
|
-
if (process.platform === "darwin") {
|
|
1724
|
-
tauriConf.pake.user_agent.macos = userAgent;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
// 处理菜单栏
|
|
1728
|
-
if (showMenu) {
|
|
1729
|
-
if (process.platform === "win32") {
|
|
1730
|
-
tauriConf.pake.menu.windows = true;
|
|
1731
|
-
}
|
|
1732
|
-
if (process.platform === "linux") {
|
|
1733
|
-
tauriConf.pake.menu.linux = true;
|
|
1734
|
-
}
|
|
1735
|
-
if (process.platform === "darwin") {
|
|
1736
|
-
tauriConf.pake.menu.macos = true;
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
else {
|
|
1740
|
-
if (process.platform === "win32") {
|
|
1741
|
-
tauriConf.pake.menu.windows = false;
|
|
1742
|
-
}
|
|
1743
|
-
if (process.platform === "linux") {
|
|
1744
|
-
tauriConf.pake.menu.linux = false;
|
|
1745
|
-
}
|
|
1746
|
-
if (process.platform === "darwin") {
|
|
1747
|
-
tauriConf.pake.menu.macos = false;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
// 处理托盘
|
|
1751
|
-
if (showSystemTray) {
|
|
1752
|
-
if (process.platform === "win32") {
|
|
1753
|
-
tauriConf.pake.system_tray.windows = true;
|
|
1754
|
-
}
|
|
1755
|
-
if (process.platform === "linux") {
|
|
1756
|
-
tauriConf.pake.system_tray.linux = true;
|
|
1757
|
-
}
|
|
1758
|
-
if (process.platform === "darwin") {
|
|
1759
|
-
tauriConf.pake.system_tray.macos = true;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
else {
|
|
1763
|
-
if (process.platform === "win32") {
|
|
1764
|
-
tauriConf.pake.system_tray.windows = false;
|
|
1765
|
-
}
|
|
1766
|
-
if (process.platform === "linux") {
|
|
1767
|
-
tauriConf.pake.system_tray.linux = false;
|
|
1768
|
-
}
|
|
1769
|
-
if (process.platform === "darwin") {
|
|
1770
|
-
tauriConf.pake.system_tray.macos = false;
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
// 处理targets 暂时只对linux开放
|
|
1774
|
-
if (process.platform === "linux") {
|
|
1775
|
-
delete tauriConf.tauri.bundle.deb.files;
|
|
1776
|
-
if (["all", "deb", "appimage"].includes(options.targets)) {
|
|
1777
|
-
if (options.targets === "all") {
|
|
1778
|
-
tauriConf.tauri.bundle.targets = ["deb", "appimage"];
|
|
1779
|
-
}
|
|
1780
|
-
else {
|
|
1781
|
-
tauriConf.tauri.bundle.targets = [options.targets];
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
else {
|
|
1785
|
-
logger.warn("targets must be 'all', 'deb', 'appimage', we will use default 'all'");
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
// 处理应用图标
|
|
1789
|
-
const exists = yield fs$1.stat(options.icon)
|
|
1790
|
-
.then(() => true)
|
|
1791
|
-
.catch(() => false);
|
|
1792
|
-
if (exists) {
|
|
1793
|
-
let updateIconPath = true;
|
|
1794
|
-
let customIconExt = path.extname(options.icon).toLowerCase();
|
|
1795
|
-
if (process.platform === "win32") {
|
|
1796
|
-
if (customIconExt === ".ico") {
|
|
1797
|
-
const ico_path = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}_32.ico`);
|
|
1798
|
-
tauriConf.tauri.bundle.resources = [`png/${name.toLowerCase()}_32.ico`];
|
|
1799
|
-
yield fs$1.copyFile(options.icon, ico_path);
|
|
1800
|
-
}
|
|
1801
|
-
else {
|
|
1802
|
-
updateIconPath = false;
|
|
1803
|
-
logger.warn(`icon file in Windows must be 256 * 256 pix with .ico type, but you give ${customIconExt}`);
|
|
1804
|
-
tauriConf.tauri.bundle.icon = ["png/icon_256.ico"];
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
if (process.platform === "linux") {
|
|
1808
|
-
if (customIconExt != ".png") {
|
|
1809
|
-
updateIconPath = false;
|
|
1810
|
-
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
|
|
1811
|
-
tauriConf.tauri.bundle.icon = ["png/icon_512.png"];
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1814
|
-
if (process.platform === "darwin" && customIconExt !== ".icns") {
|
|
1815
|
-
updateIconPath = false;
|
|
1816
|
-
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
|
|
1817
|
-
tauriConf.tauri.bundle.icon = ["icons/icon.icns"];
|
|
1818
|
-
}
|
|
1819
|
-
if (updateIconPath) {
|
|
1820
|
-
tauriConf.tauri.bundle.icon = [options.icon];
|
|
1821
|
-
}
|
|
1822
|
-
else {
|
|
1823
|
-
logger.warn(`icon file will not change with default.`);
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
else {
|
|
1827
|
-
logger.warn("the custom icon path may not exists. we will use default icon to replace it");
|
|
1828
|
-
if (process.platform === "win32") {
|
|
1829
|
-
tauriConf.tauri.bundle.icon = ["png/icon_256.ico"];
|
|
1830
|
-
}
|
|
1831
|
-
if (process.platform === "linux") {
|
|
1832
|
-
tauriConf.tauri.bundle.icon = ["png/icon_512.png"];
|
|
1833
|
-
}
|
|
1834
|
-
if (process.platform === "darwin") {
|
|
1835
|
-
tauriConf.tauri.bundle.icon = ["icons/icon.icns"];
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
// 处理托盘自定义图标
|
|
1839
|
-
let useDefaultIcon = true; // 是否使用默认托盘图标
|
|
1840
|
-
if (systemTrayIcon.length > 0) {
|
|
1841
|
-
const icon_exists = yield fs$1.stat(systemTrayIcon)
|
|
1842
|
-
.then(() => true)
|
|
1843
|
-
.catch(() => false);
|
|
1844
|
-
if (icon_exists) {
|
|
1845
|
-
// 需要判断图标格式,默认只支持ico和png两种
|
|
1846
|
-
let iconExt = path.extname(systemTrayIcon).toLowerCase();
|
|
1847
|
-
if (iconExt == ".png" || iconExt == ".ico") {
|
|
1848
|
-
useDefaultIcon = false;
|
|
1849
|
-
const trayIcoPath = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}${iconExt}`);
|
|
1850
|
-
tauriConf.tauri.systemTray.iconPath = `png/${name.toLowerCase()}${iconExt}`;
|
|
1851
|
-
yield fs$1.copyFile(systemTrayIcon, trayIcoPath);
|
|
1852
|
-
}
|
|
1853
|
-
else {
|
|
1854
|
-
logger.warn(`file type for system tray icon mut be .ico or .png , but you give ${iconExt}`);
|
|
1855
|
-
logger.warn(`system tray icon file will not change with default.`);
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
else {
|
|
1859
|
-
logger.warn(`${systemTrayIcon} not exists!`);
|
|
1860
|
-
logger.warn(`system tray icon file will not change with default.`);
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
// 处理托盘默认图标
|
|
1864
|
-
if (useDefaultIcon) {
|
|
1865
|
-
if (process.platform === "linux" || process.platform === "win32") {
|
|
1866
|
-
tauriConf.tauri.systemTray.iconPath = tauriConf.tauri.bundle.icon[0];
|
|
1867
|
-
}
|
|
1868
|
-
else {
|
|
1869
|
-
tauriConf.tauri.systemTray.iconPath = "png/icon_512.png";
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
// 设置安全调用 window.__TAURI__ 的安全域名为设置的应用域名
|
|
1873
|
-
setSecurityConfigWithUrl(tauriConf, url);
|
|
1874
|
-
// 保存配置文件
|
|
1875
|
-
let configPath = "";
|
|
1876
|
-
switch (process.platform) {
|
|
1877
|
-
case "win32": {
|
|
1878
|
-
configPath = path.join(npmDirectory, 'src-tauri/tauri.windows.conf.json');
|
|
1879
|
-
break;
|
|
1880
|
-
}
|
|
1881
|
-
case "darwin": {
|
|
1882
|
-
configPath = path.join(npmDirectory, 'src-tauri/tauri.macos.conf.json');
|
|
1883
|
-
break;
|
|
1884
|
-
}
|
|
1885
|
-
case "linux": {
|
|
1886
|
-
configPath = path.join(npmDirectory, 'src-tauri/tauri.linux.conf.json');
|
|
1887
|
-
break;
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
let bundleConf = { tauri: { bundle: tauriConf.tauri.bundle } };
|
|
1891
|
-
yield fs$1.writeFile(configPath, Buffer.from(JSON.stringify(bundleConf, null, 4), 'utf-8'));
|
|
1892
|
-
const pakeConfigPath = path.join(npmDirectory, 'src-tauri/pake.json');
|
|
1893
|
-
yield fs$1.writeFile(pakeConfigPath, Buffer.from(JSON.stringify(tauriConf.pake, null, 4), 'utf-8'));
|
|
1894
|
-
// logger.info("tauri config", JSON.stringify(tauriConf.build));
|
|
1895
|
-
let tauriConf2 = JSON.parse(JSON.stringify(tauriConf));
|
|
1896
|
-
delete tauriConf2.pake;
|
|
1897
|
-
delete tauriConf2.tauri.bundle;
|
|
1898
|
-
const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json');
|
|
1899
|
-
yield fs$1.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf2, null, 4), 'utf-8'));
|
|
1900
|
-
});
|
|
89
|
+
// Extracts the domain from a given URL.
|
|
90
|
+
function getDomain(inputUrl) {
|
|
91
|
+
try {
|
|
92
|
+
const url = new URL(inputUrl);
|
|
93
|
+
// Use PSL to parse domain names.
|
|
94
|
+
const parsed = psl.parse(url.hostname);
|
|
95
|
+
// If domain is available, split it and return the SLD.
|
|
96
|
+
if ("domain" in parsed && parsed.domain) {
|
|
97
|
+
return parsed.domain.split('.')[0];
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Appends 'https://' protocol to the URL if not present.
|
|
108
|
+
function appendProtocol(inputUrl) {
|
|
109
|
+
try {
|
|
110
|
+
new URL(inputUrl);
|
|
111
|
+
return inputUrl;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return `https://${inputUrl}`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Normalizes the URL by ensuring it has a protocol and is valid.
|
|
118
|
+
function normalizeUrl(urlToNormalize) {
|
|
119
|
+
const urlWithProtocol = appendProtocol(urlToNormalize);
|
|
120
|
+
if (isUrl(urlWithProtocol)) {
|
|
121
|
+
return urlWithProtocol;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
throw new Error(`Your url "${urlWithProtocol}" is invalid`);
|
|
125
|
+
}
|
|
1901
126
|
}
|
|
1902
127
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
const
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
}
|
|
1920
|
-
else {
|
|
1921
|
-
return path.resolve(options.icon);
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
if (!options.icon) {
|
|
1925
|
-
return getDefaultIcon();
|
|
1926
|
-
}
|
|
1927
|
-
});
|
|
1928
|
-
}
|
|
1929
|
-
function getDefaultIcon() {
|
|
1930
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1931
|
-
logger.info('You have not provided an app icon, use the default icon.(use --icon option to assign an icon)');
|
|
1932
|
-
let iconPath = 'src-tauri/icons/icon.icns';
|
|
1933
|
-
if (IS_WIN) {
|
|
1934
|
-
iconPath = 'src-tauri/png/icon_256.ico';
|
|
1935
|
-
}
|
|
1936
|
-
else if (IS_LINUX) {
|
|
1937
|
-
iconPath = 'src-tauri/png/icon_512.png';
|
|
1938
|
-
}
|
|
1939
|
-
return path.join(npmDirectory, iconPath);
|
|
1940
|
-
});
|
|
1941
|
-
}
|
|
1942
|
-
// export async function getIconFromPageUrl(url: string) {
|
|
1943
|
-
// const icon = await pageIcon(url);
|
|
1944
|
-
// console.log(icon);
|
|
1945
|
-
// if (icon.ext === '.ico') {
|
|
1946
|
-
// const a = await ICO.parse(icon.data);
|
|
1947
|
-
// icon.data = Buffer.from(a[0].buffer);
|
|
1948
|
-
// }
|
|
1949
|
-
// const iconDir = (await dir()).path;
|
|
1950
|
-
// const iconPath = path.join(iconDir, `/icon.icns`);
|
|
1951
|
-
// const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
|
|
1952
|
-
// await fs.writeFile(iconPath, out);
|
|
1953
|
-
// return iconPath;
|
|
1954
|
-
// }
|
|
1955
|
-
// export async function getIconFromMacosIcons(name: string) {
|
|
1956
|
-
// const data = {
|
|
1957
|
-
// query: name,
|
|
1958
|
-
// filters: 'approved:true',
|
|
1959
|
-
// hitsPerPage: 10,
|
|
1960
|
-
// page: 1,
|
|
1961
|
-
// };
|
|
1962
|
-
// const res = await axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
|
|
1963
|
-
// headers: {
|
|
1964
|
-
// 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
|
|
1965
|
-
// 'x-algolia-application-id': 'P1TXH7ZFB3',
|
|
1966
|
-
// },
|
|
1967
|
-
// });
|
|
1968
|
-
// if (!res.data.hits.length) {
|
|
1969
|
-
// return '';
|
|
1970
|
-
// } else {
|
|
1971
|
-
// return downloadIcon(res.data.hits[0].icnsUrl);
|
|
1972
|
-
// }
|
|
1973
|
-
// }
|
|
1974
|
-
function downloadIcon(iconUrl) {
|
|
1975
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1976
|
-
let iconResponse;
|
|
1977
|
-
try {
|
|
1978
|
-
iconResponse = yield axios.get(iconUrl, {
|
|
1979
|
-
responseType: 'arraybuffer',
|
|
1980
|
-
});
|
|
1981
|
-
}
|
|
1982
|
-
catch (error) {
|
|
1983
|
-
if (error.response && error.response.status === 404) {
|
|
1984
|
-
return null;
|
|
1985
|
-
}
|
|
1986
|
-
throw error;
|
|
1987
|
-
}
|
|
1988
|
-
const iconData = yield iconResponse.data;
|
|
1989
|
-
if (!iconData) {
|
|
1990
|
-
return null;
|
|
1991
|
-
}
|
|
1992
|
-
const fileDetails = yield fileTypeFromBuffer(iconData);
|
|
1993
|
-
if (!fileDetails) {
|
|
1994
|
-
return null;
|
|
1995
|
-
}
|
|
1996
|
-
const { path } = yield dir();
|
|
1997
|
-
const iconPath = `${path}/icon.${fileDetails.ext}`;
|
|
1998
|
-
yield fs$1.writeFile(iconPath, iconData);
|
|
1999
|
-
return iconPath;
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
function handleOptions(options, url) {
|
|
2004
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2005
|
-
const appOptions = Object.assign(Object.assign({}, options), { identifier: '' });
|
|
2006
|
-
const url_exists = yield fs$1.stat(url)
|
|
2007
|
-
.then(() => true)
|
|
2008
|
-
.catch(() => false);
|
|
2009
|
-
if (!appOptions.name) {
|
|
2010
|
-
if (!url_exists) {
|
|
2011
|
-
appOptions.name = yield promptText('please input your application name', getDomain(url));
|
|
2012
|
-
}
|
|
2013
|
-
else {
|
|
2014
|
-
appOptions.name = yield promptText('please input your application name', "");
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
appOptions.identifier = getIdentifier(appOptions.name, url);
|
|
2018
|
-
appOptions.icon = yield handleIcon(appOptions);
|
|
2019
|
-
return appOptions;
|
|
2020
|
-
});
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
function shellExec(command) {
|
|
2024
|
-
return new Promise((resolve, reject) => {
|
|
2025
|
-
shelljs.exec(command, { async: true, silent: false, cwd: npmDirectory }, (code) => {
|
|
2026
|
-
if (code === 0) {
|
|
2027
|
-
resolve(0);
|
|
2028
|
-
}
|
|
2029
|
-
else {
|
|
2030
|
-
reject(new Error(`${code}`));
|
|
2031
|
-
}
|
|
2032
|
-
});
|
|
2033
|
-
});
|
|
128
|
+
// Generates an identifier based on the given URL.
|
|
129
|
+
function getIdentifier(url) {
|
|
130
|
+
const postFixHash = crypto.createHash('md5')
|
|
131
|
+
.update(url)
|
|
132
|
+
.digest('hex')
|
|
133
|
+
.substring(0, 6);
|
|
134
|
+
return `pake-${postFixHash}`;
|
|
135
|
+
}
|
|
136
|
+
async function promptText(message, initial) {
|
|
137
|
+
const response = await prompts({
|
|
138
|
+
type: 'text',
|
|
139
|
+
name: 'content',
|
|
140
|
+
message,
|
|
141
|
+
initial,
|
|
142
|
+
});
|
|
143
|
+
return response.content;
|
|
2034
144
|
}
|
|
2035
145
|
|
|
2036
|
-
|
|
2037
|
-
const
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
});
|
|
2050
|
-
});
|
|
2051
|
-
const resolve = promisify(dns.resolve);
|
|
2052
|
-
function isChinaDomain(domain) {
|
|
2053
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2054
|
-
try {
|
|
2055
|
-
// 解析域名为IP地址
|
|
2056
|
-
const [ip] = yield resolve(domain);
|
|
2057
|
-
return yield isChinaIP(ip, domain);
|
|
2058
|
-
}
|
|
2059
|
-
catch (error) {
|
|
2060
|
-
// 域名无法解析,返回false
|
|
2061
|
-
logger.info(`${domain} can't be parse!`);
|
|
2062
|
-
return false;
|
|
2063
|
-
}
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
function isChinaIP(ip, domain) {
|
|
2067
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2068
|
-
try {
|
|
2069
|
-
const delay = yield ping(ip);
|
|
2070
|
-
logger.info(`${domain} latency is ${delay} ms`);
|
|
2071
|
-
// 判断延迟是否超过500ms
|
|
2072
|
-
return delay > 500;
|
|
2073
|
-
}
|
|
2074
|
-
catch (error) {
|
|
2075
|
-
// 命令执行出错,返回false
|
|
2076
|
-
logger.info(`ping ${domain} failed!`);
|
|
2077
|
-
return false;
|
|
2078
|
-
}
|
|
2079
|
-
});
|
|
146
|
+
async function handleOptions(options, url) {
|
|
147
|
+
const appOptions = {
|
|
148
|
+
...options,
|
|
149
|
+
identifier: getIdentifier(url),
|
|
150
|
+
};
|
|
151
|
+
let urlExists = await fsExtra.pathExists(url);
|
|
152
|
+
if (!appOptions.name) {
|
|
153
|
+
const defaultName = urlExists ? "" : getDomain(url);
|
|
154
|
+
const promptMessage = 'Enter your application name';
|
|
155
|
+
appOptions.name = await promptText(promptMessage, defaultName);
|
|
156
|
+
}
|
|
157
|
+
appOptions.icon = await handleIcon(appOptions);
|
|
158
|
+
return appOptions;
|
|
2080
159
|
}
|
|
2081
160
|
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
161
|
+
var windows = [
|
|
162
|
+
{
|
|
163
|
+
url: "https://weread.qq.com/",
|
|
164
|
+
transparent: true,
|
|
165
|
+
fullscreen: false,
|
|
166
|
+
width: 1200,
|
|
167
|
+
height: 780,
|
|
168
|
+
resizable: true,
|
|
169
|
+
url_type: "web"
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
var user_agent = {
|
|
173
|
+
macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
|
|
174
|
+
linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
|
|
175
|
+
windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
|
|
176
|
+
};
|
|
177
|
+
var menu = {
|
|
178
|
+
macos: true,
|
|
179
|
+
linux: false,
|
|
180
|
+
windows: false
|
|
181
|
+
};
|
|
182
|
+
var system_tray = {
|
|
183
|
+
macos: false,
|
|
184
|
+
linux: true,
|
|
185
|
+
windows: true
|
|
186
|
+
};
|
|
187
|
+
var pakeConf = {
|
|
188
|
+
windows: windows,
|
|
189
|
+
user_agent: user_agent,
|
|
190
|
+
menu: menu,
|
|
191
|
+
system_tray: system_tray
|
|
192
|
+
};
|
|
2111
193
|
|
|
2112
194
|
var tauri$3 = {
|
|
2113
195
|
security: {
|
|
@@ -2155,39 +237,6 @@ var CommonConf = {
|
|
|
2155
237
|
build: build
|
|
2156
238
|
};
|
|
2157
239
|
|
|
2158
|
-
var windows = [
|
|
2159
|
-
{
|
|
2160
|
-
url: "https://weread.qq.com/",
|
|
2161
|
-
transparent: true,
|
|
2162
|
-
fullscreen: false,
|
|
2163
|
-
width: 1200,
|
|
2164
|
-
height: 780,
|
|
2165
|
-
resizable: true,
|
|
2166
|
-
url_type: "web"
|
|
2167
|
-
}
|
|
2168
|
-
];
|
|
2169
|
-
var user_agent = {
|
|
2170
|
-
macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
|
|
2171
|
-
linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
|
|
2172
|
-
windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
|
|
2173
|
-
};
|
|
2174
|
-
var menu = {
|
|
2175
|
-
macos: true,
|
|
2176
|
-
linux: false,
|
|
2177
|
-
windows: false
|
|
2178
|
-
};
|
|
2179
|
-
var system_tray = {
|
|
2180
|
-
macos: false,
|
|
2181
|
-
linux: true,
|
|
2182
|
-
windows: true
|
|
2183
|
-
};
|
|
2184
|
-
var pakeConf = {
|
|
2185
|
-
windows: windows,
|
|
2186
|
-
user_agent: user_agent,
|
|
2187
|
-
menu: menu,
|
|
2188
|
-
system_tray: system_tray
|
|
2189
|
-
};
|
|
2190
|
-
|
|
2191
240
|
var tauri$2 = {
|
|
2192
241
|
bundle: {
|
|
2193
242
|
icon: [
|
|
@@ -2291,263 +340,409 @@ var LinuxConf = {
|
|
|
2291
340
|
tauri: tauri
|
|
2292
341
|
};
|
|
2293
342
|
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
343
|
+
const platformConfigs = {
|
|
344
|
+
win32: WinConf,
|
|
345
|
+
darwin: MacConf,
|
|
346
|
+
linux: LinuxConf
|
|
347
|
+
};
|
|
348
|
+
const { platform: platform$1 } = process;
|
|
349
|
+
// @ts-ignore
|
|
350
|
+
const platformConfig = platformConfigs[platform$1];
|
|
351
|
+
let tauriConfig = {
|
|
352
|
+
tauri: {
|
|
353
|
+
...CommonConf.tauri,
|
|
354
|
+
bundle: platformConfig.tauri.bundle,
|
|
355
|
+
},
|
|
356
|
+
package: CommonConf.package,
|
|
357
|
+
build: CommonConf.build,
|
|
358
|
+
pake: pakeConf
|
|
2299
359
|
};
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
360
|
+
|
|
361
|
+
function shellExec(command) {
|
|
362
|
+
return new Promise((resolve, reject) => {
|
|
363
|
+
shelljs.exec(command, { async: true, silent: false, cwd: npmDirectory }, (code) => {
|
|
364
|
+
if (code === 0) {
|
|
365
|
+
resolve(0);
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
reject(new Error(`${code}`));
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const resolve = promisify(dns.resolve);
|
|
375
|
+
const ping = async (host) => {
|
|
376
|
+
const lookup = promisify(dns.lookup);
|
|
377
|
+
const ip = await lookup(host);
|
|
378
|
+
const start = new Date();
|
|
379
|
+
// Prevent timeouts from affecting user experience.
|
|
380
|
+
const requestPromise = new Promise((resolve, reject) => {
|
|
381
|
+
const req = http.get(`http://${ip.address}`, (res) => {
|
|
382
|
+
const delay = new Date().getTime() - start.getTime();
|
|
383
|
+
res.resume();
|
|
384
|
+
resolve(delay);
|
|
385
|
+
});
|
|
386
|
+
req.on('error', (err) => {
|
|
387
|
+
reject(err);
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
391
|
+
setTimeout(() => {
|
|
392
|
+
reject(new Error('Request timed out after 3 seconds'));
|
|
393
|
+
}, 3000);
|
|
394
|
+
});
|
|
395
|
+
return Promise.race([requestPromise, timeoutPromise]);
|
|
396
|
+
};
|
|
397
|
+
async function isChinaDomain(domain) {
|
|
398
|
+
try {
|
|
399
|
+
const [ip] = await resolve(domain);
|
|
400
|
+
return await isChinaIP(ip, domain);
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
logger.debug(`${domain} can't be parse!`);
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
async function isChinaIP(ip, domain) {
|
|
408
|
+
try {
|
|
409
|
+
const delay = await ping(ip);
|
|
410
|
+
logger.debug(`${domain} latency is ${delay} ms`);
|
|
411
|
+
return delay > 500;
|
|
412
|
+
}
|
|
413
|
+
catch (error) {
|
|
414
|
+
logger.debug(`ping ${domain} failed!`);
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
async function installRust() {
|
|
420
|
+
const isInChina = await isChinaDomain("sh.rustup.rs");
|
|
421
|
+
const rustInstallScriptForMac = isInChina
|
|
422
|
+
? 'export RUSTUP_DIST_SERVER="https://rsproxy.cn" && export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" && curl --proto "=https" --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh'
|
|
423
|
+
: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
|
|
424
|
+
const rustInstallScriptForWindows = 'winget install --id Rustlang.Rustup';
|
|
425
|
+
const spinner = ora('Downloading Rust').start();
|
|
426
|
+
try {
|
|
427
|
+
await shellExec(IS_WIN ? rustInstallScriptForWindows : rustInstallScriptForMac);
|
|
428
|
+
spinner.succeed();
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
console.error('Error installing Rust:', error.message);
|
|
432
|
+
spinner.fail();
|
|
433
|
+
//@ts-ignore
|
|
434
|
+
process.exit(1);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function checkRustInstalled() {
|
|
438
|
+
return shelljs.exec('rustc --version', { silent: true }).code === 0;
|
|
2313
439
|
}
|
|
2314
440
|
|
|
2315
|
-
class
|
|
2316
|
-
prepare() {
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
}
|
|
2356
|
-
else {
|
|
2357
|
-
yield shellExec(`cd "${npmDirectory}" && npm install && npm run build:mac`);
|
|
2358
|
-
}
|
|
2359
|
-
dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
|
|
2360
|
-
}
|
|
2361
|
-
else {
|
|
2362
|
-
const isChina = isChinaDomain("www.npmjs.com");
|
|
2363
|
-
if (isChina) {
|
|
2364
|
-
yield shellExec(`cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build`);
|
|
2365
|
-
}
|
|
2366
|
-
else {
|
|
2367
|
-
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
|
|
2368
|
-
}
|
|
2369
|
-
let arch = "x64";
|
|
2370
|
-
if (process.arch === "arm64") {
|
|
2371
|
-
arch = "aarch64";
|
|
2372
|
-
}
|
|
2373
|
-
else {
|
|
2374
|
-
arch = process.arch;
|
|
2375
|
-
}
|
|
2376
|
-
dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
|
|
2377
|
-
}
|
|
2378
|
-
const appPath = this.getBuildAppPath(npmDirectory, dmgName, options.multiArch);
|
|
2379
|
-
const distPath = path.resolve(`${name}.dmg`);
|
|
2380
|
-
yield fs$1.copyFile(appPath, distPath);
|
|
2381
|
-
yield fs$1.unlink(appPath);
|
|
2382
|
-
logger.success('Build success!');
|
|
2383
|
-
logger.success('You can find the app installer in', distPath);
|
|
2384
|
-
});
|
|
2385
|
-
}
|
|
2386
|
-
getBuildAppPath(npmDirectory, dmgName, multiArch) {
|
|
2387
|
-
let dmgPath;
|
|
2388
|
-
if (multiArch) {
|
|
2389
|
-
dmgPath = 'src-tauri/target/universal-apple-darwin/release/bundle/dmg';
|
|
2390
|
-
}
|
|
2391
|
-
else {
|
|
2392
|
-
dmgPath = 'src-tauri/target/release/bundle/dmg';
|
|
2393
|
-
}
|
|
2394
|
-
return path.join(npmDirectory, dmgPath, dmgName);
|
|
2395
|
-
}
|
|
441
|
+
class BaseBuilder {
|
|
442
|
+
async prepare() {
|
|
443
|
+
// Windows and Linux need to install necessary build tools.
|
|
444
|
+
if (!IS_MAC) {
|
|
445
|
+
logger.info('Install Rust and required build tools to build the app.');
|
|
446
|
+
logger.info('See more in https://tauri.app/v1/guides/getting-started/prerequisites#installing.');
|
|
447
|
+
}
|
|
448
|
+
if (checkRustInstalled()) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const res = await prompts({
|
|
452
|
+
type: 'confirm',
|
|
453
|
+
message: 'Rust not detected. Install now?',
|
|
454
|
+
name: 'value',
|
|
455
|
+
});
|
|
456
|
+
if (res.value) {
|
|
457
|
+
await installRust();
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
logger.error('Error: Rust required to package your webapp!');
|
|
461
|
+
process.exit(2);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
async runBuildCommand(directory, command) {
|
|
465
|
+
const spinner = ora('Building...').start();
|
|
466
|
+
setTimeout(() => spinner.succeed(), 5000);
|
|
467
|
+
const isChina = await isChinaDomain("www.npmjs.com");
|
|
468
|
+
if (isChina) {
|
|
469
|
+
logger.info("Located in China, using npm/Rust CN mirror.");
|
|
470
|
+
const rustProjectDir = path.join(directory, 'src-tauri', ".cargo");
|
|
471
|
+
await fsExtra.ensureDir(rustProjectDir);
|
|
472
|
+
const projectCnConf = path.join(directory, "src-tauri", "rust_proxy.toml");
|
|
473
|
+
const projectConf = path.join(rustProjectDir, "config");
|
|
474
|
+
await fsExtra.copy(projectCnConf, projectConf);
|
|
475
|
+
await shellExec(`cd "${directory}" && npm install --registry=https://registry.npmmirror.com && ${command}`);
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
await shellExec(`cd "${directory}" && npm install && ${command}`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
2396
481
|
}
|
|
2397
482
|
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
}
|
|
483
|
+
async function mergeConfig(url, options, tauriConf) {
|
|
484
|
+
const { width, height, fullscreen, transparent, resizable, userAgent, showMenu, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, } = options;
|
|
485
|
+
const { platform } = process;
|
|
486
|
+
// Set Windows parameters.
|
|
487
|
+
const tauriConfWindowOptions = {
|
|
488
|
+
width,
|
|
489
|
+
height,
|
|
490
|
+
fullscreen,
|
|
491
|
+
transparent,
|
|
492
|
+
resizable,
|
|
493
|
+
};
|
|
494
|
+
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
|
495
|
+
// Determine whether the package name is valid.
|
|
496
|
+
// for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other
|
|
497
|
+
const platformRegexMapping = {
|
|
498
|
+
linux: /[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/,
|
|
499
|
+
default: /([0-9]*[a-zA-Z]+[0-9]*)+/,
|
|
500
|
+
};
|
|
501
|
+
const reg = platformRegexMapping[platform] || platformRegexMapping.default;
|
|
502
|
+
const nameCheck = reg.test(name) && reg.exec(name)[0].length === name.length;
|
|
503
|
+
if (!nameCheck) {
|
|
504
|
+
const errorMsg = platform === 'linux'
|
|
505
|
+
? `Package name is invalid. It should only include lowercase letters, numbers, and dashes, and must contain at least one lowercase letter. Examples: com-123-xxx, 123pan, pan123, weread, we-read.`
|
|
506
|
+
: `Package name is invalid. It should only include letters and numbers, and must contain at least one letter. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead.`;
|
|
507
|
+
logger.error(errorMsg);
|
|
508
|
+
process.exit();
|
|
509
|
+
}
|
|
510
|
+
tauriConf.package.productName = name;
|
|
511
|
+
tauriConf.tauri.bundle.identifier = identifier;
|
|
512
|
+
// Judge the type of URL, whether it is a file or a website.
|
|
513
|
+
// If it is a file and the recursive copy function is enabled then the file and all files in its parent folder need to be copied to the "src" directory. Otherwise, only the single file will be copied.
|
|
514
|
+
const urlExists = await fsExtra.pathExists(url);
|
|
515
|
+
if (urlExists) {
|
|
516
|
+
logger.warn('Your input might be a local file.');
|
|
517
|
+
tauriConf.pake.windows[0].url_type = 'local';
|
|
518
|
+
const fileName = path.basename(url);
|
|
519
|
+
const dirName = path.dirname(url);
|
|
520
|
+
const distDir = path.join(npmDirectory, 'dist');
|
|
521
|
+
const distBakDir = path.join(npmDirectory, 'dist_bak');
|
|
522
|
+
if (!iterCopyFile) {
|
|
523
|
+
const urlPath = path.join(distDir, fileName);
|
|
524
|
+
await fsExtra.copy(url, urlPath);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
fsExtra.moveSync(distDir, distBakDir, { overwrite: true });
|
|
528
|
+
fsExtra.copySync(dirName, distDir, { overwrite: true });
|
|
529
|
+
const filesToCopyBack = ['cli.js', 'about_pake.html'];
|
|
530
|
+
await Promise.all(filesToCopyBack.map((file) => fsExtra.copy(path.join(distBakDir, file), path.join(distDir, file))));
|
|
531
|
+
}
|
|
532
|
+
tauriConf.pake.windows[0].url = fileName;
|
|
533
|
+
tauriConf.pake.windows[0].url_type = 'local';
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
tauriConf.pake.windows[0].url_type = 'web';
|
|
537
|
+
// Set the secure domain for calling window.__TAURI__ to the application domain that has been set.
|
|
538
|
+
tauriConf.tauri.security.dangerousRemoteDomainIpcAccess[0].domain =
|
|
539
|
+
new URL(url).hostname;
|
|
540
|
+
}
|
|
541
|
+
const platformMap = {
|
|
542
|
+
win32: 'windows',
|
|
543
|
+
linux: 'linux',
|
|
544
|
+
darwin: 'macos',
|
|
545
|
+
};
|
|
546
|
+
const currentPlatform = platformMap[platform];
|
|
547
|
+
if (userAgent.length > 0) {
|
|
548
|
+
tauriConf.pake.user_agent[currentPlatform] = userAgent;
|
|
549
|
+
}
|
|
550
|
+
tauriConf.pake.menu[currentPlatform] = showMenu;
|
|
551
|
+
tauriConf.pake.system_tray[currentPlatform] = showSystemTray;
|
|
552
|
+
// Processing targets are currently only open to Linux.
|
|
553
|
+
if (platform === 'linux') {
|
|
554
|
+
delete tauriConf.tauri.bundle.deb.files;
|
|
555
|
+
const validTargets = ['all', 'deb', 'appimage'];
|
|
556
|
+
if (validTargets.includes(options.targets)) {
|
|
557
|
+
tauriConf.tauri.bundle.targets = options.targets === 'all' ? ['deb', 'appimage'] : [options.targets];
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
logger.warn(`The target must be one of ${validTargets.join(', ')}, the default 'deb' will be used.`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
// Set icon.
|
|
564
|
+
const platformIconMap = {
|
|
565
|
+
win32: {
|
|
566
|
+
fileExt: '.ico',
|
|
567
|
+
path: `png/${name.toLowerCase()}_256.ico`,
|
|
568
|
+
defaultIcon: 'png/icon_256.ico',
|
|
569
|
+
message: 'Windows icon must be .ico and 256x256px.',
|
|
570
|
+
},
|
|
571
|
+
linux: {
|
|
572
|
+
fileExt: '.png',
|
|
573
|
+
path: `png/${name.toLowerCase()}_512.png`,
|
|
574
|
+
defaultIcon: 'png/icon_512.png',
|
|
575
|
+
message: 'Linux icon must be .png and 512x512px.',
|
|
576
|
+
},
|
|
577
|
+
darwin: {
|
|
578
|
+
fileExt: '.icns',
|
|
579
|
+
path: `icons/${name.toLowerCase()}.icns`,
|
|
580
|
+
defaultIcon: 'icons/icon.icns',
|
|
581
|
+
message: 'MacOS icon must be .icns type.',
|
|
582
|
+
},
|
|
583
|
+
};
|
|
584
|
+
const iconInfo = platformIconMap[platform];
|
|
585
|
+
const exists = await fsExtra.pathExists(options.icon);
|
|
586
|
+
if (exists) {
|
|
587
|
+
let updateIconPath = true;
|
|
588
|
+
let customIconExt = path.extname(options.icon).toLowerCase();
|
|
589
|
+
if (customIconExt !== iconInfo.fileExt) {
|
|
590
|
+
updateIconPath = false;
|
|
591
|
+
logger.warn(`${iconInfo.message}, but you give ${customIconExt}`);
|
|
592
|
+
tauriConf.tauri.bundle.icon = [iconInfo.defaultIcon];
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
const iconPath = path.join(npmDirectory, 'src-tauri/', iconInfo.path);
|
|
596
|
+
tauriConf.tauri.bundle.resources = [iconInfo.path];
|
|
597
|
+
await fsExtra.copy(options.icon, iconPath);
|
|
598
|
+
}
|
|
599
|
+
if (updateIconPath) {
|
|
600
|
+
tauriConf.tauri.bundle.icon = [options.icon];
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
logger.warn(`Icon will remain as default.`);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
logger.warn('Custom icon path may be invalid. Default icon will be used instead.');
|
|
608
|
+
tauriConf.tauri.bundle.icon = [iconInfo.defaultIcon];
|
|
609
|
+
}
|
|
610
|
+
// Set tray icon path.
|
|
611
|
+
let trayIconPath = platform === 'darwin' ? 'png/icon_512.png' : tauriConf.tauri.bundle.icon[0];
|
|
612
|
+
if (systemTrayIcon.length > 0) {
|
|
613
|
+
try {
|
|
614
|
+
await fsExtra.pathExists(systemTrayIcon);
|
|
615
|
+
// 需要判断图标格式,默认只支持ico和png两种
|
|
616
|
+
let iconExt = path.extname(systemTrayIcon).toLowerCase();
|
|
617
|
+
if (iconExt == '.png' || iconExt == '.ico') {
|
|
618
|
+
const trayIcoPath = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}${iconExt}`);
|
|
619
|
+
trayIconPath = `png/${name.toLowerCase()}${iconExt}`;
|
|
620
|
+
await fsExtra.copy(systemTrayIcon, trayIcoPath);
|
|
621
|
+
}
|
|
622
|
+
else {
|
|
623
|
+
logger.warn(`System tray icon must be .ico or .png, but you provided ${iconExt}.`);
|
|
624
|
+
logger.warn(`Default system tray icon will be used.`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
catch {
|
|
628
|
+
logger.warn(`${systemTrayIcon} not exists!`);
|
|
629
|
+
logger.warn(`Default system tray icon will remain unchanged.`);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
tauriConf.tauri.systemTray.iconPath = trayIconPath;
|
|
633
|
+
// Save config file.
|
|
634
|
+
const platformConfigPaths = {
|
|
635
|
+
win32: 'src-tauri/tauri.windows.conf.json',
|
|
636
|
+
darwin: 'src-tauri/tauri.macos.conf.json',
|
|
637
|
+
linux: 'src-tauri/tauri.linux.conf.json',
|
|
638
|
+
};
|
|
639
|
+
const configPath = path.join(npmDirectory, platformConfigPaths[platform]);
|
|
640
|
+
const bundleConf = { tauri: { bundle: tauriConf.tauri.bundle } };
|
|
641
|
+
await fsExtra.writeJson(configPath, bundleConf, { spaces: 4 });
|
|
642
|
+
const pakeConfigPath = path.join(npmDirectory, 'src-tauri/pake.json');
|
|
643
|
+
await fsExtra.writeJson(pakeConfigPath, tauriConf.pake, { spaces: 4 });
|
|
644
|
+
let tauriConf2 = JSON.parse(JSON.stringify(tauriConf));
|
|
645
|
+
delete tauriConf2.pake;
|
|
646
|
+
delete tauriConf2.tauri.bundle;
|
|
647
|
+
const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json');
|
|
648
|
+
await fsExtra.writeJson(configJsonPath, tauriConf2, { spaces: 4 });
|
|
2456
649
|
}
|
|
2457
650
|
|
|
2458
|
-
class
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
}
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
logger.debug('PakeAppOptions', options);
|
|
2484
|
-
const { name } = options;
|
|
2485
|
-
yield mergeTauriConfig(url, options, tauriConf);
|
|
2486
|
-
const isChina = yield isChinaDomain("www.npmjs.com");
|
|
2487
|
-
if (isChina) {
|
|
2488
|
-
logger.info("it's in China, use npm/rust cn mirror");
|
|
2489
|
-
const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo");
|
|
2490
|
-
const e1 = fs$1.access(rust_project_dir);
|
|
2491
|
-
if (e1) {
|
|
2492
|
-
yield fs$1.mkdir(rust_project_dir, { recursive: true });
|
|
2493
|
-
}
|
|
2494
|
-
const project_cn_conf = path.join(npmDirectory, "src-tauri", "cn_config.bak");
|
|
2495
|
-
const project_conf = path.join(rust_project_dir, "config");
|
|
2496
|
-
fs$1.copyFile(project_cn_conf, project_conf);
|
|
2497
|
-
yield shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com && npm run build`);
|
|
2498
|
-
}
|
|
2499
|
-
else {
|
|
2500
|
-
yield shellExec(`cd "${npmDirectory}" && npm install && npm run build`);
|
|
2501
|
-
}
|
|
2502
|
-
let arch;
|
|
2503
|
-
if (process.arch === "x64") {
|
|
2504
|
-
arch = "amd64";
|
|
2505
|
-
}
|
|
2506
|
-
else {
|
|
2507
|
-
arch = process.arch;
|
|
2508
|
-
}
|
|
2509
|
-
if (options.targets === "deb" || options.targets === "all") {
|
|
2510
|
-
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
|
|
2511
|
-
const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
|
|
2512
|
-
const distPath = path.resolve(`${name}.deb`);
|
|
2513
|
-
yield fs$1.copyFile(appPath, distPath);
|
|
2514
|
-
yield fs$1.unlink(appPath);
|
|
2515
|
-
logger.success('Build Deb success!');
|
|
2516
|
-
logger.success('You can find the deb app installer in', distPath);
|
|
2517
|
-
}
|
|
2518
|
-
if (options.targets === "appimage" || options.targets === "all") {
|
|
2519
|
-
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
|
|
2520
|
-
const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
|
|
2521
|
-
const distAppPath = path.resolve(`${name}.AppImage`);
|
|
2522
|
-
yield fs$1.copyFile(appImagePath, distAppPath);
|
|
2523
|
-
yield fs$1.unlink(appImagePath);
|
|
2524
|
-
logger.success('Build AppImage success!');
|
|
2525
|
-
logger.success('You can find the AppImage app installer in', distAppPath);
|
|
2526
|
-
}
|
|
2527
|
-
});
|
|
2528
|
-
}
|
|
2529
|
-
getBuildAppPath(npmDirectory, packageType, packageName) {
|
|
2530
|
-
return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
|
|
2531
|
-
}
|
|
651
|
+
class MacBuilder extends BaseBuilder {
|
|
652
|
+
async build(url, options) {
|
|
653
|
+
const { name } = options;
|
|
654
|
+
await mergeConfig(url, options, tauriConfig);
|
|
655
|
+
let dmgName;
|
|
656
|
+
if (options.multiArch) {
|
|
657
|
+
await this.runBuildCommand(npmDirectory, 'npm run build:mac');
|
|
658
|
+
dmgName = `${name}_${tauriConfig.package.version}_universal.dmg`;
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
await this.runBuildCommand(npmDirectory, 'npm run build');
|
|
662
|
+
let arch = process.arch === "arm64" ? "aarch64" : process.arch;
|
|
663
|
+
dmgName = `${name}_${tauriConfig.package.version}_${arch}.dmg`;
|
|
664
|
+
}
|
|
665
|
+
const appPath = this.getBuildAppPath(npmDirectory, dmgName, options.multiArch);
|
|
666
|
+
const distPath = path.resolve(`${name}.dmg`);
|
|
667
|
+
await fsExtra.copy(appPath, distPath);
|
|
668
|
+
await fsExtra.remove(appPath);
|
|
669
|
+
logger.success('Build success!');
|
|
670
|
+
logger.success('App installer located in', distPath);
|
|
671
|
+
}
|
|
672
|
+
getBuildAppPath(npmDirectory, dmgName, multiArch) {
|
|
673
|
+
const dmgPath = multiArch ? 'src-tauri/target/universal-apple-darwin/release/bundle/dmg' : 'src-tauri/target/release/bundle/dmg';
|
|
674
|
+
return path.join(npmDirectory, dmgPath, dmgName);
|
|
675
|
+
}
|
|
2532
676
|
}
|
|
2533
677
|
|
|
2534
|
-
class
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
}
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
678
|
+
class WinBuilder extends BaseBuilder {
|
|
679
|
+
async build(url, options) {
|
|
680
|
+
const { name } = options;
|
|
681
|
+
await mergeConfig(url, options, tauriConfig);
|
|
682
|
+
await this.runBuildCommand(npmDirectory, 'npm run build');
|
|
683
|
+
const language = tauriConfig.tauri.bundle.windows.wix.language[0];
|
|
684
|
+
const arch = process.arch;
|
|
685
|
+
const msiName = `${name}_${tauriConfig.package.version}_${arch}_${language}.msi`;
|
|
686
|
+
const appPath = this.getBuildAppPath(npmDirectory, msiName);
|
|
687
|
+
const distPath = path.resolve(`${name}.msi`);
|
|
688
|
+
await fsExtra.copy(appPath, distPath);
|
|
689
|
+
await fsExtra.remove(appPath);
|
|
690
|
+
logger.success('Build success!');
|
|
691
|
+
logger.success('App installer located in', distPath);
|
|
692
|
+
}
|
|
693
|
+
getBuildAppPath(npmDirectory, msiName) {
|
|
694
|
+
return path.join(npmDirectory, 'src-tauri/target/release/bundle/msi', msiName);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
class LinuxBuilder extends BaseBuilder {
|
|
699
|
+
async build(url, options) {
|
|
700
|
+
const { name } = options;
|
|
701
|
+
await mergeConfig(url, options, tauriConfig);
|
|
702
|
+
await this.runBuildCommand(npmDirectory, 'npm run build');
|
|
703
|
+
const arch = process.arch === "x64" ? "amd64" : process.arch;
|
|
704
|
+
if (options.targets === "deb" || options.targets === "all") {
|
|
705
|
+
const debName = `${name}_${tauriConfig.package.version}_${arch}.deb`;
|
|
706
|
+
const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
|
|
707
|
+
const distPath = path.resolve(`${name}.deb`);
|
|
708
|
+
await fsExtra.copy(appPath, distPath);
|
|
709
|
+
await fsExtra.remove(appPath);
|
|
710
|
+
logger.success('Build Deb success!');
|
|
711
|
+
logger.success('Deb app installer located in', distPath);
|
|
712
|
+
}
|
|
713
|
+
if (options.targets === "appimage" || options.targets === "all") {
|
|
714
|
+
const appImageName = `${name}_${tauriConfig.package.version}_${arch}.AppImage`;
|
|
715
|
+
const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
|
|
716
|
+
const distAppPath = path.resolve(`${name}.AppImage`);
|
|
717
|
+
await fsExtra.copy(appImagePath, distAppPath);
|
|
718
|
+
await fsExtra.remove(appImagePath);
|
|
719
|
+
logger.success('Build AppImage success!');
|
|
720
|
+
logger.success('AppImage installer located in', distAppPath);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
getBuildAppPath(npmDirectory, packageType, packageName) {
|
|
724
|
+
return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
const { platform } = process;
|
|
729
|
+
const buildersMap = {
|
|
730
|
+
darwin: MacBuilder,
|
|
731
|
+
win32: WinBuilder,
|
|
732
|
+
linux: LinuxBuilder,
|
|
733
|
+
};
|
|
734
|
+
class BuilderProvider {
|
|
735
|
+
static create() {
|
|
736
|
+
const Builder = buildersMap[platform];
|
|
737
|
+
if (!Builder) {
|
|
738
|
+
throw new Error('The current system is not supported!');
|
|
739
|
+
}
|
|
740
|
+
return new Builder();
|
|
741
|
+
}
|
|
2547
742
|
}
|
|
2548
743
|
|
|
2549
744
|
var name = "pake-cli";
|
|
2550
|
-
var version = "2.
|
|
745
|
+
var version = "2.1.1";
|
|
2551
746
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。";
|
|
2552
747
|
var engines = {
|
|
2553
748
|
node: ">=16.0.0"
|
|
@@ -2594,7 +789,7 @@ var exports = "./dist/pake.js";
|
|
|
2594
789
|
var license = "MIT";
|
|
2595
790
|
var dependencies = {
|
|
2596
791
|
"@tauri-apps/api": "^1.4.0",
|
|
2597
|
-
"@tauri-apps/cli": "1.
|
|
792
|
+
"@tauri-apps/cli": "^1.4.0",
|
|
2598
793
|
axios: "^1.1.3",
|
|
2599
794
|
chalk: "^5.1.2",
|
|
2600
795
|
commander: "^11.0.0",
|
|
@@ -2604,6 +799,7 @@ var dependencies = {
|
|
|
2604
799
|
loglevel: "^1.8.1",
|
|
2605
800
|
ora: "^6.1.2",
|
|
2606
801
|
prompts: "^2.4.2",
|
|
802
|
+
psl: "^1.9.0",
|
|
2607
803
|
shelljs: "^0.8.5",
|
|
2608
804
|
"tmp-promise": "^3.0.3",
|
|
2609
805
|
"update-notifier": "^6.0.2"
|
|
@@ -2611,19 +807,20 @@ var dependencies = {
|
|
|
2611
807
|
var devDependencies = {
|
|
2612
808
|
"@rollup/plugin-alias": "^4.0.2",
|
|
2613
809
|
"@rollup/plugin-commonjs": "^23.0.2",
|
|
2614
|
-
"@rollup/plugin-json": "^5.0.
|
|
810
|
+
"@rollup/plugin-json": "^5.0.2",
|
|
2615
811
|
"@rollup/plugin-terser": "^0.1.0",
|
|
2616
|
-
"@rollup/plugin-typescript": "^9.0.2",
|
|
2617
812
|
"@types/fs-extra": "^9.0.13",
|
|
2618
813
|
"@types/is-url": "^1.2.30",
|
|
2619
814
|
"@types/page-icon": "^0.3.4",
|
|
2620
815
|
"@types/prompts": "^2.4.1",
|
|
816
|
+
"@types/psl": "^1.1.0",
|
|
2621
817
|
"@types/shelljs": "^0.8.11",
|
|
2622
818
|
"@types/tmp": "^0.2.3",
|
|
2623
819
|
"@types/update-notifier": "^6.0.1",
|
|
2624
820
|
"app-root-path": "^3.1.0",
|
|
2625
821
|
"cross-env": "^7.0.3",
|
|
2626
822
|
rollup: "^3.3.0",
|
|
823
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
2627
824
|
tslib: "^2.4.1",
|
|
2628
825
|
typescript: "^4.9.3"
|
|
2629
826
|
};
|
|
@@ -2645,46 +842,85 @@ var packageJson = {
|
|
|
2645
842
|
devDependencies: devDependencies
|
|
2646
843
|
};
|
|
2647
844
|
|
|
2648
|
-
function checkUpdateTips() {
|
|
2649
|
-
|
|
2650
|
-
updateNotifier({ pkg: packageJson }).notify();
|
|
2651
|
-
});
|
|
845
|
+
async function checkUpdateTips() {
|
|
846
|
+
updateNotifier({ pkg: packageJson }).notify();
|
|
2652
847
|
}
|
|
2653
848
|
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
}
|
|
849
|
+
function validateNumberInput(value) {
|
|
850
|
+
const parsedValue = Number(value);
|
|
851
|
+
if (isNaN(parsedValue)) {
|
|
852
|
+
throw new InvalidArgumentError('Not a number.');
|
|
853
|
+
}
|
|
854
|
+
return parsedValue;
|
|
855
|
+
}
|
|
856
|
+
function validateUrlInput(url) {
|
|
857
|
+
const isFile = fs.existsSync(url);
|
|
858
|
+
if (!isFile) {
|
|
859
|
+
try {
|
|
860
|
+
return normalizeUrl(url);
|
|
861
|
+
}
|
|
862
|
+
catch (error) {
|
|
863
|
+
throw new InvalidArgumentError(error.message);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return url;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
const DEFAULT_PAKE_OPTIONS = {
|
|
870
|
+
icon: '',
|
|
871
|
+
height: 780,
|
|
872
|
+
width: 1200,
|
|
873
|
+
fullscreen: false,
|
|
874
|
+
resizable: true,
|
|
875
|
+
transparent: false,
|
|
876
|
+
userAgent: '',
|
|
877
|
+
showMenu: false,
|
|
878
|
+
showSystemTray: false,
|
|
879
|
+
multiArch: false,
|
|
880
|
+
targets: 'deb',
|
|
881
|
+
iterCopyFile: false,
|
|
882
|
+
systemTrayIcon: '',
|
|
883
|
+
debug: false,
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
program
|
|
887
|
+
.version(packageJson.version)
|
|
888
|
+
.description('A CLI that can turn any webpage into a desktop app with Rust.')
|
|
889
|
+
.showHelpAfterError();
|
|
890
|
+
program
|
|
891
|
+
.argument('[url]', 'The web URL you want to package', validateUrlInput)
|
|
892
|
+
.option('--name <string>', 'Application name')
|
|
893
|
+
.option('--icon <string>', 'Application icon', DEFAULT_PAKE_OPTIONS.icon)
|
|
894
|
+
.option('--height <number>', 'Window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
|
|
895
|
+
.option('--width <number>', 'Window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
|
|
896
|
+
.option('--no-resizable', 'Whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable)
|
|
897
|
+
.option('--fullscreen', 'Start the packaged app in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
|
|
898
|
+
.option('--transparent', 'Transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
|
|
899
|
+
.option('--user-agent <string>', 'Custom user agent', DEFAULT_PAKE_OPTIONS.userAgent)
|
|
900
|
+
.option('--show-menu', 'Show menu in app', DEFAULT_PAKE_OPTIONS.showMenu)
|
|
901
|
+
.option('--show-system-tray', 'Show system tray in app', DEFAULT_PAKE_OPTIONS.showSystemTray)
|
|
902
|
+
.option('--system-tray-icon <string>', 'Custom system tray icon', DEFAULT_PAKE_OPTIONS.systemTrayIcon)
|
|
903
|
+
.option('--iter-copy-file', 'Copy files to app when URL is a local file', DEFAULT_PAKE_OPTIONS.iterCopyFile)
|
|
904
|
+
.option('--multi-arch', 'Available for Mac only, supports both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
|
|
905
|
+
.option('--targets <string>', 'Only for Linux, option "deb", "appimage" or "all"', DEFAULT_PAKE_OPTIONS.targets)
|
|
906
|
+
.option('--debug', 'Debug mode', DEFAULT_PAKE_OPTIONS.debug)
|
|
907
|
+
.action(async (url, options) => {
|
|
908
|
+
//Check for update prompt
|
|
909
|
+
await checkUpdateTips();
|
|
910
|
+
// If no URL is provided, display help information
|
|
911
|
+
if (!url) {
|
|
912
|
+
program.help();
|
|
913
|
+
}
|
|
914
|
+
log.setDefaultLevel('info');
|
|
915
|
+
if (options.debug) {
|
|
916
|
+
log.setLevel('debug');
|
|
917
|
+
}
|
|
918
|
+
const spinner = ora('Preparing...').start();
|
|
919
|
+
const builder = BuilderProvider.create();
|
|
920
|
+
await builder.prepare();
|
|
921
|
+
const appOptions = await handleOptions(options, url);
|
|
922
|
+
spinner.succeed();
|
|
923
|
+
log.debug('PakeAppOptions', appOptions);
|
|
924
|
+
await builder.build(url, appOptions);
|
|
925
|
+
});
|
|
2690
926
|
program.parse();
|