Skip to content

Commit

Permalink
refactor(electron-updater): remove NET_SESSION_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaslee119 authored and develar committed Dec 12, 2017
1 parent 1d5b408 commit 541605f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 41 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"7zip-bin": "^2.3.4",
"archiver": "^2.1.0",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.167.0",
"aws-sdk": "^2.168.0",
"bluebird-lst": "^1.0.5",
"chalk": "^2.3.0",
"chromium-pickle-js": "^0.2.0",
Expand Down Expand Up @@ -72,7 +72,7 @@
"devDependencies": {
"@develar/gitbook": "3.2.11",
"@types/debug": "^0.0.30",
"@types/ejs": "^2.3.33",
"@types/ejs": "^2.5.0",
"@types/electron-is-dev": "^0.3.0",
"@types/iconv-lite": "^0.0.1",
"@types/ini": "^1.3.29",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.4.5",
"aws-sdk": "^2.167.0",
"aws-sdk": "^2.168.0",
"mime": "^2.0.3",
"electron-publish": "~0.0.0-semantic-release",
"builder-util": "^0.0.0-semantic-release",
Expand Down
7 changes: 3 additions & 4 deletions packages/electron-updater/src/electronHttpExecutor.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { configureRequestOptionsFromUrl, DownloadOptions, HttpExecutor } from "builder-util-runtime"
import { net, session } from "electron"
import { net } from "electron"
import { ensureDir } from "fs-extra-p"
import * as path from "path"

export const NET_SESSION_NAME = "electron-updater"

export type LoginCallback = (username: string, password: string) => void

export class ElectronHttpExecutor extends HttpExecutor<Electron.ClientRequest> {
Expand Down Expand Up @@ -35,7 +33,8 @@ export class ElectronHttpExecutor extends HttpExecutor<Electron.ClientRequest> {
}

public doRequest(options: any, callback: (response: any) => void): any {
const request = (net as any).request({session: (session as any).fromPartition(NET_SESSION_NAME), ...options}, callback)
const request = net.request(options)
request.on("response", callback)
this.addProxyLoginHandler(request)
return request
}
Expand Down
3 changes: 1 addition & 2 deletions packages/electron-updater/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { CancellationToken, ProgressInfo, UpdateInfo, UpdateFileInfo, PackageFileInfo } from "builder-util-runtime"
import { CancellationToken, PackageFileInfo, ProgressInfo, UpdateFileInfo, UpdateInfo } from "builder-util-runtime"
import { EventEmitter } from "events"
import { URL } from "url"
import { AppUpdater } from "./AppUpdater"
import { LoginCallback } from "./electronHttpExecutor"

export { NET_SESSION_NAME } from "./electronHttpExecutor"
export { AppUpdater, NoOpLogger } from "./AppUpdater"
export { UpdateInfo }
export { CancellationToken } from "builder-util-runtime"
Expand Down
57 changes: 25 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
version "0.0.30"
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-0.0.30.tgz#dc1e40f7af3b9c815013a7860e6252f6352a84df"

"@types/ejs@^2.3.33":
version "2.3.33"
resolved "https://registry.yarnpkg.com/@types/ejs/-/ejs-2.3.33.tgz#0a4e0a7aeee09944154b06ce5a2ac6a118f92b00"
"@types/ejs@^2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@types/ejs/-/ejs-2.5.0.tgz#e8f76bef977666f3d71730208bcb6bbcc172a080"

"@types/electron-is-dev@^0.3.0":
version "0.3.0"
Expand Down Expand Up @@ -120,8 +120,8 @@
resolved "https://registry.yarnpkg.com/@types/node-emoji/-/node-emoji-1.4.0.tgz#34068c35b74ee5c9d73eb9b84c60b2c06a169412"

"@types/node@*":
version "8.0.57"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.57.tgz#e5d8b4dc112763e35cfc51988f4f38da3c486d99"
version "8.0.58"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.58.tgz#5b3881c0be3a646874803fee3197ea7f1ed6df90"

"@types/sanitize-filename@^1.1.28":
version "1.1.28"
Expand Down Expand Up @@ -430,9 +430,9 @@ asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"

aws-sdk@^2.167.0:
version "2.167.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.167.0.tgz#f207dff7f7e9a7883d3b69bd22513444968a36bd"
aws-sdk@^2.168.0:
version "2.168.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.168.0.tgz#561e0a231b8f70a2bee56ff5e508b6efff604fe3"
dependencies:
buffer "4.9.1"
crypto-browserify "1.0.9"
Expand Down Expand Up @@ -715,7 +715,7 @@ block-stream@*:
dependencies:
inherits "~2.0.0"

bluebird-lst@^1.0.3, bluebird-lst@^1.0.4, bluebird-lst@^1.0.5:
bluebird-lst@^1.0.3, bluebird-lst@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/bluebird-lst/-/bluebird-lst-1.0.5.tgz#bebc83026b7e92a72871a3dc599e219cbfb002a9"
dependencies:
Expand Down Expand Up @@ -1135,8 +1135,8 @@ convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1:
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5"

core-js@^2.4.0, core-js@^2.5.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b"
version "2.5.3"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.3.tgz#8acc38345824f16d8365b7c9b4259168e8ed603e"

[email protected], core-util-is@~1.0.0:
version "1.0.2"
Expand Down Expand Up @@ -1554,10 +1554,10 @@ env-paths@^1.0.0:
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0"

errno@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d"
version "0.1.5"
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.5.tgz#a563781a6052bc2c9ccd89e8cef0eb9506e0c321"
dependencies:
prr "~0.0.0"
prr "~1.0.1"

error-ex@^1.2.0:
version "1.3.1"
Expand Down Expand Up @@ -1867,21 +1867,14 @@ front-matter@^2.1.0:
dependencies:
js-yaml "^3.10.0"

fs-extra-p@^4.4.0, fs-extra-p@^4.4.4:
version "4.4.4"
resolved "https://registry.yarnpkg.com/fs-extra-p/-/fs-extra-p-4.4.4.tgz#396ad6f914eb2954e1700fd0e18288301ed45f04"
dependencies:
bluebird-lst "^1.0.4"
fs-extra "^4.0.2"

fs-extra-p@^4.4.5:
fs-extra-p@^4.4.0, fs-extra-p@^4.4.4, fs-extra-p@^4.4.5:
version "4.4.5"
resolved "https://registry.yarnpkg.com/fs-extra-p/-/fs-extra-p-4.4.5.tgz#90875f2615b53d0085b562e15d579281b9d454c2"
dependencies:
bluebird-lst "^1.0.5"
fs-extra "^4.0.3"

fs-extra@^4.0.1, fs-extra@^4.0.2, fs-extra@^4.0.3:
fs-extra@^4.0.1, fs-extra@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94"
dependencies:
Expand Down Expand Up @@ -3303,8 +3296,8 @@ mime@^2.0.3:
resolved "https://registry.yarnpkg.com/mime/-/mime-2.0.3.tgz#4353337854747c48ea498330dc034f9f4bbbcc0b"

mimer@*:
version "0.2.1"
resolved "https://registry.yarnpkg.com/mimer/-/mimer-0.2.1.tgz#c63c5a17fe86423f5161a85d55c3ed5189baaffc"
version "0.2.3"
resolved "https://registry.yarnpkg.com/mimer/-/mimer-0.2.3.tgz#8808c0d03fb2b1273b81ae25a6e52e04ce18dce4"

mimic-fn@^1.0.0:
version "1.1.0"
Expand Down Expand Up @@ -3343,8 +3336,8 @@ mkpath@^0.1.0:
resolved "https://registry.yarnpkg.com/mkpath/-/mkpath-0.1.0.tgz#7554a6f8d871834cc97b5462b122c4c124d6de91"

moment@^2.18.1:
version "2.19.3"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.3.tgz#bdb99d270d6d7fda78cc0fbace855e27fe7da69f"
version "2.19.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.4.tgz#17e5e2c6ead8819c8ecfad83a0acccb312e94682"

[email protected]:
version "0.7.1"
Expand Down Expand Up @@ -3754,8 +3747,8 @@ plist@^2.1.0:
xmldom "0.1.x"

prebuild-install@^2.3.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-2.4.0.tgz#9cd6325847f984136dd993375395d420da270a75"
version "2.4.1"
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-2.4.1.tgz#c28ba1d1eedc17fbd6b3229a657ffc0fba479b49"
dependencies:
expand-template "^1.0.2"
github-from-package "0.0.0"
Expand Down Expand Up @@ -3813,9 +3806,9 @@ progress-stream@^1.1.0:
speedometer "~0.1.2"
through2 "~0.2.3"

prr@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a"
prr@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"

pseudomap@^1.0.2:
version "1.0.2"
Expand Down

0 comments on commit 541605f

Please sign in to comment.