Strip out partner related functionality.

This commit is contained in:
Patrick Fic
2025-12-08 13:53:15 -08:00
parent 267ef714a7
commit 39d81bbc6a
54 changed files with 79 additions and 3889 deletions

View File

@@ -14,7 +14,6 @@ import log from "electron-log/main";
import { autoUpdater } from "electron-updater";
import path, { join } from "path";
import imexAppIcon from "../../resources/icon.png?asset";
import romeAppIcon from "../../resources/ro-icon.png?asset";
import {
default as ErrorTypeCheck,
@@ -22,11 +21,8 @@ import {
} from "../util/errorTypeCheck";
import ipcTypes from "../util/ipcTypes.json";
import ImportJob from "./decoder/decoder";
import LocalServer from "./http-server/http-server";
import store from "./store/store";
import { checkForAppUpdates } from "./util/checkForAppUpdates";
import { getMainWindow } from "./util/toRenderer";
import { GetAllEnvFiles } from "./watcher/watcher";
import { dumpMemoryStatsToFile } from "../util/memUsage";
import {
isKeepAliveAgentInstalled,
setupKeepAliveAgent,
@@ -35,11 +31,13 @@ import {
isKeepAliveTaskInstalled,
setupKeepAliveTask,
} from "./setup-keep-alive-task";
import store from "./store/store";
import { checkForAppUpdates } from "./util/checkForAppUpdates";
import ensureWindowOnScreen from "./util/ensureWindowOnScreen";
import ongoingMemoryDump, { dumpMemoryStatsToFile } from "../util/memUsage";
import { getMainWindow } from "./util/toRenderer";
import { GetAllEnvFiles } from "./watcher/watcher";
const appIconToUse =
import.meta.env.VITE_COMPANY === "IMEX" ? imexAppIcon : romeAppIcon;
const appIconToUse = imexAppIcon;
Sentry.init({
dsn: "https://ba41d22656999a8c1fd63bcb7df98650@o492140.ingest.us.sentry.io/4509074139447296",
@@ -54,11 +52,10 @@ log.transports.console.format =
"[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}] [PID:{processId}] {text}";
log.transports.file.maxSize = 50 * 1024 * 1024; // 50 MB
const isMac: boolean = process.platform === "darwin";
const protocol: string = "imexmedia";
const protocol: string = "esdp";
let isAppQuitting = false; //Needed on Mac as an override to allow us to fully quit the app.
let isKeepAliveLaunch = false; // Track if launched via keep-alive
// Initialize the server
const localServer = new LocalServer();
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
@@ -95,7 +92,7 @@ function createWindow(): void {
icon: appIconToUse,
}
: {}),
title: "Shop Partner",
title: "EMS Uploader",
webPreferences: {
preload: join(__dirname, "../preload/index.js"),
sandbox: false,
@@ -425,13 +422,6 @@ function createWindow(): void {
if (!isKeepAliveLaunch) {
mainWindow.show(); // Show only if not a keep-alive launch
}
//Start the HTTP server.
// Start the local HTTP server
try {
localServer.start();
} catch (error) {
log.error("Failed to start HTTP server:", errorTypeCheck(error));
}
});
mainWindow.on("close", (event: Electron.Event) => {
@@ -476,7 +466,7 @@ app.whenReady().then(async () => {
log.debug("App is ready, initializing shortcuts and protocol handlers.");
if (platform.isWindows) {
app.setAppUserModelId("Shop Partner");
app.setAppUserModelId("esdp");
}
app.on("browser-window-created", (_, window) => {
@@ -508,17 +498,8 @@ app.whenReady().then(async () => {
//Dynamically load ipcMain handlers once ready.
try {
const { initializeCronTasks } = await import("./ipc/ipcMainConfig");
await import("./ipc/ipcMainConfig");
log.debug("Successfully loaded ipcMainConfig");
try {
await initializeCronTasks();
log.info("Cron tasks initialized successfully");
} catch (error) {
log.warn("Non-fatal: Failed to initialize cron tasks", {
...ErrorTypeCheck(error),
});
}
} catch (error) {
log.error("Fatal: Failed to load ipcMainConfig", {
...ErrorTypeCheck(error),
@@ -599,7 +580,6 @@ app.whenReady().then(async () => {
//The update itself will run when the bodyshop record is queried to know what release channel to use.
openMainWindow();
ongoingMemoryDump();
app.on("activate", function () {
openMainWindow();
@@ -661,7 +641,6 @@ ipcMain.on(ipcTypes.toMain.updates.apply, () => {
});
function preQuitMethods(): void {
localServer.stop();
const currentSetting = store.get("app.openOnStartup") as boolean;
if (!import.meta.env.DEV) {
app.setLoginItemSettings({