Skip to content

Commit

Permalink
feat: validate icon permissions
Browse files Browse the repository at this point in the history
Close #2654
  • Loading branch information
develar committed Mar 5, 2018
1 parent e5e0782 commit c03ad38
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 47 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"////": "All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).",
"dependencies": {
"7zip-bin": "~3.1.0",
"app-builder-bin": "1.6.0",
"app-builder-bin": "1.7.0",
"archiver": "^2.1.1",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.205.0",
Expand All @@ -48,7 +48,7 @@
"ini": "^1.3.5",
"is-ci": "^1.1.0",
"isbinaryfile": "^3.0.2",
"js-yaml": "^3.10.0",
"js-yaml": "^3.11.0",
"lazy-val": "^1.0.3",
"lodash.isequal": "^4.5.0",
"mime": "^2.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"out"
],
"dependencies": {
"app-builder-bin": "1.6.0",
"app-builder-bin": "1.7.0",
"temp-file": "^3.1.1",
"fs-extra-p": "^4.5.2",
"is-ci": "^1.1.0",
Expand All @@ -24,7 +24,7 @@
"7zip-bin": "~3.1.0",
"semver": "^5.5.0",
"lazy-val": "^1.0.3",
"js-yaml": "^3.10.0"
"js-yaml": "^3.11.0"
},
"typings": "./out/util.d.ts"
}
3 changes: 1 addition & 2 deletions packages/builder-util/src/DebugLogger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import BluebirdPromise from "bluebird-lst"
import { outputFile } from "fs-extra-p"
import { serializeToYaml } from "./util"

Expand Down Expand Up @@ -46,7 +45,7 @@ export class DebugLogger {
return outputFile(file, serializeToYaml(this.data))
}
else {
return BluebirdPromise.resolve()
return Promise.resolve()
}
}
}
2 changes: 1 addition & 1 deletion packages/builder-util/src/asyncTaskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class AsyncTaskManager {
.catch(it => {
log.debug({error: it.message || it.toString()}, "async task error")
this.errors.push(it)
return BluebirdPromise.resolve(null)
return Promise.resolve(null)
}))
}

Expand Down
2 changes: 1 addition & 1 deletion packages/dmg-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"parse-color": "^1.0.0",
"builder-util": "^0.0.0-semantic-release",
"iconv-lite": "^0.4.19",
"js-yaml": "^3.10.0",
"js-yaml": "^3.11.0",
"electron-builder-lib": "~0.0.0-semantic-release",
"sanitize-filename": "^1.6.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"homepage": "https://github.com/electron-userland/electron-builder",
"dependencies": {
"7zip-bin": "~3.1.0",
"app-builder-bin": "1.6.0",
"app-builder-bin": "1.7.0",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.5",
"chromium-pickle-js": "^0.2.0",
Expand All @@ -54,7 +54,7 @@
"hosted-git-info": "^2.5.0",
"is-ci": "^1.1.0",
"isbinaryfile": "^3.0.2",
"js-yaml": "^3.10.0",
"js-yaml": "^3.11.0",
"read-config-file": "3.0.0",
"minimatch": "^3.0.4",
"normalize-package-data": "^2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-lib/src/fileMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export function getFileMatchers(config: Configuration, name: "files" | "extraFil
/** @internal */
export function copyFiles(matchers: Array<FileMatcher> | null): Promise<any> {
if (matchers == null || matchers.length === 0) {
return BluebirdPromise.resolve()
return Promise.resolve()
}

return BluebirdPromise.map(matchers, async (matcher: FileMatcher) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-lib/src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ function createOutDirIfNeed(targetList: Array<Target>, createdOutDirs: Set<strin
return ensureDir(it)
})
}
return BluebirdPromise.resolve()
return Promise.resolve()
}

export interface BuildResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class RemoteBuilder {

build(): Promise<any> {
if (this.buildStarted) {
return BluebirdPromise.resolve()
return Promise.resolve()
}

this.buildStarted = true
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-lib/src/targets/nsis/nsisUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class CopyElevateHelper {
}

if (isPackElevateHelper === false) {
return BluebirdPromise.resolve()
return Promise.resolve()
}

let promise = this.copied.get(appOutDir)
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/cli/install-app-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function installAppDeps(args: any) {
const muonVersion = config.muonVersion
const results = await BluebirdPromise.all<string>([
computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
muonVersion == null ? getElectronVersion(projectDir, config, packageMetadata) : BluebirdPromise.resolve(muonVersion),
muonVersion == null ? getElectronVersion(projectDir, config, packageMetadata) : Promise.resolve(muonVersion),
])

// if two package.json — force full install (user wants to install/update app deps in addition to dev)
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lazy-val": "^1.0.3",
"bluebird-lst": "^1.0.5",
"fs-extra-p": "^4.5.2",
"js-yaml": "^3.10.0",
"js-yaml": "^3.11.0",
"semver": "^5.5.0",
"source-map-support": "^0.5.3",
"builder-util-runtime": "~0.0.0-semantic-release",
Expand Down
3 changes: 1 addition & 2 deletions packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import BluebirdPromise from "bluebird-lst"
import { AllPublishOptions, asArray, CancellationToken, newError, PublishConfiguration, UpdateInfo, UUID } from "builder-util-runtime"
import { randomBytes } from "crypto"
import { Notification } from "electron"
Expand Down Expand Up @@ -226,7 +225,7 @@ export abstract class AppUpdater extends EventEmitter {

checkForUpdatesAndNotify(): Promise<UpdateCheckResult | null> {
if (isDev) {
return BluebirdPromise.resolve(null)
return Promise.resolve(null)
}

this.signals.updateDownloaded(it => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import BluebirdPromise from "bluebird-lst"
import { newError } from "builder-util-runtime"
import { createReadStream } from "fs-extra-p"
import { Writable } from "stream"
Expand Down Expand Up @@ -158,7 +157,7 @@ export class DataSplitter extends Writable {
}

private copyExistingData(index: number, end: number) {
return new BluebirdPromise((resolve, reject) => {
return new Promise((resolve, reject) => {
const w = () => {
if (index === end) {
resolve()
Expand Down Expand Up @@ -218,10 +217,10 @@ export class DataSplitter extends Writable {
this.actualPartLength += end - start
const out = this.out
if (out.write(start === 0 && data.length === end ? data : data.slice(start, end))) {
return BluebirdPromise.resolve()
return Promise.resolve()
}
else {
return new BluebirdPromise((resolve, reject) => {
return new Promise((resolve, reject) => {
out.on("error", reject)
out.once("drain", () => {
out.removeListener("error", reject)
Expand Down
8 changes: 4 additions & 4 deletions test/src/BuildTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ test.ifLinuxOrDevMac("afterPack", () => {
config: {
afterPack: () => {
called++
return BluebirdPromise.resolve()
return Promise.resolve()
}
}
}, {
Expand All @@ -137,7 +137,7 @@ test.ifLinuxOrDevMac("afterSign", () => {
config: {
afterSign: () => {
called++
return BluebirdPromise.resolve()
return Promise.resolve()
}
}
}, {
Expand Down Expand Up @@ -236,6 +236,6 @@ test.ifAll.ifDevOrLinuxCi("posix smart unpack", app({
packed: context => verifySmartUnpack(context.getResources(Platform.LINUX))}))

test("wine version", async () => {
await checkWineVersion(BluebirdPromise.resolve("1.9.23 (Staging)"))
await checkWineVersion(BluebirdPromise.resolve("2.0-rc2"))
await checkWineVersion(Promise.resolve("1.9.23 (Staging)"))
await checkWineVersion(Promise.resolve("2.0-rc2"))
})
2 changes: 1 addition & 1 deletion test/src/helpers/downloadElectron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const downloadElectron: (options: any) => Promise<any> = BluebirdPromise.promisi
export function deleteOldElectronVersion(): Promise<any> {
// on CircleCi no need to clean manually
if (process.env.CIRCLECI || !isCi) {
return BluebirdPromise.resolve()
return Promise.resolve()
}

const cacheDir = require("env-paths")("electron", {suffix: ""}).cache
Expand Down
3 changes: 1 addition & 2 deletions test/src/helpers/winHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import BluebirdPromise from "bluebird-lst"
import { walk } from "builder-util/out/fs"
import { Arch, Platform } from "electron-builder"
import { readAsarJson } from "electron-builder-lib/out/asar/asar"
Expand Down Expand Up @@ -31,7 +30,7 @@ export async function checkHelpers(resourceDir: string, packElevateHelper: boole

export async function doTest(outDir: string, perUser: boolean, productFilename = "TestApp Setup", name = "TestApp", menuCategory: string | null = null, packElevateHelper = true) {
if (process.env.DO_WINE !== "true") {
return BluebirdPromise.resolve()
return Promise.resolve()
}

const wine = new WineManager()
Expand Down
6 changes: 3 additions & 3 deletions test/src/mac/masTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test.ifAll("custom mas", () => {
entitlements: "mas-entitlements file path",
"entitlements-inherit": "mas-entitlementsInherit file path",
})
return BluebirdPromise.resolve(null)
return Promise.resolve(null)
}
})
})
Expand All @@ -62,7 +62,7 @@ test.ifAll("entitlements in the package.json", () => {
entitlements: "osx-entitlements file path",
"entitlements-inherit": "osx-entitlementsInherit file path",
})
return BluebirdPromise.resolve()
return Promise.resolve()
}
})
})
Expand All @@ -82,7 +82,7 @@ test.ifAll("entitlements in build dir", () => {
entitlements: path.join(context.projectDir, "build", "entitlements.mac.plist"),
"entitlements-inherit": path.join(context.projectDir, "build", "entitlements.mac.inherit.plist"),
})
return BluebirdPromise.resolve()
return Promise.resolve()
}
})
})
37 changes: 22 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -275,25 +275,25 @@ anymatch@^1.3.0:
micromatch "^2.1.5"
normalize-path "^2.0.0"

app-builder-bin-linux@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.6.0.tgz#d7731d7988b8a740e74d591cbd565f168a266111"
app-builder-bin-linux@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.7.0.tgz#83894c51e224382a7268997cc8af1283c1be21e3"

app-builder-bin-mac@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.6.0.tgz#c976da70796d67aeb7134a57899636f2581d1c67"
app-builder-bin-mac@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.7.0.tgz#067a91d612fd3c2b687a097343ec4bb5f42c2e5f"

app-builder-bin-win@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.6.0.tgz#528ef96430d519c270b4de260bea0ddc70df1733"
app-builder-bin-win@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.7.0.tgz#caf81af88c5506717e4015880981b4ed3508414f"

app-builder-bin@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.6.0.tgz#c0e88a488d4c23c2e7fe0bbfb70c1d61165be206"
app-builder-bin@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.7.0.tgz#cb83e469d511f3516af7bca5288b692604bbd5c1"
optionalDependencies:
app-builder-bin-linux "1.6.0"
app-builder-bin-mac "1.6.0"
app-builder-bin-win "1.6.0"
app-builder-bin-linux "1.7.0"
app-builder-bin-mac "1.7.0"
app-builder-bin-win "1.7.0"

append-transform@^0.4.0:
version "0.4.0"
Expand Down Expand Up @@ -3259,6 +3259,13 @@ js-yaml@^3.10.0, js-yaml@^3.4.2, js-yaml@^3.7.0, js-yaml@^3.9.1:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^3.11.0:
version "3.11.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef"
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

js2xmlparser@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-3.0.0.tgz#3fb60eaa089c5440f9319f51760ccd07e2499733"
Expand Down

0 comments on commit c03ad38

Please sign in to comment.