Fix indentation + typo

This commit is contained in:
DeeJayPee 2021-10-05 19:43:04 +02:00
parent 29d0db805d
commit f14a798b2c
2 changed files with 41 additions and 43 deletions

View file

@ -9,52 +9,50 @@ class Octopush extends NotificationProvider {
let okMsg = "Sent Successfully. ";
try {
// Default - V2
if (notification.octopushVersion == 2 || !notification.octopushVersion)
{
let config = {
// Default - V2
if (notification.octopushVersion == 2 || !notification.octopushVersion) {
let config = {
headers: {
"api-key": notification.octopushAPIKey,
"api-login": notification.octopushLogin,
"cache-control": "no-cache"
"api-key": notification.octopushAPIKey,
"api-login": notification.octopushLogin,
"cache-control": "no-cache"
}
};
let data = {
};
let data = {
"recipients": [
{
{
"phone_number": notification.octopushPhoneNumber
}
}
],
//octopush not supporting non ascii char
"text": msg.replace(/[^\x00-\x7F]/g, ""),
"type": notification.octopushSMSType,
"purpose": "alert",
"sender": notification.octopushSenderName
};
await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config)
}
else if (notification.octopushVersion == 1)
{
let data = {
};
await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config)
} else if (notification.octopushVersion == 1) {
let data = {
"user_login": notification.octopushDMLogin,
"api_key": notification.octopushDMAPIKey,
"sms_recipients" : notification.octopushDMPhoneNumber,
"sms_sender": notification.octopushDMSenderName,
"sms_type": (notification.octopushDMSMSType == 'sms_premium')?'FR':'XXX',
"transactional": '1',
//octopush not supporting non ascii char
"sms_text": msg.replace(/[^\x00-\x7F]/g, ""),
};
"api_key": notification.octopushDMAPIKey,
"sms_recipients": notification.octopushDMPhoneNumber,
"sms_sender": notification.octopushDMSenderName,
"sms_type": (notification.octopushDMSMSType == "sms_premium") ? "FR" : "XXX",
"transactional": "1",
//octopush not supporting non ascii char
"sms_text": msg.replace(/[^\x00-\x7F]/g, ""),
};
let config = {
headers: {
"cache-control": "no-cache"
},
params: data
};
await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config)
} else
throw new Error('Unknown Octopush version !');
let config = {
headers: {
"cache-control": "no-cache"
},
params: data
};
await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config)
} else {
throw new Error("Unknown Octopush version!");
}
return okMsg;
} catch (error) {

View file

@ -244,16 +244,16 @@
</template>
<template v-if="notification.type === 'octopush'">
<div class="mb-3">
<label for="octopush-version" class="form-label">Octopush API Version</label>
<select id="octopush-version" v-model="notification.octopushVersion" class="form-select">
<option value="2">V2</option>
<option value="1">V1 (Legacy Octopush-DM)</option>
</select>
<div class="form-text">
<div class="mb-3">
<label for="octopush-version" class="form-label">Octopush API Version</label>
<select id="octopush-version" v-model="notification.octopushVersion" class="form-select">
<option value="2">V2</option>
<option value="1">V1 (Legacy Octopush-DM)</option>
</select>
<div class="form-text">
Do you use the legacy version of Octopush (2011-2020) or the new version ?
</div>
</div>
</div>
</div>
<div class="mb-3">
<label for="octopush-key" class="form-label">API KEY</label>
<HiddenInput id="octopush-key" v-model="notification.octopushAPIKey" :required="true" autocomplete="one-time-code"></HiddenInput>