Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit bfda665

Browse files
committed
Update dist files
1 parent c0286c8 commit bfda665

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

dist/index.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const state_1 = __importDefault(require("./server/state"));
1616
const utils_1 = require("@electron-toolkit/utils");
1717
const server_1 = require("./server");
1818
const utils_2 = require("./server/utils");
19+
const electron_1 = require("electron");
1920
const path_1 = require("path");
2021
const ps_node_1 = __importDefault(require("ps-node"));
2122
let phpProcesses = [];
@@ -73,22 +74,29 @@ class NativePHP {
7374
});
7475
}
7576
bootstrapApp(app) {
76-
app.whenReady().then(() => __awaiter(this, void 0, void 0, function* () {
77-
var _a;
78-
if (process.platform === 'darwin' && process.env.NODE_ENV === 'development') {
79-
app.dock.setIcon(state_1.default.icon);
80-
}
81-
app.on('browser-window-created', (_, window) => {
82-
utils_1.optimizer.watchWindowShortcuts(window);
83-
});
84-
let nativePHPConfig = {};
77+
let nativePHPConfig = {};
78+
(0, server_1.retrieveNativePHPConfig)().then((result) => {
8579
try {
86-
let { stdout } = yield (0, server_1.retrieveNativePHPConfig)();
87-
nativePHPConfig = JSON.parse(stdout);
80+
nativePHPConfig = JSON.parse(result.stdout);
8881
}
8982
catch (e) {
9083
console.error(e);
9184
}
85+
}).catch((err) => {
86+
console.error(err);
87+
}).finally(() => {
88+
this.setupApp(nativePHPConfig);
89+
});
90+
}
91+
setupApp(nativePHPConfig) {
92+
electron_1.app.whenReady().then(() => __awaiter(this, void 0, void 0, function* () {
93+
var _a;
94+
if (process.platform === 'darwin' && process.env.NODE_ENV === 'development') {
95+
electron_1.app.dock.setIcon(state_1.default.icon);
96+
}
97+
electron_1.app.on('browser-window-created', (_, window) => {
98+
utils_1.optimizer.watchWindowShortcuts(window);
99+
});
92100
let phpIniSettings = {};
93101
try {
94102
let { stdout } = yield (0, server_1.retrievePhpIniSettings)();
@@ -102,11 +110,11 @@ class NativePHP {
102110
if (deepLinkProtocol) {
103111
if (process.defaultApp) {
104112
if (process.argv.length >= 2) {
105-
app.setAsDefaultProtocolClient(deepLinkProtocol, process.execPath, [(0, path_1.resolve)(process.argv[1])]);
113+
electron_1.app.setAsDefaultProtocolClient(deepLinkProtocol, process.execPath, [(0, path_1.resolve)(process.argv[1])]);
106114
}
107115
}
108116
else {
109-
app.setAsDefaultProtocolClient(deepLinkProtocol);
117+
electron_1.app.setAsDefaultProtocolClient(deepLinkProtocol);
110118
}
111119
}
112120
const apiPort = yield (0, server_1.startAPI)();
@@ -125,7 +133,7 @@ class NativePHP {
125133
(0, server_1.runScheduler)(apiPort.port, phpIniSettings);
126134
}, 60 * 1000);
127135
}, delay);
128-
app.on('activate', function (event, hasVisibleWindows) {
136+
electron_1.app.on('activate', function (event, hasVisibleWindows) {
129137
if (!hasVisibleWindows) {
130138
(0, utils_2.notifyLaravel)('booted');
131139
}

dist/server/php.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function getPhpPort() {
3838
function retrievePhpIniSettings() {
3939
return __awaiter(this, void 0, void 0, function* () {
4040
const env = {
41+
NATIVEPHP_RUNNING: 'true',
4142
NATIVEPHP_STORAGE_PATH: storagePath,
4243
NATIVEPHP_DATABASE_PATH: databaseFile,
4344
};
@@ -52,6 +53,7 @@ exports.retrievePhpIniSettings = retrievePhpIniSettings;
5253
function retrieveNativePHPConfig() {
5354
return __awaiter(this, void 0, void 0, function* () {
5455
const env = {
56+
NATIVEPHP_RUNNING: 'true',
5557
NATIVEPHP_STORAGE_PATH: storagePath,
5658
NATIVEPHP_DATABASE_PATH: databaseFile,
5759
};
@@ -111,10 +113,10 @@ function startQueueWorker(secret, apiPort, phpIniSettings = {}) {
111113
const env = {
112114
APP_ENV: process.env.NODE_ENV === 'development' ? 'local' : 'production',
113115
APP_DEBUG: process.env.NODE_ENV === 'development' ? 'true' : 'false',
114-
NATVEPHP_STORAGE_PATH: storagePath,
115-
NATVEPHP_DATABASE_PATH: databaseFile,
116-
NATVEPHP_API_URL: `http://localhost:${apiPort}/api/`,
117-
NATVEPHP_RUNNING: true,
116+
NATIVEPHP_STORAGE_PATH: storagePath,
117+
NATIVEPHP_DATABASE_PATH: databaseFile,
118+
NATIVEPHP_API_URL: `http://localhost:${apiPort}/api/`,
119+
NATIVEPHP_RUNNING: true,
118120
NATIVEPHP_SECRET: secret
119121
};
120122
const phpOptions = {

0 commit comments

Comments
 (0)