Remove required user_id param when sending messages
This commit is contained in:
@@ -19,10 +19,9 @@
|
||||
|
||||
<a tabindex="-1" href="/" class="linkcaption"><h1>Simple Cloud Notifier</h1></a>
|
||||
|
||||
<p>Get your user-id and user-key from the android or iOS app.<br/>And send notifications to your phone by performing a POST request against <code>{{config|baseURL}}/</code> from anywhere</p>
|
||||
<p>Get your user-key from the android or iOS app.<br/>And send notifications to your phone by performing a POST request against <code>{{config|baseURL}}/</code> from anywhere</p>
|
||||
<pre>
|
||||
curl \
|
||||
--data "user_id=${userid}" \
|
||||
--data "key=${key}" \
|
||||
--data "title=${message_title}" \
|
||||
--data "content=${message_body}" \
|
||||
@@ -35,7 +34,6 @@ curl \
|
||||
<p>Most parameters are optional, you can send a message with only a title (default priority and channel will be used)</p>
|
||||
<pre>
|
||||
curl \
|
||||
--data "user_id={userid}" \
|
||||
--data "key={key}" \
|
||||
--data "title={message_title}" \
|
||||
{{config|baseURL}}/</pre>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
All Parameters can either directly be submitted as URL parameters or they can be put into the POST body (either multipart/form-data or JSON).
|
||||
</p>
|
||||
<p>
|
||||
You <i>need</i> to supply a valid <code>[user_id, key]</code> pair and a <code>title</code> for your message, all other parameter are optional.
|
||||
You <i>need</i> to supply a valid <code>key</code> and a <code>title</code> for your message, all other parameter are optional.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-label="Statuscode">401 (Unauthorized)</td>
|
||||
<td data-label="Explanation">The user_id was not found, the key is wrong or the [user_id, key] combination does not have the SEND permissions on the specified channel</td>
|
||||
<td data-label="Explanation">The key is wrong or does not have the SEND permissions on the specified channel</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-label="Statuscode">403 (Forbidden)</td>
|
||||
@@ -125,7 +125,6 @@
|
||||
If needed the content can be supplied in the <code>content</code> parameter.
|
||||
</p>
|
||||
<pre>curl \
|
||||
--data "user_id={userid}" \
|
||||
--data "key={key}" \
|
||||
--data "title={message_title}" \
|
||||
--data "content={message_content}" \
|
||||
@@ -143,7 +142,6 @@
|
||||
If no priority is supplied the message will get the default priority of 1.
|
||||
</p>
|
||||
<pre>curl \
|
||||
--data "user_id={userid}" \
|
||||
--data "key={key}" \
|
||||
--data "title={message_title}" \
|
||||
--data "priority={0|1|2}" \
|
||||
@@ -158,7 +156,6 @@
|
||||
Channel names are case-insensitive and can only contain letters, numbers, underscores and minuses ( <code>/[[:alnum:]\-_]+/</code> )
|
||||
</p>
|
||||
<pre>curl \
|
||||
--data "user_id={userid}" \
|
||||
--data "key={key}" \
|
||||
--data "title={message_title}" \
|
||||
--data "channel={my_channel}" \
|
||||
@@ -229,7 +226,6 @@
|
||||
The message_id is optional - but if you want to use it you need to supply it via the <code>msg_id</code> parameter.
|
||||
</p>
|
||||
<pre>curl \
|
||||
--data "user_id={userid}" \
|
||||
--data "key={key}" \
|
||||
--data "title={message_title}" \
|
||||
--data "msg_id={message_id}" \
|
||||
@@ -248,7 +244,6 @@
|
||||
The custom timestamp must be within 48 hours of the current time. This parameter is only intended to supply a more precise value in case the message sending was delayed.
|
||||
</p>
|
||||
<pre>curl \
|
||||
--data "user_id={userid}" \
|
||||
--data "key={key}" \
|
||||
--data "title={message_title}" \
|
||||
--data "timestamp={unix_timestamp}" \
|
||||
|
||||
@@ -21,11 +21,6 @@
|
||||
|
||||
<a tabindex="-1" href="/" class="linkcaption"><h1>Simple Cloud Notifier</h1></a>
|
||||
|
||||
<div class="row responsive-label">
|
||||
<div class="col-sm-12 col-md-3"><label for="uid" class="doc">UserID</label></div>
|
||||
<div class="col-sm-12 col-md"><input placeholder="UserID" id="uid" class="doc" type="text" pattern="USR[A-Za-z0-9]{21}"></div>
|
||||
</div>
|
||||
|
||||
<div class="row responsive-label">
|
||||
<div class="col-sm-12 col-md-3"><label for="ukey" class="doc">Authentification Key</label></div>
|
||||
<div class="col-sm-12 col-md"><input placeholder="Key" id="ukey" class="doc" type="text" pattern="[A-Za-z0-9]{64}"></div>
|
||||
|
||||
@@ -8,20 +8,17 @@ function send()
|
||||
|
||||
me.classList.add("btn-disabled");
|
||||
|
||||
let uid = document.getElementById("uid");
|
||||
let key = document.getElementById("ukey");
|
||||
let tit = document.getElementById("tit");
|
||||
let cnt = document.getElementById("cnt");
|
||||
let pio = document.getElementById("prio");
|
||||
let cha = document.getElementById("chan");
|
||||
|
||||
uid.classList.remove('input-invalid');
|
||||
key.classList.remove('input-invalid');
|
||||
cnt.classList.remove('input-invalid');
|
||||
pio.classList.remove('input-invalid');
|
||||
|
||||
let data = new FormData();
|
||||
data.append('user_id', uid.value);
|
||||
data.append('key', key.value);
|
||||
if (tit.value !== '') data.append('title', tit.value);
|
||||
if (cnt.value !== '') data.append('content', cnt.value);
|
||||
@@ -40,7 +37,6 @@ function send()
|
||||
let resp = JSON.parse(xhr.responseText);
|
||||
if (!resp.success || xhr.status !== 200)
|
||||
{
|
||||
if (resp.errhighlight === 101) uid.classList.add('input-invalid');
|
||||
if (resp.errhighlight === 102) key.classList.add('input-invalid');
|
||||
if (resp.errhighlight === 103) tit.classList.add('input-invalid');
|
||||
if (resp.errhighlight === 104) cnt.classList.add('input-invalid');
|
||||
@@ -63,7 +59,6 @@ function send()
|
||||
'"a=' + resp.quota +
|
||||
'"a_remain=' + (resp.quota_max-resp.quota) +
|
||||
'"a_max=' + resp.quota_max +
|
||||
'&preset_user_id=' + uid.value +
|
||||
'&preset_user_key=' + key.value +
|
||||
'&preset_channel=' + cha.value;
|
||||
}
|
||||
@@ -89,7 +84,6 @@ window.addEventListener("load", function ()
|
||||
const qp = new URLSearchParams(window.location.search);
|
||||
|
||||
let btn = document.getElementById("btnSend");
|
||||
let uid = document.getElementById("uid");
|
||||
let key = document.getElementById("ukey");
|
||||
let tit = document.getElementById("tit");
|
||||
let cnt = document.getElementById("cnt");
|
||||
@@ -100,7 +94,6 @@ window.addEventListener("load", function ()
|
||||
|
||||
if (qp.has('preset_priority')) pio.selectedIndex = parseInt(qp.get("preset_priority"));
|
||||
if (qp.has('preset_user_key')) key.value = qp.get("preset_user_key");
|
||||
if (qp.has('preset_user_id')) uid.value = qp.get("preset_user_id");
|
||||
if (qp.has('preset_title')) tit.value = qp.get("preset_title");
|
||||
if (qp.has('preset_content')) cnt.value = qp.get("preset_content");
|
||||
if (qp.has('preset_channel')) cha.value = qp.get("preset_channel");
|
||||
|
||||
Reference in New Issue
Block a user