iobroker.eos-admin 8.0.0 → 8.0.2
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/NEXOWATT_EOS_BUILD_INFO.json +7 -6
- package/NEXOWATT_EOS_PREBUILT_MANIFEST.json +195 -107
- package/START_HERE_8.0.1.md +36 -0
- package/START_HERE_8.0.2.md +41 -0
- package/adminWww/.vite/manifest.json +278 -278
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +333 -329
- package/adminWww/assets/{AccessTime-Dpa6PKHY.js → AccessTime-5f47qrw7.js} +1 -1
- package/adminWww/assets/{AceEditor-DTzNaeVy.js → AceEditor-CJ-_Ev2E.js} +1 -1
- package/adminWww/assets/{AdapterUpdateDialog-B3y8RL_5.js → AdapterUpdateDialog-QwlPbETd.js} +3 -3
- package/adminWww/assets/Adapters-gKngfaOu.js +7 -0
- package/adminWww/assets/{AdminUtils-DDT_kD8H.js → AdminUtils-CopxRJZ2.js} +1 -1
- package/adminWww/assets/{Apps-C8LE9l6Z.js → Apps-BKnx1gzD.js} +1 -1
- package/adminWww/assets/{Book-QmHxDaHb.js → Book-DrhneQH0.js} +1 -1
- package/adminWww/assets/{Cached-f77QQBQD.js → Cached-XJmxLN4E.js} +1 -1
- package/adminWww/assets/{Computer-DFIUq-fL.js → Computer-DDMBRY5r.js} +1 -1
- package/adminWww/assets/{Config-BZDUILCW.js → Config-BwTa1LdH.js} +1 -1
- package/adminWww/assets/{ConfigManager-CFuOc_kb.js → ConfigManager-DYwC4yq9.js} +1 -1
- package/adminWww/assets/{CustomModal-B8vdCRn1.js → CustomModal-DjI4oCb8.js} +1 -1
- package/adminWww/assets/{CustomTab-DSPqif6P.js → CustomTab-_HYUrXsZ.js} +1 -1
- package/adminWww/assets/{DeleteForever-BnEM-6_v.js → DeleteForever-Caoe64_y.js} +1 -1
- package/adminWww/assets/EasyMode-CCRqFtQq.js +1 -0
- package/adminWww/assets/Enums-BTurn3-x.js +92 -0
- package/adminWww/assets/{Extension-DU1jqvic.js → Extension-D-tNJv4S.js} +1 -1
- package/adminWww/assets/{Fields-DnckPMA8.js → Fields-C2Bn4V04.js} +1 -1
- package/adminWww/assets/{Files-CwUHx0pF.js → Files-XdmhxGOR.js} +1 -1
- package/adminWww/assets/Hosts-DiTMe9fw.js +120 -0
- package/adminWww/assets/{InfoOutlined-l86Si1qa.js → InfoOutlined-DIGDQvu6.js} +1 -1
- package/adminWww/assets/Instances-DA6FIgRs.js +4 -0
- package/adminWww/assets/Intro-CJpwLg8Q.js +2 -0
- package/adminWww/assets/{KeyboardArrowRight-zZUJhG9e.js → KeyboardArrowRight-DVPBjTKi.js} +1 -1
- package/adminWww/assets/Logs-CA0mEMlO.js +2 -0
- package/adminWww/assets/{MoreHoriz-CR2kD-dc.js → MoreHoriz-BYaCptH0.js} +1 -1
- package/adminWww/assets/Objects-B2IC3Bce.js +301 -0
- package/adminWww/assets/{Overview-WwP6FjK-.js → Overview-HG8fAMFM.js} +2 -2
- package/adminWww/assets/{Pageview-DBITLOzI.js → Pageview-DFHddrKX.js} +1 -1
- package/adminWww/assets/{PersonOff-ANdO5Nu4.js → PersonOff-BwYQLD1M.js} +1 -1
- package/adminWww/assets/{PushPinOutlined-DvxsqPHo.js → PushPinOutlined-CEBeTmNm.js} +1 -1
- package/adminWww/assets/Remove-BPxvNccW.js +1 -0
- package/adminWww/assets/{Schedule-BMMrgd7j.js → Schedule-BQlh1nhQ.js} +1 -1
- package/adminWww/assets/{Star-DNdm064z.js → Star-ChMjBwLn.js} +1 -1
- package/adminWww/assets/State-UGfoS6qW.js +1 -0
- package/adminWww/assets/Storage-DrC3j-wf.js +1 -0
- package/adminWww/assets/{TextSnippet-Bywi1YuG.js → TextSnippet-BQ4TSmvS.js} +1 -1
- package/adminWww/assets/{Timeline-IQCnSLiw.js → Timeline-CEyldmz2.js} +1 -1
- package/adminWww/assets/{Timer-Be9yF62g.js → Timer-I0twtyWh.js} +1 -1
- package/adminWww/assets/{UnfoldMore-Du7-8wYn.js → UnfoldMore-_DDSfPKk.js} +1 -1
- package/adminWww/assets/{Usb-Ca47vqRv.js → Usb-Dwk7qdYu.js} +1 -1
- package/adminWww/assets/{UsedResources-CMTzFOX3.js → UsedResources-B6HWeXGX.js} +2 -2
- package/adminWww/assets/Users-DFeYuC5y.js +1 -0
- package/adminWww/assets/{ViewCompact-C3SC0jFF.js → ViewCompact-BbfomOIi.js} +1 -1
- package/adminWww/assets/ViewList-1pB5VinA.js +1 -0
- package/adminWww/assets/{ViewSidebar-kHvah-XS.js → ViewSidebar-DdedDirX.js} +1 -1
- package/adminWww/assets/{VpnKey-iMA7KrB-.js → VpnKey-o8QeqmnU.js} +1 -1
- package/adminWww/assets/{WifiTethering-Da8nW7Do.js → WifiTethering-Cp63fmkC.js} +1 -1
- package/adminWww/assets/{_virtual_mf-localSharedImportMap___mfe_internal__iobroker_admin__mf_owner__1-CpelrCgN.js → _virtual_mf-localSharedImportMap___mfe_internal__iobroker_admin__mf_owner__1-uaKFfE5p.js} +1 -1
- package/adminWww/assets/{bootstrap-Bs4TZ7iA.js → bootstrap-DSDOwKWU.js} +33 -33
- package/adminWww/assets/{date-fns-Bpgjk9P-.js → date-fns-ukillHs-.js} +1 -1
- package/adminWww/assets/helpers-CDcY0YJ-.js +1 -0
- package/adminWww/assets/{hostInit-2xIZYDSq.js → hostInit-Cd61hJHh.js} +1 -1
- package/adminWww/assets/{icons-material-BLgrEUSv.js → icons-material-Dms1APQk.js} +1 -1
- package/adminWww/assets/{index-BZifaJHi.js → index-D6uhIclX.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-Pe6-VnD2.js → installSVGRenderer-BR-zIijZ.js} +1 -1
- package/adminWww/assets/{lib-CE1B3iHH.js → lib-BZRGBDoe.js} +2 -2
- package/adminWww/assets/{loadShare-eager-CRNcc8D7.js → loadShare-eager-BpwDZfDr.js} +93 -93
- package/adminWww/assets/{mf-entry-bootstrap-0-a6a54377.js → mf-entry-bootstrap-0-2d631020.js} +3 -3
- package/adminWww/assets/{pendingShares-CuQbFsaK.js → pendingShares-D1Vr_qYv.js} +2 -2
- package/adminWww/assets/{sentry-B4uGc7ut.js → sentry-BFzW-2KQ.js} +1 -1
- package/adminWww/assets/{setYear-DurmWw03.js → setYear-DhVdgUBF.js} +1 -1
- package/adminWww/css/nexowatt-native-shell.css +72 -0
- package/adminWww/index.html +21 -21
- package/adminWww/js/eos-license-link.js +9 -16
- package/adminWww/js/nexowatt-native-shell.js +2 -2
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-8.0.0.js → remoteEntry-eos-8.0.2.js} +2 -2
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosSessionSecurity.js +12 -4
- package/build/lib/eosSessionSecurity.js.map +1 -1
- package/build/lib/vendor/webserver/LICENSE +21 -0
- package/build/lib/vendor/webserver/README.md +506 -0
- package/build/lib/vendor/webserver/build/index.d.ts +9 -0
- package/build/lib/vendor/webserver/build/index.js +42 -0
- package/build/lib/vendor/webserver/build/index.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.d.ts +65 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js +149 -0
- package/build/lib/vendor/webserver/build/lib/acmeChallenge.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.d.ts +60 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js +128 -0
- package/build/lib/vendor/webserver/build/lib/certificateManager.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.d.ts +21 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js +109 -0
- package/build/lib/vendor/webserver/build/lib/http2Compat.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.d.ts +167 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js +619 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.d.ts +92 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js +230 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-clients.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.d.ts +84 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js +388 -0
- package/build/lib/vendor/webserver/build/lib/oauth2-model.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.d.ts +75 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js +625 -0
- package/build/lib/vendor/webserver/build/lib/oauth2.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.d.ts +6 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js +96 -0
- package/build/lib/vendor/webserver/build/lib/securityChecker.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.d.ts +62 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js +231 -0
- package/build/lib/vendor/webserver/build/lib/usedResources.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/utils.d.ts +35 -0
- package/build/lib/vendor/webserver/build/lib/utils.js +110 -0
- package/build/lib/vendor/webserver/build/lib/utils.js.map +1 -0
- package/build/lib/vendor/webserver/build/lib/webServer.d.ts +164 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js +454 -0
- package/build/lib/vendor/webserver/build/lib/webServer.js.map +1 -0
- package/build/lib/vendor/webserver/package.json +63 -0
- package/build/lib/web.js +26 -6
- package/build/lib/web.js.map +1 -1
- package/docs/ADMIN8_MIGRATION_8.0.0_DE.md +4 -0
- package/docs/cra/CRA_IEC_GAP_ANALYSIS_2026-09-30.md +10 -0
- package/docs/security/admin8-2026-11-04/development-1.log +4 -4
- package/docs/security/admin8-2026-11-04/development-2.log +275 -233
- package/docs/security/admin8-2026-11-05/copy-update/evidence-sha256.json +0 -5
- package/docs/security/admin8-2026-11-05/login-fix/BACKEND_DIAGNOSE_DE.md +48 -0
- package/docs/security/admin8-2026-11-05/login-fix/REPORT_DE.md +47 -0
- package/docs/security/admin8-2026-11-05/login-fix/REVIEW_DE.md +7 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-adapter-api.ts.txt +122 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-file-view.ts.txt +75 -0
- package/docs/security/admin8-2026-11-05/login-fix/controller-redis-view.ts.txt +471 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/LICENSE-webserver-3.4.0 +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/REPORT_DE.md +41 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/evidence-sha256.json +116 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/http-consumer-check.cjs +58 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/README_DE.md +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.provenance.json +263 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/admission.log +16 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit-stderr.log +1 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-1.0.0.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-package.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm10-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm11-package-lock.json +387 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/evidence-sha256.json +85 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm10-node22.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm11-node24.json +11 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/local-tests.json +38 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node22.log +168 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node24.log +36 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node22.log +224 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node24.log +42 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests.json +31 -0
- package/docs/security/admin8-2026-11-05/login-fix/dependency/webserver-3.4.0-upstream.tgz +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/eos-session-8.0.0.js.txt +385 -0
- package/docs/security/admin8-2026-11-05/login-fix/evidence-sha256.json +59 -0
- package/docs/security/admin8-2026-11-05/login-fix/path-budget.json +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/provenance.json +51 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/admission.log +21 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/archive-scan.json +13 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/artifacts.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/backend-build.log +5 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/consumer-package-lock.json +3258 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/copy-update-journal.json +165 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/development.log +365 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/frontend-build.log +149 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-final-install-node22.log +9 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.stderr +2 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.json +15 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.stderr +0 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/inventory.log +8 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.json +7809 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.stderr +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.json +10213 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.stderr +282 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/pipeline.json +72 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/seal.log +6 -0
- package/docs/security/admin8-2026-11-05/login-fix/release/vendor-final-review-node24.log +18 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduce.cjs +79 -0
- package/docs/security/admin8-2026-11-05/login-fix/reproduction.json +80 -0
- package/docs/security/admin8-2026-11-05/login-fix/upstream-LICENSE.txt +22 -0
- package/docs/security/admin8-2026-11-05/login-fix/validation.json +85 -0
- package/docs/security/admin8-2026-11-05/system-fix/BACKEND_ROLE_REVIEW_DE.md +79 -0
- package/docs/security/admin8-2026-11-05/system-fix/NAVIGATION_DE.md +30 -0
- package/docs/security/admin8-2026-11-05/system-fix/REPORT_DE.md +51 -0
- package/docs/security/admin8-2026-11-05/system-fix/REVIEW_DE.md +65 -0
- package/docs/security/admin8-2026-11-05/system-fix/SCOPE_DE.md +21 -0
- package/docs/security/admin8-2026-11-05/system-fix/SYSTEM_DE.md +44 -0
- package/docs/security/admin8-2026-11-05/system-fix/archive-scan.json +12 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/README.md +46 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/integrity.json +16 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/system-browser-result.json +3607 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/system-browser.cjs +221 -0
- package/docs/security/admin8-2026-11-05/system-fix/browser/system-fixture.cjs +60 -0
- package/docs/security/admin8-2026-11-05/system-fix/evidence-sha256.json +49 -0
- package/docs/security/admin8-2026-11-05/system-fix/license-ui-tests-node22.log +80 -0
- package/docs/security/admin8-2026-11-05/system-fix/license-ui-tests-node24.log +19 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/lint.log +0 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/node22-tests.log +56 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/node24-tests.log +15 -0
- package/docs/security/admin8-2026-11-05/system-fix/navigation/source-sha256.json +11 -0
- package/docs/security/admin8-2026-11-05/system-fix/path-budget.json +7 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/artifacts.log +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/audit-root.json +22 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/audit-root.stderr +1 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/backend-build.log +5 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/clean.log +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-audit.json +22 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-audit.stderr +2 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-install.log +4 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/consumer-package-lock.json +3258 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/development.log +392 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/frontend-build.log +149 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/http-node22.json +15 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/http-node24.json +15 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/inventory.log +8 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/overlay-journal.json +452 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/overlay-publish.log +10790 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/overlay-validation.json +12 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/pack.json +8104 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/pack.stderr +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/retired-801.json +68 -0
- package/docs/security/admin8-2026-11-05/system-fix/release/seal.log +6 -0
- package/docs/security/admin8-2026-11-05/system-fix/review-tests.log +30 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-before.log +86 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-lint.log +0 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-node22.log +44 -0
- package/docs/security/admin8-2026-11-05/system-fix/role-context-test.log +13 -0
- package/docs/security/admin8-2026-11-05/system-fix/validation.json +90 -0
- package/docs/third-party/admin8/NOTICE-PROVENANCE.json +3 -3
- package/io-package.json +13 -15
- package/package.json +10 -4
- package/release-manifests/admin8-development-validation.json +136 -43
- package/reports/security/artifact-inventory.json +822 -587
- package/reports/security/inventory-summary.json +39 -17
- package/reports/security/sbom-backend-lock.cdx.json +108 -111
- package/reports/security/sbom-frontend-lock.cdx.json +5 -5
- package/reports/security/source-runtime-manifest.json +553 -163
- package/tools/nexowatt-admin8-development-check.cjs +8 -1
- package/tools/nexowatt-artifact-inventory.cjs +8 -1
- package/tools/nexowatt-installer-ems-selftest.cjs +1 -1
- package/tools/nexowatt-lock-provenance-check.cjs +8 -3
- package/tools/nexowatt-repair-lock-metadata.cjs +3 -3
- package/tools/nexowatt-role-security-selftest.cjs +2 -2
- package/tools/nexowatt-security-inventory.cjs +22 -1
- package/tools/nexowatt-user-area-selftest.cjs +1 -1
- package/tools/nexowatt-v7109-clean-core-selftest.cjs +1 -1
- package/tools/nexowatt-vendored-webserver.cjs +69 -0
- package/tools/vendor/eos-retired-release-files.json +268 -1
- package/tools/vendor/webserver-3.4.0-source.provenance.json +244 -0
- package/adminWww/assets/Adapters-BDxfhfGe.js +0 -7
- package/adminWww/assets/EasyMode-TwIN5yxu.js +0 -1
- package/adminWww/assets/Enums-CSzSzWm7.js +0 -92
- package/adminWww/assets/Hosts-QkyuASJy.js +0 -120
- package/adminWww/assets/Instances-BaWBemTT.js +0 -4
- package/adminWww/assets/Intro-DsfrPrWv.js +0 -2
- package/adminWww/assets/Logs-Cngy2Opt.js +0 -2
- package/adminWww/assets/Objects-DY8KS7zK.js +0 -301
- package/adminWww/assets/Remove-DplJatnC.js +0 -1
- package/adminWww/assets/State-vP1o2BCL.js +0 -1
- package/adminWww/assets/Storage-COo2RkS1.js +0 -1
- package/adminWww/assets/Users-BjTGOjzL.js +0 -1
- package/adminWww/assets/ViewList-DuKCnBnc.js +0 -1
- package/adminWww/assets/helpers-DBoACUHw.js +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Serves ACME HTTP-01 challenges on behalf of the acme adapter.
|
|
4
|
+
*
|
|
5
|
+
* The CA fetches `http://<domain>/.well-known/acme-challenge/<token>` on port
|
|
6
|
+
* 80 - path and port are fixed by RFC 8555 - so on a host with a single public
|
|
7
|
+
* IP that request lands on whatever adapter holds port 80, normally web or
|
|
8
|
+
* admin. The acme adapter used to take the port over for the duration of an
|
|
9
|
+
* order, stopping the adapter that had it, which costs a short outage and can
|
|
10
|
+
* leave that adapter stopped if the order throws
|
|
11
|
+
* (https://github.com/iobroker-community-adapters/ioBroker.acme/issues/85).
|
|
12
|
+
*
|
|
13
|
+
* Instead the acme adapter publishes its tokens in a state and whoever already
|
|
14
|
+
* holds the port answers from there. Nothing is stopped, no port has to be
|
|
15
|
+
* free, and it works across the hosts of a multihost installation.
|
|
16
|
+
*
|
|
17
|
+
* The lookup has to happen before any authentication - the CA is anonymous -
|
|
18
|
+
* which is why this sits in front of the app rather than in a route.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ACME_TOKEN_REGEX = exports.ACME_CHALLENGE_STATE_PATTERN = exports.ACME_CHALLENGE_PREFIX = void 0;
|
|
22
|
+
exports.acmeChallengeToken = acmeChallengeToken;
|
|
23
|
+
exports.findAcmeChallenge = findAcmeChallenge;
|
|
24
|
+
exports.serveAcmeChallenge = serveAcmeChallenge;
|
|
25
|
+
exports.acmeChallengeMiddleware = acmeChallengeMiddleware;
|
|
26
|
+
/** Path the CA requests. Reserved for ACME by RFC 8615, so nothing else owns it. */
|
|
27
|
+
exports.ACME_CHALLENGE_PREFIX = '/.well-known/acme-challenge/';
|
|
28
|
+
/**
|
|
29
|
+
* Where the acme adapter publishes. The instance number is not fixed and two
|
|
30
|
+
* instances may be ordering at once, so every match is consulted.
|
|
31
|
+
*/
|
|
32
|
+
exports.ACME_CHALLENGE_STATE_PATTERN = 'acme.*.info.httpChallenges';
|
|
33
|
+
/**
|
|
34
|
+
* RFC 8555 tokens are base64url. Anything else is rejected before it can reach
|
|
35
|
+
* a lookup, which keeps this unauthenticated path from turning arbitrary URLs
|
|
36
|
+
* into database reads.
|
|
37
|
+
*/
|
|
38
|
+
exports.ACME_TOKEN_REGEX = /^[A-Za-z0-9_-]{16,128}$/;
|
|
39
|
+
/**
|
|
40
|
+
* Pick the challenge token out of a request URL, if it is one at all.
|
|
41
|
+
*
|
|
42
|
+
* @param url the raw request URL
|
|
43
|
+
* @returns the token, or null when this request is not an ACME challenge
|
|
44
|
+
*/
|
|
45
|
+
function acmeChallengeToken(url) {
|
|
46
|
+
if (!url || !url.startsWith(exports.ACME_CHALLENGE_PREFIX)) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
// A query string is not part of the token; the CA sends none, but a probe
|
|
50
|
+
// or a proxy might.
|
|
51
|
+
const token = url.slice(exports.ACME_CHALLENGE_PREFIX.length).split(/[?#]/)[0];
|
|
52
|
+
return exports.ACME_TOKEN_REGEX.test(token) ? token : null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Look a token up in what the acme adapter currently publishes.
|
|
56
|
+
*
|
|
57
|
+
* Read on demand rather than kept in a subscription cache: the adapter
|
|
58
|
+
* publishes a token and has the CA validate it immediately afterwards, so a
|
|
59
|
+
* cache would race with the order it is meant to serve. The path is only hit a
|
|
60
|
+
* handful of times per certificate.
|
|
61
|
+
*
|
|
62
|
+
* @param adapter the ioBroker adapter
|
|
63
|
+
* @param token the token from the request URL
|
|
64
|
+
* @returns the key authorization to answer with, or null
|
|
65
|
+
*/
|
|
66
|
+
async function findAcmeChallenge(adapter, token) {
|
|
67
|
+
const states = await adapter.getForeignStatesAsync(exports.ACME_CHALLENGE_STATE_PATTERN);
|
|
68
|
+
const now = Date.now();
|
|
69
|
+
for (const [id, state] of Object.entries(states || {})) {
|
|
70
|
+
if (!state || typeof state.val !== 'string') {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
let published;
|
|
74
|
+
try {
|
|
75
|
+
published = JSON.parse(state.val);
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
adapter.log.warn(`Ignoring "${id}": published ACME challenges are not valid JSON`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const entry = published === null || published === void 0 ? void 0 : published[token];
|
|
82
|
+
if (entry && typeof entry.keyAuthorization === 'string' && entry.expires > now) {
|
|
83
|
+
return entry.keyAuthorization;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Answer an ACME HTTP-01 challenge request.
|
|
90
|
+
*
|
|
91
|
+
* Answers only when the token is actually published. Anything else - a request
|
|
92
|
+
* that is not a challenge, an unknown token, a states DB that cannot be read -
|
|
93
|
+
* is reported as unhandled so the caller passes it on. Nothing an application
|
|
94
|
+
* serves on that path is ever shadowed by this.
|
|
95
|
+
*
|
|
96
|
+
* @param adapter the ioBroker adapter
|
|
97
|
+
* @param req the incoming request
|
|
98
|
+
* @param res the response to write to
|
|
99
|
+
* @returns true when the request was answered here
|
|
100
|
+
*/
|
|
101
|
+
async function serveAcmeChallenge(adapter, req, res) {
|
|
102
|
+
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const token = acmeChallengeToken(req.url);
|
|
106
|
+
if (!token) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
let keyAuthorization;
|
|
110
|
+
try {
|
|
111
|
+
keyAuthorization = await findAcmeChallenge(adapter, token);
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
adapter.log.warn(`Could not read published ACME challenges: ${e.message}`);
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (!keyAuthorization) {
|
|
118
|
+
adapter.log.debug(`No ACME challenge published for token ${token}`);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
res.writeHead(200, {
|
|
122
|
+
'Content-Type': 'application/octet-stream',
|
|
123
|
+
'Content-Length': Buffer.byteLength(keyAuthorization),
|
|
124
|
+
// A token is valid once and briefly - no cache in between may keep it.
|
|
125
|
+
'Cache-Control': 'no-store',
|
|
126
|
+
});
|
|
127
|
+
res.end(req.method === 'HEAD' ? undefined : keyAuthorization);
|
|
128
|
+
adapter.log.info(`Answered ACME HTTP-01 challenge for token ${token}`);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The same as express middleware, for an adapter that builds its server itself
|
|
133
|
+
* instead of through `WebServer`.
|
|
134
|
+
*
|
|
135
|
+
* Mount it before any authentication:
|
|
136
|
+
* `app.use(acmeChallengeMiddleware(adapter))`
|
|
137
|
+
*
|
|
138
|
+
* @param adapter the ioBroker adapter
|
|
139
|
+
*/
|
|
140
|
+
function acmeChallengeMiddleware(adapter) {
|
|
141
|
+
return (req, res, next) => {
|
|
142
|
+
serveAcmeChallenge(adapter, req, res).then(served => {
|
|
143
|
+
if (!served) {
|
|
144
|
+
next();
|
|
145
|
+
}
|
|
146
|
+
}, next);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=acmeChallenge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acmeChallenge.js","sourceRoot":"","sources":["../../src/lib/acmeChallenge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAkCH,gDAQC;AAcD,8CAqBC;AAeD,gDAmCC;AAWD,0DAUC;AAhJD,oFAAoF;AACvE,QAAA,qBAAqB,GAAG,8BAA8B,CAAC;AAEpE;;;GAGG;AACU,QAAA,4BAA4B,GAAG,4BAA4B,CAAC;AAEzE;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,yBAAyB,CAAC;AAU1D;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,GAAuB;IACtD,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,6BAAqB,CAAC,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,0EAA0E;IAC1E,oBAAoB;IACpB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,6BAAqB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,wBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,iBAAiB,CAAC,OAAyB,EAAE,KAAa;IAC5E,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,qBAAqB,CAAC,oCAA4B,CAAC,CAAC;IACjF,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEvB,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAA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A6C,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3E,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,yCAAyC,KAAK,EAAE,CAAC,CAAC;QACpE,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;QACf,cAAc,EAAE,0BAA0B;QAC1C,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC;QACrD,uEAAuE;QACvE,eAAe,EAAE,UAAU;KAC9B,CAAC,CAAC;IACH,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,6CAA6C,KAAK,EAAE,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,uBAAuB,CACnC,OAAyB;IAEzB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACtB,kBAAkB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAChD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,IAAI,EAAE,CAAC;YACX,CAAC;QACL,CAAC,EAAE,IAAI,CAAC,CAAC;IACb,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
interface CertificateManagerOptions {
|
|
2
|
+
adapter: ioBroker.Adapter;
|
|
3
|
+
}
|
|
4
|
+
export interface CertificateCollection {
|
|
5
|
+
/** Creating adapter */
|
|
6
|
+
from: string;
|
|
7
|
+
/** expiry date/time - mandatory */
|
|
8
|
+
/** So not everyone needs to decode cert to discover this */
|
|
9
|
+
tsExpires: number;
|
|
10
|
+
/** private key - mandatory */
|
|
11
|
+
key: string | Buffer;
|
|
12
|
+
/** public certificate - mandatory */
|
|
13
|
+
cert: string | Buffer;
|
|
14
|
+
/** domains - mandatory */
|
|
15
|
+
domains: string[];
|
|
16
|
+
/** chain - optional */
|
|
17
|
+
chain?: string | Buffer | (Buffer | string)[];
|
|
18
|
+
/** Optional flag to indicate that the certificate is only for staging/testing purposes and should not be used in production */
|
|
19
|
+
staging?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type SubscribeCertificateCollectionsCallback = (err: Error | null, collections?: Record<string, CertificateCollection>) => void;
|
|
22
|
+
export declare class CertificateManager {
|
|
23
|
+
private readonly adapter;
|
|
24
|
+
constructor(options: CertificateManagerOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Returns all collections of SSL keys, certificates, etc.
|
|
27
|
+
*/
|
|
28
|
+
getAllCollections(): Promise<Record<string, CertificateCollection> | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns collection of SSL keys, certificates, etc. by ID
|
|
31
|
+
*
|
|
32
|
+
* @param collectionId id of the collection to filter for
|
|
33
|
+
*/
|
|
34
|
+
getCollection(collectionId: string): Promise<CertificateCollection | Record<string, CertificateCollection> | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Saves a collection of SSL keys, certificates, etc. by ID
|
|
37
|
+
*
|
|
38
|
+
* @param collectionId collection ID
|
|
39
|
+
* @param collection object holding all related keys, certificates, etc.
|
|
40
|
+
*/
|
|
41
|
+
setCollection(collectionId: string, collection: CertificateCollection): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Remove a collection of SSL keys, certificates, etc. by ID
|
|
44
|
+
*
|
|
45
|
+
* @param collectionId collection ID
|
|
46
|
+
*/
|
|
47
|
+
delCollection(collectionId: string): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Subscribes the certificate collections object and calls callback on every change
|
|
50
|
+
*
|
|
51
|
+
* @param collectionId if null, return all collections in callback
|
|
52
|
+
* @param callback called on every change
|
|
53
|
+
*/
|
|
54
|
+
subscribeCollections(collectionId: string | null, callback: SubscribeCertificateCollectionsCallback): void;
|
|
55
|
+
/**
|
|
56
|
+
* Returns list of available certificate collection IDs
|
|
57
|
+
*/
|
|
58
|
+
getCollectionIds(): Promise<string[]>;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CertificateManager = void 0;
|
|
4
|
+
const SYSTEM_CERTIFICATES_ID = 'system.certificates';
|
|
5
|
+
class CertificateManager {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.adapter = options.adapter;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns all collections of SSL keys, certificates, etc.
|
|
11
|
+
*/
|
|
12
|
+
async getAllCollections() {
|
|
13
|
+
try {
|
|
14
|
+
const obj = await this.adapter.getForeignObjectAsync(SYSTEM_CERTIFICATES_ID);
|
|
15
|
+
// If collectionId does not exist, not an error situation: return null to indicate this.
|
|
16
|
+
const collections = obj === null || obj === void 0 ? void 0 : obj.native.collections;
|
|
17
|
+
return collections || null;
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
this.adapter.log.error(`No certificates found: ${e.message}`);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns collection of SSL keys, certificates, etc. by ID
|
|
26
|
+
*
|
|
27
|
+
* @param collectionId id of the collection to filter for
|
|
28
|
+
*/
|
|
29
|
+
async getCollection(collectionId) {
|
|
30
|
+
try {
|
|
31
|
+
const collections = await this.getAllCollections();
|
|
32
|
+
return collections ? collections[collectionId] : null;
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
this.adapter.log.error(`No certificates found: ${e.message}`);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Saves a collection of SSL keys, certificates, etc. by ID
|
|
41
|
+
*
|
|
42
|
+
* @param collectionId collection ID
|
|
43
|
+
* @param collection object holding all related keys, certificates, etc.
|
|
44
|
+
*/
|
|
45
|
+
async setCollection(collectionId, collection) {
|
|
46
|
+
const mandatory = ['from', 'tsExpires', 'key', 'cert', 'domains'];
|
|
47
|
+
if (!mandatory.every(key => Object.keys(collection).includes(key))) {
|
|
48
|
+
throw new Error(`At least one mandatory key (${mandatory.join(',')}) missing from collection`);
|
|
49
|
+
}
|
|
50
|
+
await this.adapter.extendForeignObjectAsync(SYSTEM_CERTIFICATES_ID, {
|
|
51
|
+
native: {
|
|
52
|
+
collections: {
|
|
53
|
+
[collectionId]: collection,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Remove a collection of SSL keys, certificates, etc. by ID
|
|
60
|
+
*
|
|
61
|
+
* @param collectionId collection ID
|
|
62
|
+
*/
|
|
63
|
+
async delCollection(collectionId) {
|
|
64
|
+
try {
|
|
65
|
+
const obj = await this.adapter.getForeignObjectAsync(SYSTEM_CERTIFICATES_ID);
|
|
66
|
+
if ((obj === null || obj === void 0 ? void 0 : obj.native.collections) &&
|
|
67
|
+
typeof obj.native.collections === 'object' &&
|
|
68
|
+
collectionId in obj.native.collections) {
|
|
69
|
+
delete obj.native.collections[collectionId];
|
|
70
|
+
await this.adapter.setForeignObjectAsync(SYSTEM_CERTIFICATES_ID, obj);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
// Did not exit -> goal reached
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
throw new Error(`No certificates found: ${e.message}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Subscribes the certificate collections object and calls callback on every change
|
|
83
|
+
*
|
|
84
|
+
* @param collectionId if null, return all collections in callback
|
|
85
|
+
* @param callback called on every change
|
|
86
|
+
*/
|
|
87
|
+
subscribeCollections(collectionId, callback) {
|
|
88
|
+
this.adapter.subscribeForeignObjects(SYSTEM_CERTIFICATES_ID);
|
|
89
|
+
this.adapter.on('objectChange', (id, obj) => {
|
|
90
|
+
var _a;
|
|
91
|
+
if (id === SYSTEM_CERTIFICATES_ID) {
|
|
92
|
+
this.adapter.log.debug(`${SYSTEM_CERTIFICATES_ID} updated`);
|
|
93
|
+
if (!((_a = obj === null || obj === void 0 ? void 0 : obj.native) === null || _a === void 0 ? void 0 : _a.collections)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const collections = obj.native.collections;
|
|
97
|
+
if (!collectionId) {
|
|
98
|
+
// No specific ID requested, return them all
|
|
99
|
+
callback(null, collections);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (collections[collectionId]) {
|
|
103
|
+
callback(null, { [collectionId]: collections[collectionId] });
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// Can't find the requested collection ID, return an empty object & error
|
|
107
|
+
callback(new Error(`Subscribed collection ID ${collectionId} not found`), {});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns list of available certificate collection IDs
|
|
115
|
+
*/
|
|
116
|
+
async getCollectionIds() {
|
|
117
|
+
try {
|
|
118
|
+
const obj = await this.adapter.getForeignObjectAsync(SYSTEM_CERTIFICATES_ID);
|
|
119
|
+
const collections = obj === null || obj === void 0 ? void 0 : obj.native.collections;
|
|
120
|
+
return collections ? Object.keys(collections) : [];
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
throw new Error(`No certificates found: ${e.message}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.CertificateManager = CertificateManager;
|
|
128
|
+
//# sourceMappingURL=certificateManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"certificateManager.js","sourceRoot":"","sources":["../../src/lib/certificateManager.ts"],"names":[],"mappings":";;;AA2BA,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAErD,MAAa,kBAAkB;IAG3B,YAAY,OAAkC;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB;QACnB,IAAI,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;YAC7E,wFAAwF;YACxF,MAAM,WAAW,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAC,WAAW,CAAC;YAE5C,OAAO,WAAW,IAAI,IAAI,CAAC;QAC/B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CACf,YAAoB;QAEpB,IAAI,CAAC;YACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAEnD,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1D,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAC,YAAoB,EAAE,UAAiC;QACvE,MAAM,SAAS,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CAAC,WAAW,CAAC;YAC5C,OAAO,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;CACJ;AAnID,gDAmIC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import http2 from 'node:http2';
|
|
2
|
+
/**
|
|
3
|
+
* Make an HTTP/2 compat request and response usable for apps written against HTTP/1.
|
|
4
|
+
*
|
|
5
|
+
* Express replaces the prototype of every request and response with its own, which inherits from
|
|
6
|
+
* `http.IncomingMessage` / `http.ServerResponse`. An `Http2ServerRequest` loses `url`, `headers`,
|
|
7
|
+
* `method`, `_read` and the rest of its class that way, and the first read of the body throws
|
|
8
|
+
* outside any handler - which takes the whole process down. Pinned to the instance, those members
|
|
9
|
+
* come before whatever prototype is installed afterwards. HTTP/1 connection headers an app sets on
|
|
10
|
+
* the response are dropped on the way.
|
|
11
|
+
*
|
|
12
|
+
* On top of that, it fills in two headers HTTP/1 code relies on:
|
|
13
|
+
* - `host`: an HTTP/2 client sends the `:authority` pseudo-header instead, so `req.hostname` and
|
|
14
|
+
* every URL built from `req.get('host')` would come out empty;
|
|
15
|
+
* - `transfer-encoding`: a body without `content-length` is valid in HTTP/2, but `type-is` - and so
|
|
16
|
+
* body-parser - only detects a body by one of these two headers and would skip it silently.
|
|
17
|
+
*
|
|
18
|
+
* @param req the HTTP/2 compat request
|
|
19
|
+
* @param res the HTTP/2 compat response
|
|
20
|
+
*/
|
|
21
|
+
export declare function adaptHttp2Request(req: http2.Http2ServerRequest, res: http2.Http2ServerResponse): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.adaptHttp2Request = adaptHttp2Request;
|
|
7
|
+
const node_http_1 = __importDefault(require("node:http"));
|
|
8
|
+
const node_http2_1 = __importDefault(require("node:http2"));
|
|
9
|
+
/**
|
|
10
|
+
* Collect the members an HTTP/2 compat object has to keep on the instance itself.
|
|
11
|
+
*
|
|
12
|
+
* These are the members of the HTTP/2 prototype and every member of the HTTP/1 prototypes, each
|
|
13
|
+
* resolved the way the HTTP/2 prototype chain resolves it. The HTTP/1 ones matter as well: after a
|
|
14
|
+
* prototype swap they would otherwise be found on the HTTP/1 class and run against the HTTP/2
|
|
15
|
+
* internals - `IncomingMessage.prototype._destroy`, for example, writes the getter-only `aborted`.
|
|
16
|
+
* A member the HTTP/2 chain does not have at all is covered with `undefined`, as it would be
|
|
17
|
+
* without the swap.
|
|
18
|
+
*
|
|
19
|
+
* @param http2Prototype prototype of the HTTP/2 compat class
|
|
20
|
+
* @param http1Prototypes prototypes of the HTTP/1 class chain down to where both chains meet
|
|
21
|
+
*/
|
|
22
|
+
function collectMembers(http2Prototype, http1Prototypes) {
|
|
23
|
+
const keys = new Set(Reflect.ownKeys(http2Prototype));
|
|
24
|
+
for (const prototype of http1Prototypes) {
|
|
25
|
+
for (const key of Reflect.ownKeys(prototype)) {
|
|
26
|
+
keys.add(key);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
keys.delete('constructor');
|
|
30
|
+
const members = {};
|
|
31
|
+
for (const key of keys) {
|
|
32
|
+
let descriptor;
|
|
33
|
+
for (let prototype = http2Prototype; prototype && !descriptor; prototype = Object.getPrototypeOf(prototype)) {
|
|
34
|
+
descriptor = Object.getOwnPropertyDescriptor(prototype, key);
|
|
35
|
+
}
|
|
36
|
+
// Configurable, so that whoever wants to redefine a member on the instance still can
|
|
37
|
+
members[key] = { ...(descriptor || { value: undefined, writable: true }), configurable: true };
|
|
38
|
+
}
|
|
39
|
+
return members;
|
|
40
|
+
}
|
|
41
|
+
// Both chains meet at `Readable` (requests) and at the legacy `Stream` (responses)
|
|
42
|
+
const requestMembers = collectMembers(node_http2_1.default.Http2ServerRequest.prototype, [node_http_1.default.IncomingMessage.prototype]);
|
|
43
|
+
const responseMembers = collectMembers(node_http2_1.default.Http2ServerResponse.prototype, [
|
|
44
|
+
node_http_1.default.ServerResponse.prototype,
|
|
45
|
+
node_http_1.default.OutgoingMessage.prototype,
|
|
46
|
+
]);
|
|
47
|
+
/**
|
|
48
|
+
* HTTP/1 connection-specific headers, which HTTP/2 forbids (RFC 9113, 8.2.2). Node drops `connection` with a
|
|
49
|
+
* process warning, but throws on the others - once the response is sent, i.e. out of `res.end()`, where no app
|
|
50
|
+
* expects it and where even the error handler trips over the same header again.
|
|
51
|
+
*/
|
|
52
|
+
const CONNECTION_HEADERS = ['connection', 'keep-alive', 'proxy-connection', 'transfer-encoding', 'upgrade'];
|
|
53
|
+
function isConnectionHeader(name) {
|
|
54
|
+
return typeof name === 'string' && CONNECTION_HEADERS.includes(name.toLowerCase());
|
|
55
|
+
}
|
|
56
|
+
const { setHeader, appendHeader, writeHead } = node_http2_1.default.Http2ServerResponse.prototype;
|
|
57
|
+
responseMembers.setHeader.value = function (name, value) {
|
|
58
|
+
return isConnectionHeader(name) ? this : Reflect.apply(setHeader, this, [name, value]);
|
|
59
|
+
};
|
|
60
|
+
responseMembers.appendHeader.value = function (name, value) {
|
|
61
|
+
return isConnectionHeader(name) ? this : Reflect.apply(appendHeader, this, [name, value]);
|
|
62
|
+
};
|
|
63
|
+
// writeHead() stores its headers without going through setHeader(). A header list given as an array is
|
|
64
|
+
// passed on as it is.
|
|
65
|
+
responseMembers.writeHead.value = function (...args) {
|
|
66
|
+
return Reflect.apply(writeHead, this, args.map(arg => arg && typeof arg === 'object' && !Array.isArray(arg)
|
|
67
|
+
? Object.fromEntries(Object.entries(arg).filter(([name]) => !isConnectionHeader(name)))
|
|
68
|
+
: arg));
|
|
69
|
+
};
|
|
70
|
+
// HTTP/1 only, so covered with `undefined` above. express-session calls it whenever it saves the session
|
|
71
|
+
// before the response ends - with `resave` on every response - and each of them failed with
|
|
72
|
+
// `res._implicitHeader is not a function`. HTTP/1 does `this.writeHead(this.statusCode)`; only once here,
|
|
73
|
+
// as HTTP/2 throws on a second writeHead().
|
|
74
|
+
responseMembers._implicitHeader.value = function () {
|
|
75
|
+
if (!this.headersSent) {
|
|
76
|
+
this.writeHead(this.statusCode);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Make an HTTP/2 compat request and response usable for apps written against HTTP/1.
|
|
81
|
+
*
|
|
82
|
+
* Express replaces the prototype of every request and response with its own, which inherits from
|
|
83
|
+
* `http.IncomingMessage` / `http.ServerResponse`. An `Http2ServerRequest` loses `url`, `headers`,
|
|
84
|
+
* `method`, `_read` and the rest of its class that way, and the first read of the body throws
|
|
85
|
+
* outside any handler - which takes the whole process down. Pinned to the instance, those members
|
|
86
|
+
* come before whatever prototype is installed afterwards. HTTP/1 connection headers an app sets on
|
|
87
|
+
* the response are dropped on the way.
|
|
88
|
+
*
|
|
89
|
+
* On top of that, it fills in two headers HTTP/1 code relies on:
|
|
90
|
+
* - `host`: an HTTP/2 client sends the `:authority` pseudo-header instead, so `req.hostname` and
|
|
91
|
+
* every URL built from `req.get('host')` would come out empty;
|
|
92
|
+
* - `transfer-encoding`: a body without `content-length` is valid in HTTP/2, but `type-is` - and so
|
|
93
|
+
* body-parser - only detects a body by one of these two headers and would skip it silently.
|
|
94
|
+
*
|
|
95
|
+
* @param req the HTTP/2 compat request
|
|
96
|
+
* @param res the HTTP/2 compat response
|
|
97
|
+
*/
|
|
98
|
+
function adaptHttp2Request(req, res) {
|
|
99
|
+
Object.defineProperties(req, requestMembers);
|
|
100
|
+
Object.defineProperties(res, responseMembers);
|
|
101
|
+
const headers = req.headers;
|
|
102
|
+
if (headers.host === undefined && headers[':authority'] !== undefined) {
|
|
103
|
+
headers.host = headers[':authority'];
|
|
104
|
+
}
|
|
105
|
+
if (headers['content-length'] === undefined && !req.stream.endAfterHeaders) {
|
|
106
|
+
headers['transfer-encoding'] = 'chunked';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=http2Compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http2Compat.js","sourceRoot":"","sources":["../../src/lib/http2Compat.ts"],"names":[],"mappings":";;;;;AAyGA,8CAWC;AApHD,0DAA6B;AAC7B,4DAA+B;AAE/B;;;;;;;;;;;;GAYG;AACH,SAAS,cAAc,CAAC,cAAsB,EAAE,eAAyB;IACrE,MAAM,IAAI,GAAG,IAAI,GAAG,CAAc,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;IACnE,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;QACtC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAE3B,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,UAA0C,CAAC;QAC/C,KAAK,IAAI,SAAS,GAAG,cAAc,EAAE,SAAS,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1G,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QACjE,CAAC;QACD,qFAAqF;QACrF,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,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C;IACzC,CAAC;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAC,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;QACzE,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;IAC7C,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { Express, Request, Response } from 'express';
|
|
2
|
+
import type { OAuth2Model } from './oauth2-model';
|
|
3
|
+
import { type OAuth2ClientStore } from './oauth2-clients';
|
|
4
|
+
export interface AuthorizationCodeFlowOptions {
|
|
5
|
+
/** The Express app the endpoints are registered on. */
|
|
6
|
+
app: Express;
|
|
7
|
+
/** The OAuth2 model providing user verification and token issuance. */
|
|
8
|
+
model: OAuth2Model;
|
|
9
|
+
/** Storage for registered clients. */
|
|
10
|
+
clientStore: OAuth2ClientStore;
|
|
11
|
+
/**
|
|
12
|
+
* Externally reachable base URL of this server, without a trailing slash, e.g.
|
|
13
|
+
* `https://iobroker.example.com`. Required behind a reverse proxy: the URLs published in the
|
|
14
|
+
* discovery document must be the ones the client can actually reach. When omitted, the URL is
|
|
15
|
+
* derived from the request, which is only correct for directly exposed servers.
|
|
16
|
+
*/
|
|
17
|
+
baseUrl?: string | ((req: Request) => string);
|
|
18
|
+
/** Allow clients to register themselves via RFC 7591. Enabled by default. */
|
|
19
|
+
dynamicClientRegistration?: boolean;
|
|
20
|
+
/** Name shown on the login and consent pages. Defaults to "ioBroker". */
|
|
21
|
+
productName?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Implements the OAuth2 authorization code flow with PKCE (RFC 7636), dynamic client registration
|
|
25
|
+
* (RFC 7591) and authorization server metadata (RFC 8414) on top of an existing {@link OAuth2Model}.
|
|
26
|
+
*
|
|
27
|
+
* This is deliberately not built on `oauth2-server`: that package (3.x) has no PKCE support, and
|
|
28
|
+
* MCP clients require it. Token issuance still goes through the model, so access and refresh tokens
|
|
29
|
+
* are indistinguishable from those issued by the password grant.
|
|
30
|
+
*/
|
|
31
|
+
export declare class AuthorizationCodeFlow {
|
|
32
|
+
private readonly adapter;
|
|
33
|
+
private readonly model;
|
|
34
|
+
private readonly clientStore;
|
|
35
|
+
private readonly options;
|
|
36
|
+
private readonly productName;
|
|
37
|
+
/**
|
|
38
|
+
* @param adapter ioBroker adapter used for session storage and logging
|
|
39
|
+
* @param options Flow options
|
|
40
|
+
*/
|
|
41
|
+
constructor(adapter: ioBroker.Adapter, options: AuthorizationCodeFlowOptions);
|
|
42
|
+
/**
|
|
43
|
+
* Register the endpoints that must be reachable without authentication: the discovery document
|
|
44
|
+
* and — when enabled — dynamic client registration.
|
|
45
|
+
*
|
|
46
|
+
* Must be called *before* the app-wide `authorize` middleware so these routes stay public.
|
|
47
|
+
*/
|
|
48
|
+
registerPublicRoutes(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Handle `POST /oauth/revoke` (RFC 7009), so a client can drop its tokens when the user
|
|
51
|
+
* disconnects it. Per the RFC an unknown token is not an error — the caller's goal is met either
|
|
52
|
+
* way, and reporting it would let anyone probe which tokens exist.
|
|
53
|
+
*
|
|
54
|
+
* @param req The incoming request
|
|
55
|
+
* @param res The response to write to
|
|
56
|
+
*/
|
|
57
|
+
private handleRevoke;
|
|
58
|
+
/**
|
|
59
|
+
* Register the endpoints that need to know whether the browser is already logged in.
|
|
60
|
+
*
|
|
61
|
+
* Must be called *after* the app-wide `authorize` middleware, which populates `req.user` from an
|
|
62
|
+
* `access_token` cookie — otherwise an already logged-in user would be asked for the password again.
|
|
63
|
+
*/
|
|
64
|
+
registerAuthorizeRoutes(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Determine the externally reachable base URL. Behind a reverse proxy the request-derived value
|
|
67
|
+
* is wrong unless the host app enabled `trust proxy`, which is why {@link AuthorizationCodeFlowOptions.baseUrl}
|
|
68
|
+
* exists.
|
|
69
|
+
*
|
|
70
|
+
* @param req The incoming request
|
|
71
|
+
*/
|
|
72
|
+
private getBaseUrl;
|
|
73
|
+
/**
|
|
74
|
+
* Handle `POST /oauth/register`.
|
|
75
|
+
*
|
|
76
|
+
* @param req The incoming request
|
|
77
|
+
* @param res The response to write to
|
|
78
|
+
*/
|
|
79
|
+
private handleRegister;
|
|
80
|
+
/**
|
|
81
|
+
* Handle `GET /oauth/authorize`: validate the request, then show either the login form or the
|
|
82
|
+
* consent page.
|
|
83
|
+
*
|
|
84
|
+
* @param req The incoming request
|
|
85
|
+
* @param res The response to write to
|
|
86
|
+
*/
|
|
87
|
+
private handleAuthorizeStart;
|
|
88
|
+
/**
|
|
89
|
+
* Handle `POST /oauth/authorize`: the login form submission, the consent decision, or both in
|
|
90
|
+
* sequence.
|
|
91
|
+
*
|
|
92
|
+
* @param req The incoming request
|
|
93
|
+
* @param res The response to write to
|
|
94
|
+
*/
|
|
95
|
+
private handleAuthorizeSubmit;
|
|
96
|
+
/**
|
|
97
|
+
* Redeem an authorization code for tokens. Called from the `/oauth/token` route when the request
|
|
98
|
+
* carries `grant_type=authorization_code`.
|
|
99
|
+
*
|
|
100
|
+
* @param req The incoming request
|
|
101
|
+
* @param res The response to write to
|
|
102
|
+
*/
|
|
103
|
+
handleTokenRequest(req: Request, res: Response): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* @param id Session key
|
|
106
|
+
* @param ttl Time to live in seconds
|
|
107
|
+
* @param data Payload to store
|
|
108
|
+
*/
|
|
109
|
+
private setSession;
|
|
110
|
+
/**
|
|
111
|
+
* @param id Session key
|
|
112
|
+
*/
|
|
113
|
+
private getSession;
|
|
114
|
+
/**
|
|
115
|
+
* @param id Session key
|
|
116
|
+
*/
|
|
117
|
+
private destroySession;
|
|
118
|
+
/**
|
|
119
|
+
* Redirect back to the client with an OAuth2 error (RFC 6749 §4.1.2.1). Only ever called with a
|
|
120
|
+
* redirect URI that was verified against the client's registration.
|
|
121
|
+
*
|
|
122
|
+
* @param res The response to write to
|
|
123
|
+
* @param redirectUri Verified redirect URI
|
|
124
|
+
* @param error OAuth2 error code
|
|
125
|
+
* @param description Human-readable detail
|
|
126
|
+
* @param state The client's `state` value, echoed back unchanged
|
|
127
|
+
*/
|
|
128
|
+
private redirectWithError;
|
|
129
|
+
/**
|
|
130
|
+
* Answer an unexpected rejection from a route handler instead of letting it escape.
|
|
131
|
+
*
|
|
132
|
+
* These handlers are started from synchronous Express callbacks, so a rejection nobody catches
|
|
133
|
+
* is an unhandled rejection — which terminates the host adapter's process on current Node
|
|
134
|
+
* versions, and leaves the request hanging either way.
|
|
135
|
+
*
|
|
136
|
+
* @param res The response to write to
|
|
137
|
+
* @param handler The already started handler
|
|
138
|
+
* @param json Whether this endpoint answers with JSON rather than an HTML page
|
|
139
|
+
*/
|
|
140
|
+
private guard;
|
|
141
|
+
/**
|
|
142
|
+
* Render the login form or the consent page, depending on whether the request already knows its user.
|
|
143
|
+
*
|
|
144
|
+
* @param res The response to write to
|
|
145
|
+
* @param requestId Identifier of the pending request; doubles as CSRF token
|
|
146
|
+
* @param pending The pending authorization request
|
|
147
|
+
* @param error Optional error message to show above the form
|
|
148
|
+
*/
|
|
149
|
+
private sendAuthorizePage;
|
|
150
|
+
/**
|
|
151
|
+
* Render a terminal error page for problems that must not be reported back to the client
|
|
152
|
+
* application (unknown client, bad redirect URI, expired request).
|
|
153
|
+
*
|
|
154
|
+
* @param res The response to write to
|
|
155
|
+
* @param status HTTP status code
|
|
156
|
+
* @param title Short headline
|
|
157
|
+
* @param message Explanation shown to the user
|
|
158
|
+
*/
|
|
159
|
+
private sendErrorPage;
|
|
160
|
+
/**
|
|
161
|
+
* Wrap page content in the shared, dependency-free HTML shell.
|
|
162
|
+
*
|
|
163
|
+
* @param title Document title
|
|
164
|
+
* @param content Already escaped HTML body
|
|
165
|
+
*/
|
|
166
|
+
private htmlPage;
|
|
167
|
+
}
|