Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate client version string from package.json version #212

Merged
merged 2 commits into from Dec 18, 2014
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

Generate client version string from package.json version

Depends on this PR: webpro/versionify#2
  • Loading branch information
feross committed Dec 17, 2014
commit 147311347388e02fcc93cdadc17dc7cc2ec99397
@@ -17,13 +17,22 @@ var parallel = require('run-parallel')
var parseTorrent = require('parse-torrent')
var speedometer = require('speedometer')
var stream = require('stream')
var zeroFill = require('zero-fill')

var FSStorage = require('./lib/fs-storage') // browser exclude
var Storage = require('./lib/storage')
var Torrent = require('./lib/torrent')

inherits(WebTorrent, EventEmitter)

/**
* BitTorrent client version string (used in peer ID).
* Generated from package.json major and minor version. For example:
* '0.16.1' -> '0016'
* '1.2.5' -> '0102'
*/
var VERSION = '__VERSION__'.match(/([0-9]+)/g).slice(0, 2).map(zeroFill(2)).join('')

/**
* WebTorrent Client
* @param {Object} opts
@@ -49,7 +58,7 @@ function WebTorrent (opts) {
: Storage

self.peerId = opts.peerId === undefined
? new Buffer('-WW0001-' + hat(48), 'utf8')
? new Buffer('-WW' + VERSION + '-' + hat(48), 'utf8')
: typeof opts.peerId === 'string'
? new Buffer(opts.peerId, 'utf8')
: opts.peerId
@@ -21,6 +21,11 @@
"load-ip-set": false,
"ut_pex": false
},
"browserify": {
"transform": [
"browserify-versionify"
]
},
"bugs": {
"url": "https://github.com/feross/webtorrent/issues"
},
@@ -64,24 +69,21 @@
"ut_metadata": "^2.1.0",
"ut_pex": "^1.0.1",
"webtorrent-swarm": "^0.3.0",
"windows-no-runnable": "~0.0.6"
"windows-no-runnable": "~0.0.6",
"zero-fill": "^2.1.0"
},
"devDependencies": {
"bittorrent-tracker": "^2.5.0",
"brfs": "^1.2.0",
"browserify": "^6.1.0",
"browserify": "^7.0.0",
"browserify-versionify": "^1.0.2",
"portfinder": "^0.2.1",
"run-auto": "^1.0.0",
"tape": "^3.0.3",
"uglify-js": "^2.4.15",
"zelda": "^2.0.0",
"zuul": "^1.11.1"
},
"optionalDependencies": {
"airplay-js": "^0.2.3",
"chromecast-js": "^0.1.4",
"nodebmc": "0.0.5"
},
"homepage": "http://webtorrent.io",
"keywords": [
"torrent",
@@ -96,6 +98,11 @@
],
"license": "MIT",
"main": "index.js",
"optionalDependencies": {
"airplay-js": "^0.2.3",
"chromecast-js": "^0.1.4",
"nodebmc": "0.0.5"
},
"repository": {
"type": "git",
"url": "git://github.com/feross/webtorrent.git"
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.