Skip to content

Commit 20157e9

Browse files
committed
Merge branch 'master' into trevj-remove-accumulator
2 parents 2385746 + ec7650f commit 20157e9

101 files changed

Lines changed: 308 additions & 346 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ build/*
1111
node_modules/*
1212
npm-debug.log
1313
tmp/*
14+
third_party/typings

Dockerfile

Lines changed: 0 additions & 20 deletions
This file was deleted.

Gruntfile.coffee

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,8 @@ config =
314314
# with a couple of fixes.
315315
'./src/cloud/social/shim/net.js:net'
316316
'./src/cloud/social/shim/dns.js:dns'
317-
# Subset of ssh2-streams (all except SFTP) which works well in
318-
# the browser.
319-
'./src/cloud/social/alias/ssh2-streams.js:ssh2-streams'
317+
# Alternative that works for freedomjs modules.
318+
'./src/cloud/social/alias/brorand.js:brorand'
320319
# Fallback for crypto-browserify's randombytes, for Firefox.
321320
'./src/cloud/social/alias/randombytes.js:randombytes'
322321
]
@@ -327,9 +326,8 @@ config =
327326
# with a couple of fixes.
328327
'./src/cloud/social/shim/net.js:net'
329328
'./src/cloud/social/shim/dns.js:dns'
330-
# Subset of ssh2-streams (all except SFTP) which works well in
331-
# the browser.
332-
'./src/cloud/social/alias/ssh2-streams.js:ssh2-streams'
329+
# Alternative that works for freedomjs modules.
330+
'./src/cloud/social/alias/brorand.js:brorand'
333331
# Fallback for crypto-browserify's randombytes, for Firefox.
334332
'./src/cloud/social/alias/randombytes.js:randombytes'
335333
]

bin/connect-pair.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "uproxy-lib",
33
"description": "Shared libraries for uProxy projects.",
4-
"version": "37.1.1",
4+
"version": "37.1.2",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/uProxy/uproxy-lib"
@@ -60,11 +60,10 @@
6060
"lodash": "^3.10.1",
6161
"request": "^2.53.0",
6262
"socks5-http-client": "^1.0.2",
63-
"ssh2": "0.4.12",
64-
"ssh2-streams": "0.0.18",
65-
"tsd": "^0.6.5",
63+
"ssh2": "0.5.0",
6664
"tslint": "^3.3.0",
6765
"typescript": "~1.8.2",
66+
"typings": "^0.7.12",
6867
"yargs": "^3.0.4"
6968
},
7069
"scripts": {

setup.cmd

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if "%1" NEQ "third_party" if "%1" NEQ "clean" (
4343
%~1
4444
goto:eof
4545

46-
:: On Windows, npm, bower, tsd, and grunt are batch files
46+
:: On Windows, npm, bower, typings, and grunt are batch files
4747
:: So we have to explicitly call then with "call"
4848
:: These also happen to be the commands that we want to assert,
4949
:: or exit on failure for, so there is an additional "exit /b"
@@ -72,13 +72,10 @@ goto:eof
7272
call :runCmd "copy build\dev\uproxy-lib\build-tools\*.js build\tools\"
7373
goto:eof
7474

75-
:: Note: The "tsd reinstall" command seems to create a third_party/third_party folder
76-
:: on Windows, so we manually delete this after
7775
:thirdParty
7876
call :runAndAssertCmdArgs "%NPM_BIN_DIR%bower" install --allow-root
7977
call :runCmd "mkdir build\third_party"
80-
call :runAndAssertCmdArgs "%NPM_BIN_DIR%tsd" reinstall --config .\third_party\tsd.json
81-
call :runCmd "rmdir third_party\third_party /s /q"
78+
call :runAndAssertCmdArgs cd third_party; "%NPM_BIN_DIR%tsd" reinstall --config .\third_party\tsd.json; cd ..
8279
call :runCmd "robocopy third_party\ build\third_party\ /s /e > nul 2>&1"
8380
call :runCmd "mkdir build\third_party\freedom-pgp-e2e"
8481
call :runCmd "copy node_modules\freedom-pgp-e2e\dist build\third_party\freedom-pgp-e2e\"

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function thirdParty ()
3939
{
4040
runAndAssertCmd "$NPM_BIN_DIR/bower install --allow-root --config.interactive=false"
4141
runAndAssertCmd "mkdir -p build/third_party"
42-
runAndAssertCmd "$NPM_BIN_DIR/tsd reinstall --config ./third_party/tsd.json"
42+
runAndAssertCmd "pushd third_party && $NPM_BIN_DIR/typings install && popd"
4343
runAndAssertCmd "cp -r third_party/* build/third_party/"
4444
runAndAssertCmd "mkdir -p build/third_party/freedom-pgp-e2e"
4545
runAndAssertCmd "cp -r node_modules/freedom-pgp-e2e/dist build/third_party/freedom-pgp-e2e/"

src/aqm/aqm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path='../../../third_party/typings/es6-promise/es6-promise.d.ts' />
1+
/// <reference path='../../../third_party/typings/browser.d.ts' />
22

33
import logging = require('../logging/logging');
44

src/arraybuffers/arraybuffers.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path='../../../third_party/typings/jasmine/jasmine.d.ts' />
1+
/// <reference path='../../../third_party/typings/browser.d.ts' />
22

33
import arraybuffers = require('./arraybuffers');
44

src/arraybuffers/arraybuffers.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path='../../../third_party/typings/node/node.d.ts' />
1+
/// <reference path='../../../third_party/typings/browser.d.ts' />
22

33
// Byte-wise equality check of array buffers by comparison of each byte's
44
// value.
@@ -121,24 +121,16 @@ export function stringToUtf8EncodedArrayBuffer(str:string) :ArrayBuffer {
121121
return ab.buffer;
122122
}
123123

124-
// Converts a node.js Buffer to an ArrayBuffer
125-
export function bufferToArrayBuffer(buffer:Buffer) :ArrayBuffer {
126-
var ab = new ArrayBuffer(buffer.length);
127-
var bytes = new Uint8Array(ab);
128-
for (var i = 0; i < buffer.length; ++i) {
129-
bytes[i] = buffer[i];
130-
}
131-
return bytes.buffer;
124+
// Returns an ArrayBuffer backed by the same memory as the supplied
125+
// Node.js Buffer.
126+
export function bufferToArrayBuffer(buffer: Buffer): ArrayBuffer {
127+
return buffer.buffer;
132128
}
133129

134-
// Converts an ArrayBuffer to a node.js Buffer
135-
export function arrayBufferToBuffer(ab:ArrayBuffer) :Buffer {
136-
var buffer = new Buffer(ab.byteLength);
137-
var bytes = new Uint8Array(ab);
138-
for (var i = 0; i < buffer.length; ++i) {
139-
buffer[i] = bytes[i];
140-
}
141-
return buffer;
130+
// Returns a Node.js Buffer backed by the same memory as the supplied
131+
// ArrayBuffer.
132+
export function arrayBufferToBuffer(ab: ArrayBuffer): Buffer {
133+
return new Buffer(ab);
142134
}
143135

144136
// Splits an ArrayBuffer into two at a given offset

0 commit comments

Comments
 (0)