Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ LEARNING_PACKAGE_PATH="./learning-packages"
# Default to `false`
#AGGRESSIVE_DISCONNECT=false

# -------------------------------
# NUT (Network UPS Tools) Settings
# -------------------------------
# NUT_HOST=localhost
# NUT_PORT=3493
# NUT_UPS_NAME=myUps

66 changes: 27 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"express": "^4.21.2",
"geoip-lite": "^1.4.10",
"i18next": "^23.15.1",
"nut-client": "^0.0.9",
"postcss": "^8.4.40",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
9 changes: 9 additions & 0 deletions src/api/core/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AdbManager } from "../android/adb/AdbManager.ts";
import { useAdb, ENV_GAMALESS } from "../index.ts";
import { JsonPlayerAsk, JsonOutput } from "./Constants.ts";
// import {mDnsService} from "../infra/mDnsService.ts";
import { NutManager } from "../infra/nut/NutManager.ts";
import { getLogger } from "@logtape/logtape";

const logger = getLogger(["core", "Controller"]);
Expand All @@ -18,6 +19,7 @@ export class Controller {

adb_manager: AdbManager | undefined;
// mDnsService: mDnsService;
nut_manager: NutManager;


constructor(useAdb: boolean) {
Expand All @@ -36,12 +38,16 @@ export class Controller {
} else {
logger.warn("Couldn't find ADB working or started, cancelling ADB management")
}

this.nut_manager = new NutManager();
}

// Allow running init functions for some components needing it
async initialize() {
if (this.adb_manager)
await this.adb_manager.init();

await this.nut_manager.init();
}

async restart() {
Expand All @@ -67,6 +73,9 @@ export class Controller {

if (useAdb) this.adb_manager = new AdbManager(this);

this.nut_manager.close();
this.nut_manager = new NutManager();

await this.initialize();
}

Expand Down
7 changes: 7 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ process.env.EXTRA_LEARNING_PACKAGE_PATH = process.env.EXTRA_LEARNING_PACKAGE_P
const ENV_AGGRESSIVE_DISCONNECT: boolean = process.env.AGGRESSIVE_DISCONNECT !== undefined ? ['true', '1', 'yes'].includes(process.env.AGGRESSIVE_DISCONNECT.toLowerCase()) : false;
// ! GAMA =====

// NUT (Network UPS Tools) =====
process.env.NUT_HOST = process.env.NUT_HOST || 'localhost';
process.env.NUT_PORT = process.env.NUT_PORT || '3493';
process.env.NUT_UPS_NAME = process.env.NUT_UPS_NAME || 'myUps';
// ! NUT =====

// Headsets =====
process.env.HEADSET_WS_PORT = process.env.HEADSET_WS_PORT || '8080';
// ! Headsets =====
Expand Down Expand Up @@ -164,6 +170,7 @@ start().catch(err => {
});

export {
isCommandAvailable,
ENV_GAMALESS,
ENV_VERBOSE,
ENV_EXTRA_VERBOSE,
Expand Down
Loading
Loading