Skip to content

Commit 52995df

Browse files
committed
fix: "status 401: Unauthorized" issue with dl.bintray.com
Close #1581
1 parent a2e58c0 commit 52995df

File tree

8 files changed

+23
-16
lines changed

8 files changed

+23
-16
lines changed

.idea/dictionaries/develar.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"ajv": "^5.1.3",
3232
"ajv-keywords": "^2.0.0",
3333
"archiver": "^1.3.0",
34-
"aws-sdk": "^2.55.0",
34+
"aws-sdk": "^2.56.0",
3535
"bluebird-lst": "^1.0.2",
3636
"chalk": "^1.1.3",
3737
"chromium-pickle-js": "^0.2.0",
@@ -78,7 +78,6 @@
7878
"babel-plugin-transform-es2015-parameters": "^6.24.1",
7979
"babel-plugin-transform-es2015-spread": "^6.22.0",
8080
"babel-plugin-transform-inline-imports-commonjs": "^1.2.0",
81-
"catharsis": "^0.8.8",
8281
"convert-source-map": "^1.5.0",
8382
"decompress-zip": "^0.3.0",
8483
"depcheck": "^0.6.7",

packages/electron-builder-http/src/httpExecutor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export abstract class HttpExecutor<REQUEST_OPTS, REQUEST> {
153153
protected doDownload(requestOptions: any, destination: string, redirectCount: number, options: DownloadOptions, callback: (error: Error | null) => void, onCancel: (callback: () => void) => void) {
154154
const request = this.doRequest(requestOptions, (response: Electron.IncomingMessage) => {
155155
if (response.statusCode >= 400) {
156-
callback(new Error(`Cannot download "${requestOptions.protocol || "https"}://${requestOptions.hostname}/${requestOptions.path}", status ${response.statusCode}: ${response.statusMessage}`))
156+
callback(new Error(`Cannot download "${requestOptions.protocol || "https:"}//${requestOptions.hostname}${requestOptions.path}", status ${response.statusCode}: ${response.statusMessage}`))
157157
return
158158
}
159159

@@ -298,7 +298,8 @@ export function configureRequestOptions(options: RequestOptions, token?: string
298298
headers["Cache-Control"] = "no-cache"
299299
}
300300

301-
if (options.protocol == null) {
301+
// do not specify for node (in any case we use https module)
302+
if (options.protocol == null && process.versions["electron"] != null) {
302303
options.protocol = "https:"
303304
}
304305
return options

packages/electron-builder-util/src/binDownload.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export function getBinFromBintray(name: string, version: string, sha2: string):
1414
return getBin(name, dirName, `https://dl.bintray.com/electron-userland/bin/${dirName}.7z`, sha2)
1515
}
1616

17+
export function getBinFromGithub(name: string, version: string, sha2: string): Promise<string> {
18+
const dirName = `${name}-${version}`
19+
return getBin(name, dirName, `https://github.com/electron-userland/electron-builder-binaries/releases/download/${dirName}/${dirName}.7z`, sha2)
20+
}
21+
1722
export function getBin(name: string, dirName: string, url: string, sha2: string): Promise<string> {
1823
let promise = versionToPromise.get(dirName)
1924
// if rejected, we will try to download again

packages/electron-builder/src/targets/nsis.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import BluebirdPromise from "bluebird-lst"
22
import _debug from "debug"
33
import { Arch, Target } from "electron-builder-core"
44
import { asArray, debug, doSpawn, exec, getPlatformIconFileName, handleProcess, isEmptyOrSpaces, use } from "electron-builder-util"
5-
import { getBinFromBintray } from "electron-builder-util/out/binDownload"
5+
import { getBinFromGithub } from "electron-builder-util/out/binDownload"
66
import { copyFile } from "electron-builder-util/out/fs"
77
import { log, subTask, warn } from "electron-builder-util/out/log"
88
import { asyncAll } from "electron-builder-util/out/promise"
@@ -24,9 +24,9 @@ const debugLang = _debug("electron-builder:lang")
2424
const ELECTRON_BUILDER_NS_UUID = "50e065bc-3134-11e6-9bab-38c9862bdaf3"
2525

2626
// noinspection SpellCheckingInspection
27-
const nsisPathPromise = getBinFromBintray("nsis", "3.0.1.13", "2921dd404ce9b69679088a6f1409a56dd360da2077fe1019573c0712c9edf057")
27+
const nsisPathPromise = getBinFromGithub("nsis", "3.0.1.13", "2921dd404ce9b69679088a6f1409a56dd360da2077fe1019573c0712c9edf057")
2828
// noinspection SpellCheckingInspection
29-
const nsisResourcePathPromise = getBinFromBintray("nsis-resources", "3.0.0", "cde0e77b249e29d74250bf006aa355d3e02b32226e1c6431fb48facae41d8a7e")
29+
const nsisResourcePathPromise = getBinFromGithub("nsis-resources", "3.0.0", "cde0e77b249e29d74250bf006aa355d3e02b32226e1c6431fb48facae41d8a7e")
3030

3131
const USE_NSIS_BUILT_IN_COMPRESSOR = false
3232

@@ -344,7 +344,7 @@ export class NsisTarget extends Target {
344344
menu = sanitizeFileName(packager.appInfo.companyName)
345345
}
346346
else {
347-
menu = (<string>options.menuCategory).split(/\/|\\/).map(it => sanitizeFileName(it)).join("\\")
347+
menu = (<string>options.menuCategory).split(/[\/\\]/).map(it => sanitizeFileName(it)).join("\\")
348348
}
349349
if (!isEmptyOrSpaces(menu)) {
350350
defines.MENU_FILENAME = menu

packages/electron-builder/src/windowsCodeSign.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { exec } from "electron-builder-util"
2-
import { getBinFromBintray } from "electron-builder-util/out/binDownload"
2+
import { getBinFromGithub } from "electron-builder-util/out/binDownload"
33
import { rename } from "fs-extra-p"
44
import isCi from "is-ci"
55
import { release } from "os"
@@ -10,7 +10,7 @@ const TOOLS_VERSION = "1.7.0"
1010

1111
export function getSignVendorPath() {
1212
//noinspection SpellCheckingInspection
13-
return getBinFromBintray("winCodeSign", TOOLS_VERSION, "a34a60e74d02b81d0303e498f03c70ce0133f908b671f62ec32896db5cd0a716")
13+
return getBinFromGithub("winCodeSign", TOOLS_VERSION, "a34a60e74d02b81d0303e498f03c70ce0133f908b671f62ec32896db5cd0a716")
1414
}
1515

1616
export interface FileCodeSigningInfo {

test/src/windows/portableTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { app } from "../helpers/packTester"
55
test.ifAll.ifNotCiMac("portable", app({
66
targets: Platform.WINDOWS.createTarget(["portable", "nsis"]),
77
config: {
8+
publish: null,
89
nsis: {
910
}
1011
}

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ acorn@^3.0.4, acorn@^3.3.0:
8383
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
8484

8585
acorn@^4.0.4:
86-
version "4.0.11"
87-
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0"
86+
version "4.0.13"
87+
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
8888

8989
ajv-keywords@^2.0.0:
9090
version "2.0.0"
@@ -271,9 +271,9 @@ asynckit@^0.4.0:
271271
version "0.4.0"
272272
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
273273

274-
aws-sdk@^2.55.0:
275-
version "2.55.0"
276-
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.55.0.tgz#7528f3729ecbc8e5aea42ac89e1ff2537086f7c2"
274+
aws-sdk@^2.56.0:
275+
version "2.56.0"
276+
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.56.0.tgz#a18c3005c7adb1c6edc86b95f2833aedd4f86493"
277277
dependencies:
278278
buffer "5.0.6"
279279
crypto-browserify "1.0.9"
@@ -688,7 +688,7 @@ caseless@~0.12.0:
688688
version "0.12.0"
689689
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
690690

691-
catharsis@^0.8.8, catharsis@~0.8.8:
691+
catharsis@~0.8.8:
692692
version "0.8.8"
693693
resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.8.8.tgz#693479f43aac549d806bd73e924cd0d944951a06"
694694
dependencies:

0 commit comments

Comments
 (0)