thrust-cli 1.0.8 ā 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/daemon.js +21 -17
package/package.json
CHANGED
package/utils/daemon.js
CHANGED
|
@@ -151,33 +151,37 @@ export async function startDaemon(preferredPort) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// ---
|
|
154
|
+
// --- INTELLIGENT BROWSER OPENER ---
|
|
155
155
|
async function safeOpenBrowser(url) {
|
|
156
156
|
try {
|
|
157
157
|
if (process.env.TERMUX_VERSION) {
|
|
158
|
-
exec(`termux-open-url ${url}`, (
|
|
159
|
-
|
|
158
|
+
exec(`termux-open-url ${url}`, () => {
|
|
159
|
+
console.log("š Please open the URL manually in your mobile browser.");
|
|
160
160
|
});
|
|
161
161
|
} else if (!process.env.DISPLAY && process.platform === 'linux') {
|
|
162
162
|
console.log("š [Headless] Please open the URL manually in a browser.");
|
|
163
163
|
} else {
|
|
164
|
-
|
|
164
|
+
const chromeName = process.platform === 'darwin' ? 'google chrome' :
|
|
165
|
+
process.platform === 'win32' ? 'chrome' : 'google-chrome';
|
|
166
|
+
|
|
167
|
+
console.log("š Attempting to launch dashboard in App Mode...");
|
|
168
|
+
|
|
165
169
|
try {
|
|
166
|
-
// Try Chrome App Mode
|
|
167
|
-
const
|
|
168
|
-
process.platform === 'win32' ? 'chrome' : 'google-chrome';
|
|
169
|
-
|
|
170
|
-
await open(url, {
|
|
170
|
+
// ATTEMPT 1: Try Chrome App Mode
|
|
171
|
+
const browserProcess = await open(url, {
|
|
171
172
|
app: { name: chromeName, arguments: [`--app=${url}`, '--window-size=1000,800'] }
|
|
172
173
|
});
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
await open(url);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
|
|
175
|
+
// Catch asynchronous spawn failures (e.g., Windows when Chrome isn't in PATH)
|
|
176
|
+
browserProcess.on('error', async () => {
|
|
177
|
+
console.log("š Chrome App Mode failed. Falling back to default browser...");
|
|
178
|
+
await open(url).catch(()=>{});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
} catch (chromeErr) {
|
|
182
|
+
// Catch synchronous promise rejections (e.g., Mac/Linux when Chrome is missing)
|
|
183
|
+
console.log("š Chrome App Mode unavailable. Falling back to default browser...");
|
|
184
|
+
await open(url);
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
187
|
} catch (e) {
|