Add exclusion for QB on non-windows.
This commit is contained in:
@@ -25,8 +25,7 @@
|
|||||||
"@electron-toolkit/utils": "^4.0.0",
|
"@electron-toolkit/utils": "^4.0.0",
|
||||||
"electron-log": "^5.3.2",
|
"electron-log": "^5.3.2",
|
||||||
"electron-store": "^8.2.0",
|
"electron-store": "^8.2.0",
|
||||||
"electron-updater": "^6.3.9",
|
"electron-updater": "^6.3.9"
|
||||||
"winax": "^3.6.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ant-design/v5-patch-for-react-19": "^1.0.3",
|
"@ant-design/v5-patch-for-react-19": "^1.0.3",
|
||||||
@@ -72,5 +71,8 @@
|
|||||||
"redux-thunk": "^3.1.0",
|
"redux-thunk": "^3.1.0",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.2",
|
||||||
"vite": "^6.2.1"
|
"vite": "^6.2.1"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"winax": "^3.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import * as Winax from "winax";
|
|
||||||
import log from "electron-log/main";
|
import log from "electron-log/main";
|
||||||
|
|
||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
@@ -7,11 +6,25 @@ import errorTypeCheck from "../../util/errorTypeCheck";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import store from "../store/store";
|
import store from "../store/store";
|
||||||
|
|
||||||
|
let Winax: any; // Declare Winax as any to avoid TypeScript errors on non-Windows platforms
|
||||||
|
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
Winax = require("winax");
|
||||||
|
}
|
||||||
|
|
||||||
export async function handleQuickBookRequest(
|
export async function handleQuickBookRequest(
|
||||||
req: Request,
|
req: Request,
|
||||||
res: Response,
|
res: Response,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
//TODO: Add OS sysstem checking. This can only happen on windows machines.
|
if (process.platform !== "win32") {
|
||||||
|
res
|
||||||
|
.status(500)
|
||||||
|
.json({
|
||||||
|
error: "QuickBooks Desktop integration is only available on Windows",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QbFilePath: string = `C:\\Users\\PatrickFic\\Development\\FRODO COLLISION.QBW`;
|
const QbFilePath: string = `C:\\Users\\PatrickFic\\Development\\FRODO COLLISION.QBW`;
|
||||||
// ||
|
// ||
|
||||||
// (store.get("settings.qbFilePath") as string) F
|
// (store.get("settings.qbFilePath") as string) F
|
||||||
@@ -81,6 +94,10 @@ export async function handleQuickBookRequest(
|
|||||||
|
|
||||||
//This set of functions works.
|
//This set of functions works.
|
||||||
export function TestQB(): void {
|
export function TestQB(): void {
|
||||||
|
if (process.platform !== "win32") {
|
||||||
|
log.warn("TestQB is only available on Windows");
|
||||||
|
return;
|
||||||
|
}
|
||||||
let requestProcessor, ticket;
|
let requestProcessor, ticket;
|
||||||
try {
|
try {
|
||||||
requestProcessor = new Winax.Object("QBXMLRP.RequestProcessor.1");
|
requestProcessor = new Winax.Object("QBXMLRP.RequestProcessor.1");
|
||||||
|
|||||||
Reference in New Issue
Block a user