fix: Fixed browser referencing main and getting called twice when in dev mode
This commit is contained in:
parent
a78e75335f
commit
7c10f4e4c2
4 changed files with 16 additions and 11 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import { RunBunServer } from './server';
|
||||
import { RunAPIServer } from './api/rpc';
|
||||
import { cleanup as appCleanup, config, events } from './api/app';
|
||||
import * as app from './api/app';
|
||||
import init from './browser';
|
||||
import { dirname } from 'pathe';
|
||||
import { createInterface } from 'readline';
|
||||
import { isSteamDeckGameMode } from './utils';
|
||||
|
||||
const api = RunAPIServer();
|
||||
let bunServer: { stop: () => void; } | undefined;
|
||||
|
|
@ -16,7 +17,7 @@ if (!process.env.PUBLIC_ACCESS)
|
|||
async function cleanup ()
|
||||
{
|
||||
console.log("Cleaning Up");
|
||||
await appCleanup();
|
||||
await app.cleanup();
|
||||
bunServer?.stop();
|
||||
await api.apiServer.stop(true);
|
||||
await api.cleanup();
|
||||
|
|
@ -38,17 +39,18 @@ if (process.env.HEADLESS)
|
|||
});
|
||||
|
||||
// Called by user
|
||||
events.on('exitapp', () =>
|
||||
app.events.on('exitapp', () =>
|
||||
{
|
||||
process.send?.({ type: 'exitapp' });
|
||||
cleanup();
|
||||
});
|
||||
} else
|
||||
{
|
||||
await init(events, Bun.env.FORCE_BROWSER === "true", {
|
||||
configPath: dirname(config.path),
|
||||
windowPosition: config.get('windowPosition'),
|
||||
windowSize: config.get('windowSize')
|
||||
await init(app.events, Bun.env.FORCE_BROWSER === "true", {
|
||||
configPath: dirname(app.config.path),
|
||||
windowPosition: app.config.get('windowPosition'),
|
||||
windowSize: app.config.get('windowSize'),
|
||||
isSteamDeckGameMode: isSteamDeckGameMode()
|
||||
});
|
||||
await cleanup();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { SERVER_URL } from "@shared/constants";
|
|||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { getBrowserPath } from "./get-browser";
|
||||
import { isSteamDeckGameMode } from "../utils";
|
||||
import { ensureDir } from 'fs-extra';
|
||||
import { host } from "./host";
|
||||
|
||||
|
|
@ -11,6 +10,7 @@ export interface BrowserParams
|
|||
configPath: string;
|
||||
windowPosition?: { x: number, y: number; };
|
||||
windowSize?: { width?: number, height?: number; };
|
||||
isSteamDeckGameMode: boolean;
|
||||
}
|
||||
|
||||
export async function BuildParams (data: BrowserParams)
|
||||
|
|
@ -54,7 +54,7 @@ export async function BuildParams (data: BrowserParams)
|
|||
args.push('--allow-insecure-localhost');
|
||||
args.push('--auto-accept-camera-and-microphone-capture');
|
||||
|
||||
if (isSteamDeckGameMode())
|
||||
if (data.isSteamDeckGameMode)
|
||||
{
|
||||
args.push('--kiosk');
|
||||
} else if (data.windowSize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue