clickgo-native 0.0.3-dev3 → 0.0.5-dev5

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/dist/index.js CHANGED
@@ -84,7 +84,7 @@ const methods = {
84
84
  'cg-set-state': {
85
85
  'once': false,
86
86
  handler: function (t, state) {
87
- if (hasFrame || !form || !state) {
87
+ if (!hasFrame || !form || !state) {
88
88
  return;
89
89
  }
90
90
  if (!verifyToken(t)) {
@@ -105,6 +105,24 @@ const methods = {
105
105
  }
106
106
  }
107
107
  },
108
+ 'cg-activate': {
109
+ 'once': false,
110
+ handler: function (t) {
111
+ if (!form) {
112
+ return;
113
+ }
114
+ if (!verifyToken(t)) {
115
+ return;
116
+ }
117
+ if (form.isMinimized()) {
118
+ form.restore();
119
+ }
120
+ form.setAlwaysOnTop(true);
121
+ form.show();
122
+ form.focus();
123
+ form.setAlwaysOnTop(false);
124
+ },
125
+ },
108
126
  'cg-close': {
109
127
  'once': false,
110
128
  handler: function (t) {
@@ -397,7 +415,7 @@ function createForm(p) {
397
415
  'preload': path.join(__dirname, '/pre.js')
398
416
  },
399
417
  'width': hasFrame ? 800 : 500,
400
- 'height': hasFrame ? 600 : 300,
418
+ 'height': hasFrame ? 700 : 300,
401
419
  'frame': hasFrame,
402
420
  'resizable': false,
403
421
  'show': false,
@@ -418,16 +436,23 @@ function createForm(p) {
418
436
  }
419
437
  form.show();
420
438
  });
421
- const lio = p.indexOf('?');
422
- const search = lio === -1 ? '' : p.slice(lio + 1);
423
- if (lio !== -1) {
424
- p = p.slice(0, lio);
439
+ if (p.startsWith('https://')) {
440
+ form.loadURL(p).catch(function (e) {
441
+ throw e;
442
+ });
443
+ }
444
+ else {
445
+ const lio = p.indexOf('?');
446
+ const search = lio === -1 ? '' : p.slice(lio + 1);
447
+ if (lio !== -1) {
448
+ p = p.slice(0, lio);
449
+ }
450
+ form.loadFile(p, {
451
+ 'search': search
452
+ }).catch(function (e) {
453
+ throw e;
454
+ });
425
455
  }
426
- form.loadFile(p, {
427
- 'search': search
428
- }).catch(function (e) {
429
- throw e;
430
- });
431
456
  form.on('close', function () {
432
457
  form = undefined;
433
458
  });
package/dist/index.ts CHANGED
@@ -76,7 +76,7 @@ const methods: Record<string, {
76
76
  'cg-set-state': {
77
77
  'once': false,
78
78
  handler: function(t: string, state: string): void {
79
- if (hasFrame || !form || !state) {
79
+ if (!hasFrame || !form || !state) {
80
80
  return;
81
81
  }
82
82
  if (!verifyToken(t)) {
@@ -97,6 +97,25 @@ const methods: Record<string, {
97
97
  }
98
98
  }
99
99
  },
100
+ // --- 激活窗体 ---
101
+ 'cg-activate': {
102
+ 'once': false,
103
+ handler: function(t: string): void {
104
+ if (!form) {
105
+ return;
106
+ }
107
+ if (!verifyToken(t)) {
108
+ return;
109
+ }
110
+ if (form.isMinimized()) {
111
+ form.restore();
112
+ }
113
+ form.setAlwaysOnTop(true);
114
+ form.show();
115
+ form.focus();
116
+ form.setAlwaysOnTop(false);
117
+ },
118
+ },
100
119
  // --- 关闭窗体(可能软件进程不会被退出) ---
101
120
  'cg-close': {
102
121
  'once': false,
@@ -461,7 +480,7 @@ function createForm(p: string): void {
461
480
  'preload': path.join(__dirname, '/pre.js')
462
481
  },
463
482
  'width': hasFrame ? 800 : 500,
464
- 'height': hasFrame ? 600 : 300,
483
+ 'height': hasFrame ? 700 : 300,
465
484
  'frame': hasFrame,
466
485
  'resizable': false,
467
486
  'show': false,
@@ -485,16 +504,25 @@ function createForm(p: string): void {
485
504
  }
486
505
  form.show();
487
506
  });
488
- const lio = p.indexOf('?');
489
- const search = lio === -1 ? '' : p.slice(lio + 1);
490
- if (lio !== -1) {
491
- p = p.slice(0, lio);
507
+ if (p.startsWith('https://')) {
508
+ // --- 加载网页 ---
509
+ form.loadURL(p).catch(function(e): void {
510
+ throw e;
511
+ });
512
+ }
513
+ else {
514
+ // --- 加载本地文件 ---
515
+ const lio = p.indexOf('?');
516
+ const search = lio === -1 ? '' : p.slice(lio + 1);
517
+ if (lio !== -1) {
518
+ p = p.slice(0, lio);
519
+ }
520
+ form.loadFile(p, {
521
+ 'search': search
522
+ }).catch(function(e): void {
523
+ throw e;
524
+ });
492
525
  }
493
- form.loadFile(p, {
494
- 'search': search
495
- }).catch(function(e): void {
496
- throw e;
497
- });
498
526
  form.on('close', function() {
499
527
  form = undefined;
500
528
  });
@@ -0,0 +1,22 @@
1
+ // eslint.config.js
2
+ const rules = require('@litert/eslint-plugin-recommended-rules');
3
+
4
+ module.exports = [
5
+ ...rules.typescript,
6
+ {
7
+ files: [
8
+ '**/*.ts', // don't add `./` before the path
9
+ ],
10
+ languageOptions: {
11
+ parserOptions: {
12
+ project: 'tsconfig.json',
13
+ tsconfigRootDir: __dirname,
14
+ },
15
+ },
16
+ rules: {
17
+ '@typescript-eslint/no-explicit-any': 'off',
18
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
19
+ 'max-lines': ['warn', 5000]
20
+ }
21
+ }
22
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo-native",
3
- "version": "0.0.3-dev3",
3
+ "version": "0.0.5-dev5",
4
4
  "description": "The software developed with ClickGo will run in Windows, Mac OS, Linux.",
5
5
  "keywords": [
6
6
  "clickgo",
@@ -14,14 +14,14 @@
14
14
  "native": "electron ./dist/test"
15
15
  },
16
16
  "devDependencies": {
17
- "@litert/eslint-plugin-rules": "^0.1.2",
18
- "@litert/loader": "^3.4.6",
19
- "@types/jszip": "^3.4.1",
20
- "@types/node": "^18.11.14",
21
- "clickgo": "^3.1.6-dev15",
22
- "typescript": "^4.9.4"
17
+ "@litert/eslint-plugin-rules": "^0.3.1",
18
+ "@litert/loader": "^3.5.9",
19
+ "@types/node": "^24.0.3",
20
+ "clickgo": "^3.16.16",
21
+ "jszip": "^3.10.1",
22
+ "typescript": "^5.8.3"
23
23
  },
24
24
  "dependencies": {
25
- "electron": "^22.0.2"
25
+ "electron": "^36.4.0"
26
26
  }
27
27
  }