feature: Add an option to enable Telegram to work behind a proxy. (#6125)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
mamoyal
2025-09-30 13:50:37 +03:00
committed by GitHub
parent f3bbddc287
commit f65aebffb1
75 changed files with 627 additions and 80 deletions

469
package-lock.json generated
View File

@@ -73,6 +73,7 @@
"prometheus-api-metrics": "~3.2.1", "prometheus-api-metrics": "~3.2.1",
"promisify-child-process": "~4.1.2", "promisify-child-process": "~4.1.2",
"protobufjs": "~7.2.4", "protobufjs": "~7.2.4",
"proxy-agent": "^5.0.0",
"qs": "~6.10.4", "qs": "~6.10.4",
"redbean-node": "~0.3.0", "redbean-node": "~0.3.0",
"redis": "~4.5.1", "redis": "~4.5.1",
@@ -4346,7 +4347,6 @@
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
"license": "MIT", "license": "MIT",
"optional": true,
"engines": { "engines": {
"node": ">= 6" "node": ">= 6"
} }
@@ -5294,7 +5294,6 @@
"version": "8.15.0", "version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
@@ -5313,6 +5312,18 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
} }
}, },
"node_modules/acorn-walk": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
"license": "MIT",
"dependencies": {
"acorn": "^8.11.0"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/aedes": { "node_modules/aedes": {
"version": "0.46.3", "version": "0.46.3",
"resolved": "https://registry.npmjs.org/aedes/-/aedes-0.46.3.tgz", "resolved": "https://registry.npmjs.org/aedes/-/aedes-0.46.3.tgz",
@@ -5778,6 +5789,18 @@
"integrity": "sha512-CbNem/7hxrjSiOAOOTX4iZxu+0m3jiLqlsERQwwPM1IDR/22M8IPpA1VVndCLw5KtjRYyRODbvAEIfuTogNDng==", "integrity": "sha512-CbNem/7hxrjSiOAOOTX4iZxu+0m3jiLqlsERQwwPM1IDR/22M8IPpA1VVndCLw5KtjRYyRODbvAEIfuTogNDng==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/ast-types": {
"version": "0.13.4",
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz",
"integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==",
"license": "MIT",
"dependencies": {
"tslib": "^2.0.1"
},
"engines": {
"node": ">=4"
}
},
"node_modules/astral-regex": { "node_modules/astral-regex": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
@@ -7454,6 +7477,15 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/data-uri-to-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz",
"integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==",
"license": "MIT",
"engines": {
"node": ">= 6"
}
},
"node_modules/data-view-buffer": { "node_modules/data-view-buffer": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz",
@@ -7629,7 +7661,6 @@
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/default-browser": { "node_modules/default-browser": {
@@ -7715,6 +7746,21 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/degenerator": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/degenerator/-/degenerator-3.0.4.tgz",
"integrity": "sha512-Z66uPeBfHZAHVmue3HPfyKu2Q0rC2cRxbTOsvmU/po5fvvcx27W4mIu9n0PUlQih4oUYvcG1BsbtVv8x7KDOSw==",
"license": "MIT",
"dependencies": {
"ast-types": "^0.13.2",
"escodegen": "^1.8.1",
"esprima": "^4.0.0",
"vm2": "^3.9.17"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/delay": { "node_modules/delay": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz",
@@ -8521,6 +8567,97 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/escodegen": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz",
"integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==",
"license": "BSD-2-Clause",
"dependencies": {
"esprima": "^4.0.1",
"estraverse": "^4.2.0",
"esutils": "^2.0.2",
"optionator": "^0.8.1"
},
"bin": {
"escodegen": "bin/escodegen.js",
"esgenerate": "bin/esgenerate.js"
},
"engines": {
"node": ">=4.0"
},
"optionalDependencies": {
"source-map": "~0.6.1"
}
},
"node_modules/escodegen/node_modules/estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=4.0"
}
},
"node_modules/escodegen/node_modules/levn": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
"integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==",
"license": "MIT",
"dependencies": {
"prelude-ls": "~1.1.2",
"type-check": "~0.3.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/escodegen/node_modules/optionator": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
"integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
"license": "MIT",
"dependencies": {
"deep-is": "~0.1.3",
"fast-levenshtein": "~2.0.6",
"levn": "~0.3.0",
"prelude-ls": "~1.1.2",
"type-check": "~0.3.2",
"word-wrap": "~1.2.3"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/escodegen/node_modules/prelude-ls": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==",
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/escodegen/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"license": "BSD-3-Clause",
"optional": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/escodegen/node_modules/type-check": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
"integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==",
"license": "MIT",
"dependencies": {
"prelude-ls": "~1.1.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/eslint": { "node_modules/eslint": {
"version": "8.14.0", "version": "8.14.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.14.0.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.14.0.tgz",
@@ -8730,6 +8867,19 @@
"url": "https://opencollective.com/eslint" "url": "https://opencollective.com/eslint"
} }
}, },
"node_modules/esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"license": "BSD-2-Clause",
"bin": {
"esparse": "bin/esparse.js",
"esvalidate": "bin/esvalidate.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/esquery": { "node_modules/esquery": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
@@ -8777,7 +8927,6 @@
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true,
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -9049,7 +9198,6 @@
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/fast-uri": { "node_modules/fast-uri": {
@@ -9187,6 +9335,15 @@
"node": "^10.12.0 || >=12.0.0" "node": "^10.12.0 || >=12.0.0"
} }
}, },
"node_modules/file-uri-to-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz",
"integrity": "sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==",
"license": "MIT",
"engines": {
"node": ">= 6"
}
},
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
@@ -9492,6 +9649,42 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0" "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
} }
}, },
"node_modules/ftp": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz",
"integrity": "sha512-faFVML1aBx2UoDStmLwv2Wptt4vw5x03xxX172nhA5Y5HBshW5JweqQ2W4xL4dezQTG8inJsuYcpPHHU3X5OTQ==",
"dependencies": {
"readable-stream": "1.1.x",
"xregexp": "2.0.0"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/ftp/node_modules/isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==",
"license": "MIT"
},
"node_modules/ftp/node_modules/readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==",
"license": "MIT",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"node_modules/ftp/node_modules/string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==",
"license": "MIT"
},
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@@ -9876,6 +10069,55 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/get-uri": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/get-uri/-/get-uri-3.0.2.tgz",
"integrity": "sha512-+5s0SJbGoyiJTZZ2JTpFPLMPSch72KEqGOTvQsBqg0RBWvwhWUSYZFAtz3TPW0GXJuLBJPts1E241iHg+VRfhg==",
"license": "MIT",
"dependencies": {
"@tootallnate/once": "1",
"data-uri-to-buffer": "3",
"debug": "4",
"file-uri-to-path": "2",
"fs-extra": "^8.1.0",
"ftp": "^0.3.10"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/get-uri/node_modules/fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
},
"engines": {
"node": ">=6 <7 || >=8"
}
},
"node_modules/get-uri/node_modules/jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
"license": "MIT",
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/get-uri/node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"license": "MIT",
"engines": {
"node": ">= 4.0.0"
}
},
"node_modules/getopts": { "node_modules/getopts": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/getopts/-/getopts-2.3.0.tgz", "resolved": "https://registry.npmjs.org/getopts/-/getopts-2.3.0.tgz",
@@ -10083,7 +10325,6 @@
"version": "4.2.11", "version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/graphemer": { "node_modules/graphemer": {
@@ -10552,6 +10793,12 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/ip": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz",
"integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==",
"license": "MIT"
},
"node_modules/ip-address": { "node_modules/ip-address": {
"version": "10.0.1", "version": "10.0.1",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.0.1.tgz", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.0.1.tgz",
@@ -12560,6 +12807,15 @@
"smart-buffer": "^4.1.0" "smart-buffer": "^4.1.0"
} }
}, },
"node_modules/netmask": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz",
"integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==",
"license": "MIT",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/node-addon-api": { "node_modules/node-addon-api": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
@@ -13138,6 +13394,93 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/pac-proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-5.0.0.tgz",
"integrity": "sha512-CcFG3ZtnxO8McDigozwE3AqAw15zDvGH+OjXO4kzf7IkEKkQ4gxQ+3sdF50WmhQ4P/bVusXcqNE2S3XrNURwzQ==",
"license": "MIT",
"dependencies": {
"@tootallnate/once": "1",
"agent-base": "6",
"debug": "4",
"get-uri": "3",
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "5",
"pac-resolver": "^5.0.0",
"raw-body": "^2.2.0",
"socks-proxy-agent": "5"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/pac-proxy-agent/node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"license": "MIT",
"dependencies": {
"debug": "4"
},
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/pac-proxy-agent/node_modules/http-proxy-agent": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",
"integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",
"license": "MIT",
"dependencies": {
"@tootallnate/once": "1",
"agent-base": "6",
"debug": "4"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/pac-proxy-agent/node_modules/https-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
"license": "MIT",
"dependencies": {
"agent-base": "6",
"debug": "4"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/pac-proxy-agent/node_modules/socks-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz",
"integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==",
"license": "MIT",
"dependencies": {
"agent-base": "^6.0.2",
"debug": "4",
"socks": "^2.3.3"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/pac-resolver": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-5.0.1.tgz",
"integrity": "sha512-cy7u00ko2KVgBAjuhevqpPeHIkCIqPe1v24cydhWjmeuzaBfmUWFCZJ1iAh5TuVzVZoUzXIW7K8sMYOZ84uZ9Q==",
"license": "MIT",
"dependencies": {
"degenerator": "^3.0.2",
"ip": "^1.1.5",
"netmask": "^2.0.2"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/package-json-from-dist": { "node_modules/package-json-from-dist": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
@@ -13909,6 +14252,93 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-5.0.0.tgz",
"integrity": "sha512-gkH7BkvLVkSfX9Dk27W6TyNOWWZWRilRfk1XxGNWOYJ2TuedAv1yFpCaU9QSBmBe716XOTNpYNOzhysyw8xn7g==",
"license": "MIT",
"dependencies": {
"agent-base": "^6.0.0",
"debug": "4",
"http-proxy-agent": "^4.0.0",
"https-proxy-agent": "^5.0.0",
"lru-cache": "^5.1.1",
"pac-proxy-agent": "^5.0.0",
"proxy-from-env": "^1.0.0",
"socks-proxy-agent": "^5.0.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/proxy-agent/node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"license": "MIT",
"dependencies": {
"debug": "4"
},
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/proxy-agent/node_modules/http-proxy-agent": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",
"integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",
"license": "MIT",
"dependencies": {
"@tootallnate/once": "1",
"agent-base": "6",
"debug": "4"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/proxy-agent/node_modules/https-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
"license": "MIT",
"dependencies": {
"agent-base": "6",
"debug": "4"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/proxy-agent/node_modules/lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
"integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
"license": "ISC",
"dependencies": {
"yallist": "^3.0.2"
}
},
"node_modules/proxy-agent/node_modules/socks-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-5.0.1.tgz",
"integrity": "sha512-vZdmnjb9a2Tz6WEQVIurybSwElwPxMZaIc7PzqbJTrezcKNznv6giT7J7tZDZ1BojVaa1jvO/UiUdhDVB0ACoQ==",
"license": "MIT",
"dependencies": {
"agent-base": "^6.0.2",
"debug": "4",
"socks": "^2.3.3"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/proxy-agent/node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"license": "ISC"
},
"node_modules/proxy-from-env": { "node_modules/proxy-from-env": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
@@ -17305,6 +17735,23 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0" "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
} }
}, },
"node_modules/vm2": {
"version": "3.9.19",
"resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.19.tgz",
"integrity": "sha512-J637XF0DHDMV57R6JyVsTak7nIL8gy5KH4r1HiwWLf/4GBbb5MKL5y7LpmF4A8E2nR6XmzpmMFQ7V7ppPTmUQg==",
"deprecated": "The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.",
"license": "MIT",
"dependencies": {
"acorn": "^8.7.0",
"acorn-walk": "^8.2.0"
},
"bin": {
"vm2": "bin/vm2"
},
"engines": {
"node": ">=6.0"
}
},
"node_modules/vue": { "node_modules/vue": {
"version": "3.4.38", "version": "3.4.38",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.38.tgz", "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.38.tgz",
@@ -17749,7 +18196,6 @@
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
"integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -17923,6 +18369,15 @@
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/xregexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz",
"integrity": "sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA==",
"license": "MIT",
"engines": {
"node": "*"
}
},
"node_modules/xtend": { "node_modules/xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

View File

@@ -132,6 +132,7 @@
"prometheus-api-metrics": "~3.2.1", "prometheus-api-metrics": "~3.2.1",
"promisify-child-process": "~4.1.2", "promisify-child-process": "~4.1.2",
"protobufjs": "~7.2.4", "protobufjs": "~7.2.4",
"proxy-agent": "^5.0.0",
"qs": "~6.10.4", "qs": "~6.10.4",
"redbean-node": "~0.3.0", "redbean-node": "~0.3.0",
"redis": "~4.5.1", "redis": "~4.5.1",

View File

@@ -17,12 +17,14 @@ class Elks extends NotificationProvider {
data.append("to", notification.elksToNumber ); data.append("to", notification.elksToNumber );
data.append("message", msg); data.append("message", msg);
const config = { let config = {
headers: { headers: {
"Authorization": "Basic " + Buffer.from(`${notification.elksUsername}:${notification.elksAuthToken}`).toString("base64") "Authorization": "Basic " + Buffer.from(`${notification.elksUsername}:${notification.elksAuthToken}`).toString("base64")
} }
}; };
config = this.getAxiosConfigWithProxy(config);
await axios.post(url, data, config); await axios.post(url, data, config);
return okMsg; return okMsg;

View File

@@ -30,6 +30,8 @@ class Alerta extends NotificationProvider {
type: "exceptionAlert", type: "exceptionAlert",
}; };
config = this.getAxiosConfigWithProxy(config);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let postData = Object.assign({ let postData = Object.assign({
event: "msg", event: "msg",

View File

@@ -41,7 +41,9 @@ class AlertNow extends NotificationProvider {
"event_id": eventId, "event_id": eventId,
}; };
await axios.post(notification.alertNowWebhookURL, data); let config = this.getAxiosConfigWithProxy({});
await axios.post(notification.alertNowWebhookURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -72,6 +72,8 @@ class AliyunSMS extends NotificationProvider {
data: qs.stringify(params), data: qs.stringify(params),
}; };
config = this.getAxiosConfigWithProxy(config);
let result = await axios(config); let result = await axios(config);
if (result.data.Message === "OK") { if (result.data.Message === "OK") {
return true; return true;

View File

@@ -96,12 +96,13 @@ class Bark extends NotificationProvider {
*/ */
async postNotification(notification, title, subtitle, endpoint) { async postNotification(notification, title, subtitle, endpoint) {
let result; let result;
let config = this.getAxiosConfigWithProxy({});
if (notification.apiVersion === "v1" || notification.apiVersion == null) { if (notification.apiVersion === "v1" || notification.apiVersion == null) {
// url encode title and subtitle // url encode title and subtitle
title = encodeURIComponent(title); title = encodeURIComponent(title);
subtitle = encodeURIComponent(subtitle); subtitle = encodeURIComponent(subtitle);
const params = this.additionalParameters(notification); const params = this.additionalParameters(notification);
result = await axios.get(`${endpoint}/${title}/${subtitle}${params}`); result = await axios.get(`${endpoint}/${title}/${subtitle}${params}`, config);
} else { } else {
result = await axios.post(`${endpoint}/push`, { result = await axios.post(`${endpoint}/push`, {
title, title,
@@ -109,7 +110,7 @@ class Bark extends NotificationProvider {
icon: barkNotificationAvatar, icon: barkNotificationAvatar,
sound: notification.barkSound || "telegraph", // default sound is telegraph sound: notification.barkSound || "telegraph", // default sound is telegraph
group: notification.barkGroup || "UptimeKuma", // default group is UptimeKuma group: notification.barkGroup || "UptimeKuma", // default group is UptimeKuma
}); }, config);
} }
this.checkResult(result); this.checkResult(result);
if (result.statusText != null) { if (result.statusText != null) {

View File

@@ -19,7 +19,8 @@ class Bitrix24 extends NotificationProvider {
"ATTACH[BLOCKS][0][MESSAGE]": msg "ATTACH[BLOCKS][0][MESSAGE]": msg
}; };
await axios.get(`${notification.bitrix24WebhookURL}/im.notify.system.add.json`, { params }); let config = this.getAxiosConfigWithProxy({ params });
await axios.get(`${notification.bitrix24WebhookURL}/im.notify.system.add.json`, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -18,6 +18,7 @@ class Brevo extends NotificationProvider {
"api-key": notification.brevoApiKey, "api-key": notification.brevoApiKey,
}, },
}; };
config = this.getAxiosConfigWithProxy(config);
let to = [{ email: notification.brevoToEmail }]; let to = [{ email: notification.brevoToEmail }];

View File

@@ -12,7 +12,8 @@ class CallMeBot extends NotificationProvider {
try { try {
const url = new URL(notification.callMeBotEndpoint); const url = new URL(notification.callMeBotEndpoint);
url.searchParams.set("text", msg); url.searchParams.set("text", msg);
await axios.get(url.toString()); let config = this.getAxiosConfigWithProxy({});
await axios.get(url.toString(), config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -22,7 +22,8 @@ class Cellsynt extends NotificationProvider {
} }
}; };
try { try {
const resp = await axios.post("https://se-1.cellsynt.net/sms.php", null, data); let config = this.getAxiosConfigWithProxy(data);
const resp = await axios.post("https://se-1.cellsynt.net/sms.php", null, config);
if (resp.data == null ) { if (resp.data == null ) {
throw new Error("Could not connect to Cellsynt, please try again."); throw new Error("Could not connect to Cellsynt, please try again.");
} else if (resp.data.includes("Error:")) { } else if (resp.data.includes("Error:")) {

View File

@@ -29,6 +29,7 @@ class ClickSendSMS extends NotificationProvider {
} }
] ]
}; };
config = this.getAxiosConfigWithProxy(config);
let resp = await axios.post(url, data, config); let resp = await axios.post(url, data, config);
if (resp.data.data.messages[0].status !== "SUCCESS") { if (resp.data.data.messages[0].status !== "SUCCESS") {
let error = "Something gone wrong. Api returned " + resp.data.data.messages[0].status + "."; let error = "Something gone wrong. Api returned " + resp.data.data.messages[0].status + ".";

View File

@@ -60,6 +60,7 @@ class DingDing extends NotificationProvider {
url: `${notification.webHookUrl}&timestamp=${timestamp}&sign=${encodeURIComponent(this.sign(timestamp, notification.secretKey))}`, url: `${notification.webHookUrl}&timestamp=${timestamp}&sign=${encodeURIComponent(this.sign(timestamp, notification.secretKey))}`,
data: JSON.stringify(params), data: JSON.stringify(params),
}; };
config = this.getAxiosConfigWithProxy(config);
let result = await axios(config); let result = await axios(config);
if (result.data.errmsg === "ok") { if (result.data.errmsg === "ok") {

View File

@@ -12,6 +12,7 @@ class Discord extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
const discordDisplayName = notification.discordUsername || "Uptime Kuma"; const discordDisplayName = notification.discordUsername || "Uptime Kuma";
const webhookUrl = new URL(notification.discordWebhookUrl); const webhookUrl = new URL(notification.discordWebhookUrl);
if (notification.discordChannelType === "postToThread") { if (notification.discordChannelType === "postToThread") {
@@ -21,7 +22,7 @@ class Discord extends NotificationProvider {
// Check if the webhook has an avatar // Check if the webhook has an avatar
let webhookHasAvatar = true; let webhookHasAvatar = true;
try { try {
const webhookInfo = await axios.get(webhookUrl.toString()); const webhookInfo = await axios.get(webhookUrl.toString(), config);
webhookHasAvatar = !!webhookInfo.data.avatar; webhookHasAvatar = !!webhookInfo.data.avatar;
} catch (e) { } catch (e) {
// If we can't verify, we assume he has an avatar to avoid forcing the default avatar // If we can't verify, we assume he has an avatar to avoid forcing the default avatar
@@ -40,7 +41,7 @@ class Discord extends NotificationProvider {
if (notification.discordChannelType === "createNewForumPost") { if (notification.discordChannelType === "createNewForumPost") {
discordtestdata.thread_name = notification.postName; discordtestdata.thread_name = notification.postName;
} }
await axios.post(webhookUrl.toString(), discordtestdata); await axios.post(webhookUrl.toString(), discordtestdata, config);
return okMsg; return okMsg;
} }
@@ -82,7 +83,7 @@ class Discord extends NotificationProvider {
discorddowndata.content = notification.discordPrefixMessage; discorddowndata.content = notification.discordPrefixMessage;
} }
await axios.post(webhookUrl.toString(), discorddowndata); await axios.post(webhookUrl.toString(), discorddowndata, config);
return okMsg; return okMsg;
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
@@ -124,7 +125,7 @@ class Discord extends NotificationProvider {
discordupdata.content = notification.discordPrefixMessage; discordupdata.content = notification.discordPrefixMessage;
} }
await axios.post(webhookUrl.toString(), discordupdata); await axios.post(webhookUrl.toString(), discordupdata, config);
return okMsg; return okMsg;
} }
} catch (error) { } catch (error) {

View File

@@ -11,13 +11,14 @@ class Evolution extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
const config = { let config = {
headers: { headers: {
"Accept": "application/json", "Accept": "application/json",
"Content-Type": "application/json", "Content-Type": "application/json",
"apikey": notification.evolutionAuthToken, "apikey": notification.evolutionAuthToken,
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = { let data = {
"number": notification.evolutionRecipient, "number": notification.evolutionRecipient,

View File

@@ -12,6 +12,7 @@ class Feishu extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let testdata = { let testdata = {
msg_type: "text", msg_type: "text",
@@ -19,7 +20,7 @@ class Feishu extends NotificationProvider {
text: msg, text: msg,
}, },
}; };
await axios.post(notification.feishuWebHookUrl, testdata); await axios.post(notification.feishuWebHookUrl, testdata, config);
return okMsg; return okMsg;
} }
@@ -49,7 +50,7 @@ class Feishu extends NotificationProvider {
] ]
} }
}; };
await axios.post(notification.feishuWebHookUrl, downdata); await axios.post(notification.feishuWebHookUrl, downdata, config);
return okMsg; return okMsg;
} }
@@ -79,7 +80,7 @@ class Feishu extends NotificationProvider {
] ]
} }
}; };
await axios.post(notification.feishuWebHookUrl, updata); await axios.post(notification.feishuWebHookUrl, updata, config);
return okMsg; return okMsg;
} }
} catch (error) { } catch (error) {

View File

@@ -11,10 +11,11 @@ class FreeMobile extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
await axios.post(`https://smsapi.free-mobile.fr/sendmsg?msg=${encodeURIComponent(msg.replace("🔴", "⛔️"))}`, { await axios.post(`https://smsapi.free-mobile.fr/sendmsg?msg=${encodeURIComponent(msg.replace("🔴", "⛔️"))}`, {
"user": notification.freemobileUser, "user": notification.freemobileUser,
"pass": notification.freemobilePass, "pass": notification.freemobilePass,
}); }, config);
return okMsg; return okMsg;

View File

@@ -24,6 +24,7 @@ class GoAlert extends NotificationProvider {
let config = { let config = {
headers: headers headers: headers
}; };
config = this.getAxiosConfigWithProxy(config);
await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config); await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -13,6 +13,7 @@ class GoogleChat extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
// Google Chat message formatting: https://developers.google.com/chat/api/guides/message-formats/basic // Google Chat message formatting: https://developers.google.com/chat/api/guides/message-formats/basic
if (notification.googleChatUseTemplate && notification.googleChatTemplate) { if (notification.googleChatUseTemplate && notification.googleChatTemplate) {
// Send message using template // Send message using template
@@ -23,7 +24,7 @@ class GoogleChat extends NotificationProvider {
heartbeatJSON heartbeatJSON
); );
const data = { "text": renderedText }; const data = { "text": renderedText };
await axios.post(notification.googleChatWebhookURL, data); await axios.post(notification.googleChatWebhookURL, data, config);
return okMsg; return okMsg;
} }
@@ -95,7 +96,7 @@ class GoogleChat extends NotificationProvider {
], ],
}; };
await axios.post(notification.googleChatWebhookURL, data); await axios.post(notification.googleChatWebhookURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -31,8 +31,7 @@ class Gorush extends NotificationProvider {
} }
] ]
}; };
let config = {}; let config = this.getAxiosConfigWithProxy({});
await axios.post(`${notification.gorushServerURL}/api/push`, data, config); await axios.post(`${notification.gorushServerURL}/api/push`, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -11,6 +11,7 @@ class Gotify extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
if (notification.gotifyserverurl && notification.gotifyserverurl.endsWith("/")) { if (notification.gotifyserverurl && notification.gotifyserverurl.endsWith("/")) {
notification.gotifyserverurl = notification.gotifyserverurl.slice(0, -1); notification.gotifyserverurl = notification.gotifyserverurl.slice(0, -1);
} }
@@ -18,7 +19,7 @@ class Gotify extends NotificationProvider {
"message": msg, "message": msg,
"priority": notification.gotifyPriority || 8, "priority": notification.gotifyPriority || 8,
"title": "Uptime-Kuma", "title": "Uptime-Kuma",
}); }, config);
return okMsg; return okMsg;

View File

@@ -16,13 +16,14 @@ class GrafanaOncall extends NotificationProvider {
} }
try { try {
let config = this.getAxiosConfigWithProxy({});
if (heartbeatJSON === null) { if (heartbeatJSON === null) {
let grafanaupdata = { let grafanaupdata = {
title: "General notification", title: "General notification",
message: msg, message: msg,
state: "alerting", state: "alerting",
}; };
await axios.post(notification.GrafanaOncallURL, grafanaupdata); await axios.post(notification.GrafanaOncallURL, grafanaupdata, config);
return okMsg; return okMsg;
} else if (heartbeatJSON["status"] === DOWN) { } else if (heartbeatJSON["status"] === DOWN) {
let grafanadowndata = { let grafanadowndata = {
@@ -30,7 +31,7 @@ class GrafanaOncall extends NotificationProvider {
message: heartbeatJSON["msg"], message: heartbeatJSON["msg"],
state: "alerting", state: "alerting",
}; };
await axios.post(notification.GrafanaOncallURL, grafanadowndata); await axios.post(notification.GrafanaOncallURL, grafanadowndata, config);
return okMsg; return okMsg;
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
let grafanaupdata = { let grafanaupdata = {
@@ -38,7 +39,7 @@ class GrafanaOncall extends NotificationProvider {
message: heartbeatJSON["msg"], message: heartbeatJSON["msg"],
state: "ok", state: "ok",
}; };
await axios.post(notification.GrafanaOncallURL, grafanaupdata); await axios.post(notification.GrafanaOncallURL, grafanaupdata, config);
return okMsg; return okMsg;
} }
} catch (error) { } catch (error) {

View File

@@ -14,6 +14,7 @@ class GtxMessaging extends NotificationProvider {
const text = msg.replaceAll("🔴 ", "").replaceAll("✅ ", ""); const text = msg.replaceAll("🔴 ", "").replaceAll("✅ ", "");
try { try {
let config = this.getAxiosConfigWithProxy({});
const data = new URLSearchParams(); const data = new URLSearchParams();
data.append("from", notification.gtxMessagingFrom.trim()); data.append("from", notification.gtxMessagingFrom.trim());
data.append("to", notification.gtxMessagingTo.trim()); data.append("to", notification.gtxMessagingTo.trim());
@@ -21,7 +22,7 @@ class GtxMessaging extends NotificationProvider {
const url = `https://rest.gtx-messaging.net/smsc/sendsms/${notification.gtxMessagingApiKey}/json`; const url = `https://rest.gtx-messaging.net/smsc/sendsms/${notification.gtxMessagingApiKey}/json`;
await axios.post(url, data); await axios.post(url, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -18,7 +18,7 @@ class HeiiOnCall extends NotificationProvider {
payload["url"] = baseURL + getMonitorRelativeURL(monitorJSON.id); payload["url"] = baseURL + getMonitorRelativeURL(monitorJSON.id);
} }
const config = { let config = {
headers: { headers: {
Accept: "application/json", Accept: "application/json",
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -28,6 +28,7 @@ class HeiiOnCall extends NotificationProvider {
const heiiUrl = `https://heiioncall.com/triggers/${notification.heiiOnCallTriggerId}/`; const heiiUrl = `https://heiioncall.com/triggers/${notification.heiiOnCallTriggerId}/`;
// docs https://heiioncall.com/docs#manual-triggers // docs https://heiioncall.com/docs#manual-triggers
try { try {
config = this.getAxiosConfigWithProxy(config);
if (!heartbeatJSON) { if (!heartbeatJSON) {
// Testing or general notification like certificate expiry // Testing or general notification like certificate expiry
payload["msg"] = msg; payload["msg"] = msg;

View File

@@ -15,6 +15,13 @@ class HomeAssistant extends NotificationProvider {
const notificationService = notification?.notificationService || defaultNotificationService; const notificationService = notification?.notificationService || defaultNotificationService;
try { try {
let config = {
headers: {
Authorization: `Bearer ${notification.longLivedAccessToken}`,
"Content-Type": "application/json",
},
};
config = this.getAxiosConfigWithProxy(config);
await axios.post( await axios.post(
`${notification.homeAssistantUrl.trim().replace(/\/*$/, "")}/api/services/notify/${notificationService}`, `${notification.homeAssistantUrl.trim().replace(/\/*$/, "")}/api/services/notify/${notificationService}`,
{ {
@@ -26,14 +33,7 @@ class HomeAssistant extends NotificationProvider {
channel: "Uptime Kuma", channel: "Uptime Kuma",
icon_url: "https://github.com/louislam/uptime-kuma/blob/master/public/icon.png?raw=true", icon_url: "https://github.com/louislam/uptime-kuma/blob/master/public/icon.png?raw=true",
} }), } }),
}, }, config);
{
headers: {
Authorization: `Bearer ${notification.longLivedAccessToken}`,
"Content-Type": "application/json",
},
}
);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -31,6 +31,8 @@ class Keep extends NotificationProvider {
let webhookURL = url + "/alerts/event/uptimekuma"; let webhookURL = url + "/alerts/event/uptimekuma";
config = this.getAxiosConfigWithProxy(config);
await axios.post(webhookURL, data, config); await axios.post(webhookURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -22,6 +22,7 @@ class Kook extends NotificationProvider {
}, },
}; };
try { try {
config = this.getAxiosConfigWithProxy(config);
await axios.post(url, data, config); await axios.post(url, data, config);
return okMsg; return okMsg;

View File

@@ -19,6 +19,7 @@ class Line extends NotificationProvider {
"Authorization": "Bearer " + notification.lineChannelAccessToken "Authorization": "Bearer " + notification.lineChannelAccessToken
} }
}; };
config = this.getAxiosConfigWithProxy(config);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let testMessage = { let testMessage = {
"to": notification.lineUserID, "to": notification.lineUserID,

View File

@@ -20,6 +20,7 @@ class LineNotify extends NotificationProvider {
"Authorization": "Bearer " + notification.lineNotifyAccessToken "Authorization": "Bearer " + notification.lineNotifyAccessToken
} }
}; };
config = this.getAxiosConfigWithProxy(config);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let testMessage = { let testMessage = {
"message": msg, "message": msg,

View File

@@ -13,13 +13,14 @@ class LunaSea extends NotificationProvider {
const url = "https://notify.lunasea.app/v1"; const url = "https://notify.lunasea.app/v1";
try { try {
let config = this.getAxiosConfigWithProxy({});
const target = this.getTarget(notification); const target = this.getTarget(notification);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let testdata = { let testdata = {
"title": "Uptime Kuma Alert", "title": "Uptime Kuma Alert",
"body": msg, "body": msg,
}; };
await axios.post(`${url}/custom/${target}`, testdata); await axios.post(`${url}/custom/${target}`, testdata, config);
return okMsg; return okMsg;
} }
@@ -30,7 +31,7 @@ class LunaSea extends NotificationProvider {
heartbeatJSON["msg"] + heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}; };
await axios.post(`${url}/custom/${target}`, downdata); await axios.post(`${url}/custom/${target}`, downdata, config);
return okMsg; return okMsg;
} }
@@ -41,7 +42,7 @@ class LunaSea extends NotificationProvider {
heartbeatJSON["msg"] + heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}; };
await axios.post(`${url}/custom/${target}`, updata); await axios.post(`${url}/custom/${target}`, updata, config);
return okMsg; return okMsg;
} }

View File

@@ -37,6 +37,7 @@ class Matrix extends NotificationProvider {
"body": msg "body": msg
}; };
config = this.getAxiosConfigWithProxy(config);
await axios.put(`${notification.homeserverUrl}/_matrix/client/r0/rooms/${roomId}/send/m.room.message/${randomString}`, data, config); await axios.put(`${notification.homeserverUrl}/_matrix/client/r0/rooms/${roomId}/send/m.room.message/${randomString}`, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -12,6 +12,7 @@ class Mattermost extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
const mattermostUserName = notification.mattermostusername || "Uptime Kuma"; const mattermostUserName = notification.mattermostusername || "Uptime Kuma";
// If heartbeatJSON is null, assume non monitoring notification (Certificate warning) or testing. // If heartbeatJSON is null, assume non monitoring notification (Certificate warning) or testing.
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
@@ -19,7 +20,7 @@ class Mattermost extends NotificationProvider {
username: mattermostUserName, username: mattermostUserName,
text: msg, text: msg,
}; };
await axios.post(notification.mattermostWebhookUrl, mattermostTestData); await axios.post(notification.mattermostWebhookUrl, mattermostTestData, config);
return okMsg; return okMsg;
} }
@@ -98,7 +99,7 @@ class Mattermost extends NotificationProvider {
}, },
], ],
}; };
await axios.post(notification.mattermostWebhookUrl, mattermostdata); await axios.post(notification.mattermostWebhookUrl, mattermostdata, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -42,7 +42,8 @@ class Notifery extends NotificationProvider {
"x-api-key": notification.notiferyApiKey, "x-api-key": notification.notiferyApiKey,
}; };
await axios.post(url, data, { headers }); let config = this.getAxiosConfigWithProxy({ headers });
await axios.post(url, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -1,5 +1,6 @@
const { Liquid } = require("liquidjs"); const { Liquid } = require("liquidjs");
const { DOWN } = require("../../src/util"); const { DOWN } = require("../../src/util");
const ProxyAgent = require("proxy-agent");
class NotificationProvider { class NotificationProvider {
@@ -115,6 +116,22 @@ class NotificationProvider {
throw new Error(msg); throw new Error(msg);
} }
/**
* Returns axios config with proxy agent if proxy env is set.
* @param {object} axiosConfig - Axios config containing params
* @returns {object} Axios config
*/
getAxiosConfigWithProxy(axiosConfig = {}) {
const proxyEnv = process.env.notification_proxy || process.env.NOTIFICATION_PROXY;
if (proxyEnv) {
const agent = new ProxyAgent(proxyEnv);
axiosConfig.httpsAgent = agent;
axiosConfig.httpAgent = agent;
axiosConfig.proxy = false;
}
return axiosConfig;
}
} }
module.exports = NotificationProvider; module.exports = NotificationProvider;

View File

@@ -22,6 +22,8 @@ class Ntfy extends NotificationProvider {
"Authorization": "Bearer " + notification.ntfyaccesstoken, "Authorization": "Bearer " + notification.ntfyaccesstoken,
}; };
} }
let config = { headers };
config = this.getAxiosConfigWithProxy(config);
// If heartbeatJSON is null, assume non monitoring notification (Certificate warning) or testing. // If heartbeatJSON is null, assume non monitoring notification (Certificate warning) or testing.
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let ntfyTestData = { let ntfyTestData = {
@@ -31,7 +33,7 @@ class Ntfy extends NotificationProvider {
"priority": notification.ntfyPriority, "priority": notification.ntfyPriority,
"tags": [ "test_tube" ], "tags": [ "test_tube" ],
}; };
await axios.post(notification.ntfyserverurl, ntfyTestData, { headers: headers }); await axios.post(notification.ntfyserverurl, ntfyTestData, config);
return okMsg; return okMsg;
} }
let tags = []; let tags = [];
@@ -70,7 +72,7 @@ class Ntfy extends NotificationProvider {
data.icon = notification.ntfyIcon; data.icon = notification.ntfyIcon;
} }
await axios.post(notification.ntfyserverurl, data, { headers: headers }); await axios.post(notification.ntfyserverurl, data, config);
return okMsg; return okMsg;

View File

@@ -22,6 +22,7 @@ class Octopush extends NotificationProvider {
"cache-control": "no-cache" "cache-control": "no-cache"
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = { let data = {
"recipients": [ "recipients": [
{ {
@@ -53,6 +54,7 @@ class Octopush extends NotificationProvider {
}, },
params: data params: data
}; };
config = this.getAxiosConfigWithProxy(config);
// V1 API returns 200 even on error so we must check // V1 API returns 200 even on error so we must check
// response data // response data

View File

@@ -25,6 +25,7 @@ class OneBot extends NotificationProvider {
"Authorization": "Bearer " + notification.accessToken, "Authorization": "Bearer " + notification.accessToken,
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let pushText = "UptimeKuma Alert: " + msg; let pushText = "UptimeKuma Alert: " + msg;
let data = { let data = {
"auto_escape": true, "auto_escape": true,

View File

@@ -13,12 +13,13 @@ class OneChat extends NotificationProvider {
const url = "https://chat-api.one.th/message/api/v1/push_message"; const url = "https://chat-api.one.th/message/api/v1/push_message";
try { try {
const config = { let config = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: "Bearer " + notification.accessToken, Authorization: "Bearer " + notification.accessToken,
}, },
}; };
config = this.getAxiosConfigWithProxy(config);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
const testMessage = { const testMessage = {
to: notification.recieverId, to: notification.recieverId,

View File

@@ -33,6 +33,7 @@ class Onesender extends NotificationProvider {
"Authorization": "Bearer " + notification.onesenderToken, "Authorization": "Bearer " + notification.onesenderToken,
} }
}; };
config = this.getAxiosConfigWithProxy(config);
await axios.post(notification.onesenderURL, data, config); await axios.post(notification.onesenderURL, data, config);
return okMsg; return okMsg;

View File

@@ -80,6 +80,7 @@ class Opsgenie extends NotificationProvider {
"Authorization": `GenieKey ${notification.opsgenieApiKey}`, "Authorization": `GenieKey ${notification.opsgenieApiKey}`,
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let res = await axios.post(url, data, config); let res = await axios.post(url, data, config);
if (res.status == null) { if (res.status == null) {

View File

@@ -27,6 +27,7 @@ class PromoSMS extends NotificationProvider {
"Accept": "text/json", "Accept": "text/json",
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = { let data = {
"recipients": [ notification.promosmsPhoneNumber ], "recipients": [ notification.promosmsPhoneNumber ],
//Trim message to maximum length of 1 SMS or 4 if we allowed long messages //Trim message to maximum length of 1 SMS or 4 if we allowed long messages

View File

@@ -12,6 +12,7 @@ class Pumble extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
if (heartbeatJSON === null && monitorJSON === null) { if (heartbeatJSON === null && monitorJSON === null) {
let data = { let data = {
"attachments": [ "attachments": [
@@ -23,7 +24,7 @@ class Pumble extends NotificationProvider {
] ]
}; };
await axios.post(notification.webhookURL, data); await axios.post(notification.webhookURL, data, config);
return okMsg; return okMsg;
} }
@@ -37,7 +38,7 @@ class Pumble extends NotificationProvider {
] ]
}; };
await axios.post(notification.webhookURL, data); await axios.post(notification.webhookURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -20,6 +20,7 @@ class Pushbullet extends NotificationProvider {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}; };
config = this.getAxiosConfigWithProxy(config);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let data = { let data = {
"type": "note", "type": "note",

View File

@@ -33,7 +33,8 @@ class PushDeer extends NotificationProvider {
}; };
try { try {
let res = await axios.post(url, data); let config = this.getAxiosConfigWithProxy({});
let res = await axios.post(url, data, config);
if ("error" in res.data) { if ("error" in res.data) {
let error = res.data.error; let error = res.data.error;

View File

@@ -41,8 +41,9 @@ class Pushover extends NotificationProvider {
} }
try { try {
let config = this.getAxiosConfigWithProxy({});
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
await axios.post(url, data); await axios.post(url, data, config);
return okMsg; return okMsg;
} }
@@ -52,7 +53,7 @@ class Pushover extends NotificationProvider {
} }
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>: ${heartbeatJSON["localDateTime"]}`; data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>: ${heartbeatJSON["localDateTime"]}`;
await axios.post(url, data); await axios.post(url, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -17,11 +17,12 @@ class PushPlus extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://www.pushplus.plus/send"; const url = "https://www.pushplus.plus/send";
try { try {
const config = { let config = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
}; };
config = this.getAxiosConfigWithProxy(config);
const params = { const params = {
"token": notification.pushPlusSendKey, "token": notification.pushPlusSendKey,
"title": this.checkStatus(heartbeatJSON, monitorJSON), "title": this.checkStatus(heartbeatJSON, monitorJSON),

View File

@@ -11,6 +11,7 @@ class Pushy extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
await axios.post(`https://api.pushy.me/push?api_key=${notification.pushyAPIKey}`, { await axios.post(`https://api.pushy.me/push?api_key=${notification.pushyAPIKey}`, {
"to": notification.pushyToken, "to": notification.pushyToken,
"data": { "data": {
@@ -21,7 +22,7 @@ class Pushy extends NotificationProvider {
"badge": 1, "badge": 1,
"sound": "ping.aiff" "sound": "ping.aiff"
} }
}); }, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -14,6 +14,7 @@ class RocketChat extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = this.getAxiosConfigWithProxy({});
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let data = { let data = {
"text": msg, "text": msg,
@@ -21,7 +22,7 @@ class RocketChat extends NotificationProvider {
"username": notification.rocketusername, "username": notification.rocketusername,
"icon_emoji": notification.rocketiconemo, "icon_emoji": notification.rocketiconemo,
}; };
await axios.post(notification.rocketwebhookURL, data); await axios.post(notification.rocketwebhookURL, data, config);
return okMsg; return okMsg;
} }
@@ -55,7 +56,7 @@ class RocketChat extends NotificationProvider {
data.attachments[0].title_link = baseURL + getMonitorRelativeURL(monitorJSON.id); data.attachments[0].title_link = baseURL + getMonitorRelativeURL(monitorJSON.id);
} }
await axios.post(notification.rocketwebhookURL, data); await axios.post(notification.rocketwebhookURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -17,7 +17,7 @@ class SendGrid extends NotificationProvider {
Authorization: `Bearer ${notification.sendgridApiKey}`, Authorization: `Bearer ${notification.sendgridApiKey}`,
}, },
}; };
config = this.getAxiosConfigWithProxy(config);
let personalizations = { let personalizations = {
to: [{ email: notification.sendgridToEmail }], to: [{ email: notification.sendgridToEmail }],
}; };

View File

@@ -18,10 +18,11 @@ class ServerChan extends NotificationProvider {
: `https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`; : `https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`;
try { try {
let config = this.getAxiosConfigWithProxy({});
await axios.post(url, { await axios.post(url, {
"title": this.checkStatus(heartbeatJSON, monitorJSON), "title": this.checkStatus(heartbeatJSON, monitorJSON),
"desp": msg, "desp": msg,
}); }, config);
return okMsg; return okMsg;

View File

@@ -17,6 +17,7 @@ class SerwerSMS extends NotificationProvider {
"Content-Type": "application/json", "Content-Type": "application/json",
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = { let data = {
"username": notification.serwersmsUsername, "username": notification.serwersmsUsername,
"password": notification.serwersmsPassword, "password": notification.serwersmsPassword,

View File

@@ -17,7 +17,7 @@ class SevenIO extends NotificationProvider {
text: msg, text: msg,
}; };
const config = { let config = {
baseURL: "https://gateway.seven.io/api/", baseURL: "https://gateway.seven.io/api/",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -26,6 +26,7 @@ class SevenIO extends NotificationProvider {
}; };
try { try {
config = this.getAxiosConfigWithProxy(config);
// testing or certificate expiry notification // testing or certificate expiry notification
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
await axios.post("sms", data, config); await axios.post("sms", data, config);

View File

@@ -17,7 +17,7 @@ class Signal extends NotificationProvider {
"recipients": notification.signalRecipients.replace(/\s/g, "").split(","), "recipients": notification.signalRecipients.replace(/\s/g, "").split(","),
}; };
let config = {}; let config = {};
config = this.getAxiosConfigWithProxy(config);
await axios.post(notification.signalURL, data, config); await axios.post(notification.signalURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -21,11 +21,12 @@ class SIGNL4 extends NotificationProvider {
monitorUrl: this.extractAddress(monitorJSON), monitorUrl: this.extractAddress(monitorJSON),
}; };
const config = { let config = {
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}; };
config = this.getAxiosConfigWithProxy(config);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
// Test alert // Test alert

View File

@@ -131,6 +131,7 @@ class Slack extends NotificationProvider {
} }
try { try {
let config = this.getAxiosConfigWithProxy({});
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let data = { let data = {
"text": msg, "text": msg,
@@ -138,7 +139,7 @@ class Slack extends NotificationProvider {
"username": notification.slackusername, "username": notification.slackusername,
"icon_emoji": notification.slackiconemo, "icon_emoji": notification.slackiconemo,
}; };
await axios.post(notification.slackwebhookURL, data); await axios.post(notification.slackwebhookURL, data, config);
return okMsg; return okMsg;
} }
@@ -168,7 +169,7 @@ class Slack extends NotificationProvider {
await Slack.deprecateURL(notification.slackbutton); await Slack.deprecateURL(notification.slackbutton);
} }
await axios.post(notification.slackwebhookURL, data); await axios.post(notification.slackwebhookURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -18,6 +18,7 @@ class SMSPlanet extends NotificationProvider {
"content-type": "multipart/form-data" "content-type": "multipart/form-data"
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = { let data = {
"from": notification.smsplanetSenderName, "from": notification.smsplanetSenderName,

View File

@@ -18,6 +18,7 @@ class SMSC extends NotificationProvider {
"Accept": "text/json", "Accept": "text/json",
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let getArray = [ let getArray = [
"fmt=3", "fmt=3",

View File

@@ -17,6 +17,7 @@ class SMSEagle extends NotificationProvider {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let sendMethod; let sendMethod;
let recipientType; let recipientType;
@@ -78,6 +79,7 @@ class SMSEagle extends NotificationProvider {
"Content-Type": "application/json", "Content-Type": "application/json",
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let encoding = (notification.smseagleEncoding) ? "unicode" : "standard"; let encoding = (notification.smseagleEncoding) ? "unicode" : "standard";
let priority = (notification.smseaglePriority) ?? 0; let priority = (notification.smseaglePriority) ?? 0;

View File

@@ -18,7 +18,8 @@ class SMSManager extends NotificationProvider {
number: notification.numbers, number: notification.numbers,
gateway: notification.messageType, gateway: notification.messageType,
}; };
await axios.get(`${url}?apikey=${data.apikey}&message=${data.message}&number=${data.number}&gateway=${data.messageType}`); let config = this.getAxiosConfigWithProxy({});
await axios.get(`${url}?apikey=${data.apikey}&message=${data.message}&number=${data.number}&gateway=${data.messageType}`, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -29,6 +29,7 @@ class SMSPartner extends NotificationProvider {
"Accept": "application/json", "Accept": "application/json",
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let resp = await axios.post(url, data, config); let resp = await axios.post(url, data, config);

View File

@@ -26,7 +26,8 @@ class SpugPush extends NotificationProvider {
} }
} }
const apiUrl = `https://push.spug.cc/send/${notification.templateKey}`; const apiUrl = `https://push.spug.cc/send/${notification.templateKey}`;
await axios.post(apiUrl, formData); let config = this.getAxiosConfigWithProxy({});
await axios.post(apiUrl, formData, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -45,6 +45,7 @@ class Squadcast extends NotificationProvider {
} }
}); });
} }
config = this.getAxiosConfigWithProxy(config);
await axios.post(notification.squadcastWebhookURL, data, config); await axios.post(notification.squadcastWebhookURL, data, config);
return okMsg; return okMsg;

View File

@@ -31,8 +31,9 @@ class Stackfield extends NotificationProvider {
const data = { const data = {
"Title": textMsg, "Title": textMsg,
}; };
let config = this.getAxiosConfigWithProxy({});
await axios.post(notification.stackfieldwebhookURL, data); await axios.post(notification.stackfieldwebhookURL, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -185,7 +185,8 @@ class Teams extends NotificationProvider {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
_sendNotification = async (webhookUrl, payload) => { _sendNotification = async (webhookUrl, payload) => {
await axios.post(webhookUrl, payload); let config = this.getAxiosConfigWithProxy({});
await axios.post(webhookUrl, payload, config);
}; };
/** /**

View File

@@ -25,7 +25,8 @@ class TechulusPush extends NotificationProvider {
} }
try { try {
await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, data); let config = this.getAxiosConfigWithProxy({});
await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

View File

@@ -30,9 +30,9 @@ class Telegram extends NotificationProvider {
} }
} }
await axios.get(`${url}/bot${notification.telegramBotToken}/sendMessage`, { let config = this.getAxiosConfigWithProxy({ params });
params: params,
}); await axios.get(`${url}/bot${notification.telegramBotToken}/sendMessage`, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

View File

@@ -10,12 +10,13 @@ class Threema extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const url = "https://msgapi.threema.ch/send_simple"; const url = "https://msgapi.threema.ch/send_simple";
const config = { let config = {
headers: { headers: {
"Accept": "*/*", "Accept": "*/*",
"Content-Type": "application/x-www-form-urlencoded; charset=utf-8" "Content-Type": "application/x-www-form-urlencoded; charset=utf-8"
} }
}; };
config = this.getAxiosConfigWithProxy(config);
const data = { const data = {
from: notification.threemaSenderIdentity, from: notification.threemaSenderIdentity,

View File

@@ -19,6 +19,7 @@ class Twilio extends NotificationProvider {
"Authorization": "Basic " + Buffer.from(apiKey + ":" + notification.twilioAuthToken).toString("base64"), "Authorization": "Basic " + Buffer.from(apiKey + ":" + notification.twilioAuthToken).toString("base64"),
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = new URLSearchParams(); let data = new URLSearchParams();
data.append("To", notification.twilioToNumber); data.append("To", notification.twilioToNumber);

View File

@@ -11,13 +11,14 @@ class WAHA extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
const config = { let config = {
headers: { headers: {
"Accept": "application/json", "Accept": "application/json",
"Content-Type": "application/json", "Content-Type": "application/json",
"X-Api-Key": notification.wahaApiKey, "X-Api-Key": notification.wahaApiKey,
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = { let data = {
"session": notification.wahaSession, "session": notification.wahaSession,

View File

@@ -41,6 +41,7 @@ class Webhook extends NotificationProvider {
} }
} }
config = this.getAxiosConfigWithProxy(config);
await axios.post(notification.webhookURL, data, config); await axios.post(notification.webhookURL, data, config);
return okMsg; return okMsg;

View File

@@ -17,6 +17,7 @@ class WeCom extends NotificationProvider {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let body = this.composeMessage(heartbeatJSON, msg); let body = this.composeMessage(heartbeatJSON, msg);
await axios.post(`https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${notification.weComBotKey}`, body, config); await axios.post(`https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${notification.weComBotKey}`, body, config);
return okMsg; return okMsg;

View File

@@ -11,13 +11,14 @@ class Whapi extends NotificationProvider {
const okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
const config = { let config = {
headers: { headers: {
"Accept": "application/json", "Accept": "application/json",
"Content-Type": "application/json", "Content-Type": "application/json",
"Authorization": "Bearer " + notification.whapiAuthToken, "Authorization": "Bearer " + notification.whapiAuthToken,
} }
}; };
config = this.getAxiosConfigWithProxy(config);
let data = { let data = {
"to": notification.whapiRecipient, "to": notification.whapiRecipient,

View File

@@ -18,7 +18,8 @@ class WPush extends NotificationProvider {
"apikey": notification.wpushAPIkey, "apikey": notification.wpushAPIkey,
"channel": notification.wpushChannel "channel": notification.wpushChannel
}; };
const result = await axios.post("https://api.wpush.cn/api/v1/send", context); let config = this.getAxiosConfigWithProxy({});
const result = await axios.post("https://api.wpush.cn/api/v1/send", context, config);
if (result.data.code !== 0) { if (result.data.code !== 0) {
throw result.data.message; throw result.data.message;
} }

View File

@@ -16,7 +16,7 @@ class YZJ extends NotificationProvider {
msg = `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`; msg = `${this.statusToString(heartbeatJSON["status"])} ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`;
} }
const config = { let config = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -26,6 +26,7 @@ class YZJ extends NotificationProvider {
}; };
// yzjtype=0 => general robot // yzjtype=0 => general robot
const url = `${notification.yzjWebHookUrl}?yzjtype=0&yzjtoken=${notification.yzjToken}`; const url = `${notification.yzjWebHookUrl}?yzjtype=0&yzjtoken=${notification.yzjToken}`;
config = this.getAxiosConfigWithProxy(config);
const result = await axios.post(url, params, config); const result = await axios.post(url, params, config);
if (!result.data?.success) { if (!result.data?.success) {

View File

@@ -27,7 +27,8 @@ class ZohoCliq extends NotificationProvider {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
_sendNotification = async (webhookUrl, payload) => { _sendNotification = async (webhookUrl, payload) => {
await axios.post(webhookUrl, { text: payload.join("\n") }); let config = this.getAxiosConfigWithProxy({});
await axios.post(webhookUrl, { text: payload.join("\n") }, config);
}; };
/** /**