Skip to content

Commit

Permalink
chore: fix startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Saschl committed Sep 29, 2024
1 parent 8c08553 commit 8938fca
Show file tree
Hide file tree
Showing 7 changed files with 6,172 additions and 4,139 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
- name: Checkout source
uses: actions/checkout@v4
- name: set Node version
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Build Local API
run: |
npm install
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NestFactory } from '@nestjs/core';
import { platform } from 'os';
import { hideConsole } from 'node-hide-console-window';
import * as path from 'path';
import { getExecutablePath } from 'apps/server/src/utilities/pathUtil';
import { getExecutablePath } from './utilities/pathUtil';
import { ShutDownService } from './utilities/shutdown.service';
import { AppModule } from './app.module';
import { NetworkService } from './utilities/network.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/terrain/processing/terrainworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TerrainWorker {
private displayRendering: {
[side: string]: {
timeout: NodeJS.Timeout;
durationInterval: NodeJS.Timer;
durationInterval: NodeJS.Timeout;
startupTimestamp: number;
navigationDisplay: NavigationDisplayRenderer;
cycleData: {
Expand Down
16 changes: 13 additions & 3 deletions apps/server/src/utilities/systray.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Injectable, Logger, Inject, OnApplicationShutdown } from '@nestjs/common';
import { ConfigType } from '@nestjs/config';
import { hideConsole, showConsole } from 'node-hide-console-window';
import open = require('open');
import { openApp } from 'open';
import type open from 'open';
import SysTray, { MenuItem } from 'systray2';
import { join } from 'path';
import { getExecutablePath } from 'apps/server/src/utilities/pathUtil';
Expand All @@ -14,6 +15,15 @@ interface MenuItemClickable extends MenuItem {
items?: MenuItemClickable[];
}


let openModule: typeof open;
let openAppModule: typeof openApp;
eval(`import('open')`).then((module) => {
openModule = module.default;
openAppModule = module.openApp;
});


@Injectable()
export class SysTrayService implements OnApplicationShutdown {
constructor(
Expand Down Expand Up @@ -56,7 +66,7 @@ export class SysTrayService implements OnApplicationShutdown {
tooltip: 'Open the MCDU remote display with your default browser, using your local IP',
enabled: true,
click: async () => {
open(`http://${await this.networkService.getLocalIp(true)}:${this.serverConf.port}/interfaces/mcdu`);
openModule(`http://${await this.networkService.getLocalIp(true)}:${this.serverConf.port}/interfaces/mcdu`);
},
},
],
Expand All @@ -67,7 +77,7 @@ export class SysTrayService implements OnApplicationShutdown {
tooltip: 'Open resource folder in your file explorer',
enabled: true,
click: () => {
open.openApp('explorer', { arguments: [`${getExecutablePath()}\\resources`] });
openAppModule('explorer', { arguments: [`${getExecutablePath()}\\resources`] });
},
};

Expand Down
4 changes: 1 addition & 3 deletions doExe.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import exe from '@angablue/exe';
const build = exe({
entry: './dist/main.js',
out: './build/fbw-simbridge.exe',
pkg: ['-C', 'GZip', '-c', './package.json'], // Specify extra pkg arguments
version: '0.5.0',
target: 'node18-win-x64',
version: '0.5.5',
icon: './apps/server/src/assets/images/tail.ico',
properties: {
FileDescription: 'fbw-simbridge',
Expand Down
Loading

0 comments on commit 8938fca

Please sign in to comment.