homebridge-melcloud-control 4.1.2-beta.59 → 4.1.2-beta.60

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/functions.js +12 -29
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.1.2-beta.59",
4
+ "version": "4.1.2-beta.60",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/functions.js CHANGED
@@ -100,49 +100,32 @@ class Functions extends EventEmitter {
100
100
  if (chromiumPath) return chromiumPath;
101
101
  } catch { }
102
102
 
103
- if (this.logWarn) this.emit('warn', 'Chromium not found. Attempting installation...');
104
-
105
103
  // --- Detect Entware (QNAP) ---
106
104
  let entwareExists = false;
107
105
  try { await access('/opt/bin/opkg', fs.constants.X_OK); entwareExists = true; } catch { }
108
106
 
109
107
  if (entwareExists) {
110
108
  try {
111
- if (this.logDebug) this.emit('debug', 'Detected Entware. Installing Chromium and libraries via opkg...');
112
109
  await execPromise('/opt/bin/opkg update');
113
- await execPromise('/opt/bin/opkg install chromium');
114
-
115
- // Install all essential dependencies
116
110
  await execPromise('/opt/bin/opkg install nspr nss libx11 libxcomposite libxdamage libxrandr libatk libatk-bridge libcups libdrm libgbm libasound');
117
-
118
- // Add Entware lib path to LD_LIBRARY_PATH
119
111
  process.env.LD_LIBRARY_PATH = '/opt/lib:' + (process.env.LD_LIBRARY_PATH || '');
120
- if (this.logDebug) this.emit('debug', 'LD_LIBRARY_PATH set for Chromium');
121
-
122
- // Verify binary exists
123
- const { stdout: checkOut } = await execPromise('which chromium || which chromium-browser || true');
124
- chromiumPath = checkOut.trim() || '/opt/bin/chromium';
125
- if (chromiumPath) return chromiumPath;
126
- } catch (error) {
127
- if (this.logError) this.emit('error', `Entware Chromium/libs installation failed: ${error.message}`);
128
- }
112
+ } catch { }
129
113
  }
130
114
 
131
- // --- Generic Linux install ---
132
- const installCommands = [
133
- 'apt-get update -y && apt-get install -y chromium chromium-browser chromium-codecs-ffmpeg',
134
- 'apk add --no-cache chromium ffmpeg',
135
- 'yum install -y chromium chromium-codecs-ffmpeg'
115
+ // --- Generic Linux installs missing libs for Puppeteer ---
116
+ const depInstall = [
117
+ 'apt-get update -y && apt-get install -y libnspr4 libnss3 libx11-6 libxcomposite1 libxdamage1 libxrandr2 libatk1.0-0 libcups2 libdrm2 libgbm1 libasound2',
118
+ 'apk add --no-cache nspr nss libx11 libxcomposite libxdamage libxrandr atk cups libdrm libgbm alsa-lib',
119
+ 'yum install -y nspr nss libX11 libXcomposite libXdamage libXrandr atk cups libdrm libgbm alsa-lib'
136
120
  ];
137
- for (const cmd of installCommands) {
138
- try {
139
- await execPromise(`sudo ${cmd}`);
140
- const { stdout: checkOut } = await execPromise('which chromium || which chromium-browser || true');
141
- chromiumPath = checkOut.trim() || '/usr/bin/chromium';
142
- if (chromiumPath) return chromiumPath;
143
- } catch { }
121
+ for (const cmd of depInstall) {
122
+ try { await execPromise(`sudo ${cmd}`); } catch { }
144
123
  }
145
124
 
125
+ // Set LD_LIBRARY_PATH so Puppeteer's Chromium can find libs
126
+ process.env.LD_LIBRARY_PATH = '/usr/lib:/usr/lib64:' + (process.env.LD_LIBRARY_PATH || '');
127
+
128
+ // Return null since Chromium itself nie instaluje – Puppeteer użyje swojego binarnego
146
129
  return null;
147
130
  }
148
131