mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-10 15:21:03 +00:00
add custom protocol handler support
This commit is contained in:
parent
7c9b95fa1b
commit
18871061d5
9
cli.js
9
cli.js
@ -5,6 +5,15 @@ var packager = require('./')
|
||||
args.dir = args._[0]
|
||||
args.name = args._[1]
|
||||
|
||||
var protocolSchemes = args.protocol
|
||||
var protocolNames = args['protocol-names']
|
||||
|
||||
if (protocolSchemes && protocolNames && protocolNames.length === protocolSchemes.length) {
|
||||
args.protocol = protocolSchemes.map(function (scheme, i) {
|
||||
return {schemes: [scheme], name: protocolNames[i]}
|
||||
})
|
||||
}
|
||||
|
||||
if (!args.dir || !args.name) {
|
||||
console.error('Usage: atom-shell-packager <sourcedir> <Appname>')
|
||||
process.exit(1)
|
||||
|
9
index.js
9
index.js
@ -57,6 +57,15 @@ module.exports = function packager (opts, cb) {
|
||||
pl2.CFBundleIdentifier = bundleHelperId
|
||||
pl2.CFBundleName = opts.name
|
||||
|
||||
if (opts.protocols) {
|
||||
pl2.CFBundleURLTypes = pl1.CFBundleURLTypes = opts.protocols.map(function (protocol) {
|
||||
return {
|
||||
CFBundleURLName: protocol.name,
|
||||
CFBundleURLSchemes: [].concat(protocol.schemes)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fs.writeFileSync(paths.info1, plist.build(pl1))
|
||||
fs.writeFileSync(paths.info2, plist.build(pl2))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user