File tree Expand file tree Collapse file tree 8 files changed +70
-16
lines changed Expand file tree Collapse file tree 8 files changed +70
-16
lines changed Original file line number Diff line number Diff line change 22
22
"graceful-updater" : " 1" ,
23
23
"lodash" : " 4" ,
24
24
"moment" : " ^2.29.4" ,
25
- "network-interface" : " 18" ,
26
25
"semver" : " ^7.3.8"
27
26
},
27
+ "optionalDependencies" : {
28
+ "network-interface" : " 18" ,
29
+ "windows-verify-trust" : " 1"
30
+ },
28
31
"devDependencies" : {
29
32
"@applint/spec" : " ^1.2.3" ,
30
33
"@electron/asar" : " 3" ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const nodemon = require('gulp-nodemon');
6
6
function startElectron ( done ) {
7
7
const stream = nodemon ( {
8
8
script : path . resolve ( __dirname , 'launcher.js' ) ,
9
- ext : 'ts js json' ,
9
+ ext : 'ts js json html ' ,
10
10
ignore : [ ] ,
11
11
watch : [
12
12
'src' ,
Original file line number Diff line number Diff line change 1
- import { ipcMain } from 'electron' ;
1
+ import { ipcMain , dialog } from 'electron' ;
2
2
3
3
export default class App {
4
4
init ( ) {
5
+ this . isWin = process . platform === 'win32' ;
5
6
require ( './window-manager' ) ( this ) ;
6
7
this . bindIPC ( ) ;
7
8
}
8
9
10
+ alertWindows ( ) {
11
+ dialog . showErrorBox ( 'error' , 'only windows' ) ;
12
+ }
13
+
9
14
bindIPC ( ) {
15
+ const { isWin } = this ;
10
16
ipcMain . on ( 'start-action' , ( _ , action ) => {
11
17
if ( action === 'electrom' ) {
12
18
require ( './electrom' ) ( this ) ;
@@ -17,7 +23,23 @@ export default class App {
17
23
} else if ( action === 'electron-webview-schedule' ) {
18
24
require ( './webview-schedule' ) ( this ) ;
19
25
} else if ( action === 'electron-windows-titlebar' ) {
20
- require ( './windows-titlebar' ) ( this ) ;
26
+ if ( isWin ) {
27
+ require ( './windows-titlebar' ) ( this ) ;
28
+ return ;
29
+ }
30
+ this . alertWindows ( ) ;
31
+ } else if ( action === 'network-interface' ) {
32
+ if ( isWin ) {
33
+ require ( './network-interface' ) ( this ) ;
34
+ return ;
35
+ }
36
+ this . alertWindows ( ) ;
37
+ } else if ( action === 'windows-verify-trust' ) {
38
+ if ( isWin ) {
39
+ require ( './windows-verify-trust' ) ( this ) ;
40
+ return ;
41
+ }
42
+ this . alertWindows ( ) ;
21
43
}
22
44
} ) ;
23
45
}
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ import networkInterface from 'network-interface' ;
4
+
5
+ module . exports = ( app : any ) => {
6
+ networkInterface . addEventListener ( 'wlan-status-changed' , ( error , data ) => {
7
+ if ( error ) {
8
+ throw error ;
9
+ return ;
10
+ }
11
+ console . log ( 'event fired: wlan-status-changed' ) ;
12
+ console . log ( data ) ;
13
+ } ) ;
14
+ } ;
Original file line number Diff line number Diff line change 10
10
}
11
11
html ,
12
12
body {
13
- background-color : white;
14
13
width : 100% ;
15
14
height : 100% ;
16
15
margin : 0 ;
17
16
padding : 0 ;
17
+ overflow : hidden;
18
18
}
19
19
hr {
20
- margin : 12 px 0 ;
20
+ margin : 8 px 0 ;
21
21
border : none;
22
22
height : 1px ;
23
23
background-color : # ebebeb ;
24
24
}
25
- h2 , ol {
25
+ h3 , ol {
26
26
margin : 0 ;
27
27
padding : 0 ;
28
28
}
29
29
ol {
30
30
padding-left : 20px ;
31
31
}
32
32
li {
33
- margin : 16 px 0 ;
33
+ margin : 8 px 0 ;
34
34
padding : 4px ;
35
35
cursor : pointer;
36
36
background-color : aliceblue;
43
43
.wrapper {
44
44
padding : 12px ;
45
45
}
46
+ .wrapper a {
47
+ font-size : 14px ;
48
+ margin : 4px 0 ;
49
+ }
46
50
</ style >
47
51
</ head >
48
52
< body >
49
53
< div class ="wrapper ">
50
- < h2 > Electron Modules</ h2 >
54
+ < h3 > Electron Modules</ h3 >
51
55
< a href ="https://github.com/electron-modules " target ="_blank ">
52
56
https://github.com/electron-modules
53
57
</ a >
@@ -59,6 +63,7 @@ <h2>Electron Modules</h2>
59
63
< li data-action ="electron-webview-schedule "> 📚 Electron Webview Schedule</ li >
60
64
< li data-action ="electron-windows-titlebar "> 🌓 Electron Windows Titlebar</ li >
61
65
< li data-action ="network-interface "> 💻 Network Interface</ li >
66
+ < li data-action ="windows-verify-trust "> 🛡 Windows Verify Trust</ li >
62
67
< ol >
63
68
</ div >
64
69
< script src ="./main.js "> </ script >
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ module.exports = (app) => {
22
22
url : loadingUrl ,
23
23
} ,
24
24
browserWindow : {
25
- width : 640 ,
26
- height : 420 ,
25
+ width : 580 ,
26
+ height : 390 ,
27
27
webPreferences : {
28
28
enableRemoteModule : false ,
29
29
nodeIntegration : false ,
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- const url = require ( 'url' ) ;
4
- const path = require ( 'path' ) ;
5
- const _ = require ( 'lodash' ) ;
6
- const { ipcMain } = require ( 'electron' ) ;
7
- const windowTitleBar = require ( 'electron-windows-titlebar' ) ;
3
+ import url from 'url' ;
4
+ import path from 'path' ;
5
+ import _ from 'lodash' ;
6
+ import { ipcMain } from 'electron' ;
7
+ import windowTitleBar from 'electron-windows-titlebar' ;
8
8
9
9
module . exports = ( app : any ) => {
10
10
const windowUrl = url . format ( {
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ import { isLibExist , getLibPath , verifyTrust } from 'windows-verify-trust' ;
4
+
5
+ module . exports = ( app : any ) => {
6
+ const targetFileName = 'wlanapi.dll' ;
7
+ console . log ( 'isLibExist: %s' , isLibExist ( targetFileName ) ) ;
8
+ console . log ( 'getLibPath: %s' , getLibPath ( targetFileName ) ) ;
9
+ console . log ( 'verifyTrust: %s' , verifyTrust ( targetFileName ) ) ;
10
+ } ;
You can’t perform that action at this time.
0 commit comments