Merge pull request #640 from anonymlol/master
new protocol handler: stream-magnet
This commit is contained in:
@@ -206,6 +206,12 @@ function buildDarwin (cb) {
|
|||||||
CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
|
CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
|
||||||
CFBundleURLName: 'BitTorrent Magnet URL',
|
CFBundleURLName: 'BitTorrent Magnet URL',
|
||||||
CFBundleURLSchemes: [ 'magnet' ]
|
CFBundleURLSchemes: [ 'magnet' ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CFBundleTypeRole: 'Editor',
|
||||||
|
CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
|
||||||
|
CFBundleURLName: 'BitTorrent Stream-Magnet URL',
|
||||||
|
CFBundleURLSchemes: [ 'stream-magnet' ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function installDarwin () {
|
|||||||
|
|
||||||
// On OS X, only protocols that are listed in `Info.plist` can be set as the
|
// On OS X, 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('stream-magnet')
|
||||||
|
|
||||||
// File handlers are defined in `Info.plist`.
|
// File handlers are defined in `Info.plist`.
|
||||||
}
|
}
|
||||||
@@ -63,6 +63,12 @@ function installWin32 () {
|
|||||||
iconPath,
|
iconPath,
|
||||||
EXEC_COMMAND
|
EXEC_COMMAND
|
||||||
)
|
)
|
||||||
|
registerProtocolHandlerWin32(
|
||||||
|
'stream-magnet',
|
||||||
|
'URL:BitTorrent Stream-Magnet URL',
|
||||||
|
iconPath,
|
||||||
|
EXEC_COMMAND
|
||||||
|
)
|
||||||
registerFileHandlerWin32(
|
registerFileHandlerWin32(
|
||||||
'.torrent',
|
'.torrent',
|
||||||
'io.webtorrent.torrent',
|
'io.webtorrent.torrent',
|
||||||
@@ -201,6 +207,7 @@ function uninstallWin32 () {
|
|||||||
var Registry = require('winreg')
|
var Registry = require('winreg')
|
||||||
|
|
||||||
unregisterProtocolHandlerWin32('magnet', EXEC_COMMAND)
|
unregisterProtocolHandlerWin32('magnet', EXEC_COMMAND)
|
||||||
|
unregisterProtocolHandlerWin32('stream-magnet', EXEC_COMMAND)
|
||||||
unregisterFileHandlerWin32('.torrent', 'io.webtorrent.torrent', EXEC_COMMAND)
|
unregisterFileHandlerWin32('.torrent', 'io.webtorrent.torrent', EXEC_COMMAND)
|
||||||
|
|
||||||
function unregisterProtocolHandlerWin32 (protocol, command) {
|
function unregisterProtocolHandlerWin32 (protocol, command) {
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ function onOpen (files) {
|
|||||||
function isTorrent (file) {
|
function isTorrent (file) {
|
||||||
var name = typeof file === 'string' ? file : file.name
|
var name = typeof file === 'string' ? file : file.name
|
||||||
var isTorrentFile = path.extname(name).toLowerCase() === '.torrent'
|
var isTorrentFile = path.extname(name).toLowerCase() === '.torrent'
|
||||||
var isMagnet = typeof file === 'string' && /^magnet:/.test(file)
|
var isMagnet = typeof file === 'string' && /^magnet:/.test(file) || /^stream-magnet:/.test(file)
|
||||||
return isTorrentFile || isMagnet
|
return isTorrentFile || isMagnet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Exec=$EXEC_PATH %U
|
|||||||
TryExec=$TRY_EXEC_PATH
|
TryExec=$TRY_EXEC_PATH
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
Categories=Network;FileTransfer;P2P;
|
Categories=Network;FileTransfer;P2P;
|
||||||
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
|
MimeType=application/x-bittorrent;x-scheme-handler/magnet;x-scheme-handler/stream-magnet;
|
||||||
|
|
||||||
Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress;
|
Actions=CreateNewTorrent;OpenTorrentFile;OpenTorrentAddress;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user