{"_id":"pingback","_rev":"10-8dd50759437b1e4f04649c1a3008b576","name":"pingback","description":"pingbacks for node.js","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"pingback","description":"pingbacks for node.js","author":{"name":"Christopher Jeffrey"},"version":"0.0.1","main":"./lib/pingback.js","repository":{"type":"git","url":"git://github.com/chjj/node-pingback.git"},"keywords":["pingback","blog","rpc"],"dependencies":{},"devDependencies":{},"_id":"pingback@0.0.1","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"ac64e7242840b00815b499cccaca657deaa4e356","tarball":"https://registry.npmjs.org/pingback/-/pingback-0.0.1.tgz","integrity":"sha512-dxiOWyVAWYSa0qC0X6JEgSSyuaU/Dtm4e7EZ8GhXJNbih5NuCzbyvGzcldyNqA3cSZhjMDARVPTwTUTfW0nyCg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAGLJiYKN7vb+I/jg0k4uVvOL18BIXfWq+r3jCrZisZrAiAglSj+6h6MSM+Ve7TuIKUs4gFhXiGS6k3QxEvKajAWcg=="}]},"scripts":{},"directories":{}},"0.0.2":{"name":"pingback","description":"pingbacks for node.js","author":{"name":"Christopher Jeffrey"},"version":"0.0.2","main":"./lib/pingback.js","repository":{"type":"git","url":"git://github.com/chjj/node-pingback.git"},"keywords":["pingback","blog","rpc"],"dependencies":{},"devDependencies":{},"_id":"pingback@0.0.2","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"1b5b88a36b1e41b267ca540883fe7f6593097dfa","tarball":"https://registry.npmjs.org/pingback/-/pingback-0.0.2.tgz","integrity":"sha512-98b4gdGjIxLnndta4z4VE7xCE/pbIuqhhft7lRM5ERYqvKRS/gLzkOCe7sboN3qhq6wZ8XWEMNSx6NWISlOL2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF0Vn0zZLryhxu+OUQrnexiwd7U41EEWjsXKhpavO71jAiBbIJgfQ6fEej7QJkJRvtnHtaoZv8No866dBi97LRDfEw=="}]},"scripts":{},"directories":{}},"0.0.3":{"name":"pingback","description":"pingbacks for node.js","author":{"name":"Christopher Jeffrey"},"version":"0.0.3","main":"./index.js","repository":{"type":"git","url":"git://github.com/chjj/node-pingback.git"},"keywords":["pingback","blog","rpc"],"bugs":{"url":"https://github.com/chjj/node-pingback/issues"},"homepage":"https://github.com/chjj/node-pingback","_id":"pingback@0.0.3","dist":{"shasum":"b5b5ad29d509c7c3be4a0ce31ffdf0e4fa0102ab","tarball":"https://registry.npmjs.org/pingback/-/pingback-0.0.3.tgz","integrity":"sha512-F5q8w8QbrwLW4zCo6xJedZNZZJE/g1dgxoJoleBHTyZK01voGFmQkbycJ4/nJ1ViXmkxgxyn5Tc64doaRiXxQw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFtouyEEkP9mdYiVvTYXjXFY288jZJ4RlK2RPLpgDXaWAiANcOJZB37d3dI7LBlUTj4OXG/tel5/2PTi1rQ6tDjLpw=="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"chjj","email":"chjjeffrey@gmail.com"},"maintainers":[{"name":"chjj","email":"chjjeffrey@gmail.com"}]}},"maintainers":[{"name":"chjj","email":"chjjeffrey@gmail.com"}],"time":{"modified":"2022-06-23T23:58:46.949Z","created":"2011-07-16T14:50:25.774Z","0.0.1":"2011-07-16T14:50:26.201Z","0.0.2":"2011-07-20T06:51:51.889Z","0.0.3":"2014-02-02T04:08:02.535Z"},"author":{"name":"Christopher Jeffrey"},"repository":{"type":"git","url":"git://github.com/chjj/node-pingback.git"},"readme":"# node-pingback\r\n\r\nPingbacks have come to node.js. If you're writing a blog, you may be interested \r\nin this. It conforms to the \r\n[pingback specification](http://www.hixie.ch/specs/pingback/pingback), as well \r\nas the [XML-RPC spec](http://www.xmlrpc.com/spec), however, it may need more \r\ntesting. \r\n\r\nIt protects against spam, has no dependencies, and can be used right out of \r\nthe box. Connect/Express middleware is included.\r\n\r\n## Usage\r\n\r\n### Receiving Pingbacks (contrived example for clarity)\r\n\r\n``` js\r\napp.use('/pingback', Pingback.middleware(function(source, target, next) {\r\n  var self = this;\r\n  Posts.get(target.pathname, function(err, post) {\r\n    if (err) {\r\n      return next(Pingback.TARGET_DOES_NOT_EXIST); \r\n    }\r\n    if (post.pingbacks[source.href]) { \r\n      return next(Pingback.ALREADY_REGISTERED);\r\n    }\r\n    if (post.pingbacksDisabled) {\r\n      return next(Pingback.TARGET_CANNOT_BE_USED); \r\n    }\r\n    // or pass zero above for a generic error\r\n    post.pingbacks.push({\r\n      from: source.href, // e.g. \"http://domain.tld/hey_check_out_this_guys_post\"\r\n      title: self.title, // e.g. \"Joe's blog\"\r\n      text: self.excerpt // e.g. \"hey, check this out: <a href=\"your_site\">...</a>\"\r\n    });\r\n    post.save();\r\n    next(); // send a success response\r\n  });\r\n}));\r\n```\r\n\r\nWhat you see above is merely the abstracted interface of the bundled middleware.\r\nSee example.js/test.js for more in-depth and lower-level examples.\r\n\r\n### Sending Pingbacks\r\n\r\n``` js\r\n// ping a target - err will be a fault code if present\r\nPingback.send('[target]', '[source]', function(err, pingback) {\r\n  if (!err) console.log('Pinged ' + pingback.href + ' successfully.');\r\n});\r\n\r\n// scan an html string for links to ping\r\nvar text = 'a link here: <a href=\"http://localhost:9000/article\">a post</a>';\r\nPingback.scan(text, '[source]', function(err, pingback) {\r\n  // optional callback - will get called for every pingback sent\r\n  if (!err) console.log('Pinged ' + pingback.href + ' successfully.');\r\n});\r\n```\r\n\r\nAgain, see example.js/test.js for more examples and explanation.\r\n\r\n## Reference\r\n\r\n### Fault Code Constants\r\n\r\n``` js\r\nPingback.METHOD_NOT_FOUND = -32601;\r\nPingback.GENERAL_ERROR = 0;\r\nPingback.SOURCE_DOES_NOT_EXIST = 16;\r\nPingback.NO_LINK_TO_TARGET = 17;\r\nPingback.TARGET_DOES_NOT_EXIST = 32;\r\nPingback.TARGET_CANNOT_BE_USED = 33;\r\nPingback.ALREADY_REGISTERED = 48;\r\nPingback.ACCESS_DENIED = 49;\r\n```\r\n\r\n### Pingback properties\r\n\r\n- `source`: a parsed url object of the source\r\n- `target`: a parsed url object of the target\r\n- `excerpt`: an excerpt from the source's page\r\n- `title`: the title of the source page\r\n\r\n### Events for receiving pingbacks\r\n\r\n- `ping`: An optional event to validate and handle errors/faults. If bound,\r\n          this will be triggered as the first event and passed a `next` \r\n          callback, which can be passed a fault code to trigger a fault \r\n          response, otherwise it will continue handling the pingback. \r\n          Arguments: `source`, `target`, `next`.\r\n- `fault`: Emitted when a fault occurs. Passed the fault code and string.\r\n           Arguments: `code`, `msg`.\r\n- `error`: Emitted for non-fault related errors. Calls the next middleware layer \r\n           in the bundled connect/express middleware function. Arguments: `err`.\r\n- `end`: Emitted if no `ping` listeners have been bound, and after a pingback \r\n         has been received and verified. Arguments: `source`, `target`, `next`.\r\n         `next` has the same effect as the callback passed for `ping`.\r\n- `success`: Emitted if a `ping` listener was bound, and after the pingback has \r\n             been received and handled. Arguments: `source`, `target`.\r\n\r\n## License\r\n(c) Copyright 2011, Christopher Jeffrey (MIT License). \r\nSee LICENSE for more info.","readmeFilename":"README.md","users":{"docluv":true}}