thelounge-plugin-ntfy 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -7,7 +7,6 @@ const {
7
7
  loadUserConfig,
8
8
  saveUserSetting,
9
9
  saveNetworkSetting,
10
- PER_NETWORK_KEYS,
11
10
  } = require("./src/config.js");
12
11
 
13
12
  // user -> Map<network.uuid -> handler and client>
@@ -426,10 +425,7 @@ const ntfyCommand = {
426
425
  const setArgs = networkArgs.slice(1);
427
426
 
428
427
  if (setArgs.length < 2) {
429
- say("Usage: /ntfy config network set <setting_key> <value>");
430
- say(
431
- `Available per-network settings: ${Array.from(PER_NETWORK_KEYS).join(", ")}`,
432
- );
428
+ helpMessage();
433
429
  return;
434
430
  }
435
431
 
@@ -451,10 +447,7 @@ const ntfyCommand = {
451
447
  const removeArgs = networkArgs.slice(1);
452
448
 
453
449
  if (removeArgs.length < 1) {
454
- say("Usage: /ntfy config network remove <setting_key>");
455
- say(
456
- `Available per-network settings: ${Array.from(PER_NETWORK_KEYS).join(", ")}`,
457
- );
450
+ helpMessage();
458
451
  return;
459
452
  }
460
453
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thelounge-plugin-ntfy",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "A plugin for The Lounge that sends push notifications via ntfy when highlighted",
5
5
  "keywords": [
6
6
  "thelounge",
package/src/handler.js CHANGED
@@ -3,6 +3,13 @@
3
3
  const { loadUserConfig, getNetworkSetting } = require("./config.js");
4
4
  const { PluginLogger } = require("./logger.js");
5
5
 
6
+ function stripIrcFormatting(message) {
7
+ return message.replace(
8
+ /[\x02\x0F\x16\x1D\x1F]|(?:\x03(?:\d{1,2}(?:,\d{1,2})?)?)/g,
9
+ "",
10
+ );
11
+ }
12
+
6
13
  function createHandler(client, network) {
7
14
  return async (data) => {
8
15
  // Ignore own messages
@@ -95,7 +102,7 @@ function createHandler(client, network) {
95
102
  title: isPM
96
103
  ? `${network.name}: ${data.nick}`
97
104
  : `${network.name} ${data.target}: ${data.nick}`,
98
- message: message,
105
+ message: stripIrcFormatting(message),
99
106
  });
100
107
  } catch (e) {
101
108
  PluginLogger.error("Failed to send ntfy notification", e);