Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ceredsms notification provider #5368

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

ceredpl
Copy link

@ceredpl ceredpl commented Nov 21, 2024

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • [x ] I have read and understand the pull request rules.

Description

Add ceredsms notification provider
Fixes #(issue)

Type of change

Please delete any options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • User interface (UI)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (a fix or feature that would cause existing functionality to not work as expected)
  • Other
  • This change requires a documentation update

Checklist

  • [x ] My code follows the style guidelines of this project
  • [x ] I ran ESLint and other linters for modified files
  • [x ] I have performed a self-review of my own code and tested it
  • [x ] I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • [ x] My changes generates no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

kuma-ceredsms

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

@ceredpl
Copy link
Author

ceredpl commented Nov 21, 2024

@louislam how can i add translation to file /src/pl.json

@cyril59310
Copy link
Contributor

You cannot modify translation files other than the en.json file to avoid any conflicts with our Weblate translation tool. I invite you to remove the changes from the pl.json file and add the translation keys in English to the en.json file. Then, you can translate them into your language using our Weblate tool.

Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, thanks for rebasing.
I have left a few minor comments below.

The most important part is that we still need to have a screenshot of the message getting through (our UI does not count)

<template>
<div class="mb-3">
<label for="ceredsms-key" class="form-label">{{ $t('API Key') }}</label>
<HiddenInput id="ceredsms-key" v-model="$parent.notification.ceredsmsApiKey" :required="true" autocomplete="new-password"></HiddenInput>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a link to the docs or where users can find this token as a helptext?

</div>
<div class="mb-3">
<label for="ceredsms-sender-name" class="form-label">{{ $t("Originator") }}</label>
<input id="ceredsms-sender-name" v-model="$parent.notification.ceredsmsSenderName" type="text" minlength="3" maxlength="11" class="form-control">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a helptext where this will be displayed. For SMS this is not quite obvious

* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, was changed for all others

Suggested change
let okMsg = "Sent Successfully.";
const okMsg = "Sent Successfully.";

const axios = require("axios");

class CeredSMS extends NotificationProvider {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, was changed for all others

Suggested change

Comment on lines +29 to +30
if (resp.data.message) {
let error = `CeredSMS.pl API returned error message: ${resp.data.error.message}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are first checking if message exists and then using error.messsage
Is this intentional?

Comment on lines +31 to +34
this.throwGeneralAxiosError(error);
} else {
let error = "CeredSMS.pl API returned an unexpected response";
this.throwGeneralAxiosError(error);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing inside the catch does not work as you think it does.
Please throw a regular error here instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants