mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
Compare commits
4 commits
0d54cd6993
...
ce73517c46
Author | SHA1 | Date | |
---|---|---|---|
|
ce73517c46 | ||
|
d2f71d11d6 | ||
|
f65453e50c | ||
|
495bf51ac8 |
2 changed files with 35 additions and 11 deletions
|
@ -156,15 +156,38 @@ class DockerHost {
|
||||||
let certPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameCert);
|
let certPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameCert);
|
||||||
let keyPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameKey);
|
let keyPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameKey);
|
||||||
|
|
||||||
if (dockerType === "tcp" && fs.existsSync(caPath) && fs.existsSync(certPath) && fs.existsSync(keyPath)) {
|
let key;
|
||||||
let ca = fs.readFileSync(caPath);
|
let cert;
|
||||||
let key = fs.readFileSync(keyPath);
|
let ca;
|
||||||
let cert = fs.readFileSync(certPath);
|
|
||||||
certOptions = {
|
if (dockerType === "tcp") {
|
||||||
ca,
|
if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
|
||||||
key,
|
// Load the key and cert
|
||||||
cert
|
key = fs.readFileSync(keyPath);
|
||||||
};
|
cert = fs.readFileSync(certPath);
|
||||||
|
|
||||||
|
if (fs.existsSync(caPath)) {
|
||||||
|
// Condition 1: Mutual TLS with self-signed certificate
|
||||||
|
ca = fs.readFileSync(caPath);
|
||||||
|
certOptions = {
|
||||||
|
ca,
|
||||||
|
key,
|
||||||
|
cert
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Condition 2: Mutual TLS with certificate in the standard trust store
|
||||||
|
certOptions = {
|
||||||
|
key,
|
||||||
|
cert
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (fs.existsSync(caPath)) {
|
||||||
|
// Condition 3: TLS using self-signed certificate (without mutual TLS)
|
||||||
|
ca = fs.readFileSync(caPath);
|
||||||
|
certOptions = {
|
||||||
|
ca
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -12,8 +12,9 @@ class ServerChan extends NotificationProvider {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
// serverchan3 requires sending via ft07.com
|
// serverchan3 requires sending via ft07.com
|
||||||
const url = String(notification.serverChanSendKey).startsWith("sctp")
|
const matchResult = String(notification.serverChanSendKey).match(/^sctp(\d+)t/i);
|
||||||
? `https://${notification.serverChanSendKey}.push.ft07.com/send`
|
const url = matchResult && matchResult[1]
|
||||||
|
? `https://${matchResult[1]}.push.ft07.com/send/${notification.serverChanSendKey}.send`
|
||||||
: `https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`;
|
: `https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue