From b2e8babd2e1f48a5d1cff99ad52d6f55567c6bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Thu, 10 Oct 2024 08:52:51 +0000 Subject: [PATCH 1/3] fix(service-alerts): Update win service alert templates to latest look-n-feel Implements #1257 --- .../failed-reload-qseow.handlebars | 2 +- .../service-started.handlebars | 93 +++++------ .../service-stopped.handlebars | 93 +++++------ .../service-started.handlebars | 152 ++++++++++++++---- .../service-stopped.handlebars | 152 ++++++++++++++---- 5 files changed, 327 insertions(+), 165 deletions(-) diff --git a/src/config/email_templates/failed-reload-qseow.handlebars b/src/config/email_templates/failed-reload-qseow.handlebars index 424ec7de..9aa4098e 100644 --- a/src/config/email_templates/failed-reload-qseow.handlebars +++ b/src/config/email_templates/failed-reload-qseow.handlebars @@ -2,7 +2,7 @@

-
+
diff --git a/src/config/email_templates/service-started.handlebars b/src/config/email_templates/service-started.handlebars index c8f6645b..223545f3 100644 --- a/src/config/email_templates/service-started.handlebars +++ b/src/config/email_templates/service-started.handlebars @@ -1,44 +1,6 @@

Windows service {{serviceStatus}}: '{{serviceDisplayName}}'

- @@ -47,32 +9,55 @@ {{! Please refer to https://handlebarsjs.com/guide/#simple-expressions for info on Handlebars templating syntax }} - - - + - - + + - - + - - + - - + - - + +
Host - {{host}} -
Service name - {{serviceName}} + + Host
+ {{host}} +
+ Service name
+ {{serviceName}}
Service display name{{serviceDisplayName}} + Service status
+ {{serviceStatus}} +
+ Service display name
+ {{serviceDisplayName}} +
Service status{{serviceStatus}} + + Previous service status
+ {{servicePrevStatus}} +
+ Service startup mode
+ {{serviceStartType}} +
Previous service status{{servicePrevStatus}} + + EXE path
+ {{serviceExePath}} +
Service startup mode{{serviceStartType}} +
EXE path{{serviceExePath}} +{{#each genericUrls}} +{{!-- Possible to use conditional logic in the template to include or exclude buttons based on the value of a variable. For example, the following code snippet includes a button only if the value of the id variable is "butler_docs": --}} +{{!-- {{#if (eq id "butler_docs")}} --}} + {{this.linkText}} +{{!-- {{/if}} --}} +{{/each}} +
diff --git a/src/config/email_templates/service-stopped.handlebars b/src/config/email_templates/service-stopped.handlebars index c8f6645b..223545f3 100644 --- a/src/config/email_templates/service-stopped.handlebars +++ b/src/config/email_templates/service-stopped.handlebars @@ -1,44 +1,6 @@

Windows service {{serviceStatus}}: '{{serviceDisplayName}}'

- @@ -47,32 +9,55 @@ {{! Please refer to https://handlebarsjs.com/guide/#simple-expressions for info on Handlebars templating syntax }} - - - + - - + + - - + - - + - - + - - + +
Host - {{host}} -
Service name - {{serviceName}} + + Host
+ {{host}} +
+ Service name
+ {{serviceName}}
Service display name{{serviceDisplayName}} + Service status
+ {{serviceStatus}} +
+ Service display name
+ {{serviceDisplayName}} +
Service status{{serviceStatus}} + + Previous service status
+ {{servicePrevStatus}} +
+ Service startup mode
+ {{serviceStartType}} +
Previous service status{{servicePrevStatus}} + + EXE path
+ {{serviceExePath}} +
Service startup mode{{serviceStartType}} +
EXE path{{serviceExePath}} +{{#each genericUrls}} +{{!-- Possible to use conditional logic in the template to include or exclude buttons based on the value of a variable. For example, the following code snippet includes a button only if the value of the id variable is "butler_docs": --}} +{{!-- {{#if (eq id "butler_docs")}} --}} + {{this.linkText}} +{{!-- {{/if}} --}} +{{/each}} +
diff --git a/src/config/teams_templates/service-started.handlebars b/src/config/teams_templates/service-started.handlebars index 0a0393ab..58af268d 100644 --- a/src/config/teams_templates/service-started.handlebars +++ b/src/config/teams_templates/service-started.handlebars @@ -1,29 +1,125 @@ { - "@type": "MessageCard", - "@context": "https://schema.org/extensions", - "themeColor": "0076D7", - "summary": "Windows service is stopped", - "sections": [{ - "activityTitle": "# ✅ Windows service {{serviceStatus}}: '{{serviceDisplayName}}' on host '{{host}}' ", - "facts": [{ - "name": "Host", - "value": "{{host}}" - },{ - "name": "Name", - "value": "{{serviceName}}" - },{ - "name": "Display name", - "value": "{{serviceDisplayName}}" - },{ - "name": "Status", - "value": "{{serviceStatus}}" - },{ - "name": "Previous status", - "value": "{{servicePrevStatus}}" - },{ - "name": "Startup mode", - "value": "{{serviceStartType}}" - }], - "markdown": true - }] -} + "type": "message", + "attachments": [ + { + "contentType": "application/vnd.microsoft.card.adaptive", + "contentUrl": null, + "content": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "type": "AdaptiveCard", + "version": "1.3", + "msteams": { + "width": "Full" + }, + "body": [ + { + "type": "TextBlock", + "size": "large", + "weight": "bolder", + "text": "✅ Windows service {{serviceStatus}}: '{{serviceDisplayName}}'", + "style": "heading", + "wrap": true + }, + { + "type": "ColumnSet", + "columns": [ + { + "type": "Column", + "items": [ + { + "type": "Image", + "style": "person", + "url": "https://raw.githubusercontent.com/ptarmiganlabs/butler/master/icon.png", + "altText": "Butler the Bot", + "size": "medium" + } + ], + "width": "auto" + }, + { + "type": "Column", + "items": [ + { + "type": "TextBlock", + "weight": "bolder", + "text": "Butler the Bot", + "wrap": true + }, + { + "type": "TextBlock", + "spacing": "none", + "text": "", + "isSubtle": true, + "wrap": true + } + ], + "width": "stretch" + } + ] + }, + + { + "type": "FactSet", + "spacing": "large", + "facts": [ + { + "title": "Host:", + "value": "{{host}}" + }, + { + "title": "Name:", + "value": "{{serviceName}}" + }, + { + "title": "Display name:", + "value": "{{serviceDisplayName}}" + }, + { + "title": "Status:", + "value": "{{serviceStatus}}" + }, + { + "title": "Previous status:", + "value": "{{servicePrevStatus}}" + }, + { + "title": "Startup mode:", + "value": "{{serviceStartType}}" + } + ] + }, + + { + "type": "ActionSet", + "spacing": "extraLarge", + "separator": true, + "actions": [ +{{#each genericUrls}} +{{#if (eq id "butler_docs")}} + { + "type": "Action.OpenUrl", + "title": "{{this.linkText}}", + "tooltip": "{{this.comment}}", + "url": "{{this.url}}", + "role": "button" + }, +{{/if}} +{{/each}} +{{#each genericUrls}} +{{#if (eq id "ptarmiganlabs_com")}} + { + "type": "Action.OpenUrl", + "title": "{{this.linkText}}", + "tooltip": "{{this.comment}}", + "url": "{{this.url}}", + "role": "button" + } +{{/if}} +{{/each}} + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/config/teams_templates/service-stopped.handlebars b/src/config/teams_templates/service-stopped.handlebars index 1b3bafac..7dd80816 100644 --- a/src/config/teams_templates/service-stopped.handlebars +++ b/src/config/teams_templates/service-stopped.handlebars @@ -1,29 +1,125 @@ { - "@type": "MessageCard", - "@context": "https://schema.org/extensions", - "themeColor": "0076D7", - "summary": "Windows service is stopped", - "sections": [{ - "activityTitle": "# ❌ Windows service {{serviceStatus}}: '{{serviceDisplayName}}'", - "facts": [{ - "name": "Host", - "value": "{{host}}" - },{ - "name": "Name", - "value": "{{serviceName}}" - },{ - "name": "Display name", - "value": "{{serviceDisplayName}}" - },{ - "name": "Status", - "value": "{{serviceStatus}}" - },{ - "name": "Previous status", - "value": "{{servicePrevStatus}}" - },{ - "name": "Startup mode", - "value": "{{serviceStartType}}" - }], - "markdown": true - }] -} + "type": "message", + "attachments": [ + { + "contentType": "application/vnd.microsoft.card.adaptive", + "contentUrl": null, + "content": { + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "type": "AdaptiveCard", + "version": "1.3", + "msteams": { + "width": "Full" + }, + "body": [ + { + "type": "TextBlock", + "size": "large", + "weight": "bolder", + "text": "❌ Windows service {{serviceStatus}}: '{{serviceDisplayName}}'", + "style": "heading", + "wrap": true + }, + { + "type": "ColumnSet", + "columns": [ + { + "type": "Column", + "items": [ + { + "type": "Image", + "style": "person", + "url": "https://raw.githubusercontent.com/ptarmiganlabs/butler/master/icon.png", + "altText": "Butler the Bot", + "size": "medium" + } + ], + "width": "auto" + }, + { + "type": "Column", + "items": [ + { + "type": "TextBlock", + "weight": "bolder", + "text": "Butler the Bot", + "wrap": true + }, + { + "type": "TextBlock", + "spacing": "none", + "text": "", + "isSubtle": true, + "wrap": true + } + ], + "width": "stretch" + } + ] + }, + + { + "type": "FactSet", + "spacing": "large", + "facts": [ + { + "title": "Host:", + "value": "{{host}}" + }, + { + "title": "Name:", + "value": "{{serviceName}}" + }, + { + "title": "Display name:", + "value": "{{serviceDisplayName}}" + }, + { + "title": "Status:", + "value": "{{serviceStatus}}" + }, + { + "title": "Previous status:", + "value": "{{servicePrevStatus}}" + }, + { + "title": "Startup mode:", + "value": "{{serviceStartType}}" + } + ] + }, + + { + "type": "ActionSet", + "spacing": "extraLarge", + "separator": true, + "actions": [ +{{#each genericUrls}} +{{#if (eq id "butler_docs")}} + { + "type": "Action.OpenUrl", + "title": "{{this.linkText}}", + "tooltip": "{{this.comment}}", + "url": "{{this.url}}", + "role": "button" + }, +{{/if}} +{{/each}} +{{#each genericUrls}} +{{#if (eq id "ptarmiganlabs_com")}} + { + "type": "Action.OpenUrl", + "title": "{{this.linkText}}", + "tooltip": "{{this.comment}}", + "url": "{{this.url}}", + "role": "button" + } +{{/if}} +{{/each}} + ] + } + ] + } + } + ] +} \ No newline at end of file From b02e6a86aa8f61ee2b9a78c85a569aad740c0543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Thu, 10 Oct 2024 09:09:58 +0000 Subject: [PATCH 2/3] fix(xml-appender): Update XML appender files to more reliably detect successful reloads Fixes #1259 --- src/config/log_appender_xml/scheduler/LocalLogConfig.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/config/log_appender_xml/scheduler/LocalLogConfig.xml b/src/config/log_appender_xml/scheduler/LocalLogConfig.xml index 191a3348..3316a994 100644 --- a/src/config/log_appender_xml/scheduler/LocalLogConfig.xml +++ b/src/config/log_appender_xml/scheduler/LocalLogConfig.xml @@ -40,7 +40,7 @@ - + @@ -86,17 +86,13 @@ + - - - - - From 16032c079807b62ffe252158c57665b7d1627d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Thu, 10 Oct 2024 11:50:29 +0000 Subject: [PATCH 3/3] chore(deps): Update dependencies to stay safe and secure --- package-lock.json | 41 +++++++++++++++++++++-------------------- package.json | 8 ++++---- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index b844fa0b..ed1a1f1c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,15 +58,15 @@ "systeminformation": "^5.23.5", "upath": "^2.0.1", "uuid": "^10.0.0", - "winston": "^3.14.2", + "winston": "^3.15.0", "winston-daily-rotate-file": "^5.0.0", "ws": "^8.18.0", "xstate": "^5.18.2" }, "devDependencies": { - "@babel/eslint-parser": "^7.25.1", - "@babel/plugin-syntax-import-assertions": "^7.25.6", - "@eslint/js": "^9.11.1", + "@babel/eslint-parser": "^7.25.7", + "@babel/plugin-syntax-import-assertions": "^7.25.7", + "@eslint/js": "^9.12.0", "esbuild": "^0.24.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", @@ -222,9 +222,9 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "7.25.1", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.25.1.tgz", - "integrity": "sha512-Y956ghgTT4j7rKesabkh5WeqgSFZVFwaPR0IWFm7KFHFmmJ4afbG49SmfW4S+GyRPx0Dy5jxEWA5t0rpxfElWg==", + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.25.7.tgz", + "integrity": "sha512-B+BO9x86VYsQHimucBAL1fxTJKF4wyKY6ZVzee9QgzdZOUfs3BaR6AQrgoGrRI+7IFS1wUz/VyQ+SoBcSpdPbw==", "dev": true, "license": "MIT", "dependencies": { @@ -346,9 +346,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", - "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.7.tgz", + "integrity": "sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==", "dev": true, "license": "MIT", "engines": { @@ -554,13 +554,13 @@ } }, "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.25.6.tgz", - "integrity": "sha512-aABl0jHw9bZ2karQ/uUD6XP4u0SG22SJrOHFoL6XB1R7dTovOP4TzTlsxOYC5yQ1pdscVK2JTUnF6QL3ARoAiQ==", + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.25.7.tgz", + "integrity": "sha512-ZvZQRmME0zfJnDQnVBKYzHxXT7lYBB3Revz1GuS7oLXWMgqUPX4G+DDbT30ICClht9WKV34QVrZhSw6WdklwZQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" + "@babel/helper-plugin-utils": "^7.25.7" }, "engines": { "node": ">=6.9.0" @@ -1297,9 +1297,9 @@ "peer": true }, "node_modules/@eslint/js": { - "version": "9.11.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.11.1.tgz", - "integrity": "sha512-/qu+TWz8WwPWc7/HcIJKi+c+MOm46GdVaSlTTQcaqaL53+GsoA6MxWp5PtTx48qbSP7ylM1Kn7nhvkugfJvRSA==", + "version": "9.12.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.12.0.tgz", + "integrity": "sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==", "dev": true, "license": "MIT", "engines": { @@ -7432,9 +7432,10 @@ } }, "node_modules/winston": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.14.2.tgz", - "integrity": "sha512-CO8cdpBB2yqzEf8v895L+GNKYJiEq8eKlHU38af3snQBQ+sdAIUepjMSguOIJC7ICbzm0ZI+Af2If4vIJrtmOg==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.15.0.tgz", + "integrity": "sha512-RhruH2Cj0bV0WgNL+lOfoUBI4DVfdUNjVnJGVovWZmrcKtrFTTRzgXYK2O9cymSGjrERCtaAeHwMNnUWXlwZow==", + "license": "MIT", "dependencies": { "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", diff --git a/package.json b/package.json index 992a840d..20d02b92 100644 --- a/package.json +++ b/package.json @@ -98,15 +98,15 @@ "systeminformation": "^5.23.5", "upath": "^2.0.1", "uuid": "^10.0.0", - "winston": "^3.14.2", + "winston": "^3.15.0", "winston-daily-rotate-file": "^5.0.0", "ws": "^8.18.0", "xstate": "^5.18.2" }, "devDependencies": { - "@babel/eslint-parser": "^7.25.1", - "@babel/plugin-syntax-import-assertions": "^7.25.6", - "@eslint/js": "^9.11.1", + "@babel/eslint-parser": "^7.25.7", + "@babel/plugin-syntax-import-assertions": "^7.25.7", + "@eslint/js": "^9.12.0", "esbuild": "^0.24.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1",