@@ -7,6 +7,7 @@ import Listr = require('listr')
|
||||
import patchApk from './patch-apk'
|
||||
import { TaskOptions } from './cli'
|
||||
import observeAsync from './utils/observe-async'
|
||||
import buildGlob from './utils/build-glob'
|
||||
|
||||
export function patchXapkBundle(options: TaskOptions) {
|
||||
return patchAppBundle(options, { isXapk: true })
|
||||
@@ -55,7 +56,7 @@ function patchAppBundle(options: TaskOptions, { isXapk }: { isXapk: boolean }) {
|
||||
title: 'Signing APKs',
|
||||
task: () =>
|
||||
observeAsync(async log => {
|
||||
const apkFiles = await globby(path.join(bundleDir, '**/*.apk'))
|
||||
const apkFiles = await globby(buildGlob(bundleDir, '**/*.apk'))
|
||||
|
||||
await uberApkSigner
|
||||
.sign(apkFiles, { zipalign: false })
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
import * as path from 'path'
|
||||
import globby = require('globby')
|
||||
import { ListrTaskWrapper } from 'listr'
|
||||
|
||||
import observeAsync from '../utils/observe-async'
|
||||
import processSmaliFile from './smali/process-file'
|
||||
import buildGlob from '../utils/build-glob'
|
||||
|
||||
export default async function disableCertificatePinning(
|
||||
directoryPath: string,
|
||||
task: ListrTaskWrapper,
|
||||
) {
|
||||
return observeAsync(async log => {
|
||||
// Convert Windows path (using backslashes) to POSIX path (using slashes)
|
||||
const directoryPathPosix = directoryPath
|
||||
.split(path.sep)
|
||||
.join(path.posix.sep)
|
||||
const globPattern = path.posix.join(directoryPathPosix, 'smali*/**/*.smali')
|
||||
const smaliGlob = buildGlob(directoryPath, 'smali*/**/*.smali')
|
||||
|
||||
let pinningFound = false
|
||||
|
||||
log('Scanning Smali files...')
|
||||
for await (const filePathChunk of globby.stream(globPattern)) {
|
||||
for await (const filePathChunk of globby.stream(smaliGlob)) {
|
||||
// Required because Node.js streams are not typed as generics
|
||||
const filePath = filePathChunk as string
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import * as path from 'path'
|
||||
|
||||
/** Build a glob pattern that works on POSIX and Windows. */
|
||||
export default function buildGlob(...components: string[]) {
|
||||
// Convert Windows path (using backslashes) to POSIX path (using slashes)
|
||||
const unixComponents = components.map(component =>
|
||||
component.split(path.sep).join(path.posix.sep),
|
||||
)
|
||||
|
||||
return path.posix.join(...unixComponents)
|
||||
}
|
||||
Reference in New Issue
Block a user