Skip to content

Commit

Permalink
fix: temporary workaround for bubblewrap issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jgw96 committed Aug 12, 2024
1 parent ea92ab2 commit 10429c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions build/bubbleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { GeneratedAppPackage } from './generatedAppPackage.js';
import { TwaManifestJson } from '@bubblewrap/core/dist/lib/TwaManifest.js';
import { fetchUtils } from '@bubblewrap/core';
import { FetchEngine } from '@bubblewrap/core/dist/lib/FetchUtils.js';
import generatePassword from 'password-generator';

/*
* Wraps Google's bubblewrap to build a signed APK from a PWA.
Expand Down Expand Up @@ -71,6 +72,14 @@ export class BubbleWrapper {
// Do we have a signing key?
// If so, sign the APK, generate digital asset links file, and generate an app bundle.
if (this.apkSettings.signingMode !== 'none' && this.signingKeyInfo) {
if (this.apkSettings.signingMode === "new") {
// temporary workaround for https://github.com/GoogleChromeLabs/bubblewrap/issues/693
const passToUse = generatePassword(12, false);

this.signingKeyInfo.keyPassword = passToUse;
this.signingKeyInfo.storePassword = passToUse;
}

const signedApkPath = await this.signApk(apkPath, this.signingKeyInfo);
const assetLinksPath = await this.tryGenerateAssetLinks(
this.signingKeyInfo
Expand Down
7 changes: 5 additions & 2 deletions routes/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,15 @@ function validateApkRequest(request: express.Request): AppPackageRequest {

// Validate signing option fields
if (options.signingMode !== 'none' && options.signing) {
console.log("options.signing", options.signing);
// If we don't have a key password or store password, create one now.
const passToUse = generatePassword(12, false);

if (!options.signing.keyPassword) {
options.signing.keyPassword = generatePassword(12, false);
options.signing.keyPassword = passToUse;
}
if (!options.signing.storePassword) {
options.signing.storePassword = generatePassword(12, false);
options.signing.storePassword = passToUse;
}

// Verify we have the required signing options.
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit 10429c5

Please sign in to comment.