mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 15:53:33 +00:00 
			
		
		
		
	wildcard support
This commit is contained in:
		| @@ -141,16 +141,35 @@ const internalCertificate = { | ||||
| 								}); | ||||
| 						}) | ||||
| 						.then((in_use_result) => { | ||||
| 							// Is CloudFlare, no config needed, so skip 3 and 5. | ||||
| 							if (data.meta.cloudflare_use) { | ||||
| 								return internalNginx.reload().then(() => { | ||||
| 									// 4. Request cert | ||||
| 									return internalCertificate.requestLetsEncryptCloudFlareDnsSsl(certificate, data.meta.cloudflare_token); | ||||
| 								}) | ||||
| 								.then(internalNginx.reload) | ||||
| 								.then(() => { | ||||
| 									// 6. Re-instate previously disabled hosts | ||||
| 									return internalCertificate.enableInUseHosts(in_use_result); | ||||
| 								}) | ||||
| 								.then(() => { | ||||
| 									return certificate; | ||||
| 								}) | ||||
| 								.catch((err) => { | ||||
| 									// In the event of failure, revert things and throw err back | ||||
| 									return internalCertificate.enableInUseHosts(in_use_result) | ||||
| 										.then(internalNginx.reload) | ||||
| 										.then(() => { | ||||
| 											throw err; | ||||
| 										}); | ||||
| 								}); | ||||
| 							} else { | ||||
| 								// 3. Generate the LE config | ||||
| 								return internalNginx.generateLetsEncryptRequestConfig(certificate) | ||||
| 									.then(internalNginx.reload) | ||||
| 									.then(() => { | ||||
| 										// 4. Request cert | ||||
| 									if (data.meta.cloudflare_use) { | ||||
| 										return internalCertificate.requestLetsEncryptCloudFlareDnsSsl(certificate, data.meta.cloudflare_token); | ||||
| 									} else { | ||||
| 										return internalCertificate.requestLetsEncryptSsl(certificate); | ||||
| 									} | ||||
| 									}) | ||||
| 									.then(() => { | ||||
| 										// 5. Remove LE config | ||||
| @@ -175,6 +194,7 @@ const internalCertificate = { | ||||
| 												throw err; | ||||
| 											}); | ||||
| 									}); | ||||
| 							} | ||||
| 						}) | ||||
| 						.then(() => { | ||||
| 							// At this point, the letsencrypt cert should exist on disk. | ||||
| @@ -763,26 +783,25 @@ const internalCertificate = { | ||||
| 		let tokenLoc = '~/cloudflare-token'; | ||||
| 		let storeKey = 'echo "dns_cloudflare_api_token = ' + apiToken + '" > ' + tokenLoc;	 | ||||
|  | ||||
| 		let cmd = certbot_command + ' certonly --non-interactive ' + | ||||
| 		let cmd =  | ||||
| 			storeKey + " && " + | ||||
| 			certbot_command + ' certonly --non-interactive ' + | ||||
| 			'--cert-name "npm-' + certificate.id + '" ' + | ||||
| 			'--agree-tos ' + | ||||
| 			'--email "' + certificate.meta.letsencrypt_email + '" ' +			 | ||||
| 			'--domains "' + certificate.domain_names.join(',') + '" ' + | ||||
| 			'--dns-cloudflare --dns-cloudflare-credentials ' + tokenLoc + ' ' + | ||||
| 			(le_staging ? '--staging' : ''); | ||||
| 			'--dns-cloudflare --dns-cloudflare-credentials ' + tokenLoc + | ||||
| 			(le_staging ? ' --staging' : '') | ||||
| 			+ ' && rm ' + tokenLoc; | ||||
|  | ||||
| 		if (debug_mode) { | ||||
| 			logger.info('Command:', cmd); | ||||
| 		} | ||||
|  | ||||
| 		return utils.exec(storeKey).then((result) => { | ||||
| 			utils.exec(cmd).then((result) => { | ||||
| 				utils.exec('rm ' + tokenLoc).then(result => { | ||||
| 					logger.success(result); | ||||
| 		return utils.exec(cmd).then((result) => { | ||||
| 				logger.info(result); | ||||
| 				return result; | ||||
| 			}); | ||||
| 			}); | ||||
| 		}); | ||||
| 	}, | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -39,6 +39,7 @@ module.exports = Mn.View.extend({ | ||||
|  | ||||
|             if (!this.ui.form[0].checkValidity()) { | ||||
|                 $('<input type="submit">').hide().appendTo(this.ui.form).click().remove(); | ||||
|                 $(this).addClass('btn-loading'); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @@ -94,6 +95,7 @@ module.exports = Mn.View.extend({ | ||||
|             } | ||||
|  | ||||
|             this.ui.buttons.prop('disabled', true).addClass('btn-disabled'); | ||||
|             this.ui.save.addClass('btn-loading'); | ||||
|  | ||||
|             // compile file data | ||||
|             let form_data = new FormData(); | ||||
| @@ -132,6 +134,7 @@ module.exports = Mn.View.extend({ | ||||
|                 .catch(err => { | ||||
|                     alert(err.message); | ||||
|                     this.ui.buttons.prop('disabled', false).removeClass('btn-disabled'); | ||||
|                     this.ui.save.removeClass('btn-loading'); | ||||
|                 }); | ||||
|         } | ||||
|     }, | ||||
| @@ -161,7 +164,7 @@ module.exports = Mn.View.extend({ | ||||
|                     text:  input | ||||
|                 }; | ||||
|             }, | ||||
|             createFilter: /^(?:[^.*]+\.?)+[^.]$/ | ||||
|             createFilter: /^(?:[^.]+\.?)+[^.]$/ | ||||
|         }); | ||||
|         this.ui.cloudflare.hide(); | ||||
|     }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user