diff --git a/.gitignore b/.gitignore index 6c5de46..fd65e51 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,9 @@ pids *.pid.lock #remove js files -build/*.js +**/*.js +**/*.js.map +!static/*.js # Directory for instrumented libs generated by jscoverage/JSCover lib-cov diff --git a/README.md b/README.md index 7570300..5d64d06 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,23 @@ This tool generates a zip file containing both an `.apk` file (for testing) and Please use our [main repository for any issues/bugs/features suggestion](https://github.com/pwa-builder/PWABuilder/issues/new/choose). -# Running locally +# Running Locally -Run `npm start dev`, then launch your browser to localhost:3333. A page will launch that allows you to generate an Android package. +You will need [Docker](https://www.docker.com/products/docker-desktop/) and the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) to run this service locally. -You may also generate a package manually by sending a POST to `/generateAppPackage` with the following JSON body: +Steps: + +1. Run `az acr login -n pwabuilder` to authenticate with our Azure Container Registry. + +2. If you are testing locally, go to `Dockerfile` and change line 13 to `NODE_ENV=test`. + +3. Run `npm run docker:build` to build the Docker image, this may take a while the first time you run it. + +4. Once the build is complete, run `npm run docker:run` to start the Docker container. + +5. Visit `localhost` to see the CloudAPK testing interface. + +If you don't want to use the testing interface, you may also generate a package manually by sending a POST to `/generateAppPackage` with the following JSON body: ```json { diff --git a/app.js b/app.js deleted file mode 100644 index 6468088..0000000 --- a/app.js +++ /dev/null @@ -1,13 +0,0 @@ -import express from 'express'; -import router from './routes/project.js'; -import cors from 'cors'; -import bodyParser from 'body-parser'; -const app = express(); -app.use(bodyParser.json()); -app.use(cors({ - origin: '*', -})); -app.use('/', router); -app.use(express.static('static')); -export default app; -//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/app.js.map b/app.js.map deleted file mode 100644 index 50667ee..0000000 --- a/app.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AAEtB,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3B,GAAG,CAAC,GAAG,CACL,IAAI,CAAC;IACH,MAAM,EAAE,GAAG;CACZ,CAAC,CACH,CAAC;AACF,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACrB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAElC,eAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/build/analytics.js.map b/build/analytics.js.map deleted file mode 100644 index df9250b..0000000 --- a/build/analytics.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"analytics.js","sourceRoot":"","sources":["analytics.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,EAAE,EAClB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,IAAK,iBAIJ;AAJD,WAAK,iBAAiB;IACpB,+DAAW,CAAA;IACX,iEAAY,CAAA;IACZ,gEAAY,CAAA;AACd,CAAC,EAJI,iBAAiB,KAAjB,iBAAiB,QAIrB;AAED,IAAI,iBAAiB,GAAsB,iBAAiB,CAAC,OAAO,CAAC;AACrE,MAAM,UAAU,cAAc;IAC5B,IAAI;QACF,WAAW,CAAC,KAAK,EAAE;aAChB,yBAAyB,CAAC,uBAAuB,CAAC,UAAU,CAAC;aAC7D,4BAA4B,CAAC,IAAI,CAAC;aAClC,sBAAsB,CAAC,KAAK,CAAC;aAC7B,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC;aACvC,wBAAwB,CAAC,KAAK,CAAC;aAC/B,0BAA0B,CAAC,KAAK,CAAC;aACjC,qBAAqB,CAAC,KAAK,CAAC;aAC5B,sBA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E,qBAAqB;gBAC3B,UAAU,EAAE,UAAU;aACvB,CAAC,CAAC;SACJ;aAAM;YACL,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;YACzB,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC;gBACnC,IAAI,EAAE,4BAA4B;gBAClC,UAAU,EAAE,UAAU;aACvB,CAAC,CAAC;SACJ;KACF;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAClB;AACH,CAAC"} \ No newline at end of file diff --git a/build/analytics.ts b/build/analytics.ts index ae51966..b7e1997 100644 --- a/build/analytics.ts +++ b/build/analytics.ts @@ -46,12 +46,13 @@ export function trackEvent( console.error("App insights no defaultClient"); return; } - + var properties: any = { name: analyticsInfo.name, url: analyticsInfo.url, platformId: analyticsInfo.platformId, platformIdVersion: analyticsInfo.platformIdVersion, + referrer: analyticsInfo.referrer, }; try { @@ -87,4 +88,5 @@ export type AnalyticsInfo = { platformId: string | null; platformIdVersion: string | null; correlationId: string | null; + referrer: string | null; }; diff --git a/build/androidPackageOptions.js.map b/build/androidPackageOptions.js.map deleted file mode 100644 index d7623ba..0000000 --- a/build/androidPackageOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"androidPackageOptions.js","sourceRoot":"","sources":["androidPackageOptions.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/appPackageRequest.js.map b/build/appPackageRequest.js.map deleted file mode 100644 index da8a105..0000000 --- a/build/appPackageRequest.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"appPackageRequest.js","sourceRoot":"","sources":["appPackageRequest.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/bubbleWrapper.js.map b/build/bubbleWrapper.js.map deleted file mode 100644 index 49c3329..0000000 --- a/build/bubbleWrapper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bubbleWrapper.js","sourceRoot":"","sources":["bubbleWrapper.ts"],"names":[],"mapp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C,IAAK,EAAE,SAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAEO,eAAe,CACrB,QAAoD;QAEpD,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,CAAC,IAAI,CACV,oDAAoD,EACpD,QAAQ,CACT,CAAC;YACF,OAAO,KAAK,CAAC;SACd;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;YACnB,OAAO,CAAC,IAAI,CACV,0DAA0D,EAC1D,QAAQ,CACT,CAAC;YACF,OAAO,KAAK,CAAC;SACd;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACjB,OAAO,CAAC,IAAI,CAAC,6CAA6C,EAAE,QAAQ,CAAC,CAAC;YACtE,OAAO,KAAK,CAAC;SACd;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC1C,OAAO,CAAC,IAAI,CACV,iEAAiE,EACjE,QAAQ,CACT,CAAC;YACF,OAAO,KAAK,CAAC;SACd;QACD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;YAC5C,OAAO,CAAC,IAAI,CACV,wDAAwD,EACxD,QAAQ,CAAC,KAAK,CACf,CAAC;YACF,OAAO,KAAK,CAAC;SACd;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"} \ No newline at end of file diff --git a/build/generatedAppPackage.js.map b/build/generatedAppPackage.js.map deleted file mode 100644 index 9692c2c..0000000 --- a/build/generatedAppPackage.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"generatedAppPackage.js","sourceRoot":"","sources":["generatedAppPackage.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/signingOptions.js.map b/build/signingOptions.js.map deleted file mode 100644 index d226f71..0000000 --- a/build/signingOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"signingOptions.js","sourceRoot":"","sources":["signingOptions.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/urlLogger.js.map b/build/urlLogger.js.map deleted file mode 100644 index c6e1e4c..0000000 --- a/build/urlLogger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"urlLogger.js","sourceRoot":"","sources":["urlLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,OAAgB,EAAE,KAAoB;IAC5E,+EAA+E;IAC/E,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC7C,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;KAC5B;IAED,OAAO,KAAK,CAAC,SAAS,EAAE;QACpB,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACL,cAAc,EAAE,iCAAiC;SACpD;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACjB,GAAG,EAAE,GAAG;YACR,cAAc,EAAE,OAAO;YACvB,mBAAmB,EAAE,KAAK;SAC7B,CAAC;KACL,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;AACzE,CAAC"} \ No newline at end of file diff --git a/build/utils.js.map b/build/utils.js.map deleted file mode 100644 index 955cc27..0000000 --- a/build/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,KAAU;IACpC,IAAI,CAAC,KAAK,EAAE;QACR,OAAO,eAAe,CAAC;KAC1B;IAED,IAAI,YAAY,GAAG,KAAK,CAAC,OAAO,IAAI,GAAG,KAAK,EAAE,CAAC;IAE/C,6EAA6E;IAC7E,IAAI,KAAK,CAAC,GAAG,EAAE;QACX,YAAY,IAAI,YAAY,KAAK,CAAC,GAAG,EAAE,CAAC;KAC3C;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;QACjD,YAAY,IAAI,aAAa,KAAK,CAAC,IAAI,EAAE,CAAC;KAC7C;IAED,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC;IACpD,IAAI,eAAe,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;QAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAA;QAC/C,YAAY,IAAI,OAAO,KAAK,KAAK,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;KAClE;IAED,OAAO,YAAY,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/env/test.env b/env/test.env index 3b715b4..69b44e0 100644 --- a/env/test.env +++ b/env/test.env @@ -1,9 +1,9 @@ # Environment -NODE_ENV=testing +NODE_ENV=test # Server -PORT=4000 -HOST=localost +PORT=80 +HOST=localhost JDK8PATH=/usr/lib/jvm/java-8-openjdk-amd64/ ANDROIDTOOLSPATH=/opt/android-sdk diff --git a/package.json b/package.json index 06f90ce..78788d7 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,12 @@ "main": "server.js", "type": "module", "scripts": { - "start": "NODE_ENV=production&& node ./server.js", + "start": "node ./server.js", "postinstall": "tsc", "dev": "node --inspect=5858 --loader ts-node/esm ./server.ts", - "build": "tsc" + "build": "tsc", + "docker:build": "docker build -t cloud-apk .", + "docker:run": "docker run -p 80:80 cloud-apk" }, "repository": { "type": "git", diff --git a/routes/project.js b/routes/project.js deleted file mode 100644 index 9ee2e79..0000000 --- a/routes/project.js +++ /dev/null @@ -1,438 +0,0 @@ -import express from 'express'; -import { BubbleWrapper } from '../build/bubbleWrapper.js'; -import { join } from 'path'; -import tmp from 'tmp'; -import archiver from 'archiver'; -import fs from 'fs-extra'; -import { deleteAsync } from 'del'; -import generatePassword from 'password-generator'; -import fetch from 'node-fetch'; -import { logUrlResult } from '../build/urlLogger.js'; -import { errorToString } from '../build/utils.js'; -import { trackEvent } from '../build/analytics.js'; -const router = express.Router(); -const tempFileRemovalTimeoutMs = 1000 * 60 * 5; // 5 minutes -tmp.setGracefulCleanup(); // remove any tmp file artifacts on process exit -/** - * Generates an APK package and zips it up along with the signing key info. Sends back the zip file. - * Expects a POST body containing @see ApkOptions form data. - */ -router.post(['/generateAppPackage', '/generateApkZip'], async function (request, response) { - const apkRequest = validateApkRequest(request); - const platformId = request.headers['platform-identifier']; - const platformIdVersion = request.headers['platform-identifier-version']; - const correlationId = request.headers['correlation-id']; - const analyticsInfo = { - url: apkRequest.options?.pwaUrl || apkRequest.options?.host || '', - packageId: apkRequest.options?.packageId || '', - name: apkRequest.options?.name || '', - platformId: platformId ? platformId.toString() : null, - platformIdVersion: platformIdVersion - ? platformIdVersion.toString() - : null, - correlationId: correlationId ? correlationId.toString() : null, - }; - if (apkRequest.validationErrors.length > 0 || !apkRequest.options) { - const errorMessage = 'Invalid PWA settings: ' + apkRequest.validationErrors.join(', '); - logUrlResult(apkRequest.options?.pwaUrl || apkRequest.options?.host || '', false, errorMessage); - trackEvent(analyticsInfo, errorMessage, false); - response.status(500).send(errorMessage); - return; - } - try { - const appPackage = await createAppPackage(apkRequest.options); - // Create our zip file containing the APK, readme, and signing info. - const zipFile = await zipAppPackage(appPackage, apkRequest.options); - response.sendFile(zipFile, {}); - logUrlResult(apkRequest.options.pwaUrl || apkRequest.options.host, true, null); - trackEvent(analyticsInfo, null, true); - console.info('Process completed successfully.'); - } - catch (err) { - console.error('Error generating app package', err); - const errorString = errorToString(err); - logUrlResult(apkRequest.options.pwaUrl || apkRequest.options.host, false, 'Error generating app package ' + errorToString); - trackEvent(analyticsInfo, errorString, false); - response - .status(500) - .send('Error generating app package: \r\n' + errorString); - } -}); -/** - * This endpoint tries to fetch a URL. This is useful because we occasionally have bug reports - * where the Android packaging service can't fetch an image or other resource. - * Example: https://github.com/pwa-builder/PWABuilder/issues/1166 - * - * Often, the cause is the developer's web server is blocking an IP address range that includes - * our published app service. - * - * This endpoint checks for that by performing a simple fetch. - * - * Usage: /fetch?type=blob&url=https://somewebsite.com/favicon-512x512.png - */ -router.get('/fetch', async function (request, response) { - const url = request.query.url; - if (!url) { - response.status(500).send('You must specify a URL'); - return; - } - if (typeof url !== 'string') { - response.status(500).send('URL must be a string'); - return; - } - let type; - if (request.query.type !== null && - typeof request.query.type === 'string' && - ['blob', 'json', 'text'].includes(request.query.type)) { - type = request.query.type; - } - else { - type = 'text'; - } - let fetchResult; - try { - fetchResult = await fetch(url); - } - catch (fetchError) { - response - .status(500) - .send(`Unable to initiate fetch for ${url}. Error: ${fetchError}`); - return; - } - if (!fetchResult.ok) { - response - .status(fetchResult.status) - .send(`Unable to fetch ${url}. Status: ${fetchResult.status}, ${fetchResult.statusText}`); - return; - } - if (fetchResult.type) { - response.type(fetchResult.type); - } - if (fetchResult.headers) { - fetchResult.headers.forEach((value, name) => response.setHeader(name, value)); - } - try { - if (type === 'blob') { - const blob = await fetchResult.arrayBuffer(); - response.status(fetchResult.status).send(Buffer.from(blob)); - } - else if (type === 'json') { - const json = await fetchResult.json(); - response.status(fetchResult.status).send(json); - } - else { - const text = await fetchResult.text(); - response.status(fetchResult.status).send(text); - } - } - catch (getResultError) { - response - .status(500) - .send(`Unable to fetch result from ${url} using type ${type}. Error: ${getResultError}`); - } -}); -function validateApkRequest(request) { - const validationErrors = []; - // If we were unable to parse ApkOptions, there's no more validation to do. - let options = tryParseOptionsFromRequest(request); - if (!options) { - validationErrors.push("Malformed argument. Coudn't find ApkOptions in body"); - return { - options: null, - validationErrors, - }; - } - // Ensure we have required fields. - const requiredFields = [ - 'appVersion', - 'appVersionCode', - 'backgroundColor', - 'display', - 'fallbackType', - 'host', - 'iconUrl', - 'launcherName', - 'navigationColor', - 'packageId', - 'signingMode', - 'startUrl', - 'themeColor', - 'webManifestUrl', - ]; - // The "fullScopeUrl" field is required only for Meta Quest devices. - if (options.isMetaQuest) { - requiredFields.push('fullScopeUrl'); - } - validationErrors.push(...requiredFields.filter((f) => !options[f]).map((f) => `${f} is required`)); - // We must have signing options if the signing is enabled. - if (options.signingMode !== 'none' && !options.signing) { - validationErrors.push(`Signing options are required when signing mode = '${options.signingMode}'`); - } - // If the user is supplying their own signing key, we have some additional requirements: - // - A signing key file must be specified - // - The signing key file must be a base64 encoded string. - // - A store password must be supplied - // - A key password must be supplied - if (options.signingMode === 'mine' && options.signing) { - // We must have a keystore file uploaded if the signing mode is use existing. - if (!options.signing.file) { - validationErrors.push("You must supply a signing key file when signing mode = 'mine'"); - } - // Signing file must be a base 64 encoded string. - if (options.signing.file && !options.signing.file.startsWith('data:')) { - validationErrors.push('Signing file must be a base64 encoded string containing the Android keystore file'); - } - if (!options.signing.storePassword) { - validationErrors.push("You must supply a store password when signing mode = 'mine'"); - } - if (!options.signing.keyPassword) { - validationErrors.push("You must supply a key password when signing mode = 'mine'"); - } - } - // Validate signing option fields - if (options.signingMode !== 'none' && options.signing) { - // If we don't have a key password or store password, create one now. - if (!options.signing.keyPassword) { - options.signing.keyPassword = generatePassword(12, false); - } - if (!options.signing.storePassword) { - options.signing.storePassword = generatePassword(12, false); - } - // Verify we have the required signing options. - const requiredSigningOptions = [ - 'alias', - 'keyPassword', - 'storePassword', - ]; - // If we're creating a new key, we require additional info. - if (options.signingMode === 'new') { - requiredSigningOptions.push('countryCode', 'fullName', 'organization', 'organizationalUnit'); - } - validationErrors.push(...requiredSigningOptions - .filter((f) => !options?.signing[f]) - .map((f) => `Signing option ${f} is required`)); - } - return { - options: options, - validationErrors, - }; -} -function tryParseOptionsFromRequest(request) { - // See if the body is our options request. - if (request.body['packageId']) { - return request.body; - } - return null; -} -async function createAppPackage(options) { - let projectDir = null; - try { - // Create a temporary directory where we'll do all our work. - projectDir = tmp.dirSync({ prefix: 'pwabuilder-cloudapk-' }); - const projectDirPath = projectDir.name; - // Get the signing information. - const signing = await createLocalSigninKeyInfo(options, projectDirPath); - // Generate the APK, keys, and digital asset links. - return await createAppPackageWith403Fallback(options, projectDirPath, signing); - } - finally { - // Schedule this directory for cleanup in the near future. - scheduleTmpDirectoryCleanup(projectDir?.name); - } -} -async function createAppPackageWith403Fallback(options, projectDirPath, signing) { - // Create the app package. - // If we get a get a 403 error, try again using our URL proxy service. - // - // We've witnessed dozens of cases where we receive a 403 forbidden from accessing a server: - // - https://github.com/pwa-builder/PWABuilder/issues/1499 - // - https://github.com/pwa-builder/PWABuilder/issues/1476 - // - https://github.com/pwa-builder/PWABuilder/issues/1375 - // - https://github.com/pwa-builder/PWABuilder/issues/1320 - // - // When this happens, we can swap out the APK url items with a safe proxy server that doesn't have the same issues. - // For example, if the icon is https://foo.com/img.png, we change this to - // https://pwabuilder-safe-url.azurewebsites.net/api/getsafeurl?url=https://foo.com/img/png - const http1Fetch = 'node-fetch'; - const http2Fetch = 'fetch-h2'; - try { - const bubbleWrapper = new BubbleWrapper(options, projectDirPath, signing, http1Fetch); - return await bubbleWrapper.generateAppPackage(); - } - catch (error) { - const errorMessage = error?.message || ''; - console.log('ERROR MESSAGE', errorMessage); - const is403Error = errorMessage.includes('403') || - errorMessage.includes('ECONNREFUSED') || - errorMessage.includes('ENOTFOUND'); - if (is403Error) { - const optionsWithSafeUrl = getAndroidOptionsWithSafeUrls(options); - console.warn('Encountered 403 error when generating app package. Retrying with safe URL proxy.', error, optionsWithSafeUrl); - const bubbleWrapper = new BubbleWrapper(optionsWithSafeUrl, projectDirPath, signing, http2Fetch); - return await bubbleWrapper.generateAppPackage(); - } - // It's not a 403 / connection refused? Just throw it. - console.error('Bubblewrap failed to generated app package.', error); - throw error; - } -} -async function createLocalSigninKeyInfo(apkSettings, projectDir) { - // If we're told not to sign it, skip this. - if (apkSettings.signingMode === 'none') { - return null; - } - // Did the user upload a key file for signing? If so, download it to our directory. - const keyFilePath = join(projectDir, 'signingKey.keystore'); - if (apkSettings.signingMode === 'mine') { - if (!apkSettings.signing?.file) { - throw new Error("Signing mode is 'mine', but no signing key file was supplied."); - } - const fileBuffer = base64ToBuffer(apkSettings.signing.file); - await fs.promises.writeFile(keyFilePath, fileBuffer); - } - function base64ToBuffer(base64) { - const matches = base64.match(/^data:([A-Za-z-+\/]+);base64,(.+)$/); - if (!matches || matches.length !== 3) { - throw new Error('Invalid base 64 string'); - } - return Buffer.from(matches[2], 'base64'); - } - // Make sure we have signing info supplied, otherwise we received bad data. - if (!apkSettings.signing) { - throw new Error(`Signing mode was set to ${apkSettings.signingMode}, but no signing information was supplied.`); - } - return { - keyFilePath: keyFilePath, - ...apkSettings.signing, - }; -} -/*** - * Creates a zip file containing the app package and associated artifacts. - */ -async function zipAppPackage(appPackage, apkOptions) { - console.info('Zipping app package with options', appPackage, apkOptions); - const apkName = `${apkOptions.name}${apkOptions.signingMode === 'none' ? '-unsigned' : ''}.apk`; - let tmpZipFile = null; - return new Promise((resolve, reject) => { - try { - const archive = archiver('zip', { - zlib: { level: 5 }, - }); - archive.on('warning', function (zipWarning) { - console.warn('Warning during zip creation', zipWarning); - }); - archive.on('error', function (zipError) { - console.error('Error during zip creation', zipError); - reject(zipError); - }); - tmpZipFile = tmp.tmpNameSync({ - prefix: 'pwabuilder-cloudapk-', - postfix: '.zip', - }); - const output = fs.createWriteStream(tmpZipFile); - output.on('close', () => { - if (tmpZipFile) { - resolve(tmpZipFile); - } - else { - reject('No zip file was created'); - } - }); - archive.pipe(output); - // Append the APK and next steps readme. - const isSigned = !!appPackage.signingInfo; - archive.file(appPackage.apkFilePath, { name: apkName }); - archive.file(isSigned ? './Next-steps.html' : './Next-steps-unsigned.html', { name: 'Readme.html' }); - // If we've signed it, we should have signing info, asset links file, and app bundle. - if (appPackage.signingInfo && appPackage.signingInfo.keyFilePath) { - archive.file(appPackage.signingInfo.keyFilePath, { - name: 'signing.keystore', - }); - const readmeContents = [ - "Keep this file and signing.keystore in a safe place. You'll need these files if you want to upload future versions of your PWA to the Google Play Store.\r\n", - 'Key store file: signing.keystore', - `Key store password: ${appPackage.signingInfo.storePassword}`, - `Key alias: ${appPackage.signingInfo.alias}`, - `Key password: ${appPackage.signingInfo.keyPassword}`, - `Signer's full name: ${appPackage.signingInfo.fullName}`, - `Signer's organization: ${appPackage.signingInfo.organization}`, - `Signer's organizational unit: ${appPackage.signingInfo.organizationalUnit}`, - `Signer's country code: ${appPackage.signingInfo.countryCode}`, - ]; - archive.append(readmeContents.join('\r\n'), { - name: 'signing-key-info.txt', - }); - // Zip up the asset links. - if (appPackage.assetLinkFilePath) { - archive.file(appPackage.assetLinkFilePath, { - name: 'assetlinks.json', - }); - } - } - // Zip up the app bundle as well. - if (appPackage.appBundleFilePath) { - archive.file(appPackage.appBundleFilePath, { - name: `${apkOptions.name}${apkOptions.signingMode === 'none' ? '-unsigned' : ''}.aab`, - }); - } - // Add the source code directory if need be. - if (apkOptions.includeSourceCode) { - archive.directory(appPackage.projectDirectory, 'source'); - } - archive.finalize(); - } - catch (err) { - reject(err); - } - finally { - scheduleTmpFileCleanup(tmpZipFile); - } - }); -} -function scheduleTmpFileCleanup(file) { - if (file) { - console.info('Scheduled cleanup for tmp file', file); - const delFile = function () { - const filePath = file.replace(/\\/g, '/'); // Use / instead of \ otherwise del gets failed to delete files on Windows - deleteAsync([filePath], { force: true }) - .then((deletedPaths) => console.info('Cleaned up tmp file', deletedPaths)) - .catch((err) => console.warn('Unable to cleanup tmp file. It will be cleaned up on process exit', err, filePath)); - }; - setTimeout(() => delFile(), tempFileRemovalTimeoutMs); - } -} -function scheduleTmpDirectoryCleanup(dir) { - // We can't use dir.removeCallback() because it will fail with "ENOTEMPTY: directory not empty" error. - // We can't use fs.rmdir(path, { recursive: true }) as it's supported only in Node 12+, which isn't used by our docker image. - if (dir) { - const dirToDelete = dir.replace(/\\/g, '/'); // Use '/' instead of '\', otherwise del gets confused and won't cleanup on Windows. - const dirPatternToDelete = dirToDelete + '/**'; // Glob pattern to delete subdirectories and files - console.info('Scheduled cleanup for tmp directory', dirPatternToDelete); - const delDir = function () { - deleteAsync([dirPatternToDelete], { force: true }) // force allows us to delete files outside of workspace - .then((deletedPaths) => console.info('Cleaned up tmp directory', dirPatternToDelete, deletedPaths?.length, 'subdirectories and files were deleted')) - .catch((err) => console.warn('Unable to cleanup tmp directory. It will be cleaned up on process exit', err)); - }; - setTimeout(() => delDir(), tempFileRemovalTimeoutMs); - } -} -function getAndroidOptionsWithSafeUrls(options) { - const absoluteUrlProps = [ - 'maskableIconUrl', - 'monochromeIconUrl', - 'iconUrl', - 'webManifestUrl', - ]; - const newOptions = { ...options }; - for (let prop of absoluteUrlProps) { - const url = newOptions[prop]; - if (url && typeof url === 'string') { - const safeUrlFetcherEndpoint = 'https://pwabuilder-safe-url.azurewebsites.net/api/getsafeurl'; - const safeUrl = `${safeUrlFetcherEndpoint}?url=${encodeURIComponent(url)}`; - newOptions[prop] = safeUrl; - } - } - return newOptions; -} -export default router; -//# sourceMappingURL=project.js.map \ No newline at end of file diff --git a/routes/project.js.map b/routes/project.js.map deleted file mode 100644 index a118502..0000000 --- a/routes/project.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"project.js","sourceRoot":"","sources":["project.ts"],"names":[],"mappings":"AAAA,OAAO,OAAqB,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,UAAU,CAAC;AAK1B,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAGlC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAmB,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO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kB,EAClB,YAAY,EAAE,MAAM,EACpB,uCAAuC,CACxC,CACF;iBACA,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAClB,OAAO,CAAC,IAAI,CACV,wEAAwE,EACxE,GAAG,CACJ,CACF,CAAC;QACN,CAAC,CAAC;QACF,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,wBAAwB,CAAC,CAAC;KACtD;AACH,CAAC;AAED,SAAS,6BAA6B,CACpC,OAA8B;IAE9B,MAAM,gBAAgB,GAAuC;QAC3D,iBAAiB;QACjB,mBAAmB;QACnB,SAAS;QACT,gBAAgB;KACjB,CAAC;IACF,MAAM,UAAU,GAA0B,EAAE,GAAG,OAAO,EAAE,CAAC;IACzD,KAAK,IAAI,IAAI,IAAI,gBAAgB,EAAE;QACjC,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAClC,MAAM,sBAAsB,GAC1B,8DAA8D,CAAC;YACjE,MAAM,OAAO,GAAG,GAAG,sBAAsB,QAAQ,kBAAkB,CACjE,GAAG,CACJ,EAAE,CAAC;YACH,UAAU,CAAC,IAAI,CAAS,GAAG,OAAO,CAAC;SACrC;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/routes/project.ts b/routes/project.ts index 8175aed..4acb718 100644 --- a/routes/project.ts +++ b/routes/project.ts @@ -43,6 +43,7 @@ router.post( ? platformIdVersion.toString() : null, correlationId: correlationId ? correlationId.toString() : null, + referrer: request.query.ref ? request.query.ref.toString() : null, }; if (apkRequest.validationErrors.length > 0 || !apkRequest.options) { const errorMessage = diff --git a/server.js b/server.js deleted file mode 100644 index 83d3313..0000000 --- a/server.js +++ /dev/null @@ -1,21 +0,0 @@ -import dotenv from 'dotenv'; -import app from './app.js'; -const port = process.env.PORT || 3333; -const configResult = dotenv.config({ - path: `./env/${app.get("env")}.env` -}); -if (configResult.error) { - console.error("Error loading .env file", configResult.error); -} -else { - console.info("Configured with environment file", configResult.parsed); -} -const jdk8Path = process.env.JDK8PATH; -const androidDevToolsPath = process.env.ANDROIDTOOLSPATH; -if (!jdk8Path || !androidDevToolsPath) { - console.error("Couldn't find environment variables for JDK8 path or Android Dev tools", app.get("env"), jdk8Path, androidDevToolsPath); -} -app.listen(port, () => { - console.log(`App listening on port ${port}`); -}); -//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/server.js.map b/server.js.map deleted file mode 100644 index 8717a72..0000000 --- a/server.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"server.js","sourceRoot":"","sources":["server.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AAEtC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,SAAS,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM;CACtC,CAAC,CAAC;AACH,IAAI,YAAY,CAAC,KAAK,EAAE;IACpB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;CAChE;KAAM;IACH,OAAO,CAAC,IAAI,CAAC,kCAAkC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CACzE;AAED,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AACtC,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;AACzD,IAAI,CAAC,QAAQ,IAAI,CAAC,mBAAmB,EAAE;IACnC,OAAO,CAAC,KAAK,CAAC,wEAAwE,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC;CAC1I;AAED,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IAClB,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC"} \ No newline at end of file