daplie-tools
Advanced tools
Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3
@@ -229,7 +229,8 @@ #!/usr/bin/env node | ||
.usage('dns:list -n <domainname>') | ||
.option('-n, --name <value>', 'Specify a domainname / hostname') | ||
.option('-n, --name <value>', 'Specify a domainname / hostname') | ||
.option('--all', 'Show all dns records for this account') | ||
.parse(process.argv) | ||
; | ||
if (helpme || 'string' !== typeof program.opts().name) { | ||
if (helpme || (!program.opts().all && 'string' !== typeof program.opts().name)) { | ||
program.help(); | ||
@@ -239,4 +240,12 @@ return; | ||
var promise; | ||
program.provider = cliOptions.provider; | ||
oauth3.getDns(program.opts()).then(function (results) { | ||
if (program.opts().all) { | ||
promise = oauth3.allDns(program.opts()); | ||
} | ||
else { | ||
promise = oauth3.getDns(program.opts()); | ||
} | ||
promise.then(function (results) { | ||
if (!results || !Array.isArray(results.records)) { | ||
@@ -262,3 +271,3 @@ console.error("unexpected response:"); | ||
results.records.forEach(function (record) { | ||
record.updatedAt = record.updatedAt || 0; | ||
record.updatedAt = parseInt(record.updatedAt, 10) || 0; | ||
if (record.device.length < 10) { | ||
@@ -285,27 +294,27 @@ record.device += '\t'; | ||
else if ('dns:set' === cmd) { | ||
// daplie dns:device add <DEVICE NAME> <IPv4 or IPv6> | ||
// daplie dns:device remove <DEVICE NAME> <IPv4 or IPv6> | ||
// daplie dns:device reset <DEVICE NAME> <IPv4 or IPv6> // just one | ||
// daplie dns:device add <DEVICE NAME> <IPv4 or IPv6> | ||
// daplie dns:device remove <DEVICE NAME> <IPv4 or IPv6> | ||
// daplie dns:device reset <DEVICE NAME> <IPv4 or IPv6> // just one | ||
// daplie dns:domain add <DOMAIN NAME> <TYPE> <DEVICE NAME> <TTL> <PRIORITY> | ||
// daplie dns:domain remove <DOMAIN NAME> <DEVICE NAME> | ||
// daplie dns:domain reset <DOMAIN NAME> <DEVICE NAME> // just one | ||
// daplie dns:domain add <DOMAIN NAME> <TYPE> <DEVICE NAME> <TTL> <PRIORITY> | ||
// daplie dns:domain remove <DOMAIN NAME> <DEVICE NAME> | ||
// daplie dns:domain reset <DOMAIN NAME> <DEVICE NAME> // just one | ||
// daplie dns:update | ||
// daplie dns:update | ||
// TODO update device by ip | ||
// TODO add or remove device from domain | ||
program | ||
// TODO update device by ip | ||
// TODO add or remove device from domain | ||
program | ||
.usage('dns:set -n <domainname> -d <devicename> -a <answer>') | ||
.option('-n, --name <value>', 'Specify a domainname / hostname') | ||
.option('-d, --device <value>', 'Name of device associated with the answer') | ||
.option( | ||
'-t, --type <value>' | ||
, 'Record type. One of: A, AAAA, ANAME, CNAME, FWD, MX, SRV, TXT' | ||
, /^(A|AAAA|ANAME|CNAME|FWD|MX|SRV|TXT)$/i | ||
) | ||
.option('-a, --answer <value>', 'The value of IPv4, IPv6, CNAME, or ANAME') | ||
.option('-p, --priority <n>', 'Priority (for MX record, only)') | ||
.parse(process.argv) | ||
; | ||
.option('-n, --name <value>', 'Specify a domainname / hostname') | ||
.option('-d, --device <value>', 'Name of device associated with the answer') | ||
.option( | ||
'-t, --type <value>' | ||
, 'Record type. One of: A, AAAA, ANAME, CNAME, FWD, MX, SRV, TXT' | ||
, /^(A|AAAA|ANAME|CNAME|FWD|MX|SRV|TXT)$/i | ||
) | ||
.option('-a, --answer <value>', 'The value of IPv4, IPv6, CNAME, or ANAME') | ||
.option('-p, --priority <n>', 'Priority (for MX record, only)') | ||
.parse(process.argv) | ||
; | ||
@@ -320,5 +329,5 @@ if (helpme || !('string' === typeof program.opts().name && program.answer)) { | ||
, domain: program.opts().name | ||
, answer: program.answer | ||
, type: program.type | ||
, priority: program.priority | ||
, answer: program.answer | ||
, type: program.type | ||
, priority: program.priority | ||
, device: program.device || require('os').hostname() | ||
@@ -444,4 +453,3 @@ }).then(function (results) { | ||
, 'Update with comma-separated list of IPv4 and IPv6 addresses') | ||
.option('--ttl <seconds>', 'time to live (default is 300 seconds - 5 minutes)') | ||
//.option('-u, --update', "Also update the device to use this client's IP address") | ||
//.option('--ttl <seconds>', 'time to live (default is 300 seconds - 5 minutes)') | ||
.parse(process.argv) | ||
@@ -462,10 +470,24 @@ ; | ||
}); | ||
} | ||
/* | ||
.replace(/:device/, opts.device) | ||
.replace(/:tld/, opts.tld) | ||
.replace(/:sld/, opts.sld) | ||
.replace(/:sub/, opts.sub || '.') | ||
'update', 'ttl', 'priority', 'addresses' | ||
*/ | ||
else if ('devices:detach' === cmd) { | ||
program | ||
.usage('devices:detach -d <devicename> -n <domainname>') | ||
.option('-d, --device <value>', 'Name of device to add') | ||
.option('-n, --name <value>', 'Name of domain') | ||
.parse(process.argv) | ||
; | ||
if (helpme || (!program.opts().device || !program.opts().device)) { | ||
program.help(); | ||
console.log(''); | ||
console.log('Example: daplie devices:detach -d localhost -n example.com'); | ||
console.log(''); | ||
return; | ||
} | ||
oauth3.detachDevice(program.opts()).then(function (results) { | ||
console.log('DEBUG devices:detach results:'); | ||
console.log(results); | ||
}); | ||
} | ||
@@ -472,0 +494,0 @@ |
{ | ||
"name": "daplie-tools", | ||
"version": "1.0.0-alpha.2", | ||
"version": "1.0.0-alpha.3", | ||
"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.2", | ||
"oauth3-cli": "git+https://github.com/OAuth3/oauth3-cli.git#v1.0.0-alpha.3", | ||
"request": "^2.69.0" | ||
} | ||
} |
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
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
17725
5
469