新增HTTP开放API服务
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { mainHandle } from '@common/mainIpc'
|
||||
import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames'
|
||||
import {
|
||||
startServer,
|
||||
stopServer,
|
||||
getStatus,
|
||||
} from '@main/modules/openApi'
|
||||
|
||||
|
||||
export default () => {
|
||||
mainHandle<LX.OpenAPI.Actions, any>(WIN_MAIN_RENDERER_EVENT_NAME.open_api_action, async({ params: data }) => {
|
||||
switch (data.action) {
|
||||
case 'enable':
|
||||
return data.data.enable ? await startServer(parseInt(data.data.port)) : await stopServer()
|
||||
case 'status': return getStatus()
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user