iobroker.mywebui 1.37.59 → 1.37.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.
package/io-package.json
CHANGED
package/package.json
CHANGED
|
@@ -161,47 +161,46 @@ let ScreenViewer = class ScreenViewer extends BaseCustomWebComponentConstructorA
|
|
|
161
161
|
}
|
|
162
162
|
async loadScreenData(html, style, script, settings, properties) {
|
|
163
163
|
// SERVER-SIDE SECURITY CHECK: backend reads screen file + groups from ioBroker DB
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
'
|
|
170
|
-
{ screenName: this.screenName, username }
|
|
171
|
-
(result) => resolve(result || { allowed: false, reason: 'no response' })
|
|
164
|
+
if (this.screenName) {
|
|
165
|
+
try {
|
|
166
|
+
const username = iobrokerHandler.userName || (await iobrokerHandler.getCurrentUser())?.name;
|
|
167
|
+
const _check = iobrokerHandler.connection.sendTo(
|
|
168
|
+
iobrokerHandler.namespace,
|
|
169
|
+
'checkScreenAccess',
|
|
170
|
+
{ screenName: this.screenName, username }
|
|
172
171
|
);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
});
|
|
172
|
+
const _timeout = new Promise(r => setTimeout(() => r({ allowed: true, _timeout: true }), 5000));
|
|
173
|
+
const accessResult = await Promise.race([_check, _timeout]);
|
|
176
174
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
175
|
+
if (!accessResult.allowed) {
|
|
176
|
+
console.warn('⛔ [Screen Visibility] Server denied access to:', this.screenName);
|
|
177
|
+
const action = accessResult.action || 'hide';
|
|
178
|
+
if (action === 'redirect' && accessResult.redirectScreen) {
|
|
179
|
+
this.screenName = accessResult.redirectScreen;
|
|
180
|
+
this._loadScreen();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this._rootShadow.innerHTML = `
|
|
184
|
+
<div style="display:flex;align-items:center;justify-content:center;height:100%;font-family:sans-serif;">
|
|
185
|
+
<div style="text-align:center;padding:40px;">
|
|
186
|
+
<div style="font-size:48px;margin-bottom:20px;">🔒</div>
|
|
187
|
+
<h2 style="margin:0 0 10px 0;color:#666;">Access Denied</h2>
|
|
188
|
+
<p style="color:#999;">You don't have permission to view this screen.</p>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
`;
|
|
183
192
|
return;
|
|
184
193
|
}
|
|
185
|
-
this._rootShadow.innerHTML = `
|
|
186
|
-
<div style="display:flex;align-items:center;justify-content:center;height:100%;font-family:sans-serif;">
|
|
187
|
-
<div style="text-align:center;padding:40px;">
|
|
188
|
-
<div style="font-size:48px;margin-bottom:20px;">🔒</div>
|
|
189
|
-
<h2 style="margin:0 0 10px 0;color:#666;">Access Denied</h2>
|
|
190
|
-
<p style="color:#999;">You don't have permission to view this screen.</p>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
`;
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
194
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
if (accessResult._timeout) {
|
|
196
|
+
console.warn('[Screen Visibility] Backend timeout — fail-open');
|
|
197
|
+
} else {
|
|
198
|
+
console.log('✅ [Screen Visibility] Server granted access to:', this.screenName);
|
|
199
|
+
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
console.error('❌ [Screen Visibility] Server check failed:', err);
|
|
202
|
+
// fail-open
|
|
201
203
|
}
|
|
202
|
-
} catch (err) {
|
|
203
|
-
console.error('❌ [Screen Visibility] Server check failed:', err);
|
|
204
|
-
// fail-open: backend xətası olduqda screen-i göstər
|
|
205
204
|
}
|
|
206
205
|
|
|
207
206
|
if (properties) {
|