iobroker.eos-admin 7.9.98 → 7.9.100

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 (57) hide show
  1. package/INSTALL_TEST_V7.9.100.md +11 -0
  2. package/MERGE_UPDATE_README_V7.9.100.md +5 -0
  3. package/NEXOWATT_EOS_BUILD_INFO.json +20 -20
  4. package/PUBLISH_STABLE_V7.9.100.md +15 -0
  5. package/README.md +6 -16
  6. package/README_STABILITY_V7.9.100.md +3 -0
  7. package/RELEASE_ACCEPTANCE_V7.9.100.md +11 -0
  8. package/RELEASE_NOTES_V7.9.100.md +11 -0
  9. package/adminWww/assets/Intro-DkwRiz1n-v84.js +2 -2
  10. package/adminWww/assets/bootstrap-COulQZax-v84.js +2 -2
  11. package/adminWww/css/eos-auto-update.css +4 -0
  12. package/adminWww/css/eos-ems-overview.css +3 -5
  13. package/adminWww/css/nexowatt-native-shell.css +26 -112
  14. package/adminWww/index.html +21 -18
  15. package/adminWww/js/eos-account-management.js +19 -28
  16. package/adminWww/js/eos-assistant.js +1 -1
  17. package/adminWww/js/eos-auto-update.js +78 -0
  18. package/adminWww/js/eos-ems-overview.js +2 -3
  19. package/adminWww/js/eos-release-watch.js +77 -0
  20. package/adminWww/js/eos-role-bootstrap.js +11 -8
  21. package/adminWww/js/eos-role-ui.js +2 -2
  22. package/adminWww/js/nexowatt-native-shell.js +1 -1
  23. package/adminWww/static/js/nexowatt-stable-login.js +3 -3
  24. package/adminWww/static/js/{nexowatt-stable-v98.js → nexowatt-stable-v100.js} +2 -2
  25. package/build/lib/eosAutoUpdate.js +43 -0
  26. package/build/lib/eosPassword.js +62 -0
  27. package/build/lib/eosRequestSecurity.js +31 -0
  28. package/build/lib/web.js +194 -151
  29. package/build/main.js +2 -1
  30. package/io-package.json +7 -11
  31. package/package.json +23 -13
  32. package/src/lib/eosAutoUpdate.ts +320 -0
  33. package/tools/nexowatt-account-management-selftest.cjs +19 -15
  34. package/tools/nexowatt-apply-ems-overview.cjs +2 -4
  35. package/tools/nexowatt-auto-update-selftest.cjs +34 -0
  36. package/tools/nexowatt-cache-update-selftest.cjs +12 -0
  37. package/tools/nexowatt-clean-legacy-runtime.cjs +1 -1
  38. package/tools/nexowatt-ems-overview-selftest.cjs +1 -1
  39. package/tools/nexowatt-login-layout-selftest.cjs +11 -11
  40. package/tools/nexowatt-merge-update-selftest.cjs +1 -1
  41. package/tools/nexowatt-modern-ui-selftest.cjs +2 -2
  42. package/tools/nexowatt-password-write-selftest.cjs +42 -44
  43. package/tools/nexowatt-request-security-selftest.cjs +11 -0
  44. package/tools/nexowatt-runtime-cleanup-selftest.cjs +6 -6
  45. package/tools/nexowatt-stable-v100-selftest.cjs +27 -0
  46. package/tools/nexowatt-sync-release-version.cjs +1 -42
  47. package/tools/nexowatt-ui-overview-runtime-selftest.cjs +3 -1
  48. package/tools/nexowatt-validate-package.cjs +23 -23
  49. package/tools/nexowatt-version-sync-selftest.cjs +1 -18
  50. package/INSTALL_TEST_V7.9.98.md +0 -39
  51. package/MERGE_UPDATE_README_V7.9.98.md +0 -29
  52. package/PUBLISH_STABLE_V7.9.98.md +0 -33
  53. package/README_STABILITY_V7.9.98.md +0 -22
  54. package/RELEASE_ACCEPTANCE_V7.9.98.md +0 -48
  55. package/RELEASE_NOTES_V7.9.98.md +0 -32
  56. package/tools/nexowatt-account-password-flow-selftest.cjs +0 -186
  57. package/tools/nexowatt-stable-v98-selftest.cjs +0 -14
package/build/lib/web.js CHANGED
@@ -21,6 +21,9 @@ const session = require("express-session");
21
21
  const bodyParser = require("body-parser");
22
22
  const cookieParser = require("cookie-parser");
23
23
  const iobroker_mcp_1 = require("iobroker.mcp");
24
+ const eosPassword_1 = require("./eosPassword");
25
+ const eosRequestSecurity_1 = require("./eosRequestSecurity");
26
+ const eosAutoUpdate_1 = require("./eosAutoUpdate");
24
27
  let AdapterStore;
25
28
  /** Content of a socket-io file */
26
29
  let socketIoFile;
@@ -713,54 +716,10 @@ class Web {
713
716
  }
714
717
  return { valid: true, password: value };
715
718
  }
716
- getEosPasswordUserName(userId) {
717
- const userName = String(userId || '').trim().replace(/^system\.user\./, '');
718
- if (!/^[A-Za-z0-9_.@-]+$/.test(userName)) {
719
- throw new Error('invalidPasswordTarget');
720
- }
721
- return userName;
722
- }
723
719
  async setEosUserPassword(userId, password) {
724
- // ioBroker's password API expects the account name, not the system.user.* object id.
725
- const userName = this.getEosPasswordUserName(userId);
726
- // The server-side Admin/Service context performs the controller password write, so managed
727
- // Installer and End User accounts do not need global users.write rights in the browser.
728
- const options = { user: EOS_PASSWORD_SERVICE_USER };
729
- if (typeof this.adapter.setPasswordAsync === 'function') {
730
- await this.adapter.setPasswordAsync(userName, password, options);
731
- }
732
- else if (typeof this.adapter.setPassword === 'function') {
733
- await new Promise((resolve, reject) => {
734
- this.adapter.setPassword?.(userName, password, options, error => (error ? reject(error) : resolve()));
735
- });
736
- }
737
- else {
738
- throw new Error('passwordApiUnavailable');
739
- }
740
- if (typeof this.adapter.checkPasswordAsync === 'function') {
741
- const result = await this.adapter.checkPasswordAsync(userName, password, options);
742
- const valid = Array.isArray(result) ? result[0] === true : result === true;
743
- if (!valid) {
744
- throw new Error('passwordVerificationFailed');
745
- }
746
- return;
747
- }
748
- const userObject = (await this.adapter.getForeignObjectAsync(userId));
749
- if (!String(userObject?.common?.password || '').trim()) {
750
- throw new Error('passwordWriteFailed');
751
- }
752
- }
753
- async updateEosAccountMetadata(userId, updater) {
754
- const userObject = (await this.adapter.getForeignObjectAsync(userId));
755
- if (!userObject) {
756
- throw new Error('userObjectUnavailableAfterPasswordChange');
757
- }
758
- const native = { ...(userObject.native || {}) };
759
- const account = { ...(native.nexowattEosAccount || {}) };
760
- native.nexowattEosAccount = account;
761
- updater(native, account);
762
- await this.adapter.extendForeignObjectAsync(userId, { native }, { user: EOS_PASSWORD_SERVICE_USER });
720
+ await (0, eosPassword_1.setEosUserPasswordWithVerification)(this.adapter, userId, password, EOS_PASSWORD_SERVICE_USER);
763
721
  }
722
+
764
723
  async destroyEosRequestSessions(req) {
765
724
  const token = this.readAccessTokenFromRequest(req);
766
725
  if (!token || typeof this.adapter.destroySession !== 'function') {
@@ -789,7 +748,11 @@ class Web {
789
748
  res.status(403).json({ error: 'passwordSetupNotAllowed' });
790
749
  return;
791
750
  }
792
- if (!this.isEosSameOriginWrite(req) || req.headers['x-nexowatt-eos-first-login'] !== '1') {
751
+ if (req.headers['x-nexowatt-eos-first-login'] !== '1') {
752
+ res.status(403).json({ error: 'invalidRequest' });
753
+ return;
754
+ }
755
+ if (!this.isEosSameOriginWrite(req)) {
793
756
  res.status(403).json({ error: 'invalidRequestOrigin' });
794
757
  return;
795
758
  }
@@ -808,24 +771,34 @@ class Web {
808
771
  return;
809
772
  }
810
773
  await this.setEosUserPassword(access.userId, validation.password);
774
+ const userObject = (await this.adapter.getForeignObjectAsync(access.userId));
775
+ if (!userObject) {
776
+ throw new Error('userObjectUnavailableAfterPasswordChange');
777
+ }
778
+ const native = { ...(userObject.native || {}) };
779
+ const account = { ...(native.nexowattEosAccount || {}) };
811
780
  const now = new Date().toISOString();
812
- await this.updateEosAccountMetadata(access.userId, (native, account) => {
813
- account.passwordInitialized = true;
814
- account.passwordInitializedAt = Date.now();
815
- account.passwordInitializationVersion = 1;
816
- account.passwordInitializedBy = 'self';
817
- account.passwordSetupVersion = 1;
818
- account.passwordSetAt = now;
819
- account.firstLoginCompletedAt = now;
820
- account.forcePasswordChange = false;
821
- account.passwordlessFirstLoginAllowed = false;
822
- native.nexowattPasswordChangeRequired = false;
823
- native.eosPasswordChangeRequired = false;
824
- native.nexowattFirstLoginPending = false;
825
- native.eosFirstLoginRequired = false;
826
- native.nexowattInitialPasswordApplied = false;
827
- native.nexowattPasswordChangedAt = now;
828
- });
781
+ account.passwordInitialized = true;
782
+ account.passwordInitializedAt = Date.now();
783
+ account.passwordInitializationVersion = 1;
784
+ account.passwordInitializedBy = 'self';
785
+ account.passwordSetupVersion = 1;
786
+ account.passwordSetAt = now;
787
+ account.firstLoginCompletedAt = now;
788
+ account.forcePasswordChange = false;
789
+ account.passwordlessFirstLoginAllowed = false;
790
+ native.nexowattEosAccount = account;
791
+ native.nexowattPasswordChangeRequired = false;
792
+ native.eosPasswordChangeRequired = false;
793
+ native.nexowattFirstLoginPending = false;
794
+ native.eosFirstLoginRequired = false;
795
+ native.nexowattInitialPasswordApplied = false;
796
+ native.nexowattPasswordChangedAt = now;
797
+ await this.adapter.extendForeignObjectAsync(access.userId, { native }, { user: EOS_PASSWORD_SERVICE_USER });
798
+ const persistedState = await this.getEosFirstLoginPasswordState(access.userId, access.role);
799
+ if (persistedState.required || !persistedState.initialized) {
800
+ throw new Error('passwordMetadataNotPersisted');
801
+ }
829
802
  await this.destroyEosRequestSessions(req);
830
803
  for (const cookie of ['access_token', 'refresh_token', 'connect.sid']) {
831
804
  res.clearCookie(cookie);
@@ -1049,25 +1022,29 @@ class Web {
1049
1022
  return;
1050
1023
  }
1051
1024
  await this.setEosUserPassword(claim.userId, validation.password);
1025
+ const user = (await this.adapter.getForeignObjectAsync(claim.userId));
1026
+ if (!user) {
1027
+ throw new Error('userObjectUnavailableAfterPasswordChange');
1028
+ }
1029
+ const native = { ...(user.native || {}) };
1030
+ const account = { ...(native.nexowattEosAccount || {}) };
1052
1031
  const now = new Date().toISOString();
1053
- await this.updateEosAccountMetadata(claim.userId, (native, account) => {
1054
- account.passwordInitialized = true;
1055
- account.passwordInitializedAt = Date.now();
1056
- account.passwordInitializationVersion = 1;
1057
- account.passwordInitializedBy = 'passwordless-first-activation';
1058
- account.passwordSetupVersion = 1;
1059
- account.passwordSetAt = now;
1060
- account.firstLoginCompletedAt = now;
1061
- account.forcePasswordChange = false;
1062
- account.passwordlessFirstLoginAllowed = false;
1063
- account.passwordlessClaimCompletedAt = now;
1064
- native.nexowattPasswordChangeRequired = false;
1065
- native.eosPasswordChangeRequired = false;
1066
- native.nexowattFirstLoginPending = false;
1067
- native.eosFirstLoginRequired = false;
1068
- native.nexowattInitialPasswordApplied = false;
1069
- native.nexowattPasswordChangedAt = now;
1070
- });
1032
+ account.passwordInitialized = true;
1033
+ account.passwordInitializedAt = Date.now();
1034
+ account.passwordInitializationVersion = 1;
1035
+ account.passwordInitializedBy = 'passwordless-first-activation';
1036
+ account.passwordSetupVersion = 1;
1037
+ account.passwordSetAt = now;
1038
+ account.firstLoginCompletedAt = now;
1039
+ account.forcePasswordChange = false;
1040
+ account.passwordlessFirstLoginAllowed = false;
1041
+ account.passwordlessClaimCompletedAt = now;
1042
+ native.nexowattEosAccount = account;
1043
+ native.nexowattPasswordChangeRequired = false;
1044
+ native.eosPasswordChangeRequired = false;
1045
+ native.nexowattFirstLoginPending = false;
1046
+ native.eosFirstLoginRequired = false;
1047
+ await this.adapter.extendForeignObjectAsync(claim.userId, { native }, { user: EOS_PASSWORD_SERVICE_USER });
1071
1048
  this.invalidateEosPasswordClaimsForUser(claim.userId);
1072
1049
  res.clearCookie('nexowatt_eos_first_login', { path: '/nexowatt/account' });
1073
1050
  this.adapter.log.info(`EOS passwordless first activation completed for ${claim.userId}`);
@@ -1134,10 +1111,14 @@ class Web {
1134
1111
  res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
1135
1112
  const access = await this.getEosRequestAccess(req);
1136
1113
  if (!access.userId || (access.role !== 'admin' && access.role !== 'installer')) {
1137
- res.status(403).json({ error: 'permissionError' });
1114
+ res.status(403).json({ error: 'permissionError', role: access.role });
1115
+ return;
1116
+ }
1117
+ if (req.headers['x-nexowatt-eos-account-reset'] !== '1') {
1118
+ res.status(403).json({ error: 'invalidRequest' });
1138
1119
  return;
1139
1120
  }
1140
- if (!this.isEosSameOriginWrite(req) || req.headers['x-nexowatt-eos-account-reset'] !== '1') {
1121
+ if (!this.isEosSameOriginWrite(req)) {
1141
1122
  res.status(403).json({ error: 'invalidRequestOrigin' });
1142
1123
  return;
1143
1124
  }
@@ -1146,19 +1127,12 @@ class Web {
1146
1127
  res.status(400).json({ error: 'invalidTarget' });
1147
1128
  return;
1148
1129
  }
1149
- const targetAccess = await this.getEosAccessForUserId(targetUserId);
1150
- const explicitInstaller = targetAccess.groups.some(group => this.getEosInstallerGroups().includes(group));
1151
- const explicitEndUser = targetAccess.groups.some(group => this.getEosEndUserGroups().includes(group));
1152
- const explicitlyManagedRole = explicitInstaller
1153
- ? 'installer'
1154
- : explicitEndUser
1155
- ? 'enduser'
1156
- : null;
1157
- if (targetAccess.role === 'admin'
1158
- || !explicitlyManagedRole
1159
- || (access.role === 'installer' && explicitlyManagedRole !== 'enduser')) {
1160
- // Never rely on the secure-default "enduser" classification for a password reset. The
1161
- // target must be an explicit member of a managed EOS installer/end-user group.
1130
+ const managedAccounts = await this.getEosManagedAccounts(access.role);
1131
+ const managedTarget = managedAccounts.find(account => account.id === targetUserId);
1132
+ const explicitlyManagedRole = managedTarget?.role === 'installer' || managedTarget?.role === 'enduser'
1133
+ ? managedTarget.role
1134
+ : null;
1135
+ if (!managedTarget || !explicitlyManagedRole) {
1162
1136
  res.status(403).json({ error: 'permissionError' });
1163
1137
  return;
1164
1138
  }
@@ -1172,26 +1146,36 @@ class Web {
1172
1146
  return;
1173
1147
  }
1174
1148
  await this.setEosUserPassword(targetUserId, 'nexowatt');
1149
+ const user = (await this.adapter.getForeignObjectAsync(targetUserId));
1150
+ if (!user) {
1151
+ throw new Error('userObjectUnavailableAfterPasswordReset');
1152
+ }
1153
+ const native = { ...(user.native || {}) };
1154
+ const account = { ...(native.nexowattEosAccount || {}) };
1175
1155
  const now = new Date().toISOString();
1176
- await this.updateEosAccountMetadata(targetUserId, (native, account) => {
1177
- account.passwordInitialized = false;
1178
- account.passwordSetupVersion = 0;
1179
- account.passwordInitializationVersion = 0;
1180
- account.forcePasswordChange = true;
1181
- account.passwordlessFirstLoginAllowed = false;
1182
- account.passwordResetAt = now;
1183
- account.passwordResetBy = access.userId;
1184
- account.passwordResetMode = 'initial-password';
1185
- account.passwordSetAt = null;
1186
- account.firstLoginCompletedAt = null;
1187
- native.nexowattPasswordChangeRequired = true;
1188
- native.eosPasswordChangeRequired = true;
1189
- native.nexowattFirstLoginPending = true;
1190
- native.eosFirstLoginRequired = true;
1191
- native.nexowattInitialPasswordApplied = true;
1192
- native.nexowattInitialPasswordVersion = 1;
1193
- native.nexowattStableInitialCredentialVersion = 1;
1194
- });
1156
+ account.passwordInitialized = false;
1157
+ account.passwordSetupVersion = 0;
1158
+ account.passwordInitializationVersion = 0;
1159
+ account.forcePasswordChange = true;
1160
+ account.passwordlessFirstLoginAllowed = false;
1161
+ account.passwordResetAt = now;
1162
+ account.passwordResetBy = access.userId;
1163
+ account.passwordResetMode = 'initial-password';
1164
+ native.nexowattEosAccount = account;
1165
+ native.nexowattPasswordChangeRequired = true;
1166
+ native.eosPasswordChangeRequired = true;
1167
+ native.nexowattFirstLoginPending = true;
1168
+ native.eosFirstLoginRequired = true;
1169
+ native.nexowattInitialPasswordApplied = true;
1170
+ native.nexowattInitialPasswordVersion = 1;
1171
+ native.nexowattStableInitialCredentialVersion = 1;
1172
+ delete account.passwordSetAt;
1173
+ delete account.firstLoginCompletedAt;
1174
+ await this.adapter.extendForeignObjectAsync(targetUserId, { native }, { user: EOS_PASSWORD_SERVICE_USER });
1175
+ const resetState = await this.getEosFirstLoginPasswordState(targetUserId, explicitlyManagedRole);
1176
+ if (!resetState.required || resetState.initialized) {
1177
+ throw new Error('passwordMetadataNotPersisted');
1178
+ }
1195
1179
  this.invalidateEosPasswordClaimsForUser(targetUserId);
1196
1180
  this.adapter.log.warn(`EOS account ${targetUserId} was reset to the mandatory initial-password flow by ${access.userId}`);
1197
1181
  res.status(200).json({
@@ -1267,26 +1251,42 @@ class Web {
1267
1251
  ],
1268
1252
  });
1269
1253
  }
1270
- isEosSameOriginWrite(req) {
1271
- const fetchSite = String(req.headers['sec-fetch-site'] || '').trim().toLowerCase();
1272
- if (fetchSite === 'cross-site') {
1273
- return false;
1254
+ getNexoWattStableUpdateManager() {
1255
+ this.nexowattStableUpdateManager ||= new eosAutoUpdate_1.NexoWattStableUpdateManager(this.adapter);
1256
+ return this.nexowattStableUpdateManager;
1257
+ }
1258
+ async sendNexoWattStableUpdateStatus(req, res) {
1259
+ const access = await this.getEosRequestAccess(req);
1260
+ if (access.role !== 'admin') {
1261
+ res.status(403).json({ error: 'permissionError' });
1262
+ return;
1274
1263
  }
1275
- const origin = String(req.headers.origin || '').trim();
1276
- if (!origin) {
1277
- return true;
1264
+ res.status(200).json(await this.getNexoWattStableUpdateManager().getStatus(false));
1265
+ }
1266
+ async saveNexoWattStableUpdateSettings(req, res) {
1267
+ const access = await this.getEosRequestAccess(req);
1268
+ if (access.role !== 'admin') {
1269
+ res.status(403).json({ error: 'permissionError' });
1270
+ return;
1278
1271
  }
1279
- try {
1280
- const originUrl = new URL(origin);
1281
- const directHost = String(req.headers.host || '').trim().toLowerCase();
1282
- const forwardedHost = String(req.headers['x-forwarded-host'] || '').split(',')[0].trim().toLowerCase();
1283
- const allowedHosts = new Set([directHost, forwardedHost].filter(Boolean));
1284
- return allowedHosts.has(originUrl.host.toLowerCase());
1272
+ if (req.headers['x-nexowatt-eos-auto-update'] !== '1') {
1273
+ res.status(403).json({ error: 'invalidRequest' });
1274
+ return;
1285
1275
  }
1286
- catch {
1287
- return false;
1276
+ if (!this.isEosSameOriginWrite(req)) {
1277
+ res.status(403).json({ error: 'invalidRequestOrigin' });
1278
+ return;
1279
+ }
1280
+ if (typeof req.body?.enabled !== 'boolean') {
1281
+ res.status(400).json({ error: 'invalidEnabledValue' });
1282
+ return;
1288
1283
  }
1284
+ res.status(200).json(await this.getNexoWattStableUpdateManager().setEnabled(req.body.enabled));
1285
+ }
1286
+ isEosSameOriginWrite(req) {
1287
+ return (0, eosRequestSecurity_1.isEosSameOriginRequest)(req.headers);
1289
1288
  }
1289
+
1290
1290
  async saveEosBasicSettings(req, res) {
1291
1291
  res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
1292
1292
  const access = await this.getEosRequestAccess(req);
@@ -1516,7 +1516,25 @@ class Web {
1516
1516
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
1517
1517
  next();
1518
1518
  });*/
1519
+ void this.getNexoWattStableUpdateManager().start().catch(error => {
1520
+ this.adapter.log.warn(`[NexoWatt stable updates] Startup reconciliation failed: ${error instanceof Error ? error.message : error}`);
1521
+ });
1522
+ this.server.app.get('/nexowatt/updates/status', (req, res) => {
1523
+ void this.sendNexoWattStableUpdateStatus(req, res).catch(error => {
1524
+ this.adapter.log.warn(`[NexoWatt stable updates] Cannot read status: ${error instanceof Error ? error.message : error}`);
1525
+ res.status(500).json({ error: 'autoUpdateStatusFailed' });
1526
+ });
1527
+ });
1528
+ this.server.app.post('/nexowatt/updates/settings', (req, res) => {
1529
+ void this.saveNexoWattStableUpdateSettings(req, res).catch(error => {
1530
+ this.adapter.log.warn(`[NexoWatt stable updates] Cannot save settings: ${error instanceof Error ? error.message : error}`);
1531
+ res.status(500).json({ error: 'autoUpdateSettingsFailed' });
1532
+ });
1533
+ });
1519
1534
  this.server.app.get('/version', (_req, res) => {
1535
+ res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
1536
+ res.setHeader('Pragma', 'no-cache');
1537
+ res.setHeader('Expires', '0');
1520
1538
  res.status(200).send(this.adapter.version);
1521
1539
  });
1522
1540
  // v36: Repair stale/broken URLs generated by older EOS hard-logout builds.
@@ -1795,8 +1813,13 @@ class Web {
1795
1813
  });
1796
1814
  this.server.app.post('/nexowatt/account/first-password', (req, res) => {
1797
1815
  void this.saveEosFirstLoginPassword(req, res).catch(e => {
1798
- this.adapter.log.warn(`Cannot initialize EOS first-login password: ${e instanceof Error ? e.message : e}`);
1799
- res.status(500).json({ error: 'passwordSetupFailed' });
1816
+ const detail = e instanceof Error ? e.message : String(e || '');
1817
+ this.adapter.log.warn(`Cannot initialize EOS first-login password: ${detail}`);
1818
+ const known = new Set([
1819
+ 'passwordApiUnavailable', 'passwordNotPersisted', 'passwordVerificationFailed',
1820
+ 'passwordMetadataNotPersisted', 'userObjectUnavailableAfterPasswordChange',
1821
+ ]);
1822
+ res.status(500).json({ error: known.has(detail) ? detail : 'passwordSetupFailed' });
1800
1823
  });
1801
1824
  });
1802
1825
  this.server.app.get('/nexowatt/account/manage', (req, res) => {
@@ -1807,8 +1830,13 @@ class Web {
1807
1830
  });
1808
1831
  this.server.app.post('/nexowatt/account/reset', (req, res) => {
1809
1832
  void this.resetEosAccountPassword(req, res).catch(e => {
1810
- this.adapter.log.warn(`Cannot reset EOS account: ${e instanceof Error ? e.message : e}`);
1811
- res.status(500).json({ error: 'accountResetFailed' });
1833
+ const detail = e instanceof Error ? e.message : String(e || '');
1834
+ this.adapter.log.warn(`Cannot reset EOS account: ${detail}`);
1835
+ const known = new Set([
1836
+ 'passwordApiUnavailable', 'passwordNotPersisted', 'passwordVerificationFailed',
1837
+ 'passwordMetadataNotPersisted', 'userObjectUnavailableAfterPasswordReset',
1838
+ ]);
1839
+ res.status(500).json({ error: known.has(detail) ? detail : 'accountResetFailed' });
1812
1840
  });
1813
1841
  });
1814
1842
  this.server.app.get('/iobroker_check.html', (_req, res) => {
@@ -1935,7 +1963,29 @@ class Web {
1935
1963
  res.status(404).send(get404Page(`File ${escapeHtml(fileName)} not found`));
1936
1964
  }
1937
1965
  });
1938
- const appOptions = {};
1966
+ const isEosCurrentAsset = (pathName) => pathName === '/'
1967
+ || pathName === '/index.html'
1968
+ || pathName === '/manifest.json'
1969
+ || pathName === '/mf-manifest.json'
1970
+ || pathName === '/version'
1971
+ || /^\/(?:js|css)\/(?:eos-|nexowatt-)/.test(pathName)
1972
+ || /^\/static\/js\/nexowatt-stable-v\d+\.js$/.test(pathName)
1973
+ || /^\/remoteEntry(?:-v\d+)?\.js$/.test(pathName)
1974
+ || /^\/assets\/(?:bootstrap|hostInit|Intro|index-CQZugZ1z|index-D2ymscJA|iobroker_admin__mf_v__runtimeInit__mf_v__)-[^/]+\.js$/.test(pathName);
1975
+ const applyNoStoreHeaders = (res) => {
1976
+ res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
1977
+ res.setHeader('Pragma', 'no-cache');
1978
+ res.setHeader('Expires', '0');
1979
+ res.setHeader('Surrogate-Control', 'no-store');
1980
+ };
1981
+ const appOptions = {
1982
+ setHeaders: (res, filePath) => {
1983
+ const raw = filePath.startsWith(this.wwwDir) ? filePath.slice(this.wwwDir.length) : filePath;
1984
+ const relativePath = `/${raw.replace(/\\/g, '/').replace(/^\/+/, '')}`;
1985
+ if (isEosCurrentAsset(relativePath))
1986
+ applyNoStoreHeaders(res);
1987
+ },
1988
+ };
1939
1989
  if (this.settings.cache) {
1940
1990
  appOptions.maxAge = 30_758_400_000;
1941
1991
  }
@@ -2033,31 +2083,24 @@ class Web {
2033
2083
  this.server.app.get('/empty.html', (_req, res) => {
2034
2084
  res.status(200).send('');
2035
2085
  });
2036
- // Stability release: entrypoints and module-federation manifests must always
2037
- // revalidate. Hashed leaf assets remain cacheable through express.static.
2086
+ // EOS entrypoints, overlays and patched module bundles must never be reused
2087
+ // from a previous release. Hashed untouched leaf assets may remain cacheable.
2038
2088
  this.server.app.use((req, res, next) => {
2039
2089
  const pathName = req.path || req.url.split('?')[0];
2040
- if (pathName === '/'
2041
- || pathName === '/index.html'
2042
- || pathName === '/mf-manifest.json'
2043
- || /^\/remoteEntry(?:-v\d+)?\.js$/.test(pathName)
2044
- || /^\/assets\/(?:hostInit|index-CQZugZ1z)-[^/]+\.js$/.test(pathName)) {
2045
- res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
2046
- res.setHeader('Pragma', 'no-cache');
2047
- res.setHeader('Expires', '0');
2048
- }
2090
+ if (isEosCurrentAsset(pathName))
2091
+ applyNoStoreHeaders(res);
2049
2092
  next();
2050
2093
  });
2051
2094
  this.server.app.get('/index.html', async (_req, res) => {
2052
- this.indexHTML ||= await this.prepareIndex('/index.html');
2095
+ this.indexHTML = await this.prepareIndex('/index.html');
2053
2096
  res.header('Content-Type', 'text/html');
2054
- res.header('Cache-Control', 'no-cache');
2097
+ applyNoStoreHeaders(res);
2055
2098
  res.status(200).send(this.indexHTML);
2056
2099
  });
2057
2100
  this.server.app.get('/', async (_req, res) => {
2058
- this.indexHTML ||= await this.prepareIndex('/index.html');
2101
+ this.indexHTML = await this.prepareIndex('/index.html');
2059
2102
  res.header('Content-Type', 'text/html');
2060
- res.header('Cache-Control', 'no-cache');
2103
+ applyNoStoreHeaders(res);
2061
2104
  res.status(200).send(this.indexHTML);
2062
2105
  });
2063
2106
  this.server.app.use('/', express.static(this.wwwDir, appOptions));
package/build/main.js CHANGED
@@ -20,6 +20,7 @@ const socket_classes_1 = require("@iobroker/socket-classes");
20
20
  const ws_server_1 = require("@iobroker/ws-server");
21
21
  const translations_1 = require("./lib/translations");
22
22
  const web_1 = require("./lib/web");
23
+ const eosPassword_1 = require("./lib/eosPassword");
23
24
  const checkLinuxPass_1 = require("./lib/checkLinuxPass");
24
25
  const plugin_docker_1 = require("@iobroker/plugin-docker");
25
26
  const objectFixes_1 = require("./lib/objectFixes");
@@ -1152,7 +1153,7 @@ class Admin extends adapter_core_1.Adapter {
1152
1153
  }
1153
1154
  if (String(user.common.password || '') === '') {
1154
1155
  const bootstrapSecret = `${(0, node_crypto_1.randomBytes)(48).toString('base64url')}!aA1`;
1155
- await this.setPasswordAsync(userId.replace(/^system\.user\./, ''), bootstrapSecret, { user: ADMIN_OWNER_USER });
1156
+ await (0, eosPassword_1.setEosUserPasswordWithVerification)(this, userId, bootstrapSecret, ADMIN_OWNER_USER);
1156
1157
  user = (await this.getForeignObjectAsync(userId));
1157
1158
  if (!user) {
1158
1159
  return;
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "eos-admin",
4
- "version": "7.9.98",
4
+ "version": "7.9.100",
5
5
  "titleLang": {
6
6
  "en": "NexoWatt EOS Admin",
7
7
  "de": "NexoWatt EOS Admin",
@@ -18,11 +18,6 @@
18
18
  "connectionType": "local",
19
19
  "dataSource": "push",
20
20
  "news": {
21
- "7.9.98": {
22
- "de": "Stable-Kandidat 7.9.98 ergänzt den vertikalen Cockpit-Scrollbereich, bereinigt die Login-Felder und korrigiert Passwort-Reset sowie persönliche Erstpasswortvergabe über die echte ioBroker-Passwort-API.",
23
- "en": "Stable candidate 7.9.98 adds vertical cockpit scrolling, cleans up login fields and fixes password reset plus first personal password setup through the real ioBroker password API.",
24
- "nl": "Stable-kandidaat 7.9.98 voegt verticaal scrollen in het cockpit toe, herstelt de loginvelden en corrigeert wachtwoordreset en het eerste persoonlijke wachtwoord via de echte ioBroker-wachtwoord-API."
25
- },
26
21
  "7.9.95": {
27
22
  "de": "Stable 7.9.95 macht den Release-Ordner mergesicher: Die flache Update-ZIP kann direkt über einen bestehenden Arbeitsordner entpackt werden. Vor Paketprüfung und npm-Veröffentlichung werden package.json, io-package.json, beide Lockdateien, die Frontend-Version, Build-Informationen und der aktuelle Repository-Eintrag automatisch auf dieselbe Version gebracht. Dadurch wird insbesondere ein stehen gebliebenes io-package.json aus 7.9.92/7.9.94 automatisch repariert. Die Funktionen aus 7.9.94 bleiben unverändert.",
28
23
  "en": "Stable 7.9.95 makes the release folder merge-safe: the flat update ZIP can be extracted directly over an existing working directory. Before package validation and npm publishing, package.json, io-package.json, both lockfiles, the frontend version, build information and the current repository entry are synchronized automatically. In particular, a stale io-package.json from 7.9.92/7.9.94 is repaired automatically. Functional behavior from 7.9.94 remains unchanged.",
@@ -334,7 +329,7 @@
334
329
  "icon": "admin.svg",
335
330
  "messagebox": true,
336
331
  "enabled": true,
337
- "extIcon": "https://unpkg.com/iobroker.eos-admin@7.9.98/admin/admin.svg",
332
+ "extIcon": "https://unpkg.com/iobroker.eos-admin@7.9.100/admin/admin.svg",
338
333
  "keywords": [
339
334
  "NexoWatt",
340
335
  "EOS",
@@ -345,7 +340,7 @@
345
340
  "licensed"
346
341
  ],
347
342
  "compact": true,
348
- "readme": "https://unpkg.com/iobroker.eos-admin@7.9.98/README.md",
343
+ "readme": "https://unpkg.com/iobroker.eos-admin@7.9.100/README.md",
349
344
  "authors": [
350
345
  "NexoWatt"
351
346
  ],
@@ -413,7 +408,7 @@
413
408
  "nondeletable": false,
414
409
  "allowAdapterUpdate": true,
415
410
  "allowAdapterDelete": false,
416
- "meta": "https://unpkg.com/iobroker.eos-admin@7.9.98/io-package.json",
411
+ "meta": "https://unpkg.com/iobroker.eos-admin@7.9.100/io-package.json",
417
412
  "npmPackage": "iobroker.eos-admin",
418
413
  "packetName": "iobroker.eos-admin",
419
414
  "publisher": "NexoWatt"
@@ -554,7 +549,8 @@
554
549
  "eosAllowPasswordlessFirstLogin": false,
555
550
  "eosRequireFirstLoginPasswordChange": true,
556
551
  "eosAutoAssignStandardAccounts": true,
557
- "eosAssistEnabled": false
552
+ "eosAssistEnabled": false,
553
+ "eosNexoWattAutoUpdate": true
558
554
  },
559
555
  "notifications": [
560
556
  {
@@ -1122,5 +1118,5 @@
1122
1118
  }
1123
1119
  }
1124
1120
  },
1125
- "version": "7.9.98"
1121
+ "version": "7.9.100"
1126
1122
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iobroker.eos-admin",
3
- "description": "NexoWatt EOS Admin – stable sales candidate with scrollable cockpit, clean login and verified account password writes.",
4
- "version": "7.9.98",
3
+ "description": "NexoWatt EOS Admin – stable sales release with native automatic NexoWatt Stable adapter updates.",
4
+ "version": "7.9.100",
5
5
  "contributors": [
6
6
  "bluefox <dogafox@gmail.com>",
7
7
  "apollon77",
@@ -118,21 +118,27 @@
118
118
  "tools/nexowatt-version-sync-selftest.cjs",
119
119
  "tools/nexowatt-merge-update-selftest.cjs",
120
120
  "tools/nexowatt-ems-overview-selftest.cjs",
121
- "README_STABILITY_V7.9.98.md",
122
- "RELEASE_NOTES_V7.9.98.md",
123
- "PUBLISH_STABLE_V7.9.98.md",
124
- "INSTALL_TEST_V7.9.98.md",
125
- "RELEASE_ACCEPTANCE_V7.9.98.md",
126
- "MERGE_UPDATE_README_V7.9.98.md",
121
+ "README_STABILITY_V7.9.100.md",
122
+ "RELEASE_NOTES_V7.9.100.md",
123
+ "PUBLISH_STABLE_V7.9.100.md",
124
+ "INSTALL_TEST_V7.9.100.md",
125
+ "RELEASE_ACCEPTANCE_V7.9.100.md",
126
+ "MERGE_UPDATE_README_V7.9.100.md",
127
127
  "README_EMS_OVERVIEW_MERGE.md",
128
128
  "RC73_EOS_ADMIN_MERGE_VALIDATION.md",
129
129
  "VALIDATION_EMS_OVERVIEW_MERGE.md",
130
130
  "NexoWatt_EOS_Admin_EMS_OVERVIEW_MERGE_VALIDATION.md",
131
131
  "tools/nexowatt-apply-ems-overview.cjs",
132
132
  "tools/nexowatt-ui-overview-runtime-selftest.cjs",
133
- "tools/nexowatt-stable-v98-selftest.cjs",
133
+ "tools/nexowatt-stable-v100-selftest.cjs",
134
134
  "tools/nexowatt-password-write-selftest.cjs",
135
- "tools/nexowatt-account-password-flow-selftest.cjs"
135
+ "tools/nexowatt-request-security-selftest.cjs",
136
+ "tools/nexowatt-cache-update-selftest.cjs",
137
+ "src/lib/eosAutoUpdate.ts",
138
+ "build/lib/eosAutoUpdate.js",
139
+ "adminWww/js/eos-auto-update.js",
140
+ "adminWww/css/eos-auto-update.css",
141
+ "tools/nexowatt-auto-update-selftest.cjs"
136
142
  ],
137
143
  "scripts": {
138
144
  "npm": "npm i -f && cd src-admin && npm i -f",
@@ -167,7 +173,7 @@
167
173
  "nexowatt:repo-entry": "node tools/nexowatt-generate-repo-entry.cjs",
168
174
  "nexowatt:patch-repo": "node tools/nexowatt-patch-repo.cjs",
169
175
  "nexowatt:repair-update": "node tools/nexowatt-repair-eos-admin-update.cjs",
170
- "check:eos-stability": "node tools/nexowatt-stability-check.cjs && node tools/nexowatt-esm-syntax-selftest.cjs && node tools/nexowatt-import-integrity-selftest.cjs && node tools/nexowatt-entrypoint-smoke-selftest.cjs && node tools/nexowatt-frontend-graph-check.cjs && node tools/nexowatt-policy-selftest.cjs && node tools/nexowatt-publish-channel-selftest.cjs && node tools/nexowatt-release-defaults-selftest.cjs && node tools/nexowatt-role-access-selftest.cjs && node tools/nexowatt-internal-reserve-selftest.cjs && node tools/nexowatt-first-login-selftest.cjs && node tools/nexowatt-account-management-selftest.cjs && node tools/nexowatt-modern-ui-selftest.cjs && node tools/nexowatt-login-layout-selftest.cjs && node tools/nexowatt-branding-selftest.cjs && node tools/nexowatt-default-port-selftest.cjs && node tools/nexowatt-module-popup-selftest.cjs && node tools/nexowatt-datapoint-selftest.cjs && node tools/nexowatt-update-selftest.cjs && node tools/nexowatt-datapoint-interaction-selftest.cjs && node tools/nexowatt-manual-write-policy-selftest.cjs && node tools/nexowatt-value-column-selftest.cjs && node tools/nexowatt-native-shell-selftest.cjs && node tools/nexowatt-assistant-separation-selftest.cjs && node tools/nexowatt-runtime-cleanup-selftest.cjs && node tools/nexowatt-version-sync-selftest.cjs && node tools/nexowatt-merge-update-selftest.cjs && node tools/nexowatt-password-write-selftest.cjs && node tools/nexowatt-account-password-flow-selftest.cjs && npm run check:eos-stable-v98 && node tools/nexowatt-ems-overview-selftest.cjs && node tools/nexowatt-ui-overview-runtime-selftest.cjs",
176
+ "check:eos-stability": "node tools/nexowatt-stability-check.cjs && node tools/nexowatt-esm-syntax-selftest.cjs && node tools/nexowatt-import-integrity-selftest.cjs && node tools/nexowatt-entrypoint-smoke-selftest.cjs && node tools/nexowatt-frontend-graph-check.cjs && node tools/nexowatt-policy-selftest.cjs && node tools/nexowatt-publish-channel-selftest.cjs && node tools/nexowatt-release-defaults-selftest.cjs && node tools/nexowatt-role-access-selftest.cjs && node tools/nexowatt-internal-reserve-selftest.cjs && node tools/nexowatt-first-login-selftest.cjs && node tools/nexowatt-account-management-selftest.cjs && node tools/nexowatt-cache-update-selftest.cjs && node tools/nexowatt-request-security-selftest.cjs && node tools/nexowatt-password-write-selftest.cjs && node tools/nexowatt-modern-ui-selftest.cjs && node tools/nexowatt-login-layout-selftest.cjs && node tools/nexowatt-branding-selftest.cjs && node tools/nexowatt-default-port-selftest.cjs && node tools/nexowatt-module-popup-selftest.cjs && node tools/nexowatt-datapoint-selftest.cjs && node tools/nexowatt-update-selftest.cjs && node tools/nexowatt-datapoint-interaction-selftest.cjs && node tools/nexowatt-manual-write-policy-selftest.cjs && node tools/nexowatt-value-column-selftest.cjs && node tools/nexowatt-native-shell-selftest.cjs && node tools/nexowatt-assistant-separation-selftest.cjs && node tools/nexowatt-runtime-cleanup-selftest.cjs && node tools/nexowatt-version-sync-selftest.cjs && node tools/nexowatt-merge-update-selftest.cjs && npm run check:eos-stable-v100 && node tools/nexowatt-ems-overview-selftest.cjs && node tools/nexowatt-ui-overview-runtime-selftest.cjs",
171
177
  "nexowatt:patch-built-frontend": "node tools/nexowatt-patch-built-frontend.cjs",
172
178
  "clean:eos-runtime": "node tools/nexowatt-clean-legacy-runtime.cjs",
173
179
  "precheck:eos-package": "npm run sync:eos-version && npm run prepare:eos-release-defaults && npm run clean:eos-runtime",
@@ -191,7 +197,11 @@
191
197
  "sync:eos-version": "node tools/nexowatt-sync-release-version.cjs",
192
198
  "test:eos-version-sync": "node tools/nexowatt-version-sync-selftest.cjs",
193
199
  "verify:eos-merge": "node tools/nexowatt-merge-update-selftest.cjs",
194
- "check:eos-stable-v98": "node tools/nexowatt-stable-v98-selftest.cjs"
200
+ "test:eos-password-write": "node tools/nexowatt-password-write-selftest.cjs",
201
+ "test:eos-request-security": "node tools/nexowatt-request-security-selftest.cjs",
202
+ "test:eos-cache-update": "node tools/nexowatt-cache-update-selftest.cjs",
203
+ "check:eos-stable-v100": "node tools/nexowatt-stable-v100-selftest.cjs",
204
+ "check:eos-auto-update": "node tools/nexowatt-auto-update-selftest.cjs"
195
205
  },
196
206
  "author": "NexoWatt",
197
207
  "private": false,
@@ -202,7 +212,7 @@
202
212
  },
203
213
  "nexowattReleasePolicy": {
204
214
  "distTag": "latest",
205
- "purpose": "accepted stable NexoWatt EOS sales-product release 7.9.98"
215
+ "purpose": "accepted stable NexoWatt EOS sales-product release 7.9.100"
206
216
  },
207
217
  "publisher": "NexoWatt"
208
218
  }