OS X -> Mac

This commit is contained in:
Feross Aboukhadijeh
2016-07-26 21:55:05 -07:00
parent 6891ef1a0d
commit febad56497
12 changed files with 40 additions and 40 deletions

View File

@@ -7,7 +7,7 @@
<br> <br>
</h1> </h1>
<h4 align="center">The streaming torrent client. For OS X, Windows, and Linux.</h4> <h4 align="center">The streaming torrent client. For Mac, Windows, and Linux.</h4>
<p align="center"> <p align="center">
<a href="https://gitter.im/feross/webtorrent"><img src="https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg" alt="Gitter"></a> <a href="https://gitter.im/feross/webtorrent"><img src="https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg" alt="Gitter"></a>
@@ -41,7 +41,7 @@ $ npm start
### Package app ### Package app
Builds app binaries for OS X, Linux, and Windows. Builds app binaries for Mac, Linux, and Windows.
``` ```
$ npm run package $ npm run package
@@ -57,23 +57,23 @@ Where `[platform]` is `darwin`, `linux`, `win32`, or `all` (default).
The following optional arguments are available: The following optional arguments are available:
- `--sign` - Sign the application (OS X, Windows) - `--sign` - Sign the application (Mac, Windows)
- `--package=[type]` - Package single output type. - `--package=[type]` - Package single output type.
- `deb` - Debian package - `deb` - Debian package
- `zip` - Linux zip file - `zip` - Linux zip file
- `dmg` - OS X disk image - `dmg` - Mac disk image
- `exe` - Windows installer - `exe` - Windows installer
- `portable` - Windows portable app - `portable` - Windows portable app
- `all` - All platforms (default) - `all` - All platforms (default)
Note: Even with the `--package` option, the auto-update files (.nupkg for Windows, *-darwin.zip for OS X) will always be produced. Note: Even with the `--package` option, the auto-update files (.nupkg for Windows, *-darwin.zip for Mac) will always be produced.
#### Windows build notes #### Windows build notes
To package the Windows app from non-Windows platforms, [Wine](https://www.winehq.org/) needs To package the Windows app from non-Windows platforms, [Wine](https://www.winehq.org/) needs
to be installed. to be installed.
On OS X, first install [XQuartz](http://www.xquartz.org/), then run: On Mac, first install [XQuartz](http://www.xquartz.org/), then run:
``` ```
brew install wine brew install wine

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env node #!/usr/bin/env node
/** /**
* Builds app binaries for OS X, Linux, and Windows. * Builds app binaries for Mac, Linux, and Windows.
*/ */
var cp = require('child_process') var cp = require('child_process')
@@ -56,11 +56,11 @@ function build () {
var all = { var all = {
// The human-readable copyright line for the app. Maps to the `LegalCopyright` metadata // The human-readable copyright line for the app. Maps to the `LegalCopyright` metadata
// property on Windows, and `NSHumanReadableCopyright` on OS X. // property on Windows, and `NSHumanReadableCopyright` on Mac.
'app-copyright': config.APP_COPYRIGHT, 'app-copyright': config.APP_COPYRIGHT,
// The release version of the application. Maps to the `ProductVersion` metadata // The release version of the application. Maps to the `ProductVersion` metadata
// property on Windows, and `CFBundleShortVersionString` on OS X. // property on Windows, and `CFBundleShortVersionString` on Mac.
'app-version': pkg.version, 'app-version': pkg.version,
// Package the application's source code into an archive, using Electron's archive // Package the application's source code into an archive, using Electron's archive
@@ -73,7 +73,7 @@ var all = {
'asar-unpack': 'WebTorrent*', 'asar-unpack': 'WebTorrent*',
// The build version of the application. Maps to the FileVersion metadata property on // The build version of the application. Maps to the FileVersion metadata property on
// Windows, and CFBundleVersion on OS X. Note: Windows requires the build version to // Windows, and CFBundleVersion on Mac. Note: Windows requires the build version to
// start with a number. We're using the version of the underlying WebTorrent library. // start with a number. We're using the version of the underlying WebTorrent library.
'build-version': require('webtorrent/package.json').version, 'build-version': require('webtorrent/package.json').version,
@@ -102,20 +102,20 @@ var all = {
} }
var darwin = { var darwin = {
// Build for OS X // Build for Mac
platform: 'darwin', platform: 'darwin',
// Build 64 bit binaries only. // Build 64 bit binaries only.
arch: 'x64', arch: 'x64',
// The bundle identifier to use in the application's plist (OS X only). // The bundle identifier to use in the application's plist (Mac only).
'app-bundle-id': 'io.webtorrent.webtorrent', 'app-bundle-id': 'io.webtorrent.webtorrent',
// The application category type, as shown in the Finder via "View" -> "Arrange by // The application category type, as shown in the Finder via "View" -> "Arrange by
// Application Category" when viewing the Applications directory (OS X only). // Application Category" when viewing the Applications directory (Mac only).
'app-category-type': 'public.app-category.utilities', 'app-category-type': 'public.app-category.utilities',
// The bundle identifier to use in the application helper's plist (OS X only). // The bundle identifier to use in the application helper's plist (Mac only).
'helper-bundle-id': 'io.webtorrent.webtorrent-helper', 'helper-bundle-id': 'io.webtorrent.webtorrent-helper',
// Application icon. // Application icon.
@@ -171,10 +171,10 @@ build()
function buildDarwin (cb) { function buildDarwin (cb) {
var plist = require('plist') var plist = require('plist')
console.log('OS X: Packaging electron...') console.log('Mac: Packaging electron...')
electronPackager(Object.assign({}, all, darwin), function (err, buildPath) { electronPackager(Object.assign({}, all, darwin), function (err, buildPath) {
if (err) return cb(err) if (err) return cb(err)
console.log('OS X: Packaged electron. ' + buildPath) console.log('Mac: Packaged electron. ' + buildPath)
var appPath = path.join(buildPath[0], config.APP_NAME + '.app') var appPath = path.join(buildPath[0], config.APP_NAME + '.app')
var contentsPath = path.join(appPath, 'Contents') var contentsPath = path.join(appPath, 'Contents')
@@ -261,9 +261,9 @@ function buildDarwin (cb) {
* - So the auto-updater (Squirrrel.Mac) can check that app updates are signed by * - So the auto-updater (Squirrrel.Mac) can check that app updates are signed by
* the same author as the current version. * the same author as the current version.
* - So users will not a see a warning about the app coming from an "Unidentified * - So users will not a see a warning about the app coming from an "Unidentified
* Developer" when they open it for the first time (OS X Gatekeeper). * Developer" when they open it for the first time (Mac Gatekeeper).
* *
* To sign an OS X app for distribution outside the App Store, the following are * To sign an Mac app for distribution outside the App Store, the following are
* required: * required:
* - Xcode * - Xcode
* - Xcode Command Line Tools (xcode-select --install) * - Xcode Command Line Tools (xcode-select --install)
@@ -275,10 +275,10 @@ function buildDarwin (cb) {
verbose: true verbose: true
} }
console.log('OS X: Signing app...') console.log('Mac: Signing app...')
sign(signOpts, function (err) { sign(signOpts, function (err) {
if (err) return cb(err) if (err) return cb(err)
console.log('OS X: Signed app.') console.log('Mac: Signed app.')
cb(null) cb(null)
}) })
} }
@@ -293,24 +293,24 @@ function buildDarwin (cb) {
function packageZip () { function packageZip () {
// Create .zip file (used by the auto-updater) // Create .zip file (used by the auto-updater)
console.log('OS X: Creating zip...') console.log('Mac: Creating zip...')
var inPath = path.join(buildPath[0], config.APP_NAME + '.app') var inPath = path.join(buildPath[0], config.APP_NAME + '.app')
var outPath = path.join(DIST_PATH, BUILD_NAME + '-darwin.zip') var outPath = path.join(DIST_PATH, BUILD_NAME + '-darwin.zip')
zip.zipSync(inPath, outPath) zip.zipSync(inPath, outPath)
console.log('OS X: Created zip.') console.log('Mac: Created zip.')
} }
function packageDmg (cb) { function packageDmg (cb) {
console.log('OS X: Creating dmg...') console.log('Mac: Creating dmg...')
var appDmg = require('appdmg') var appDmg = require('appdmg')
var targetPath = path.join(DIST_PATH, BUILD_NAME + '.dmg') var targetPath = path.join(DIST_PATH, BUILD_NAME + '.dmg')
rimraf.sync(targetPath) rimraf.sync(targetPath)
// Create a .dmg (OS X disk image) file, for easy user installation. // Create a .dmg (Mac disk image) file, for easy user installation.
var dmgOpts = { var dmgOpts = {
basepath: config.ROOT_PATH, basepath: config.ROOT_PATH,
target: targetPath, target: targetPath,
@@ -338,7 +338,7 @@ function buildDarwin (cb) {
if (info.type === 'step-begin') console.log(info.title + '...') if (info.type === 'step-begin') console.log(info.title + '...')
}) })
dmg.once('finish', function (info) { dmg.once('finish', function (info) {
console.log('OS X: Created dmg.') console.log('Mac: Created dmg.')
cb(null) cb(null)
}) })
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "webtorrent-desktop", "name": "webtorrent-desktop",
"description": "WebTorrent, the streaming torrent client. For OS X, Windows, and Linux.", "description": "WebTorrent, the streaming torrent client. For Mac, Windows, and Linux.",
"version": "0.9.0", "version": "0.9.0",
"author": { "author": {
"name": "WebTorrent, LLC", "name": "WebTorrent, LLC",

View File

@@ -109,7 +109,7 @@ function openTorrentAddress () {
} }
/** /**
* Dialogs on do not show a title on OS X, so the window title is used instead. * Dialogs on do not show a title on Mac, so the window title is used instead.
*/ */
function setTitle (title) { function setTitle (title) {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {

View File

@@ -12,7 +12,7 @@ var dialog = require('./dialog')
var log = require('./log') var log = require('./log')
/** /**
* Add a right-click menu to the dock icon. (OS X) * Add a right-click menu to the dock icon. (Mac)
*/ */
function init () { function init () {
if (!app.dock) return if (!app.dock) return
@@ -21,7 +21,7 @@ function init () {
} }
/** /**
* Bounce the Downloads stack if `path` is inside the Downloads folder. (OS X) * Bounce the Downloads stack if `path` is inside the Downloads folder. (Mac)
*/ */
function downloadFinished (path) { function downloadFinished (path) {
if (!app.dock) return if (!app.dock) return
@@ -30,7 +30,7 @@ function downloadFinished (path) {
} }
/** /**
* Display a counter badge for the app. (OS X, Linux) * Display a counter badge for the app. (Mac, Linux)
*/ */
function setBadge (count) { function setBadge (count) {
log(`setBadge: ${count}`) log(`setBadge: ${count}`)

View File

@@ -34,7 +34,7 @@ function installDarwin () {
var electron = require('electron') var electron = require('electron')
var app = electron.app var app = electron.app
// On OS X, only protocols that are listed in `Info.plist` can be set as the // On Mac, only protocols that are listed in `Info.plist` can be set as the
// default handler at runtime. // default handler at runtime.
app.setAsDefaultProtocolClient('magnet') app.setAsDefaultProtocolClient('magnet')
app.setAsDefaultProtocolClient('stream-magnet') app.setAsDefaultProtocolClient('stream-magnet')

View File

@@ -153,7 +153,7 @@ function processArgv (argv) {
} else if (arg === '-u') { } else if (arg === '-u') {
dialog.openTorrentAddress() dialog.openTorrentAddress()
} else if (arg.startsWith('-psn')) { } else if (arg.startsWith('-psn')) {
// Ignore OS X launchd "process serial number" argument // Ignore Mac launchd "process serial number" argument
// Issue: https://github.com/feross/webtorrent-desktop/issues/214 // Issue: https://github.com/feross/webtorrent-desktop/issues/214
} else { } else {
torrentIds.push(arg) torrentIds.push(arg)

View File

@@ -281,7 +281,7 @@ function getMenuTemplate () {
] ]
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
// Add WebTorrent app menu (OS X) // Add WebTorrent app menu (Mac)
template.unshift({ template.unshift({
label: config.APP_NAME, label: config.APP_NAME,
submenu: [ submenu: [
@@ -324,7 +324,7 @@ function getMenuTemplate () {
] ]
}) })
// Add Window menu (OS X) // Add Window menu (Mac)
template.splice(5, 0, { template.splice(5, 0, {
role: 'window', role: 'window',
submenu: [ submenu: [

View File

@@ -21,7 +21,7 @@ function init () {
if (process.platform === 'win32') { if (process.platform === 'win32') {
initWin32() initWin32()
} }
// OS X apps generally do not have menu bar icons // Mac apps generally do not have menu bar icons
} }
/** /**

View File

@@ -37,7 +37,7 @@ function init () {
minWidth: config.WINDOW_MIN_WIDTH, minWidth: config.WINDOW_MIN_WIDTH,
minHeight: config.WINDOW_MIN_HEIGHT, minHeight: config.WINDOW_MIN_HEIGHT,
title: config.APP_WINDOW_TITLE, title: config.APP_WINDOW_TITLE,
titleBarStyle: 'hidden-inset', // Hide title bar (OS X) titleBarStyle: 'hidden-inset', // Hide title bar (Mac)
useContentSize: true, // Specify web page size without OS chrome useContentSize: true, // Specify web page size without OS chrome
width: 500, width: 500,
height: HEADER_HEIGHT + (TORRENT_HEIGHT * 6) // header height + 5 torrents height: HEADER_HEIGHT + (TORRENT_HEIGHT * 6) // header height + 5 torrents
@@ -95,7 +95,7 @@ function send (...args) {
} }
/** /**
* Enforce window aspect ratio. Remove with 0. (OS X) * Enforce window aspect ratio. Remove with 0. (Mac)
*/ */
function setAspectRatio (aspectRatio) { function setAspectRatio (aspectRatio) {
if (!main.win) return if (!main.win) return
@@ -196,7 +196,7 @@ function toggleFullScreen (flag) {
log(`toggleFullScreen ${flag}`) log(`toggleFullScreen ${flag}`)
if (flag) { if (flag) {
// Fullscreen and aspect ratio do not play well together. (OS X) // Fullscreen and aspect ratio do not play well together. (Mac)
main.win.setAspectRatio(0) main.win.setAspectRatio(0)
} }

View File

@@ -50,7 +50,7 @@ function getDefaultState () {
* *
* Config path: * Config path:
* *
* OS X ~/Library/Application Support/WebTorrent/config.json * Mac ~/Library/Application Support/WebTorrent/config.json
* Linux (XDG) $XDG_CONFIG_HOME/WebTorrent/config.json * Linux (XDG) $XDG_CONFIG_HOME/WebTorrent/config.json
* Linux (Legacy) ~/.config/WebTorrent/config.json * Linux (Legacy) ~/.config/WebTorrent/config.json
* Windows (> Vista) %LOCALAPPDATA%/WebTorrent/config.json * Windows (> Vista) %LOCALAPPDATA%/WebTorrent/config.json

View File

@@ -416,7 +416,7 @@ function onVisibilityChange () {
function onFullscreenChanged (e, isFullScreen) { function onFullscreenChanged (e, isFullScreen) {
state.window.isFullScreen = isFullScreen state.window.isFullScreen = isFullScreen
if (!isFullScreen) { if (!isFullScreen) {
// Aspect ratio gets reset in fullscreen mode, so restore it (OS X) // Aspect ratio gets reset in fullscreen mode, so restore it (Mac)
ipcRenderer.send('setAspectRatio', state.playing.aspectRatio) ipcRenderer.send('setAspectRatio', state.playing.aspectRatio)
} }