Permalink
Browse files

301

  • Loading branch information...
1 parent bda835c commit 3c1ca80df79541640729a66821a7963b33dea738 @isaacs committed Feb 11, 2011
Showing with 1 addition and 21,369 deletions.
  1. +1 −95 README.md
  2. +0 −103 _auth.js
  3. +0 −651 app.js
  4. +0 −91 test.js
  5. +0 −133 ui/app.js
  6. BIN ui/attachments/fonts/Cantarell-Regular-webfont.eot
  7. +0 −143 ui/attachments/fonts/Cantarell-Regular-webfont.svg
  8. BIN ui/attachments/fonts/Cantarell-Regular-webfont.ttf
  9. BIN ui/attachments/fonts/Cantarell-Regular-webfont.woff
  10. BIN ui/attachments/fonts/Hattori_Hanzo-webfont.eot
  11. +0 −140 ui/attachments/fonts/Hattori_Hanzo-webfont.svg
  12. BIN ui/attachments/fonts/Hattori_Hanzo-webfont.ttf
  13. BIN ui/attachments/fonts/Hattori_Hanzo-webfont.woff
  14. +0 −36 ui/attachments/fonts/stylesheet.css
  15. +0 −11 ui/attachments/highcharts/adapters/mootools-adapter.js
  16. +0 −214 ui/attachments/highcharts/adapters/mootools-adapter.src.js
  17. +0 −14 ui/attachments/highcharts/adapters/prototype-adapter.js
  18. +0 −254 ui/attachments/highcharts/adapters/prototype-adapter.src.js
  19. +0 −160 ui/attachments/highcharts/highcharts.js
  20. +0 −10,580 ui/attachments/highcharts/highcharts.src.js
  21. +0 −21 ui/attachments/highcharts/modules/exporting.js
  22. +0 −671 ui/attachments/highcharts/modules/exporting.src.js
  23. +0 −170 ui/attachments/highcharts/themes/dark-blue.js
  24. +0 −170 ui/attachments/highcharts/themes/dark-green.js
  25. +0 −164 ui/attachments/highcharts/themes/gray.js
  26. +0 −97 ui/attachments/highcharts/themes/grid.js
  27. +0 −35 ui/attachments/index.html
  28. +0 −20 ui/attachments/install.html
  29. +0 −167 ui/attachments/jquery-1.4.4.min.js
  30. +0 −311 ui/attachments/layout.css
  31. +0 −3 ui/attachments/more.html
  32. 0 ui/attachments/publish.html
  33. +0 −115 ui/attachments/sammy/plugins/sammy.cache.js
  34. +0 −78 ui/attachments/sammy/plugins/sammy.data_location_proxy.js
  35. +0 −700 ui/attachments/sammy/plugins/sammy.ejs.js
  36. +0 −274 ui/attachments/sammy/plugins/sammy.form.js
  37. +0 −553 ui/attachments/sammy/plugins/sammy.haml.js
  38. +0 −362 ui/attachments/sammy/plugins/sammy.json.js
  39. +0 −140 ui/attachments/sammy/plugins/sammy.meld.js
  40. +0 −444 ui/attachments/sammy/plugins/sammy.mustache.js
  41. +0 −118 ui/attachments/sammy/plugins/sammy.nested_params.js
  42. +0 −29 ui/attachments/sammy/plugins/sammy.path_location_proxy.js
  43. +0 −756 ui/attachments/sammy/plugins/sammy.pure.js
  44. +0 −577 ui/attachments/sammy/plugins/sammy.storage.js
  45. +0 −117 ui/attachments/sammy/plugins/sammy.template.js
  46. +0 −59 ui/attachments/sammy/plugins/sammy.title.js
  47. +0 −1,704 ui/attachments/sammy/sammy.js
  48. +0 −889 ui/attachments/site.js
View
@@ -1,95 +1 @@
-# Install
-
-You'll need CouchDB version 1.0.0 or higher. We're using some newish features.
-I recommend getting one from http://couchone.com/
-
-Add a vhost config:
-
- [vhosts]
- packages:5984 = /jsregistry/_design/app/_rewrite
-
-Where `packages` is the hostname where you'll be running the thing, and `5984` is the port that CouchDB is running on. If you're running on port 80, then omit the port altogether.
-
-Now install couchapp:
-
- npm install couchapp
-
-Now run the sync app.js from this repository.
-
- couchapp --design app.js --sync --couch http://localhost:5984/jsregistry
-
-You may need to put a username and password in the URL:
-
- couchapp --design app.js --sync --couch http://user:pass@localhost:5984/jsregistry
-
-# API
-
-### GET /packagename
-
-Returns the JSON document for this package. Includes all known dists and metadata. Example:
-
- {
- "name": "foo",
- "dist-tags": { "stable": "0.1" },
- "_id": "foo",
- "versions": {
- "0.1": {
- "name": "foo",
- "_id": "foo",
- "version": "0.1",
- "dist": { "tarball": "http:\/\/domain.com\/0.1.tgz" },
- "description": "A fake package"
- }
- },
- "description": "A fake package."
- }
-
-### GET /packagename/0.1.2
-
-Returns the JSON object for a specified release. Example:
-
- {
- "name": "foo",
- "_id": "foo",
- "version": "0.1.2",
- "dist": { "tarball": "http:\/\/domain.com\/0.1.tgz" },
- "description": "A fake package"
- }
-
-### GET /packagename/stable
-
-Returns the JSON object for the specified tag.
-
- {
- "name": "foo",
- "_id": "foo",
- "version": "0.1",
- "dist": { "tarball": "http:\/\/domain.com\/0.1.tgz" },
- "description": "A fake package"
- }
-
-### PUT /packagename
-
-Create or update the entire package info.
-
-MUST include the JSON body of the entire document. Must have `content-type:application/json`.
-
-If updating this must include the latest _rev.
-
-This method can also remove previous versions and distributions if necessary.
-
-### PUT /packagename/0.1.2
-
-Create a new release version.
-
-MUST include all the metadata from package.json along with dist information as the JSON body of the request. MUST have `content-type:application/json`
-
-### PUT /pacakgename/stable
-
-Link a distribution tag (ie. "stable") to a specific version string.
-
-MUST but a JSON string as the body. Example:
-
- "0.1.2"
-
-Must have `content-type:application/json`.
+moved: <https://github.com/isaacs/npmjs.org>
View
@@ -1,103 +0,0 @@
-// sync to $host/_users/_design/_auth
-
-var ddoc = {_id:"_design/_auth", language:"javascript"}
-
-exports.app = ddoc
-
-ddoc.validate_doc_update = function (newDoc, oldDoc, userCtx) {
- if ((oldDoc || newDoc).type != 'user') {
- throw({forbidden : 'doc.type must be user'});
- }
- // we only validate user docs for now
- if (newDoc._deleted === true) {
- // allow deletes by admins and matching users
- // without checking the other fields
- if ((userCtx.roles.indexOf('_admin') != -1)
- || (userCtx.name == oldDoc.name)) {
- return;
- } else {
- throw({forbidden : 'Only admins may delete other user docs.'});
- }
- }
- if (!newDoc.name) {
- throw({forbidden : 'doc.name is required'});
- }
- if (!(newDoc.roles && (typeof newDoc.roles.length != 'undefined') )) {
- throw({forbidden : 'doc.roles must be an array'});
- }
- if (newDoc._id != 'org.couchdb.user:'+newDoc.name) {
- throw({forbidden : 'Docid must be of the form org.couchdb.user:name'});
- }
- if (oldDoc) {
- // validate all updates
- if (oldDoc.name != newDoc.name) {
- throw({forbidden : 'Usernames may not be changed.'});
- }
- }
- // don't allow unsafe URI chars.
- // grandfather in any existing usernames, though.
- if (!oldDoc && encodeURIComponent(newDoc.name).indexOf("%") !== -1) {
- throw({forbidden: 'name cannot contain any non-urlsafe characters'})
- }
- if (newDoc.password_sha && !newDoc.salt) {
- throw({forbidden : 'Users with password_sha must have a salt.'
- +'See /_utils/script/couch.js for example code.'});
- }
- if (userCtx.roles.indexOf('_admin') == -1) {
- // not an admin
- if (oldDoc) {
- // validate non-admin updates
- if (userCtx.name != newDoc.name) {
- throw({forbidden : 'You may only update your own user document.'
- +'('+userCtx.name+')'});
- }
- // validate role updates
- var oldRoles = oldDoc.roles.sort();
- var newRoles = newDoc.roles.sort();
- if (oldRoles.length != newRoles.length) {
- throw({forbidden : 'Only _admin may edit roles'});
- }
- for (var i=0; i < oldRoles.length; i++) {
- if (oldRoles[i] != newRoles[i]) {
- throw({forbidden : 'Only _admin may edit roles'});
- }
- }
- } else if (newDoc.roles.length > 0) {
- throw({forbidden : 'Only _admin may set roles'});
- }
- }
- // no system roles in users db
- for (var i=0; i < newDoc.roles.length; i++) {
- if (newDoc.roles[i][0] == '_') {
- throw({forbidden : 'No system roles (starting with underscore) in users db.'});
- }
- };
- // no system names as names
- if (newDoc.name[0] == '_') {
- throw({forbidden : 'Username may not start with underscore.'});
- }
-}
-ddoc.lists = {
- index: function (head,req) {
- var row
- , out = {}
- , id, data
- while (row = getRow()) {
- id = row.id.replace(/^org\.couchdb\.user:/, '')
- data = row.value
- delete data._id
- delete data._rev
- delete data.salt
- delete data.password_sha
- delete data.type
- delete data.roles
- delete data._deleted_conflicts
- out[id] = data
- }
- send(toJSON(out))
- }
-}
-ddoc.views = {
- listAll : { map : function (doc) { return emit(doc._id, doc) } }
-}
-
Oops, something went wrong.

0 comments on commit 3c1ca80

Please sign in to comment.