dat-registry
Advanced tools
Comparing version 2.1.2 to 3.0.0
27
index.js
@@ -11,7 +11,24 @@ var Township = require('township-client') | ||
if (!opts) opts = {} | ||
var server = opts.server || 'https://datproject.org' | ||
var api = server + '/api/v1' | ||
var township = Township(xtend(opts, { | ||
server: api // used over opts.server | ||
})) | ||
// datproject.org defaults, specify opts.server and opts.apiPath to override | ||
var SERVER = 'https://datproject.org' | ||
var API_PATH = '/api/v1' | ||
var apiPath = (opts.server && opts.server.indexOf('datproject.org') > -1) ? API_PATH: opts.apiPath // only add default path to datproject.org server | ||
var townshipOpts = Object.assign({}, opts) | ||
// set default township server & routes for datproject.org | ||
if (!townshipOpts.config.filename) townshipOpts.config.filename = '.datrc' | ||
if (!townshipOpts.server) townshipOpts.server = SERVER | ||
if (!opts.routes && apiPath) { | ||
townshipOpts.routes = { | ||
register: apiPath + '/register', | ||
login: apiPath + '/login', | ||
updatePassword: apiPath + '/updatepassword' | ||
} | ||
} | ||
var api = townshipOpts.server + apiPath | ||
var township = Township(townshipOpts) | ||
return { | ||
@@ -18,0 +35,0 @@ login: township.login.bind(township), |
{ | ||
"name": "dat-registry", | ||
"version": "2.1.2", | ||
"version": "3.0.0", | ||
"description": "dat registry api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,5 +0,12 @@ | ||
# dat-registry-client | ||
# dat-registry | ||
API Registry Client for publishing dats. | ||
API Registry Client for publishing dats. By default, the client is capable of registering, login, and publishing to datproject.org. | ||
`dat-registry` allows users to interact with and publish dats to your registry via the `dat` command line. Supporting this module on your registry will allow a user to login and publish: | ||
``` | ||
dat login custom-dat-registry.com | ||
dat publish | ||
``` | ||
## Installation | ||
@@ -37,3 +44,5 @@ | ||
* `opts.server`: the server to query. Default is `https://datproject.org/api/v1` | ||
* `opts.server`: the registry server. Default is `https://datproject.org` | ||
* `opts.apiPath`: registery server API path, e.g. we use `/api/v1` for datproject.org. This will overwrite default township routes to use server + apiPath. | ||
* `opts.config.filename`: defaults to `~.datrc` instead of township defaults. | ||
@@ -45,3 +54,2 @@ Other options are passed to [township-client](https://github.com/township/township-client), these include: | ||
config: { | ||
filename: '.townshiprc', // configuration filename (stored in os homedir) | ||
filepath: '~/.townshiprc' // specify a full config file path | ||
@@ -73,3 +81,2 @@ }, | ||
### CRUD API | ||
@@ -76,0 +83,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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
7872
6
77
96
1