diff --git a/.gitignore b/.gitignore
index a07adf7..d4543a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,5 +18,7 @@ PackageSources/SimObjects/Airplanes/**/panel/*.wasm
EFB/efb.css
EFB/efb.js
EFB/efb.html
+EFB/efb.index.js
+EFB/patched/
*.su
\ No newline at end of file
diff --git a/EFB/efb-html.patch b/EFB/efb-html.patch
index 8014e06..39e4ff5 100644
--- a/EFB/efb-html.patch
+++ b/EFB/efb-html.patch
@@ -1,13 +1,16 @@
-diff --git a/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.html b/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.html
-index a2e14f7..515e0d9 100644
---- a/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.html
-+++ b/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.html
-@@ -7,4 +7,6 @@
+Index: EFB.html
+===================================================================
+--- EFB.html
++++ EFB.html
+@@ -4,7 +4,9 @@
+
+
+-
++
++
+
-
+
+
--
-+
-+
diff --git a/EFB/efb-js.patch b/EFB/efb-js.patch
index 6e80861..0070f61 100644
--- a/EFB/efb-js.patch
+++ b/EFB/efb-js.patch
@@ -1,9 +1,10 @@
-diff --git a/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.js b/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.js
-index 0904cc9..d2bcd02 100644
---- a/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.js
-+++ b/PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb/efb.js
-@@ -42333,9 +42333,16 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
+Index: EFB.js
+===================================================================
+--- EFB.js
++++ EFB.js
+@@ -40035,11 +40035,18 @@
+ ),
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
"button",
{
- onClick: loadPayload,
@@ -20,8 +21,10 @@ index 0904cc9..d2bcd02 100644
+ children: "Manage payload & fuel"
}
),
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
-@@ -42842,6 +42849,11 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
+ "button",
+@@ -40537,8 +40544,13 @@
+ ] })
] }) }) });
}
@@ -32,13 +35,16 @@ index 0904cc9..d2bcd02 100644
+
// src/components/Router.tsx
init_common();
- var import_jsx_runtime14 = __toESM(require_jsx_runtime());
-@@ -42858,7 +42870,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
+ var import_jsx_runtime15 = __toESM(require_jsx_runtime());
+ var routes = {
+@@ -40553,9 +40565,9 @@
+ button: {
title: "Payload",
- icon: faWeightHanging
+ icon: Weight
},
- page: PayloadPage
+ page: App
},
"/perf": {
button: {
+ title: "Perf",
diff --git a/EFB/generatePatches.js b/EFB/generatePatches.js
new file mode 100644
index 0000000..1f833e4
--- /dev/null
+++ b/EFB/generatePatches.js
@@ -0,0 +1,21 @@
+const { createTwoFilesPatch } = require("diff");
+const fs = require("fs");
+
+// HTML
+
+let file1Contents = fs.readFileSync("EFB.html").toString();
+let file2Contents = fs.readFileSync("patched/EFB.html").toString();
+let patch = createTwoFilesPatch(
+ "EFB.html",
+ "EFB.html",
+ file1Contents,
+ file2Contents
+);
+fs.writeFileSync("efb-html.patch", patch);
+
+// JS
+
+file1Contents = fs.readFileSync("EFB.js").toString();
+file2Contents = fs.readFileSync("patched/EFB.js").toString();
+patch = createTwoFilesPatch("EFB.js", "EFB.js", file1Contents, file2Contents);
+fs.writeFileSync("efb-js.patch", patch);
diff --git a/insert-efb.js b/insert-efb.js
index fbabc15..4a90866 100644
--- a/insert-efb.js
+++ b/insert-efb.js
@@ -1,3 +1,4 @@
+const { applyPatch } = require("diff");
const fs = require("fs");
const util = require("node:util");
const exec = util.promisify(require("node:child_process").exec);
@@ -6,17 +7,17 @@ const readline = require("readline");
const outPath =
"./PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb";
-fs.copyFileSync("./EFB/efb.js", `${outPath}/efb.js`);
-fs.copyFileSync("./EFB/efb.html", `${outPath}/efb.html`);
fs.copyFileSync("./EFB/efb.css", `${outPath}/efb.css`);
-console.log("Files transferred.");
-exec("git apply ./EFB/efb-js.patch").then(({ stdout, stderr }) => {
- console.log("Patches efb.js applied.");
-});
-exec("git apply ./EFB/efb-html.patch").then(({ stdout, stderr }) => {
- console.log("Patches efb.html applied.");
-});
+let file1Contents = fs.readFileSync("./EFB/efb.js").toString();
+let patch = fs.readFileSync("./EFB/efb-js.patch").toString();
+let patchedFile = applyPatch(file1Contents, patch);
+fs.writeFileSync(`${outPath}/efb.js`, patchedFile);
+
+file1Contents = fs.readFileSync("./EFB/efb.html").toString();
+patch = fs.readFileSync("./EFB/efb-html.patch").toString();
+patchedFile = applyPatch(file1Contents, patch);
+fs.writeFileSync(`${outPath}/efb.html`, patchedFile);
var output = "";
var lineReader = readline.createInterface({
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..382e442
--- /dev/null
+++ b/package.json
@@ -0,0 +1,5 @@
+{
+ "devDependencies": {
+ "diff": "^8.0.2"
+ }
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
new file mode 100644
index 0000000..6583623
--- /dev/null
+++ b/pnpm-lock.yaml
@@ -0,0 +1,23 @@
+lockfileVersion: '9.0'
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+
+ .:
+ devDependencies:
+ diff:
+ specifier: ^8.0.2
+ version: 8.0.2
+
+packages:
+
+ diff@8.0.2:
+ resolution: {integrity: sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg==}
+ engines: {node: '>=0.3.1'}
+
+snapshots:
+
+ diff@8.0.2: {}