From 14f0012b129004856aa864443de820f32573865d Mon Sep 17 00:00:00 2001 From: Rasmus Eskola Date: Mon, 21 Apr 2014 16:36:06 +0300 Subject: [PATCH 1/3] url service improvements: - support POST method at user's preference - support basic HTTP auth (uses "user" and "secret" for username/password) --- push.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/push.cpp b/push.cpp index ee3915f..0bfc50b 100755 --- a/push.cpp +++ b/push.cpp @@ -132,6 +132,7 @@ class CPushMod : public CModule defaults["message_length"] = "100"; defaults["message_title"] = "{title}"; defaults["message_uri"] = ""; + defaults["message_uri_post"] = "no"; defaults["message_uri_title"] = ""; defaults["message_priority"] = "0"; defaults["message_sound"] = ""; @@ -453,7 +454,10 @@ class CPushMod : public CModule return; } - use_post = false; + if(options["message_uri_post"] != "yes") + { + use_post = false; + } if (parts[0] == "https") { @@ -471,6 +475,12 @@ class CPushMod : public CModule return; } + // HTTP basic auth + if(options["username"] != "") + { + service_auth = options["username"] + CString(":") + options["secret"]; + } + // Process the remaining portion of the URL url = parts[1]; From 5b960484eba16e68e4fda2ede0d7c447079fecd4 Mon Sep 17 00:00:00 2001 From: Rasmus Eskola Date: Wed, 23 Apr 2014 21:28:58 +0300 Subject: [PATCH 2/3] Document the usage of URL basic authentication options --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 6d3df44..c2f42a3 100755 --- a/README.md +++ b/README.md @@ -236,12 +236,18 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or This option must be set when using Boxcar or Pushover. + When using the custom URL service, if this option is set it will be used as username + for HTTP basic authentication. + * `secret = ""` Authentication token for push notifications. This option must be set when using Notify My Android, Pushover, Prowl, Supertoasty or PushBullet. + When using the custom URL service, if this option is set it will be used as password + for HTTP basic authentication. + * `target = ""` Device or target name for push notifications. @@ -280,6 +286,11 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or local scheme to access a mobile application. Keyword expansion is performed on this value. +* `message_uri_post = "no"` + + When using the custom URL service, this option allows you to specify whether to use the + POST method instead of GET. + * `message_uri_title` = ""` If you're using Pushover.net, you can specify a title for the `message_uri` option. From c73f4d55bed5ec953522edc272f1542a7e7520ea Mon Sep 17 00:00:00 2001 From: Rasmus Eskola Date: Wed, 23 Apr 2014 21:33:12 +0300 Subject: [PATCH 3/3] URL service: enable HTTP basic auth if either username or secret is set Update documentation accordingly. --- README.md | 8 ++++---- push.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c2f42a3..303c1d7 100755 --- a/README.md +++ b/README.md @@ -236,8 +236,8 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or This option must be set when using Boxcar or Pushover. - When using the custom URL service, if this option is set it will be used as username - for HTTP basic authentication. + When using the custom URL service, if this option is set it will enable HTTP basic + authentication and be used as username. * `secret = ""` @@ -245,8 +245,8 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or This option must be set when using Notify My Android, Pushover, Prowl, Supertoasty or PushBullet. - When using the custom URL service, if this option is set it will be used as password - for HTTP basic authentication. + When using the custom URL service, if this option is set it will enable HTTP basic + authentication and be used as password. * `target = ""` diff --git a/push.cpp b/push.cpp index 0bfc50b..fa59b99 100755 --- a/push.cpp +++ b/push.cpp @@ -476,7 +476,7 @@ class CPushMod : public CModule } // HTTP basic auth - if(options["username"] != "") + if(options["username"] != "" || options["secret"] != "") { service_auth = options["username"] + CString(":") + options["secret"]; }