homebridge-melcloud-control 4.1.2-beta.56 → 4.1.2-beta.58
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/homebridge-ui/public/index.html +1 -1
- package/package.json +1 -1
- package/src/functions.js +33 -85
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
|
|
151
151
|
// Ustawiamy formularz
|
|
152
152
|
formElements.accountName.innerText = account.name || '';
|
|
153
|
-
formElements.info.innerText =
|
|
153
|
+
formElements.info.innerText = ``;
|
|
154
154
|
formElements.info1.innerText = '';
|
|
155
155
|
formElements.info2.innerText = '';
|
|
156
156
|
formElements.name.value = account.name || '';
|
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.
|
|
4
|
+
"version": "4.1.2-beta.58",
|
|
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
|
@@ -70,134 +70,84 @@ class Functions extends EventEmitter {
|
|
|
70
70
|
|
|
71
71
|
// --- Detect Docker environment ---
|
|
72
72
|
let isDocker = false;
|
|
73
|
+
try { await access('/.dockerenv', fs.constants.F_OK); isDocker = true; } catch { }
|
|
73
74
|
try {
|
|
74
|
-
await
|
|
75
|
-
isDocker = true;
|
|
76
|
-
} catch {
|
|
77
|
-
try {
|
|
78
|
-
const { stdout } = await execPromise('cat /proc/1/cgroup || true');
|
|
79
|
-
if (stdout.includes('docker') || stdout.includes('containerd'))
|
|
80
|
-
isDocker = true;
|
|
81
|
-
} catch { }
|
|
82
|
-
}
|
|
75
|
+
const { stdout } = await execPromise('cat /proc/1/cgroup || true');
|
|
76
|
+
if (stdout.includes('docker') || stdout.includes('containerd')) isDocker = true;
|
|
77
|
+
} catch { }
|
|
83
78
|
|
|
84
79
|
if (isDocker && this.logDebug) this.emit('debug', 'Running inside Docker container.');
|
|
85
80
|
|
|
86
81
|
// === macOS ===
|
|
87
82
|
if (osName === 'Darwin') {
|
|
88
83
|
chromiumPath = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
|
|
89
|
-
try {
|
|
90
|
-
await access(chromiumPath, fs.constants.X_OK);
|
|
91
|
-
if (this.logDebug) this.emit('debug', `Using system Chrome at ${chromiumPath}`);
|
|
92
|
-
return chromiumPath;
|
|
93
|
-
} catch {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
84
|
+
try { await access(chromiumPath, fs.constants.X_OK); return chromiumPath; } catch { return null; }
|
|
96
85
|
}
|
|
97
86
|
|
|
98
|
-
// === ARM
|
|
87
|
+
// === ARM ===
|
|
99
88
|
if (arch.startsWith('arm')) {
|
|
100
|
-
try {
|
|
101
|
-
await
|
|
102
|
-
if (this.logDebug) this.emit('debug', 'Using system Chromium on ARM platform.');
|
|
103
|
-
return '/usr/bin/chromium-browser';
|
|
104
|
-
} catch {
|
|
105
|
-
if (this.logWarn) this.emit('warn', 'System Chromium not found on ARM. Attempting installation...');
|
|
106
|
-
try {
|
|
107
|
-
await execPromise('sudo apt-get update -y && sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg');
|
|
108
|
-
if (this.logDebug) this.emit('debug', 'Chromium installed successfully on ARM.');
|
|
109
|
-
return '/usr/bin/chromium-browser';
|
|
110
|
-
} catch {
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
89
|
+
try { await access('/usr/bin/chromium-browser', fs.constants.X_OK); return '/usr/bin/chromium-browser'; } catch {
|
|
90
|
+
try { await execPromise('sudo apt-get update -y && sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg'); return '/usr/bin/chromium-browser'; } catch { return null; }
|
|
113
91
|
}
|
|
114
92
|
}
|
|
115
93
|
|
|
116
|
-
// === Linux
|
|
94
|
+
// === Linux x64 ===
|
|
117
95
|
if (osName === 'Linux') {
|
|
118
96
|
try {
|
|
119
97
|
const { stdout: checkOut } = await execPromise('which chromium || which chromium-browser || true');
|
|
120
98
|
chromiumPath = checkOut.trim();
|
|
121
|
-
if (chromiumPath)
|
|
122
|
-
if (this.logDebug) this.emit('debug', `Found system Chromium: ${chromiumPath}`);
|
|
123
|
-
return chromiumPath;
|
|
124
|
-
}
|
|
99
|
+
if (chromiumPath) return chromiumPath;
|
|
125
100
|
} catch { }
|
|
126
101
|
|
|
127
102
|
if (this.logWarn) this.emit('warn', 'Chromium not found. Attempting installation...');
|
|
128
103
|
|
|
129
104
|
// --- Detect Entware (QNAP) ---
|
|
130
105
|
let entwareExists = false;
|
|
131
|
-
try {
|
|
132
|
-
await access('/opt/bin/opkg', fs.constants.X_OK);
|
|
133
|
-
entwareExists = true;
|
|
134
|
-
} catch { }
|
|
106
|
+
try { await access('/opt/bin/opkg', fs.constants.X_OK); entwareExists = true; } catch { }
|
|
135
107
|
|
|
136
108
|
if (entwareExists) {
|
|
137
109
|
try {
|
|
138
|
-
if (this.logDebug) this.emit('debug', 'Detected Entware.
|
|
110
|
+
if (this.logDebug) this.emit('debug', 'Detected Entware. Installing Chromium via opkg...');
|
|
139
111
|
await execPromise('/opt/bin/opkg update');
|
|
140
112
|
await execPromise('/opt/bin/opkg install chromium');
|
|
113
|
+
await execPromise('/opt/bin/opkg install nspr nss libx11 libxcomposite libxdamage libxrandr libatk libatk-bridge libcups libdrm libgbm libasound');
|
|
114
|
+
process.env.LD_LIBRARY_PATH = '/opt/lib:' + (process.env.LD_LIBRARY_PATH || '');
|
|
141
115
|
const { stdout: checkOut } = await execPromise('which chromium || which chromium-browser || true');
|
|
142
116
|
chromiumPath = checkOut.trim() || '/opt/bin/chromium';
|
|
143
|
-
|
|
144
|
-
if (this.logDebug) this.emit('debug', `Chromium installed successfully via Entware at ${chromiumPath}`);
|
|
145
|
-
return chromiumPath;
|
|
146
|
-
}
|
|
117
|
+
return chromiumPath;
|
|
147
118
|
} catch (error) {
|
|
148
119
|
if (this.logDebug) this.emit('debug', `Entware installation failed: ${error.message}`);
|
|
149
120
|
}
|
|
121
|
+
}
|
|
150
122
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
const { stdout: checkOut } = await execPromise('which chromium || which chromium-browser || true');
|
|
163
|
-
chromiumPath = checkOut.trim() || '/opt/bin/chromium';
|
|
164
|
-
if (chromiumPath) {
|
|
165
|
-
return chromiumPath;
|
|
123
|
+
// --- Fallback Puppeteer Chromium ---
|
|
124
|
+
try {
|
|
125
|
+
const puppeteerPath = puppeteer.executablePath();
|
|
126
|
+
if (puppeteerPath && fs.existsSync(puppeteerPath)) {
|
|
127
|
+
chromiumPath = puppeteerPath;
|
|
128
|
+
if (this.logDebug) this.emit('debug', `Using Puppeteer bundled Chromium at ${chromiumPath}`);
|
|
129
|
+
// Try auto-set LD_LIBRARY_PATH for QNAP
|
|
130
|
+
if (fs.existsSync('/opt/lib')) {
|
|
131
|
+
process.env.LD_LIBRARY_PATH = '/opt/lib:' + (process.env.LD_LIBRARY_PATH || '');
|
|
132
|
+
if (this.logDebug) this.emit('debug', 'LD_LIBRARY_PATH set for Chromium');
|
|
166
133
|
}
|
|
167
|
-
|
|
168
|
-
|
|
134
|
+
return chromiumPath;
|
|
135
|
+
}
|
|
136
|
+
} catch { }
|
|
169
137
|
|
|
170
|
-
// ---
|
|
138
|
+
// --- Generic Linux installs ---
|
|
171
139
|
const installCommands = [
|
|
172
140
|
'apt-get update -y && apt-get install -y chromium chromium-browser chromium-codecs-ffmpeg',
|
|
173
141
|
'apk add --no-cache chromium ffmpeg',
|
|
174
142
|
'yum install -y chromium chromium-codecs-ffmpeg'
|
|
175
143
|
];
|
|
176
|
-
|
|
177
144
|
for (const cmd of installCommands) {
|
|
178
145
|
try {
|
|
179
|
-
if (this.logDebug) this.emit('debug', `Trying installation: ${cmd}`);
|
|
180
146
|
await execPromise(`sudo ${cmd}`);
|
|
181
147
|
const { stdout: checkOut } = await execPromise('which chromium || which chromium-browser || true');
|
|
182
148
|
chromiumPath = checkOut.trim() || '/usr/bin/chromium';
|
|
183
|
-
if (chromiumPath)
|
|
184
|
-
|
|
185
|
-
return chromiumPath;
|
|
186
|
-
}
|
|
187
|
-
} catch (error) {
|
|
188
|
-
if (this.logDebug) this.emit('debug', `Install attempt failed: ${cmd} → ${error.message}`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (isDocker) {
|
|
193
|
-
try {
|
|
194
|
-
await execPromise('sudo apt-get update -y && sudo apt-get install -y chromium');
|
|
195
|
-
await access('/usr/bin/chromium', fs.constants.X_OK);
|
|
196
|
-
if (this.logDebug) this.emit('debug', 'Chromium installed successfully inside Docker at /usr/bin/chromium');
|
|
197
|
-
return '/usr/bin/chromium';
|
|
198
|
-
} catch {
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
149
|
+
if (chromiumPath) return chromiumPath;
|
|
150
|
+
} catch { }
|
|
201
151
|
}
|
|
202
152
|
|
|
203
153
|
return null;
|
|
@@ -205,13 +155,11 @@ class Functions extends EventEmitter {
|
|
|
205
155
|
|
|
206
156
|
if (this.logDebug) this.emit('debug', `Unsupported OS: ${osName}.`);
|
|
207
157
|
return null;
|
|
158
|
+
|
|
208
159
|
} catch (error) {
|
|
209
160
|
if (this.logError) this.emit('error', `Chromium detection/install error: ${error.message}`);
|
|
210
161
|
return null;
|
|
211
162
|
}
|
|
212
163
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
164
|
}
|
|
217
165
|
export default Functions
|