diff --git a/README.md b/README.md index 26d31f6e..2a892ffb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# WebTorrent.app +#   WebTorrent.app [![Gitter][webtorrent-gitter-image]][webtorrent-gitter-url] [![Travis Build][webtorrent-app-travis-image]][webtorrent-app-travis-url] @@ -11,7 +11,7 @@ #### WebTorrent, the streaming torrent client. For OS X, Windows, and Linux.

- screenshot + screenshot

## How to Contribute @@ -28,14 +28,14 @@ $ npm install $ npm start ``` -### Build binaries +### Package app + +Builds app binaries for OS X, Linux, and Windows. ``` -$ npm run build +$ npm run package ``` -Builds the app for OS X, Linux, and Windows, using [electron-packager](https://github.com/maxogden/electron-packager). - ## License diff --git a/WebTorrent.icns b/WebTorrent.icns new file mode 100644 index 00000000..cbad3c87 Binary files /dev/null and b/WebTorrent.icns differ diff --git a/WebTorrent.ico b/WebTorrent.ico new file mode 100644 index 00000000..912fffa1 Binary files /dev/null and b/WebTorrent.ico differ diff --git a/WebTorrent.png b/WebTorrent.png new file mode 100644 index 00000000..e7b0a2eb Binary files /dev/null and b/WebTorrent.png differ diff --git a/bin/package.js b/bin/package.js new file mode 100755 index 00000000..f5a188f2 --- /dev/null +++ b/bin/package.js @@ -0,0 +1,111 @@ +#!/usr/bin/env node + +var cp = require('child_process') +var electronPackager = require('electron-packager') +var fs = require('fs') +var path = require('path') +var pkg = require('../package.json') + +var all = { + // Build 64 bit binaries only. + arch: 'x64', + + // The application source directory. + dir: path.join(__dirname, '..'), + + // The release version of the application. Maps to the `ProductVersion` metadata + // property on Windows, and `CFBundleShortVersionString` on OS X. + 'app-version': pkg.version, + + // Package the application's source code into an archive, using Electron's archive + // format. Mitigates issues around long path names on Windows and slightly speeds up + // require(). + asar: false, + + // The build version of the application. Maps to the FileVersion metadata property on + // Windows, and CFBundleVersion on OS X. We're using the short git hash (e.g. 'e7d837e') + 'build-version': cp.execSync('git rev-parse --short HEAD').toString().replace('\n', ''), + + // Pattern which specifies which files to ignore when copying files to create the + // package(s). + ignore: /^\/(dist|static\/screenshot.png)$/, + + // The base directory where the finished package(s) are created. + out: path.join(__dirname, '..', 'dist'), + + // Replace an already existing output directory. + overwrite: true, + + // Runs `npm prune --production` which remove the packages specified in + // "devDependencies" before starting to package the app. + prune: true, + + // The Electron version with which the app is built (without the leading 'v') + version: pkg.devDependencies['electron-prebuilt'] +} + +var darwin = { + platform: 'darwin', + + // The bundle identifier to use in the application's plist (OS X only). + 'app-bundle-id': 'io.webtorrent.app', + + // The application category type, as shown in the Finder via "View" -> "Arrange by + // Application Category" when viewing the Applications directory (OS X only). + 'app-category-type': 'public.app-category.utilities', + + // The bundle identifier to use in the application helper's plist (OS X only). + 'helper-bundle-id': 'io.webtorrent.app.helper', + + // Application icon. + icon: path.join(__dirname, '..', 'WebTorrent.icns') +} + +var win32 = { + platform: 'win32', + + // Object hash of application metadata to embed into the executable (Windows only) + 'version-string': { + + // Company that produced the file. + CompanyName: 'WebTorrent', + + // Copyright notices that apply to the file. This should include the full text of all + // notices, legal symbols, copyright dates, and so on. + LegalCopyright: fs.readFileSync(path.join(__dirname, '..', 'LICENSE'), 'utf8'), + + // File description to be presented to users. + FileDescription: 'Streaming torrent client', + + // Original name of the file, not including a path. This information enables an + // application to determine whether a file has been renamed by a user. The format of + // the name depends on the file system for which the file was created. + OriginalFilename: 'WebTorrent.exe', + + // Name of the product with which the file is distributed. + ProductName: 'WebTorrent', + + // Internal name of the file, if one exists, for example, a module name if the file + // is a dynamic-link library. If the file has no internal name, this string should be + // the original filename, without extension. This string is required. + InternalName: 'WebTorrent' + }, + + // Application icon. + icon: path.join(__dirname, '..', 'WebTorrent.ico') +} + +var linux = { + platform: 'linux' + + // Note: Application icon for Linux is specified via the BrowserWindow `icon` option. +} + +electronPackager(Object.assign({}, all, darwin), done) +electronPackager(Object.assign({}, all, win32), done) +electronPackager(Object.assign({}, all, linux), done) + +function done (err, appPath) { + if (err) console.error(err.message || err) + else console.log('Built ' + appPath) +} diff --git a/config.js b/config.js index b8759c51..39ac4c2a 100644 --- a/config.js +++ b/config.js @@ -2,13 +2,14 @@ var path = require('path') module.exports = { APP_NAME: 'WebTorrent', - INDEX: 'file://' + path.resolve(__dirname, 'renderer', 'index.html'), - SOUND_ADD: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'add.wav'), - SOUND_DELETE: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'delete.wav'), - SOUND_DISABLE: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'disable.wav'), - SOUND_DONE: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'done.wav'), - SOUND_ENABLE: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'enable.wav'), - SOUND_ERROR: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'error.wav'), - SOUND_PLAY: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'play.wav'), - SOUND_STARTUP: 'file://' + path.resolve(__dirname, 'resources', 'sound', 'startup.wav') + APP_ICON: path.join(__dirname, 'WebTorrent.png'), + INDEX: 'file://' + path.join(__dirname, 'renderer', 'index.html'), + SOUND_ADD: 'file://' + path.join(__dirname, 'static', 'sound', 'add.wav'), + SOUND_DELETE: 'file://' + path.join(__dirname, 'static', 'sound', 'delete.wav'), + SOUND_DISABLE: 'file://' + path.join(__dirname, 'static', 'sound', 'disable.wav'), + SOUND_DONE: 'file://' + path.join(__dirname, 'static', 'sound', 'done.wav'), + SOUND_ENABLE: 'file://' + path.join(__dirname, 'static', 'sound', 'enable.wav'), + SOUND_ERROR: 'file://' + path.join(__dirname, 'static', 'sound', 'error.wav'), + SOUND_PLAY: 'file://' + path.join(__dirname, 'static', 'sound', 'play.wav'), + SOUND_STARTUP: 'file://' + path.join(__dirname, 'static', 'sound', 'startup.wav') } diff --git a/main/windows.js b/main/windows.js index d6311967..10089a3c 100644 --- a/main/windows.js +++ b/main/windows.js @@ -15,6 +15,7 @@ function createMainWindow () { autoHideMenuBar: true, // Hide top menu bar unless Alt key is pressed (Windows, Linux) backgroundColor: '#282828', darkTheme: true, // Forces dark theme (GTK+3 only) + icon: config.APP_ICON, minWidth: 375, minHeight: 38 + (120 * 2), // header height + 2 torrents show: false, // Hide window until DOM finishes loading diff --git a/package.json b/package.json index 1a4c29ce..800049f0 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "url": "git://github.com/feross/webtorrent-app.git" }, "scripts": { - "build": "electron-packager . $npm_package_productName --overwrite --out=dist --ignore='^/dist$' --prune --asar --all --version=$npm_package_devDependencies_electron_prebuilt", "debug": "DEBUG=* electron .", + "package": "node ./bin/package.js", "start": "electron .", "test": "standard", "update-authors": "./bin/update-authors.sh" diff --git a/renderer/index.css b/renderer/index.css index c0adf45d..9caaf685 100644 --- a/renderer/index.css +++ b/renderer/index.css @@ -103,7 +103,7 @@ body { font-weight: 400; src: local('Material Icons'), local('MaterialIcons-Regular'), - url(../vendor/MaterialIcons-Regular.woff2) format('woff2'); + url(../static/MaterialIcons-Regular.woff2) format('woff2'); } .icon { diff --git a/renderer/state.js b/renderer/state.js index 3d7906ab..a028e01e 100644 --- a/renderer/state.js +++ b/renderer/state.js @@ -60,19 +60,19 @@ module.exports = { status: 'paused', infoHash: 'f84b51f0d2c3455ab5dabb6643b4340234cd036e', displayName: 'Big Buck Bunny', - posterURL: '../resources/bigBuckBunny.jpg' + posterURL: path.join(__dirname, '..', 'static', 'bigBuckBunny.jpg') }, { status: 'paused', infoHash: '6a9759bffd5c0af65319979fb7832189f4f3c35d', displayName: 'Sintel', - posterURL: '../resources/sintel.jpg' + posterURL: path.join(__dirname, '..', 'static', 'sintel.jpg') }, { status: 'paused', infoHash: '02767050e0be2fd4db9a2ad6c12416ac806ed6ed', displayName: 'Tears of Steel', - posterURL: '../resources/tearsOfSteel.jpg' + posterURL: path.join(__dirname, '..', 'static', 'tearsOfSteel.jpg') } ], downloadPath: path.join(os.homedir(), 'Downloads') diff --git a/resources/BigBuckBunny_archive.torrent b/static/BigBuckBunny_archive.torrent similarity index 100% rename from resources/BigBuckBunny_archive.torrent rename to static/BigBuckBunny_archive.torrent diff --git a/vendor/MaterialIcons-Regular.woff2 b/static/MaterialIcons-Regular.woff2 similarity index 100% rename from vendor/MaterialIcons-Regular.woff2 rename to static/MaterialIcons-Regular.woff2 diff --git a/resources/TearsOfSteel_archive.torrent b/static/TearsOfSteel_archive.torrent similarity index 100% rename from resources/TearsOfSteel_archive.torrent rename to static/TearsOfSteel_archive.torrent diff --git a/resources/bigBuckBunny.jpg b/static/bigBuckBunny.jpg similarity index 100% rename from resources/bigBuckBunny.jpg rename to static/bigBuckBunny.jpg diff --git a/resources/screenshot.png b/static/screenshot.png similarity index 100% rename from resources/screenshot.png rename to static/screenshot.png diff --git a/resources/sintel.jpg b/static/sintel.jpg similarity index 100% rename from resources/sintel.jpg rename to static/sintel.jpg diff --git a/resources/sintel.torrent b/static/sintel.torrent similarity index 100% rename from resources/sintel.torrent rename to static/sintel.torrent diff --git a/resources/sound/add.wav b/static/sound/add.wav similarity index 100% rename from resources/sound/add.wav rename to static/sound/add.wav diff --git a/resources/sound/delete.wav b/static/sound/delete.wav similarity index 100% rename from resources/sound/delete.wav rename to static/sound/delete.wav diff --git a/resources/sound/disable.wav b/static/sound/disable.wav similarity index 100% rename from resources/sound/disable.wav rename to static/sound/disable.wav diff --git a/resources/sound/done.wav b/static/sound/done.wav similarity index 100% rename from resources/sound/done.wav rename to static/sound/done.wav diff --git a/resources/sound/enable.wav b/static/sound/enable.wav similarity index 100% rename from resources/sound/enable.wav rename to static/sound/enable.wav diff --git a/resources/sound/error.wav b/static/sound/error.wav similarity index 100% rename from resources/sound/error.wav rename to static/sound/error.wav diff --git a/resources/sound/play.wav b/static/sound/play.wav similarity index 100% rename from resources/sound/play.wav rename to static/sound/play.wav diff --git a/resources/sound/startup.wav b/static/sound/startup.wav similarity index 100% rename from resources/sound/startup.wav rename to static/sound/startup.wav diff --git a/resources/tearsOfSteel.jpg b/static/tearsOfSteel.jpg similarity index 100% rename from resources/tearsOfSteel.jpg rename to static/tearsOfSteel.jpg