mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-22 19:45:56 +00:00
Added changes from review
This commit is contained in:
parent
712e34572b
commit
340bfd7377
3 changed files with 7 additions and 30 deletions
|
@ -5,30 +5,6 @@ const nodemailer = require("nodemailer");
|
||||||
class SMTPMonitorType extends MonitorType {
|
class SMTPMonitorType extends MonitorType {
|
||||||
name = "smtp";
|
name = "smtp";
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} smtpSecurity the user's SMTP security setting
|
|
||||||
* @returns {boolean} True if this should test SMTPS
|
|
||||||
*/
|
|
||||||
isSMTPS(smtpSecurity) {
|
|
||||||
return smtpSecurity === "secure";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} smtpSecurity the user's SMTP security setting
|
|
||||||
* @returns {boolean} True if this should not attempt STARTTLS, even if it is available
|
|
||||||
*/
|
|
||||||
isIgnoreTLS(smtpSecurity) {
|
|
||||||
return smtpSecurity === "nostarttls";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} smtpSecurity the user's SMTP security setting
|
|
||||||
* @returns {boolean} True if this should always test STARTTLS
|
|
||||||
*/
|
|
||||||
isRequireTLS(smtpSecurity) {
|
|
||||||
return smtpSecurity === "starttls";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
@ -36,9 +12,9 @@ class SMTPMonitorType extends MonitorType {
|
||||||
let options = {
|
let options = {
|
||||||
port: monitor.port || 25,
|
port: monitor.port || 25,
|
||||||
host: monitor.hostname,
|
host: monitor.hostname,
|
||||||
secure: this.isSMTPS(monitor.smtpSecurity), // use SMTPS (not STARTTLS)
|
secure: smtpSecurity === "secure", // use SMTPS (not STARTTLS)
|
||||||
ignoreTLS: this.isIgnoreTLS(monitor.smtpSecurity), // don't use STARTTLS even if it's available
|
ignoreTLS: smtpSecurity === "nostarttls", // don't use STARTTLS even if it's available
|
||||||
requireTLS: this.isRequireTLS(monitor.smtpSecurity), // use STARTTLS or fail
|
requireTLS: smtpSecurity === "starttls", // use STARTTLS or fail
|
||||||
};
|
};
|
||||||
let transporter = nodemailer.createTransport(options);
|
let transporter = nodemailer.createTransport(options);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1051,5 +1051,6 @@
|
||||||
"RabbitMQ Password": "RabbitMQ Password",
|
"RabbitMQ Password": "RabbitMQ Password",
|
||||||
"rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.",
|
"rabbitmqHelpText": "To use the monitor, you will need to enable the Management Plugin in your RabbitMQ setup. For more information, please consult the {rabitmq_documentation}.",
|
||||||
"SendGrid API Key": "SendGrid API Key",
|
"SendGrid API Key": "SendGrid API Key",
|
||||||
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
|
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas",
|
||||||
|
"smtpHelpText": "Specify the TLS settings of the SMTP server you wish to monitor: SMTPS, STARTTLS, or ignore TLS"
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,14 +332,14 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="monitor.type === 'smtp'" class="my-3">
|
<i18n-t v-if="monitor.type === 'smtp'" keypath="smtpHelpText" tag="div" class="my-3">
|
||||||
<label for="smtp_security" class="form-label">{{ $t("SMTP Security") }}</label>
|
<label for="smtp_security" class="form-label">{{ $t("SMTP Security") }}</label>
|
||||||
<select id="smtp_security" v-model="monitor.smtpSecurity" class="form-select">
|
<select id="smtp_security" v-model="monitor.smtpSecurity" class="form-select">
|
||||||
<option value="secure">SMTPS</option>
|
<option value="secure">SMTPS</option>
|
||||||
<option value="nostarttls">Ignore STARTTLS</option>
|
<option value="nostarttls">Ignore STARTTLS</option>
|
||||||
<option value="starttls">Use STARTTLS</option>
|
<option value="starttls">Use STARTTLS</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</i18n-t>
|
||||||
|
|
||||||
<!-- Json Query -->
|
<!-- Json Query -->
|
||||||
<!-- For Json Query / SNMP -->
|
<!-- For Json Query / SNMP -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue