miroir de
				https://github.com/therootcompany/greenlock.js.git
				synchronisé 2024-11-16 17:29:00 +00:00 
			
		
		
		
	update for upcoming v3
Cette révision appartient à :
		
							Parent
							
								
									d5d14bd968
								
							
						
					
					
						révision
						ca219a00e4
					
				| @ -49,20 +49,46 @@ module.exports.create = function (gl) { | ||||
| 
 | ||||
|       var copy = utils.merge({ domains: [ hostname ] }, gl); | ||||
|       copy = utils.tplCopy(copy); | ||||
|       copy.challenge = {}; | ||||
|       copy.challenge.type = 'http-01'; // obviously...
 | ||||
|       copy.challenge.identifier = { type: 'dns', value: hostname }; | ||||
|       copy.challenge.wildcard = false; | ||||
|       copy.challenge.token = token; | ||||
|       copy.challenge.altname = hostname; | ||||
| 
 | ||||
|       // TODO tpl copy?
 | ||||
|       // TODO need to restore challengeType
 | ||||
|       gl.challenges['http-01'].get(copy, hostname, token, function (err, secret) { | ||||
|         if (err || !token) { | ||||
|           res.statusCode = 404; | ||||
|           res.setHeader('Content-Type', 'application/json; charset=utf-8'); | ||||
|           res.end('{ "error": { "message": "Error: These aren\'t the tokens you\'re looking for. Move along." } }'); | ||||
|       function cb(opts) { | ||||
|         var secret = opts.keyAuthorization || opts; | ||||
|         if (secret && 'string' === typeof secret) { | ||||
|           res.setHeader('Content-Type', 'text/plain; charset=utf-8'); | ||||
|           res.end(secret); | ||||
|           return; | ||||
|         } | ||||
|         eb(new Error("couldn't retrieve keyAuthorization")); | ||||
|         return; | ||||
|       } | ||||
|       function eb(/*err*/) { | ||||
|         res.statusCode = 404; | ||||
|         res.setHeader('Content-Type', 'application/json; charset=utf-8'); | ||||
|         res.end('{ "error": { "message": "Error: These aren\'t the tokens you\'re looking for. Move along." } }'); | ||||
|         return; | ||||
|       } | ||||
|       function mb(err, result) { | ||||
|         if (err) { eb(err); return; } | ||||
|         cb(result); | ||||
|       } | ||||
| 
 | ||||
|       var challenger = gl.challenges['http-01'].get; | ||||
|       if (1 === challenger.length) { | ||||
|         /*global Promise*/ | ||||
|         return Promise.resolve().then(function () { | ||||
|           return gl.challenges['http-01'].get(copy); | ||||
|         }).then(cb).catch(eb); | ||||
|       } else if (2 === challenger.length) { | ||||
|         gl.challenges['http-01'].get(copy, mb); | ||||
|       } else { | ||||
|         gl.challenges['http-01'].get(copy, hostname, token, mb); | ||||
|       } | ||||
| 
 | ||||
|         res.setHeader('Content-Type', 'text/plain; charset=utf-8'); | ||||
|         res.end(secret); | ||||
|       }); | ||||
|     }; | ||||
|   }; | ||||
| }; | ||||
|  | ||||
		Chargement…
	
	
			
			x
			
			
		
	
		Référencer dans un nouveau ticket
	
	Bloquer un utilisateur