thelounge-plugin-ntfy 1.7.0 → 1.7.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
@@ -501,9 +501,21 @@ module.exports = {
501
501
 
502
502
  ServerConfig.init(tl.Config.getConfig());
503
503
 
504
+ if (ServerConfig.get().baseUrl) {
505
+ try {
506
+ const url = new URL(ServerConfig.get().baseUrl);
507
+ PluginLogger.info(
508
+ `Using baseUrl from server configuration: ${url.toString()}`,
509
+ );
510
+ } catch (error) {
511
+ PluginLogger.error(
512
+ `Invalid baseUrl in server configuration: ${ServerConfig.get().baseUrl}`,
513
+ );
514
+ }
515
+ }
516
+
504
517
  const configDir = tl.Config.getPersistentStorageDir();
505
518
  setRootDir(configDir);
506
- PluginLogger.info(`[ntfy] Using config directory: ${configDir}`);
507
519
 
508
520
  tl.Commands.add("ntfy", ntfyCommand);
509
521
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thelounge-plugin-ntfy",
3
- "version": "1.7.0",
3
+ "version": "1.7.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
@@ -32,9 +32,19 @@ function createHandler(client, network) {
32
32
  return;
33
33
  }
34
34
 
35
- const channelUrl = ServerConfig.get().baseUrl
36
- ? new URL(`/#/chan-${channel.id}`, ServerConfig.get().baseUrl)
37
- : null;
35
+ let channelUrl = null;
36
+
37
+ try {
38
+ channelUrl = ServerConfig.get().baseUrl
39
+ ? new URL(`/#/chan-${channel.id}`, ServerConfig.get().baseUrl)
40
+ : null;
41
+ } catch (error) {
42
+ PluginLogger.error(
43
+ `Failed to construct channel URL for notification: ${error.message}`,
44
+ );
45
+ PluginLogger.debug(`Payload: ${JSON.stringify(data)}`);
46
+ PluginLogger.debug(`Channels: ${JSON.stringify(network.channels)}`);
47
+ }
38
48
 
39
49
  const highlightRegex = new RegExp(network.highlightRegex, "i");
40
50
  const message = data.message || "";