From 1e80a7d145e6fce8a95a98645728d548cc9d4a51 Mon Sep 17 00:00:00 2001 From: negue Date: Sat, 11 Mar 2023 00:03:33 +0100 Subject: [PATCH] WIP webhook row --- .../client/src/components/settings/api.vue | 31 --- .../src/components/ui/validatedTextInput.vue | 6 +- .../client/src/pages/settings-overview.vue | 1 - .../client/src/pages/settings/siteData.vue | 7 +- .../settings/siteDataRows/webhooksRow.vue | 244 ++++++++++++++++++ website/client/src/store/actions/user.js | 2 +- website/common/locales/en/settings.json | 3 +- 7 files changed, 258 insertions(+), 36 deletions(-) create mode 100644 website/client/src/pages/settings/siteDataRows/webhooksRow.vue diff --git a/website/client/src/components/settings/api.vue b/website/client/src/components/settings/api.vue index 6b91188f0a..e17f1215aa 100644 --- a/website/client/src/components/settings/api.vue +++ b/website/client/src/components/settings/api.vue @@ -3,37 +3,6 @@

{{ $t('API') }}

{{ $t('APIText') }}

-
-

{{ $t('thirdPartyApps') }}

- -
-

{{ $t('webhooks') }}

diff --git a/website/client/src/components/ui/validatedTextInput.vue b/website/client/src/components/ui/validatedTextInput.vue index 99f3b2ed45..f745221aaa 100644 --- a/website/client/src/components/ui/validatedTextInput.vue +++ b/website/client/src/components/ui/validatedTextInput.vue @@ -1,5 +1,5 @@ @@ -43,9 +45,12 @@ import UserIdRow from '@/pages/settings/siteDataRows/userIdRow.vue'; import UserDataRow from '@/pages/settings/siteDataRows/userDataRow.vue'; import ApiRow from '@/pages/settings/siteDataRows/apiRow.vue'; +import WebhooksRow from '@/pages/settings/siteDataRows/webhooksRow.vue'; export default { - components: { ApiRow, UserDataRow, UserIdRow }, + components: { + WebhooksRow, ApiRow, UserDataRow, UserIdRow, + }, mounted () { this.$store.dispatch('common:setTitle', { section: this.$t('settings'), diff --git a/website/client/src/pages/settings/siteDataRows/webhooksRow.vue b/website/client/src/pages/settings/siteDataRows/webhooksRow.vue new file mode 100644 index 0000000000..63a6cd768a --- /dev/null +++ b/website/client/src/pages/settings/siteDataRows/webhooksRow.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/website/client/src/store/actions/user.js b/website/client/src/store/actions/user.js index 9ea7e29357..84bb39adbe 100644 --- a/website/client/src/store/actions/user.js +++ b/website/client/src/store/actions/user.js @@ -65,7 +65,7 @@ export async function sleep (store) { } export async function addWebhook (store, payload) { - const response = await axios.post('/api/v4/user/webhook', payload.webhookInfo); + const response = await axios.post('/api/v4/user/webhook', payload.webhook); return response.data.data; } diff --git a/website/common/locales/en/settings.json b/website/common/locales/en/settings.json index dd6d73b363..b95ecb0f7f 100644 --- a/website/common/locales/en/settings.json +++ b/website/common/locales/en/settings.json @@ -167,9 +167,10 @@ "generate": "Generate", "getCodes": "Get Codes", "webhooks": "Webhooks", - "webhooksInfo": "Habitica provides webhooks so that when certain actions occur in your account, information can be sent to a script on another website. You can specify those scripts here. Be careful with this feature because specifying an incorrect URL can cause errors or slowness in Habitica. For more information, see the wiki's Webhooks page.", + "webhooksInfo": "Webhooks provide a way for developers to receive notifications when a particular action is performed, such as scoring or updating a Task, or sending a message in a Group. By creating a webhook, you will be able to listen to changes in Habitica and build apps that respond to these changes.

For additional information and examples on webhooks, please visit our API Docs", "enabled": "Enabled", "webhookURL": "Webhook URL", + "addWebhook": "Add Webhook", "invalidUrl": "invalid url", "invalidWebhookId": "the \"id\" parameter should be a valid UUID.", "webhookBooleanOption": "\"<%= option %>\" must be a Boolean value.",