This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code has a break rate of < 10%. It's still unnacceptable, though. | |
var request = require( 'request' ).defaults( { jar: true } ), | |
q = require( 'q' ); | |
var URI = 'http://demo.visualcaptcha.net/'; | |
// Make a post | |
var makePost = function makePost( imgHash, partialURL, tryNumber ) { | |
var deferred = q.defer(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const finish = (cb, url) => { | |
console.log('Sending to', url); | |
cb(null, {url: url}); | |
} | |
exports.handler = (event, context, callback) => { | |
const defaultURL = 'http://example.com'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
if (context.body) { | |
if (!context.body.email || !context.body.pass) { | |
return cb(401, 'Unauthorized'); | |
} | |
} else if (!context.headers['x-token']) { | |
return cb(403, 'Forbidden'); | |
} | |
const now = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
if (!context.query.apiKey) { | |
return cb(401, 'Unauthorized'); | |
} | |
cb(null, { | |
authenticated: true, | |
user: 'Zapier', | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
if (!context.headers['x-api-key']) { | |
return cb(401, 'Unauthorized'); | |
} | |
cb(null, { | |
authenticated: true, | |
user: 'user', | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
if (!context.headers.authorization) { | |
return cb(403, 'Forbidden'); | |
} | |
if (context.headers.authorization !== 'Bearer a_token' && context.headers.authorization !== 'Bearer a_new_token') { | |
return cb(401, 'Unauthorized'); | |
} | |
cb(null, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
cb(null, { | |
"id":"1", | |
"createdAt":1471984289, | |
"name":"name 1", | |
"authorId":63, | |
"directions":"directions 1", | |
"style":"style 1" | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
cb(null, [ | |
{ | |
"key":"authorId", | |
"label":"Author", | |
"type":"number", | |
"required": true, | |
"helpText": "This is some help, yo!" | |
} | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(context, cb) { | |
cb(null, [ | |
{ | |
"key":"name", | |
"label":"Better Name", | |
"type":"string" | |
}, | |
{ | |
"key":"authorId", | |
"label":"Author", |
OlderNewer