fix: update server settings ref
This commit is contained in:
parent
5975237a39
commit
013c0ce36e
@ -4,7 +4,14 @@ import { WindowManager } from './../managers/window'
|
||||
import { getResourcePath, userSpacePath } from './../utils/path'
|
||||
import { AppRoute } from '@janhq/core'
|
||||
import { ModuleManager, init, log } from '@janhq/core/node'
|
||||
import { startServer, stopServer } from '@janhq/server'
|
||||
import {
|
||||
startServer,
|
||||
stopServer,
|
||||
isCorsEnabled,
|
||||
isVerboseEnabled,
|
||||
getHost,
|
||||
getPort,
|
||||
} from '@janhq/server'
|
||||
|
||||
export function handleAppIPCs() {
|
||||
/**
|
||||
@ -51,19 +58,45 @@ export function handleAppIPCs() {
|
||||
/**
|
||||
* Start Jan API Server.
|
||||
*/
|
||||
ipcMain.handle(AppRoute.startServer, async (_event) =>
|
||||
startServer(
|
||||
app.isPackaged
|
||||
? join(getResourcePath(), 'docs', 'openapi', 'jan.yaml')
|
||||
: undefined,
|
||||
app.isPackaged ? join(getResourcePath(), 'docs', 'openapi') : undefined
|
||||
)
|
||||
ipcMain.handle(
|
||||
AppRoute.startServer,
|
||||
async (_event, host, port, isCorsEnabled, isVerbose) =>
|
||||
startServer(
|
||||
host,
|
||||
port,
|
||||
isCorsEnabled,
|
||||
isVerbose,
|
||||
app.isPackaged
|
||||
? join(getResourcePath(), 'docs', 'openapi', 'jan.yaml')
|
||||
: undefined,
|
||||
app.isPackaged ? join(getResourcePath(), 'docs', 'openapi') : undefined
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Stop Jan API Server.
|
||||
*/
|
||||
ipcMain.handle(AppRoute.stopServer, async (_event) => stopServer())
|
||||
ipcMain.handle(AppRoute.stopServer, stopServer)
|
||||
|
||||
/**
|
||||
* Check if CORS is enabled.
|
||||
*/
|
||||
ipcMain.handle(AppRoute.isCorsEnabled, isCorsEnabled)
|
||||
|
||||
/**
|
||||
* Check if verbose logging is enabled.
|
||||
*/
|
||||
ipcMain.handle(AppRoute.isVerboseEnabled, isVerboseEnabled)
|
||||
|
||||
/**
|
||||
* Get the host setting.
|
||||
*/
|
||||
ipcMain.handle(AppRoute.getHost, getHost)
|
||||
|
||||
/**
|
||||
* Get the port setting.
|
||||
*/
|
||||
ipcMain.handle(AppRoute.getPort, getPort)
|
||||
|
||||
/**
|
||||
* Relaunches the app in production - reload window in development.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user