From 2bba4d09ccab5158221a67bd92f8a70c76897a4f Mon Sep 17 00:00:00 2001 From: Curt Tudor Date: Fri, 26 May 2023 09:01:13 -0600 Subject: [PATCH] feat: support both 'ws' and 'wss' ER bindings (#163) --- package.json | 2 +- src/runtime.js | 30 ++++++++++++------------------ yarn.lock | 8 ++++---- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index f94f09c..3770657 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "dependencies": { "@auth0/auth0-spa-js": "^2.0.4", "@babel/runtime": "^7.17.9", - "@openziti/ziti-browzer-core": "^0.22.0", + "@openziti/ziti-browzer-core": "^0.23.0", "bowser": "^2.11.0", "cookie-interceptor": "^1.0.0", "core-js": "^3.22.8", diff --git a/src/runtime.js b/src/runtime.js index ac136cc..6460e40 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -498,14 +498,11 @@ class ZitiBrowzerRuntime { e.preventDefault(); window.zitiBrowzerRuntime.toastSuccess(`New logLevel of '${loglevelValue}' now in effect`); window.zitiBrowzerRuntime.hotKeyModal.close(); - window.zitiBrowzerRuntime.toastWarning(`Page will reload in 5 seconds...`); + window.zitiBrowzerRuntime.toastWarning(`Page will now reload...`); setTimeout(function() { - window.zitiBrowzerRuntime.wb.messageSW({ - type: 'UNREGISTER', - payload: { - } - }); - }, 3000); + zitiBrowzerRuntime.logger.debug(`################ doing page reload now ################`); + window.location.replace('https://' + zitiBrowzerRuntime.zitiConfig.httpAgent.self.host + zitiBrowzerRuntime.zitiConfig.httpAgent.target.path); + }, 2000); } /** @@ -901,7 +898,7 @@ if (isUndefined(window.zitiBrowzerRuntime)) { */ let initResults = await zitiBrowzerRuntime.initialize({loadedViaHTTPAgent: (loadedViaHTTPAgent ? true : false)}); - console.log('returned from call to zitiBrowzerRuntime.initialize'); + console.log('returned from call to zitiBrowzerRuntime.initialize -- initResults:', initResults); if (initResults.authenticated && !initResults.loadedViaHTTPAgent) { @@ -1264,17 +1261,14 @@ if (isUndefined(window.zitiBrowzerRuntime)) { HotKey: '${window.zitiBrowzerRuntime.hotKey}' `); + } - /** - * If the ZBR was loaded via a SW bootstrap, then reload the page to complete the bootstrap cycle - */ - if (loadedViaSWBootstrap) { - // setTimeout(function() { - zitiBrowzerRuntime.logger.debug(`################ loadedViaSWBootstrap detected -- doing page reload now ################`); - window.location.reload(); - // }, 300); - } - + /** + * If the ZBR was loaded via a SW bootstrap, then reload the page to complete the bootstrap cycle + */ + if (loadedViaSWBootstrap) { + zitiBrowzerRuntime.logger.debug(`################ loadedViaSWBootstrap detected -- doing page reload now ################`); + window.location.reload(); } setTimeout(window.zitiBrowzerRuntime._zbrPing, 1000, window.zitiBrowzerRuntime ); diff --git a/yarn.lock b/yarn.lock index c06a21d..8f5de0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1183,10 +1183,10 @@ "@types/emscripten" "^1.39.6" "@wasmer/wasi" "^1.0.2" -"@openziti/ziti-browzer-core@^0.22.0": - version "0.22.0" - resolved "https://registry.yarnpkg.com/@openziti/ziti-browzer-core/-/ziti-browzer-core-0.22.0.tgz#d8fa7f50368558a61e0fcefe7df0f6e115c4f5e0" - integrity sha512-qyhzVEx4DTxQcg7/OYC9raDRGBF0iEdNzH1pd8yLpLkCY9HOQ8ez2E7GwtL1T/nTqlrjgNRtpjeAVt9g+YH67A== +"@openziti/ziti-browzer-core@^0.23.0": + version "0.23.0" + resolved "https://registry.yarnpkg.com/@openziti/ziti-browzer-core/-/ziti-browzer-core-0.23.0.tgz#8f4091fcd3d30381ca66d7cb4ae281f732ca5e73" + integrity sha512-1GngFrEF2llEkYRLyUXCgNQI46/cDC0KsB5T66UtWtYC+7Bb7dHDdipDzFsYl8dj+UDyh2G+GwrDTszDGU5yxg== dependencies: "@openziti/libcrypto-js" "^0.14.1" "@openziti/ziti-browzer-edge-client" "^0.6.0"