Skip to content

Commit

Permalink
Merge branch 'feature/PB-33245_11-Prepare-windows-app-code' into 'rel…
Browse files Browse the repository at this point in the history
…ease'

PB-33245 - create new webviews for release candidate

See merge request passbolt/desktop/passbolt-windows!135
  • Loading branch information
scadra committed May 16, 2024
2 parents 50e18d3 + 2a694e5 commit b568093
Show file tree
Hide file tree
Showing 43 changed files with 173,601 additions and 176,583 deletions.
104 changes: 73 additions & 31 deletions passbolt/Webviews/Background/dist/background-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -42952,7 +42952,7 @@ class AvatarUpdateEntity extends passbolt_styleguide_src_shared_models_entity_ab
const filename = avatarBase64UpdateDto.filename;
const fileBase64 = avatarBase64UpdateDto.fileBase64;
const mimeType = avatarBase64UpdateDto.mimeType;
const file = (0,_utils_format_base64__WEBPACK_IMPORTED_MODULE_2__["default"])(fileBase64, mimeType);
const file = _utils_format_base64__WEBPACK_IMPORTED_MODULE_2__["default"].base64ToBlob(fileBase64, mimeType);
const avatarUpdateDto = {file: file, filename: filename, mimeType: mimeType};
return new AvatarUpdateEntity(avatarUpdateDto);
}
Expand Down Expand Up @@ -70631,6 +70631,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/**
* @deprecated
* Local Storage Wrapper Class
* Ref. PASSBOLT-1725
*
Expand Down Expand Up @@ -76743,6 +76744,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _error_notFoundError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../error/notFoundError */ "./node_modules/passbolt-browser-extension/src/all/background_page/error/notFoundError.js");
/* harmony import */ var passbolt_styleguide_src_shared_lib_apiClient_apiClient__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! passbolt-styleguide/src/shared/lib/apiClient/apiClient */ "./node_modules/passbolt-styleguide/src/shared/lib/apiClient/apiClient.js");
/* harmony import */ var passbolt_styleguide_src_shared_lib_apiClient_apiClientOptions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! passbolt-styleguide/src/shared/lib/apiClient/apiClientOptions */ "./node_modules/passbolt-styleguide/src/shared/lib/apiClient/apiClientOptions.js");
/* harmony import */ var _error_passboltBadResponseError__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../error/passboltBadResponseError */ "./node_modules/passbolt-browser-extension/src/all/background_page/error/passboltBadResponseError.js");
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
Expand All @@ -76762,12 +76764,13 @@ __webpack_require__.r(__webpack_exports__);




const AUTH_RESOURCE_NAME = '/auth';

class AuthenticationStatusService {
/**
* Check if the current user is authenticated.
* @returns {Promise<bool>}
* @returns {Promise<boolean>}
*/
static async isAuthenticated() {
const apiClient = new passbolt_styleguide_src_shared_lib_apiClient_apiClient__WEBPACK_IMPORTED_MODULE_3__.ApiClient(this.apiClientOptions);
Expand All @@ -76782,11 +76785,19 @@ class AuthenticationStatusService {
};
const response = await apiClient.sendRequest('GET', url, null, fetchOptions);

let responseJson;
try {
//Get response on json format
responseJson = await response.json();
} catch (error) {
// If the response cannot be parsed, it's not a Passbolt API response. It can be a nginx error (504).
throw new _error_passboltBadResponseError__WEBPACK_IMPORTED_MODULE_5__["default"]();
}

if (response.ok) {
return true;
}

const responseJson = await response.json();
// MFA required.
if (/mfa\/verify\/error\.json$/.test(response.url)) {
//Retrieve the message error details from json
Expand Down Expand Up @@ -78194,16 +78205,18 @@ __webpack_require__.r(__webpack_exports__);



const PASSBOLT_EXTENSION_UPDATE = "passboltExtensionUpdate";

class OnExtensionUpdateAvailableService {
/**
* Execute the OnExtensionUpdateAvailableService process
* @returns {Promise<void>}
*/
static async exec() {
if (await isUserAuthenticated()) {
this.shouldReload = true;
await browser.storage.session.set({[PASSBOLT_EXTENSION_UPDATE]: true});
} else {
await this.cleanAndReload();
await OnExtensionUpdateAvailableService.cleanAndReload();
}
}

Expand All @@ -78221,9 +78234,10 @@ class OnExtensionUpdateAvailableService {
* It triggers a runtime reload if an extension update was available while the user was signed in.
*/
static async handleUserLoggedOut() {
if (this.shouldReload) {
this.shouldReload = false;
await this.cleanAndReload();
const shouldUpdate = await browser.storage.session.get(PASSBOLT_EXTENSION_UPDATE);
if (shouldUpdate && shouldUpdate[PASSBOLT_EXTENSION_UPDATE]) {
await browser.storage.session.remove(PASSBOLT_EXTENSION_UPDATE);
await OnExtensionUpdateAvailableService.cleanAndReload();
}
}
}
Expand Down Expand Up @@ -83948,38 +83962,66 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/**
* Transforms a base 64 encoded file content into a file object.
* Useful when we need to transmit a file from the content code to the add-on code.
* @param string b64Data
* @param string contentType
* @param integer sliceSize
* @returns {*}
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 4.8.0
*/
function b64ToBlob(b64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;

const byteCharacters = atob(b64Data);
const byteArrays = [];
/**
* The class that deals with Passbolt to convert base64.
*/
class Base64Utils {
/**
* Transforms a base 64 encoded file content into a file object.
* Useful when we need to transmit a file from the content code to the add-on code.
* @param {string} b64Data The base64 data
* @param {string} contentType The content type
* @param {number} sliceSize The slice size
* @returns {*}
*/
static base64ToBlob(b64Data, contentType = "", sliceSize = 512) {
const byteCharacters = atob(b64Data);
const byteArrays = [];

for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);

const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}

const byteArray = new Uint8Array(byteNumbers);
const byteArray = new Uint8Array(byteNumbers);

byteArrays.push(byteArray);
byteArrays.push(byteArray);
}

return new Blob(byteArrays, {type: contentType});
}

const blob = new Blob(byteArrays, {type: contentType});
return blob;
/**
* Transforms a file object into a base 64 encoded file content.
* @param {Blob} blob
* @returns {Promise<string>}
*/
static blobToBase64(blob) {
return new Promise(resolve => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result);
reader.readAsDataURL(blob);
});
}
}

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (b64ToBlob);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Base64Utils);


/***/ }),
Expand Down Expand Up @@ -125524,7 +125566,7 @@ module.exports = JSON.parse('{"debug":false,"log":{"level":0,"console":false}}')
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"name":"background-webview","version":"1.1.0","description":"Background webview2 for passbolt dekstop windows","license":"AGPL-3.0","copyright":"Copyright 2022 Passbolt SA","homepage":"https://www.passbolt.com","repository":"https://github.com/passbolt/passbolt_windows","main":"index.js","scripts":{"build":"webpack","build-watch":"webpack --watch","lint":"npm run lint:lockfile && npm run lint:eslint","lint:lockfile":"lockfile-lint --path package-lock.json --allowed-hosts npm github.com --allowed-schemes \\"https:\\" \\"git+ssh:\\" --empty-hostname false --allowed-urls \\"[email protected]@\\"","lint:eslint":"eslint -c .eslintrc.json --ext js src","lint:eslint-fix":"eslint -c .eslintrc.json --ext js --fix src","test":"jest","test:unit":"jest --no-cache ./src/","test:coverage":"jest --no-cache ./src/ --coverage"},"devDependencies":{"@babel/eslint-parser":"^7.22.15","@babel/plugin-transform-runtime":"^7.21.4","@babel/preset-env":"^7.21.5","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^11.0.0","eslint":"^8.50.0","eslint-plugin-import":"^2.28.1","eslint-plugin-jest":"^27.4.0","eslint-plugin-no-unsanitized":"^4.0.2","eslint-plugin-react":"^7.33.2","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","jest-junit":"^15.0.0","jest-webextension-mock":"^3.8.9","lockfile-lint":"^4.12.1","replace-in-file-webpack-plugin":"^1.0.6","text-encoding-utf-8":"^1.0.2","webpack":"^5.75.0","webpack-cli":"^5.0.1"},"dependencies":{"@babel/core":"^7.23.3","@babel/preset-react":"^7.22.15","buffer":"^6.0.3","openpgp":"^5.11.1","passbolt-browser-extension":"4.7.0","passbolt-styleguide":"4.7.8","setimmediate":"^1.0.5","stream-browserify":"^3.0.0","validator":"^13.7.0"}}');
module.exports = JSON.parse('{"name":"background-webview","version":"1.1.0","description":"Background webview2 for passbolt dekstop windows","license":"AGPL-3.0","copyright":"Copyright 2022 Passbolt SA","homepage":"https://www.passbolt.com","repository":"https://github.com/passbolt/passbolt_windows","main":"index.js","scripts":{"build":"webpack","build-watch":"webpack --watch","lint":"npm run lint:lockfile && npm run lint:eslint","lint:lockfile":"lockfile-lint --path package-lock.json --allowed-hosts npm github.com --allowed-schemes \\"https:\\" \\"git+ssh:\\" --empty-hostname false --allowed-urls \\"[email protected]@\\"","lint:eslint":"eslint -c .eslintrc.json --ext js src","lint:eslint-fix":"eslint -c .eslintrc.json --ext js --fix src","test":"jest","test:unit":"jest --no-cache ./src/","test:coverage":"jest --no-cache ./src/ --coverage"},"devDependencies":{"@babel/eslint-parser":"^7.22.15","@babel/plugin-transform-runtime":"^7.21.4","@babel/preset-env":"^7.21.5","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^11.0.0","eslint":"^8.50.0","eslint-plugin-import":"^2.28.1","eslint-plugin-jest":"^27.4.0","eslint-plugin-no-unsanitized":"^4.0.2","eslint-plugin-react":"^7.33.2","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","jest-junit":"^15.0.0","jest-webextension-mock":"^3.8.9","lockfile-lint":"^4.12.1","replace-in-file-webpack-plugin":"^1.0.6","text-encoding-utf-8":"^1.0.2","webpack":"^5.75.0","webpack-cli":"^5.0.1"},"dependencies":{"@babel/core":"^7.23.3","@babel/preset-react":"^7.22.15","buffer":"^6.0.3","openpgp":"^5.11.1","passbolt-browser-extension":"4.7.8","passbolt-styleguide":"4.7.0","setimmediate":"^1.0.5","stream-browserify":"^3.0.0","validator":"^13.7.0"}}');

/***/ })

Expand Down
2 changes: 1 addition & 1 deletion passbolt/Webviews/Background/dist/background-auth.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion passbolt/Webviews/Background/dist/background-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -34132,7 +34132,7 @@ PERFORMANCE OF THIS SOFTWARE.
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"name":"background-webview","version":"1.1.0","description":"Background webview2 for passbolt dekstop windows","license":"AGPL-3.0","copyright":"Copyright 2022 Passbolt SA","homepage":"https://www.passbolt.com","repository":"https://github.com/passbolt/passbolt_windows","main":"index.js","scripts":{"build":"webpack","build-watch":"webpack --watch","lint":"npm run lint:lockfile && npm run lint:eslint","lint:lockfile":"lockfile-lint --path package-lock.json --allowed-hosts npm github.com --allowed-schemes \\"https:\\" \\"git+ssh:\\" --empty-hostname false --allowed-urls \\"[email protected]@\\"","lint:eslint":"eslint -c .eslintrc.json --ext js src","lint:eslint-fix":"eslint -c .eslintrc.json --ext js --fix src","test":"jest","test:unit":"jest --no-cache ./src/","test:coverage":"jest --no-cache ./src/ --coverage"},"devDependencies":{"@babel/eslint-parser":"^7.22.15","@babel/plugin-transform-runtime":"^7.21.4","@babel/preset-env":"^7.21.5","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^11.0.0","eslint":"^8.50.0","eslint-plugin-import":"^2.28.1","eslint-plugin-jest":"^27.4.0","eslint-plugin-no-unsanitized":"^4.0.2","eslint-plugin-react":"^7.33.2","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","jest-junit":"^15.0.0","jest-webextension-mock":"^3.8.9","lockfile-lint":"^4.12.1","replace-in-file-webpack-plugin":"^1.0.6","text-encoding-utf-8":"^1.0.2","webpack":"^5.75.0","webpack-cli":"^5.0.1"},"dependencies":{"@babel/core":"^7.23.3","@babel/preset-react":"^7.22.15","buffer":"^6.0.3","openpgp":"^5.11.1","passbolt-browser-extension":"4.7.0","passbolt-styleguide":"4.7.8","setimmediate":"^1.0.5","stream-browserify":"^3.0.0","validator":"^13.7.0"}}');
module.exports = JSON.parse('{"name":"background-webview","version":"1.1.0","description":"Background webview2 for passbolt dekstop windows","license":"AGPL-3.0","copyright":"Copyright 2022 Passbolt SA","homepage":"https://www.passbolt.com","repository":"https://github.com/passbolt/passbolt_windows","main":"index.js","scripts":{"build":"webpack","build-watch":"webpack --watch","lint":"npm run lint:lockfile && npm run lint:eslint","lint:lockfile":"lockfile-lint --path package-lock.json --allowed-hosts npm github.com --allowed-schemes \\"https:\\" \\"git+ssh:\\" --empty-hostname false --allowed-urls \\"[email protected]@\\"","lint:eslint":"eslint -c .eslintrc.json --ext js src","lint:eslint-fix":"eslint -c .eslintrc.json --ext js --fix src","test":"jest","test:unit":"jest --no-cache ./src/","test:coverage":"jest --no-cache ./src/ --coverage"},"devDependencies":{"@babel/eslint-parser":"^7.22.15","@babel/plugin-transform-runtime":"^7.21.4","@babel/preset-env":"^7.21.5","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^11.0.0","eslint":"^8.50.0","eslint-plugin-import":"^2.28.1","eslint-plugin-jest":"^27.4.0","eslint-plugin-no-unsanitized":"^4.0.2","eslint-plugin-react":"^7.33.2","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","jest-junit":"^15.0.0","jest-webextension-mock":"^3.8.9","lockfile-lint":"^4.12.1","replace-in-file-webpack-plugin":"^1.0.6","text-encoding-utf-8":"^1.0.2","webpack":"^5.75.0","webpack-cli":"^5.0.1"},"dependencies":{"@babel/core":"^7.23.3","@babel/preset-react":"^7.22.15","buffer":"^6.0.3","openpgp":"^5.11.1","passbolt-browser-extension":"4.7.8","passbolt-styleguide":"4.7.0","setimmediate":"^1.0.5","stream-browserify":"^3.0.0","validator":"^13.7.0"}}');

/***/ })

Expand Down
Loading

0 comments on commit b568093

Please sign in to comment.