This repository was archived by the owner on Oct 18, 2024. It is now read-only.
File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import appRoutes from "./api/app";
8
8
import screenRoutes from "./api/screen" ;
9
9
import dialogRoutes from "./api/dialog" ;
10
10
import debugRoutes from "./api/debug" ;
11
+ import broadcastingRoutes from "./api/broadcasting" ;
11
12
import systemRoutes from "./api/system" ;
12
13
import globalShortcutRoutes from "./api/globalShortcut" ;
13
14
import notificationRoutes from "./api/notification" ;
@@ -54,6 +55,7 @@ async function startAPIServer(randomSecret: string): Promise<APIProcess> {
54
55
httpServer . use ( "/api/menu-bar" , menuBarRoutes ) ;
55
56
httpServer . use ( "/api/progress-bar" , progressBarRoutes ) ;
56
57
httpServer . use ( "/api/power-monitor" , powerMonitorRoutes ) ;
58
+ httpServer . use ( "/api/broadcast" , broadcastingRoutes ) ;
57
59
58
60
if ( process . env . NODE_ENV === "development" ) {
59
61
httpServer . use ( "/api/debug" , debugRoutes ) ;
Original file line number Diff line number Diff line change
1
+ import express from 'express'
2
+ import state from "../state" ;
3
+ const router = express . Router ( ) ;
4
+
5
+ router . post ( '/' , ( req , res ) => {
6
+ const { event, payload} = req . body ;
7
+
8
+ Object . values ( state . windows ) . forEach ( window => {
9
+ window . webContents . send ( 'native-event' , { event, payload } )
10
+ } )
11
+
12
+ if ( state . activeMenuBar ?. window ) {
13
+ state . activeMenuBar . window . webContents . send ( 'native-event' , { event, payload } )
14
+ }
15
+
16
+ res . sendStatus ( 200 )
17
+ } )
18
+
19
+ export default router ;
You can’t perform that action at this time.
0 commit comments