aboutsummaryrefslogtreecommitdiff
path: root/internal/integration/integration.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <f@miniflux.net> 2023-09-08 22:45:17 -0700
committerGravatar Frédéric Guillot <f@miniflux.net> 2023-09-09 13:11:42 -0700
commit48f6885f4472efbe0e23f990ae8d4545f9a6a73d (patch)
treea05b35013e65f95013f90006b07870ddaeaf4065 /internal/integration/integration.go
parent32d33104a4934771ca99b1bcfe55bd0e4e88809b (diff)
downloadv2-48f6885f4472efbe0e23f990ae8d4545f9a6a73d.tar.gz
v2-48f6885f4472efbe0e23f990ae8d4545f9a6a73d.tar.zst
v2-48f6885f4472efbe0e23f990ae8d4545f9a6a73d.zip
Add generic webhook integration
Diffstat (limited to 'internal/integration/integration.go')
-rw-r--r--internal/integration/integration.go69
1 files changed, 40 insertions, 29 deletions
diff --git a/internal/integration/integration.go b/internal/integration/integration.go
index 65d005d8..07b70308 100644
--- a/internal/integration/integration.go
+++ b/internal/integration/integration.go
@@ -19,6 +19,7 @@ import (
"miniflux.app/v2/internal/integration/shiori"
"miniflux.app/v2/internal/integration/telegrambot"
"miniflux.app/v2/internal/integration/wallabag"
+ "miniflux.app/v2/internal/integration/webhook"
"miniflux.app/v2/internal/logger"
"miniflux.app/v2/internal/model"
)
@@ -168,45 +169,55 @@ func SendEntry(entry *model.Entry, integration *model.Integration) {
}
}
-// PushEntries pushes an entry array to third-party providers during feed refreshes.
-func PushEntries(entries model.Entries, integration *model.Integration) {
- if integration.MatrixBotEnabled {
- logger.Debug("[Integration] Sending %d entries for User #%d to Matrix", len(entries), integration.UserID)
+// PushEntries pushes a list of entries to activated third-party providers during feed refreshes.
+func PushEntries(feed *model.Feed, entries model.Entries, userIntegrations *model.Integration) {
+ if userIntegrations.MatrixBotEnabled {
+ logger.Debug("[Integration] Sending %d entries for User #%d to Matrix", len(entries), userIntegrations.UserID)
- err := matrixbot.PushEntries(entries, integration.MatrixBotURL, integration.MatrixBotUser, integration.MatrixBotPassword, integration.MatrixBotChatID)
+ err := matrixbot.PushEntries(entries, userIntegrations.MatrixBotURL, userIntegrations.MatrixBotUser, userIntegrations.MatrixBotPassword, userIntegrations.MatrixBotChatID)
if err != nil {
logger.Error("[Integration] push entries to matrix bot failed: %v", err)
}
}
-}
-// PushEntry pushes an entry to third-party providers during feed refreshes.
-func PushEntry(entry *model.Entry, feed *model.Feed, integration *model.Integration) {
- if integration.TelegramBotEnabled {
- logger.Debug("[Integration] Sending Entry %q for User #%d to Telegram", entry.URL, integration.UserID)
+ if userIntegrations.WebhookEnabled {
+ logger.Debug("[Integration] Sending %d entries for User #%d to Webhook URL: %s", len(entries), userIntegrations.UserID, userIntegrations.WebhookURL)
- err := telegrambot.PushEntry(entry, integration.TelegramBotToken, integration.TelegramBotChatID)
- if err != nil {
- logger.Error("[Integration] push entry to telegram bot failed: %v", err)
+ webhookClient := webhook.NewClient(userIntegrations.WebhookURL, userIntegrations.WebhookSecret)
+ if err := webhookClient.SendWebhook(entries); err != nil {
+ logger.Error("[Integration] sending entries to webhook failed: %v", err)
}
}
- if integration.AppriseEnabled {
- logger.Debug("[Integration] Sending Entry %q for User #%d to apprise", entry.URL, integration.UserID)
-
- var appriseServiceURLs string
- if len(feed.AppriseServiceURLs) > 0 {
- appriseServiceURLs = feed.AppriseServiceURLs
- } else {
- appriseServiceURLs = integration.AppriseServicesURL
- }
-
- client := apprise.NewClient(
- appriseServiceURLs,
- integration.AppriseURL,
- )
- if err := client.SendNotification(entry); err != nil {
- logger.Error("[Integration] push entry to apprise failed: %v", err)
+ // Integrations that only support sending individual entries
+ if userIntegrations.TelegramBotEnabled || userIntegrations.AppriseEnabled {
+ for _, entry := range entries {
+ if userIntegrations.TelegramBotEnabled {
+ logger.Debug("[Integration] Sending Entry %q for User #%d to Telegram", entry.URL, userIntegrations.UserID)
+
+ err := telegrambot.PushEntry(entry, userIntegrations.TelegramBotToken, userIntegrations.TelegramBotChatID)
+ if err != nil {
+ logger.Error("[Integration] push entry to telegram bot failed: %v", err)
+ }
+ }
+
+ if userIntegrations.AppriseEnabled {
+ logger.Debug("[Integration] Sending Entry %q for User #%d to apprise", entry.URL, userIntegrations.UserID)
+
+ appriseServiceURLs := userIntegrations.AppriseURL
+ if feed.AppriseServiceURLs != "" {
+ appriseServiceURLs = feed.AppriseServiceURLs
+ }
+
+ client := apprise.NewClient(
+ userIntegrations.AppriseServicesURL,
+ appriseServiceURLs,
+ )
+
+ if err := client.SendNotification(entry); err != nil {
+ logger.Error("[Integration] push entry to apprise failed: %v", err)
+ }
+ }
}
}
}
n value='committer'>committer
path: root/src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-08-23Update globals.d.ts (#4276)Gravatar VietnamecDevelopment 1-1/+1
2023-08-23Fix ffi type (#4265)Gravatar Code Hz 2-49/+272
2023-08-23Bunch of streams fixes (#4251)Gravatar Jarred Sumner 31-548/+866
2023-08-23docs: remove broken DNS link which is also not present in the official docs (...Gravatar Quentin 1-1/+0
2023-08-23Fix more types. (#4273)Gravatar xxxhussein 8-16/+22
2023-08-23ask for bun --revision instead bun -v (#4256)Gravatar Jozef Steinhübl 1-1/+1
2023-08-22fix yield (#4264)Gravatar dave caruso 2-1/+17
2023-08-22Fix Bun.inspect typesGravatar Colin McDonnell 1-1/+1
2023-08-21fix fsevents and stub for qwikcity (#4247)Gravatar dave caruso 9-64/+24
2023-08-21fix stdin stream unref and resuming (#4250)Gravatar Dylan Conway 4-19/+26
2023-08-21Docs and types for v0.8.0 (#4199)Gravatar Colin McDonnell 10-37/+487
2023-08-21Bun v0.8Gravatar Jarred Sumner 5-5/+5
2023-08-21Make the code generator less duplicativeGravatar Jarred Sumner 2-84/+39
2023-08-21import errors have `code` set to `ERR_MODULE_NOT_FOUND` and `require` errors ...Gravatar Jarred Sumner 11-19/+122
2023-08-21fetch(stream) add stream support for compressed and uncompressed data (#4127)Gravatar Ciro Spaciari 19-156/+1876
2023-08-21Fix inquirer (#4245)Gravatar dave caruso 2-3/+6
2023-08-21Update module_loader.zigGravatar Jarred Sumner 1-1/+1
2023-08-21Fix(bundler): allow generating exe file in nested path. (#4226)Gravatar Ai Hoshino 3-7/+49
2023-08-21Fix typoGravatar Colin McDonnell 1-1/+1
2023-08-21Fix crypto.EC constructor (#4242)Gravatar dave caruso 2-3/+4
2023-08-21Implement `napi_ref_threadsafe_function` (#4156)Gravatar dave caruso 10-7/+65
2023-08-21feat: Implement Bun.inspect.custom (#4243)Gravatar dave caruso 6-8/+26
2023-08-21Fixes #4089 (#4105)Gravatar Jarred Sumner 3-36/+136
2023-08-2140x faster .toString('hex') (#4237)Gravatar Jarred Sumner 3-17/+105
2023-08-21Fix memory leak in `buffer.toString("hex")` (#4235)Gravatar Jarred Sumner 2-1/+6
2023-08-21Update README.md (#4232)Gravatar xxxhussein 1-1/+1
2023-08-21Add missing header changeGravatar Jarred Sumner 1-1/+1
2023-08-21Add LazyPropertyGravatar Jarred Sumner 1-0/+3
2023-08-21Fix BigIntStats generated classGravatar Jarred Sumner 1-1/+1
2023-08-21RegenerateGravatar Jarred Sumner 1-8/+15
2023-08-21Implement FileGravatar Jarred Sumner 12-12/+387
2023-08-20Fixes #1675 (#4230)Gravatar Jarred Sumner 8-70/+297
2023-08-20Implement `--inspect-brk` (#4222)Gravatar Jarred Sumner 17-41/+101
2023-08-20Fix test failures from 3a9a6c63a (#4231)Gravatar Jarred Sumner 4-32/+34
2023-08-20Fix(bundler): use different alias mappings based on the target. (#4163)Gravatar Ai Hoshino 8-18/+90
2023-08-19Update BunDebugger.cppGravatar Jarred Sumner 1-1/+3
2023-08-19Introduce `bun --inspect-wait`Gravatar Jarred Sumner 3-19/+47
2023-08-19misc non-posix fixesGravatar Jarred Sumner 2-3/+3
2023-08-19Update lockfile.mdGravatar Jarred Sumner 1-1/+8
2023-08-19Update lockfile.mdGravatar Jarred Sumner 1-4/+4
2023-08-19Update lockfile.mdGravatar Jarred Sumner 1-1/+29
2023-08-19Update Dockerfile-distroless (#4210)Gravatar Omar 1-0/+1
2023-08-19Fix symbol visibilityGravatar Jarred Sumner 1-0/+1
2023-08-19[napi] Implement `node_api_create_syntax_error`, `node_api_symbol_for`, `nod...Gravatar Jarred Sumner 5-1/+70
2023-08-19Fix crash impacting sharp & resvg (#4221)Gravatar Jarred Sumner 5-73/+73
2023-08-19Fixes #172 (#4220)Gravatar Jarred Sumner 7-9/+87
2023-08-19Add inline sourcemaps when `--inspect` is enabled (#4213)Gravatar Jarred Sumner 3-3/+64
2023-08-19tty `ReadStream`, `WriteStream`, and readline rawmode (#4179)Gravatar Dylan Conway 23-722/+821
2023-08-18Fix make headers (again)Gravatar Jarred Sumner 1-0/+2