homebridge-melcloud-control 4.5.6-beta.1 → 4.5.6-beta.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/functions.js +17 -26
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.5.6-beta.1",
4
+ "version": "4.5.6-beta.3",
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
@@ -81,9 +81,7 @@ class Functions extends EventEmitter {
81
81
 
82
82
  try {
83
83
  const { stdout } = await execPromise('cat /proc/1/cgroup');
84
- if (stdout.includes('docker') || stdout.includes('containerd')) {
85
- isDocker = true;
86
- }
84
+ if (stdout.includes('docker') || stdout.includes('containerd')) isDocker = true;
87
85
  } catch { }
88
86
 
89
87
  /* ===================== macOS ===================== */
@@ -128,44 +126,37 @@ class Functions extends EventEmitter {
128
126
  return { path: null, arch, system: 'Qnap' };
129
127
  }
130
128
 
131
- /* ===================== Linux ARM ===================== */
132
- if (isLinux && isARM) {
133
- const armCandidates = ['/usr/bin/chromium-browser', '/usr/bin/chromium'];
134
- for (const path of armCandidates) {
129
+ /* ===================== Linux ===================== */
130
+ if (isLinux) {
131
+ const linuxCandidates = ['/usr/bin/google-chrome', '/usr/bin/chromium-browser', '/usr/bin/chromium'];
132
+
133
+ // Detect existing browser (ARM + x64)
134
+ for (const path of linuxCandidates) {
135
135
  try {
136
136
  await access(path, fs.constants.X_OK);
137
- return { path, arch, system: 'Linux ARM' };
137
+ return { path, arch, system: isDocker ? 'Linux Docker' : (isARM ? 'Linux ARM' : 'Linux') };
138
138
  } catch { }
139
139
  }
140
140
 
141
- // ARM: detect only, no runtime install
142
- return { path: null, arch, system: 'Linux ARM' };
143
- }
144
-
145
- /* ===================== Linux x64 ===================== */
146
- if (isLinux && !isARM) {
147
- const linuxCandidates = ['/usr/bin/google-chrome', '/usr/bin/chromium-browser', '/usr/bin/chromium'];
148
-
149
- try {
150
- const { stdout } = await execPromise('command -v google-chrome || command -v chromium-browser || command -v chromium');
151
- if (stdout.trim()) {
152
- return { path: stdout.trim(), arch, system: isDocker ? 'Linux Docker' : 'Linux' };
153
- }
154
- } catch { }
141
+ // ARM detect only
142
+ if (isARM) {
143
+ return { path: null, arch, system: 'Linux ARM' };
144
+ }
155
145
 
146
+ /* ===================== Linux x64 ===================== */
156
147
  if (isDocker) {
157
148
  try {
158
149
  await execPromise(`
159
150
  apt update -y &&
160
151
  apt install -y wget gnupg ca-certificates &&
161
152
  mkdir -p /etc/apt/keyrings &&
162
- wget -qO /etc/apt/keyrings/google.gpg https://dl.google.com/linux/linux_signing_key.pub &&
163
- sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list' &&
153
+ wget -qO- https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/keyrings/google-chrome.gpg && sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list' &&
164
154
  apt update -y &&
165
155
  apt install -y google-chrome-stable
166
- `);
156
+ `);
167
157
  } catch (error) {
168
158
  if (this.logError) this.emit('error', `Chrome install error: ${error}`);
159
+ return { path: null, arch, system: 'Linux Docker' };
169
160
  }
170
161
 
171
162
  for (const path of linuxCandidates) {
@@ -176,7 +167,7 @@ class Functions extends EventEmitter {
176
167
  }
177
168
  }
178
169
 
179
- return { path: null, arch, system: 'Linux' };
170
+ return { path: null, arch, system: isDocker ? 'Linux Docker' : 'Linux' };
180
171
  }
181
172
 
182
173
  return { path: null, arch, system: 'unknown' };