thrust-cli 1.0.3 ā 1.0.4
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 +20 -18
package/package.json
CHANGED
package/utils/daemon.js
CHANGED
|
@@ -151,7 +151,8 @@ export async function startDaemon(preferredPort) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
// --- BULLETPROOF BROWSER OPENER ---
|
|
155
|
+
async function safeOpenBrowser(url) {
|
|
155
156
|
try {
|
|
156
157
|
if (process.env.TERMUX_VERSION) {
|
|
157
158
|
exec(`termux-open-url ${url}`, (err) => {
|
|
@@ -160,25 +161,26 @@ function safeOpenBrowser(url) {
|
|
|
160
161
|
} else if (!process.env.DISPLAY && process.platform === 'linux') {
|
|
161
162
|
console.log("š [Headless] Please open the URL manually in a browser.");
|
|
162
163
|
} else {
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
try {
|
|
165
|
+
// OS-Specific Chrome Executable Names to force App Mode
|
|
166
|
+
const chromeName = process.platform === 'darwin' ? 'google chrome' :
|
|
167
|
+
process.platform === 'win32' ? 'chrome' : 'google-chrome';
|
|
168
|
+
|
|
169
|
+
// Force a small, docked 800x600 native app window without toolbars
|
|
170
|
+
await open(url, {
|
|
171
|
+
app: {
|
|
172
|
+
name: chromeName,
|
|
173
|
+
arguments: [`--app=${url}`, '--window-size=800,600']
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
} catch (err) {
|
|
177
|
+
// If Chrome isn't installed, fail gracefully to the default normal browser
|
|
165
178
|
try {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
} else {
|
|
170
|
-
throw new Error("Chrome App mode unsupported by package.");
|
|
171
|
-
}
|
|
172
|
-
} catch (err) {
|
|
173
|
-
// Fallback to the system's default browser safely
|
|
174
|
-
try {
|
|
175
|
-
await open(url);
|
|
176
|
-
} catch (fallbackErr) {
|
|
177
|
-
console.log("\nš OS prevented launching the browser automatically. Please open the URL above manually.\n");
|
|
178
|
-
}
|
|
179
|
+
await open(url);
|
|
180
|
+
} catch (fallbackErr) {
|
|
181
|
+
console.log("\nš OS prevented launching the browser automatically. Please open the URL above manually.\n");
|
|
179
182
|
}
|
|
180
|
-
}
|
|
181
|
-
launchBrowser();
|
|
183
|
+
}
|
|
182
184
|
}
|
|
183
185
|
} catch (e) {
|
|
184
186
|
console.log("\nš Please open the URL above manually.\n");
|