Added ability to set a webhook proxy for telegram requests

Fixed issue where config changes were broadcast before they were written
This commit is contained in:
Tzahi12345
2023-11-30 00:28:28 -05:00
parent 91c2fdc701
commit 8f246d905f
5 changed files with 18 additions and 6 deletions

View File

@@ -85,11 +85,11 @@ exports.getConfigFile = () => {
exports.setConfigFile = (config) => {
try {
const old_config = exports.getConfigFile();
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
const changes = exports.findChangedConfigItems(old_config, config);
if (changes.length > 0) {
for (const change of changes) exports.config_updated.next(change);
}
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
return true;
} catch(e) {
return false;
@@ -239,6 +239,7 @@ const DEFAULT_CONFIG = {
"use_telegram_API": false,
"telegram_bot_token": "",
"telegram_chat_id": "",
"telegram_webhook_proxy": "",
"webhook_URL": "",
"discord_webhook_URL": "",
"slack_webhook_URL": "",