@pixelbyte-software/pixcode 1.54.2 → 1.54.3

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/dist/index.html CHANGED
@@ -35,7 +35,7 @@
35
35
 
36
36
  <!-- Prevent zoom on iOS -->
37
37
  <meta name="format-detection" content="telephone=no" />
38
- <script type="module" crossorigin src="/assets/index-lqiCTrCl.js"></script>
38
+ <script type="module" crossorigin src="/assets/index-CwwdokVl.js"></script>
39
39
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-DB6V5Fl1.js">
40
40
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-CIYNS698.js">
41
41
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-C7tpxJl7.js">
@@ -5041,26 +5041,38 @@ async function startServer() {
5041
5041
  restoreRequestedTunnel({ port: Number(SERVER_PORT) }).catch((err) => {
5042
5042
  console.warn('[external-access] tunnel restore failed:', err?.message || err);
5043
5043
  });
5044
- // Auto-open browser unless explicitly disabled
5044
+ // Auto-open browser unless explicitly disabled or headless
5045
5045
  if (process.env.PIXCODE_NO_BROWSER !== '1') {
5046
5046
  const openUrl = `http://${DISPLAY_HOST}:${SERVER_PORT}`;
5047
- try {
5048
- // Use spawn with an argument array instead of exec with a
5049
- // shell string to prevent command injection through the
5050
- // host/port values (which come from env vars).
5051
- const { spawn: spawnBrowser } = await import('node:child_process');
5052
- const browserBin = process.platform === 'darwin' ? 'open'
5053
- : process.platform === 'win32' ? 'cmd'
5054
- : 'xdg-open';
5055
- const browserArgs = process.platform === 'win32'
5056
- ? ['/c', 'start', '', openUrl]
5057
- : [openUrl];
5058
- spawnBrowser(browserBin, browserArgs, { stdio: 'ignore', timeout: 3000, detached: true, shell: false }).unref();
5059
- console.log(`${c.ok('[OK]')} Opening browser at ${c.bright(openUrl)}`);
5060
- }
5061
- catch {
5047
+ // Skip browser opening on headless servers (no DISPLAY on Linux,
5048
+ // or xdg-open not installed) common for VPS/cloud deployments.
5049
+ const isHeadless = process.platform === 'linux' && (!process.env.DISPLAY || process.env.DISPLAY === '' ||
5050
+ !fs.existsSync('/usr/bin/xdg-open') && !fs.existsSync('/usr/local/bin/xdg-open'));
5051
+ if (isHeadless) {
5062
5052
  console.log(`${c.tip('[TIP]')} Open ${c.bright(openUrl)} in your browser to start using Pixcode.`);
5063
5053
  }
5054
+ else {
5055
+ try {
5056
+ const { spawn: spawnBrowser } = await import('node:child_process');
5057
+ const browserBin = process.platform === 'darwin' ? 'open'
5058
+ : process.platform === 'win32' ? 'cmd'
5059
+ : 'xdg-open';
5060
+ const browserArgs = process.platform === 'win32'
5061
+ ? ['/c', 'start', '', openUrl]
5062
+ : [openUrl];
5063
+ const child = spawnBrowser(browserBin, browserArgs, {
5064
+ stdio: 'ignore', timeout: 3000, detached: true, shell: false,
5065
+ });
5066
+ child.on('error', () => {
5067
+ // Browser binary not found or failed — non-fatal
5068
+ });
5069
+ child.unref();
5070
+ console.log(`${c.ok('[OK]')} Opening browser at ${c.bright(openUrl)}`);
5071
+ }
5072
+ catch {
5073
+ console.log(`${c.tip('[TIP]')} Open ${c.bright(openUrl)} in your browser to start using Pixcode.`);
5074
+ }
5075
+ }
5064
5076
  }
5065
5077
  console.log(`${c.tip('[TIP]')} Run "pixcode status" for full configuration details`);
5066
5078
  console.log('');