daplie-tools
Advanced tools
Comparing version 1.0.0-alpha.907 to 1.0.0-alpha.908
@@ -29,2 +29,16 @@ #!/usr/bin/env node | ||
// name, defaults | ||
/* | ||
[ 'name', 'defaults' ].forEach(function (key) { | ||
if ('function' === typeof opts[key]) { | ||
delete opts[key]; | ||
} | ||
}); | ||
*/ | ||
Object.keys(opts).forEach(function (key) { | ||
if ('function' === typeof opts[key]) { | ||
delete opts[key]; | ||
} | ||
}); | ||
Object.keys(cliOptions).forEach(function (key) { | ||
@@ -54,2 +68,3 @@ if (undefined === opts[key]) { | ||
console.log(" domains # purchase and manage domains"); | ||
console.log(" ns # manage nameservers"); | ||
console.log(" wallet # see and manage funding sources (credit cards)"); // and balance | ||
@@ -101,3 +116,5 @@ console.log(""); | ||
, 'domains' | ||
, 'glue' | ||
, 'login' | ||
, 'ns' | ||
, 'wallet' | ||
@@ -608,3 +625,3 @@ ]; | ||
var opts = mergeDefaults(program); | ||
if (helpme || (!opts.device || !opts.device)) { | ||
if (helpme || (!opts.device || !opts.name)) { | ||
program.help(); | ||
@@ -694,2 +711,160 @@ console.log(''); | ||
// | ||
// NameServer Glue Records | ||
// | ||
all.glue = function () { | ||
console.log(""); | ||
console.log("Usage: daplie glue:COMMAND [command-specific-options]"); | ||
console.log(""); | ||
console.log('Primary help topics, type "daplie help glue:COMMAND" for more details:'); | ||
console.log(""); | ||
console.log(" glue:list # show nameserver glue records"); | ||
console.log(" glue:set # set nameserver glue records"); | ||
console.log(""); | ||
}; | ||
all['glue:list'] = function () { | ||
program | ||
.usage('glue:list') | ||
.option('-a, --all', 'Show all') | ||
.option('-n, --name <value>', 'Filter by domain name') | ||
.parse(process.argv) | ||
; | ||
var opts = mergeDefaults(program); | ||
if (helpme || !(opts.name || opts.all)) { | ||
program.help(); | ||
console.log(''); | ||
console.log('Example: daplie glue:list --all'); | ||
console.log(''); | ||
return; | ||
} | ||
return oauth3.Glue.all(opts).then(function (records) { | ||
if (opts.name) { | ||
records = records.filter(function (r) { | ||
return ('.' + opts.name).length === | ||
r.name.lastIndexOf('.' + opts.name) - r.name.length; | ||
}); | ||
} | ||
console.log(""); | ||
console.log(' NAME ' + '\t' + ' IP '); | ||
console.log('----------------' + '\t' + '----------------'); | ||
records.forEach(function (r) { | ||
console.log(r.name + '\t' + r.ip); | ||
}); | ||
console.log(""); | ||
}); | ||
}; | ||
all['glue:set'] = function () { | ||
program | ||
.usage('glue:set') | ||
.option('-n, --name <value>', 'Specify a domainname such as ns1.example.com') | ||
.option('-a, --address <value>', 'Specify a domainname') | ||
.option('--defaults', 'Use the daplie nameservers and naming convention') | ||
.parse(process.argv) | ||
; | ||
var opts = mergeDefaults(program); | ||
if (helpme || !((opts.name && opts.address) || (opts.name && opts.defaults))) { | ||
program.help(); | ||
console.log(''); | ||
console.log('Examples:'); | ||
console.log(' daplie glue:set --name ns1.example.com --address 127.0.0.1'); | ||
console.log(' daplie glue:set --name example.com --defaults'); | ||
console.log(''); | ||
return; | ||
} | ||
return oauth3.Glue.set(opts).then(function (/*success*/) { | ||
console.log(""); | ||
console.log("Success"); | ||
console.log(""); | ||
}); | ||
}; | ||
// | ||
// NameServers | ||
// | ||
all.ns = function () { | ||
console.log(""); | ||
console.log("Usage: daplie ns:COMMAND [command-specific-options]"); | ||
console.log(""); | ||
console.log('Primary help topics, type "daplie help ns:COMMAND" for more details:'); | ||
console.log(""); | ||
console.log(" ns:list # show nameservers, same as `dig NS <domain>`"); | ||
console.log(" ns:set # set nameservers"); | ||
console.log(""); | ||
}; | ||
all['ns:list'] = function () { | ||
program | ||
.usage('ns:list') | ||
.option('-n, --name <value>', 'Specify a domainname') | ||
.parse(process.argv) | ||
; | ||
var opts = mergeDefaults(program); | ||
if (helpme || !opts.name) { | ||
program.help(); | ||
console.log(''); | ||
console.log('Example: daplie ns:list --name example.com'); | ||
console.log(''); | ||
return; | ||
} | ||
return require('dns').resolveNs(opts.name, function (err, nameservers) { | ||
if (err) { | ||
console.error(err.toString()); | ||
return; | ||
} | ||
console.log(""); | ||
console.log("Nameservers for " + opts.name); | ||
console.log("-----------"); | ||
console.log(""); | ||
nameservers.forEach(function (ns) { | ||
console.log(ns); | ||
}); | ||
console.log(""); | ||
}); | ||
}; | ||
all['ns:set'] = function () { | ||
program | ||
.usage('ns:set') | ||
.option('-n, --name <value>', 'Specify a domainname') | ||
.option('--nameservers <values>', 'Comma-separated list of nameservers') | ||
.option('--defaults', 'Use the daplie nameservers') | ||
.parse(process.argv) | ||
; | ||
var opts = mergeDefaults(program); | ||
if (helpme || !opts.name || !(opts.nameservers || opts.defaults)) { | ||
program.help(); | ||
console.log(''); | ||
console.log('Examples:'); | ||
console.log(' daplie ns:set --name example.com --nameservers ns1.example.com,ns2.example.com'); | ||
console.log(' daplie ns:set --name example.com --defaults'); | ||
console.log(''); | ||
return; | ||
} | ||
opts.nameservers = (opts.nameservers||'').split(','); | ||
return oauth3.Ns.set(opts).then(function (result) { | ||
console.log(""); | ||
console.log(opts.name); | ||
console.log(""); | ||
console.log("Nameservers"); | ||
console.log("-----------"); | ||
console.log(""); | ||
result.nameservers.forEach(function (ns) { | ||
console.log(ns); | ||
}); | ||
console.log(""); | ||
}); | ||
}; | ||
// | ||
// Wallet | ||
// | ||
all.wallet = function () { | ||
@@ -835,3 +1010,3 @@ console.log(""); | ||
opts.provider = cliOptions.provider; | ||
oauth3.Cards.remove(opts).then(function (/*deletedCard*/) { | ||
return oauth3.Cards.remove(opts).then(function (/*deletedCard*/) { | ||
return listCards(opts, null); | ||
@@ -841,4 +1016,14 @@ }); | ||
function run() { | ||
var p = all[cmd](); | ||
if (p && p.then) { | ||
p.then(function () {}, function (err) { | ||
console.error('Error: '); | ||
console.error(err.stack || err.message || err.toString()); | ||
}); | ||
} | ||
} | ||
if (all[cmd]) { | ||
all[cmd](); | ||
run(); | ||
} | ||
@@ -849,7 +1034,7 @@ else { | ||
process.on('unhandledRejection', function(reason, p) { | ||
process.on('unhandledRejection', function (reason/*, p*/) { | ||
console.log("Possibly Unhandled Rejection at:"); | ||
console.log("Promise:"); | ||
console.error(p); | ||
console.log("Reason:"); | ||
//console.log("Promise:"); | ||
//console.error(p); | ||
//console.log("Reason:"); | ||
console.error(reason); | ||
@@ -856,0 +1041,0 @@ process.exit(1); |
{ | ||
"name": "daplie-tools", | ||
"version": "1.0.0-alpha.907", | ||
"version": "1.0.0-alpha.908", | ||
"description": "Taking back the Internet", | ||
@@ -35,5 +35,5 @@ "main": "index.js", | ||
"commander": "^2.9.0", | ||
"oauth3-cli": "git+https://github.com/OAuth3/oauth3-cli.git#v1.0.0-alpha.907", | ||
"oauth3-cli": "git+https://github.com/OAuth3/oauth3-cli.git#v1.0.0-alpha.908", | ||
"request": "^2.69.0" | ||
} | ||
} |
# daplie-tools | ||
Taking Back the Internet | ||
https://daplie.com/articles/introducing-daplie/ | ||
## What is it? | ||
daplie-tools is a CLI client for DDNS and domain purchases. This is alpha software, NOT FOR PRODUCTION USE! | ||
## Prerequisities | ||
You need cURL and Git. You can install them using apt-get with this command: `apt-get install --yes git curl` | ||
You need Node.js You can install it on OS X or Linux with this commands: | ||
`curl -sL bit.ly/nodejs-min | bash` | ||
If you don't want to use the piped script you can download nodejs here: https://nodejs.org/en/download/ | ||
## Installation | ||
You can install it by running: `npm install -g daplie-tools` | ||
## Usage | ||
`daplie COMMAND Command-Specific-Options` | ||
## Commands | ||
See [COMMANDS.md](COMMANDS.md) | ||
## Authors | ||
daplie-tools is developed by <a href="https://github.com/coolaj86">AJ ONeal.</a> | ||
## License | ||
daplie-tools is licensed under the <a href="https://spdx.org/licenses/MPL-2.0">MPLv2</a> license. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
34704
6
930
39
1