diff --git a/internal/database/migrations.go b/internal/database/migrations.go index 8285038efa6..217595c93b2 100644 --- a/internal/database/migrations.go +++ b/internal/database/migrations.go @@ -960,4 +960,13 @@ var migrations = []func(tx *sql.Tx) error{ _, err = tx.Exec(sql) return err }, + func(tx *sql.Tx) (err error) { + sql := ` + ALTER TABLE integrations DROP COLUMN omnivore_enabled; + ALTER TABLE integrations DROP COLUMN omnivore_api_key; + ALTER TABLE integrations DROP COLUMN omnivore_url; + ` + _, err = tx.Exec(sql) + return + }, } diff --git a/internal/integration/integration.go b/internal/integration/integration.go index 850811c9d50..3381b9a03c9 100644 --- a/internal/integration/integration.go +++ b/internal/integration/integration.go @@ -19,7 +19,6 @@ import ( "miniflux.app/v2/internal/integration/notion" "miniflux.app/v2/internal/integration/ntfy" "miniflux.app/v2/internal/integration/nunuxkeeper" - "miniflux.app/v2/internal/integration/omnivore" "miniflux.app/v2/internal/integration/pinboard" "miniflux.app/v2/internal/integration/pocket" "miniflux.app/v2/internal/integration/raindrop" @@ -407,24 +406,6 @@ func SendEntry(entry *model.Entry, userIntegrations *model.Integration) { } } - if userIntegrations.OmnivoreEnabled { - slog.Debug("Sending entry to Omnivore", - slog.Int64("user_id", userIntegrations.UserID), - slog.Int64("entry_id", entry.ID), - slog.String("entry_url", entry.URL), - ) - - client := omnivore.NewClient(userIntegrations.OmnivoreAPIKey, userIntegrations.OmnivoreURL) - if err := client.SaveUrl(entry.URL); err != nil { - slog.Error("Unable to send entry to Omnivore", - slog.Int64("user_id", userIntegrations.UserID), - slog.Int64("entry_id", entry.ID), - slog.String("entry_url", entry.URL), - slog.Any("error", err), - ) - } - } - if userIntegrations.RaindropEnabled { slog.Debug("Sending entry to Raindrop", slog.Int64("user_id", userIntegrations.UserID), diff --git a/internal/integration/omnivore/omnivore.go b/internal/integration/omnivore/omnivore.go deleted file mode 100644 index b182a10a95f..00000000000 --- a/internal/integration/omnivore/omnivore.go +++ /dev/null @@ -1,125 +0,0 @@ -// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -package omnivore // import "miniflux.app/v2/internal/integration/omnivore" - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "net/http" - "time" - - "miniflux.app/v2/internal/crypto" - "miniflux.app/v2/internal/version" -) - -const defaultClientTimeout = 10 * time.Second - -const defaultApiEndpoint = "https://api-prod.omnivore.app/api/graphql" - -var mutation = ` -mutation SaveUrl($input: SaveUrlInput!) { - saveUrl(input: $input) { - ... on SaveSuccess { - url - clientRequestId - } - ... on SaveError { - errorCodes - message - } - } -} -` - -type SaveUrlInput struct { - ClientRequestId string `json:"clientRequestId"` - Source string `json:"source"` - Url string `json:"url"` -} - -type errorResponse struct { - Errors []struct { - Message string `json:"message"` - } `json:"errors"` -} - -type successResponse struct { - Data struct { - SaveUrl struct { - Url string `json:"url"` - ClientRequestId string `json:"clientRequestId"` - } `json:"saveUrl"` - } `json:"data"` -} - -type Client interface { - SaveUrl(url string) error -} - -type client struct { - wrapped *http.Client - apiEndpoint string - apiToken string -} - -func NewClient(apiToken string, apiEndpoint string) Client { - if apiEndpoint == "" { - apiEndpoint = defaultApiEndpoint - } - - return &client{wrapped: &http.Client{Timeout: defaultClientTimeout}, apiEndpoint: apiEndpoint, apiToken: apiToken} -} - -func (c *client) SaveUrl(url string) error { - var payload = map[string]interface{}{ - "query": mutation, - "variables": map[string]interface{}{ - "input": map[string]interface{}{ - "clientRequestId": crypto.GenerateUUID(), - "source": "api", - "url": url, - }, - }, - } - b, err := json.Marshal(payload) - if err != nil { - return err - } - req, err := http.NewRequest(http.MethodPost, c.apiEndpoint, bytes.NewReader(b)) - if err != nil { - return err - } - - req.Header.Set("Authorization", c.apiToken) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("User-Agent", "Miniflux/"+version.Version) - - resp, err := c.wrapped.Do(req) - if err != nil { - return err - } - - defer resp.Body.Close() - b, err = io.ReadAll(resp.Body) - if err != nil { - return fmt.Errorf("omnivore: failed to parse response: %s", err) - } - - if resp.StatusCode >= 400 { - var errResponse errorResponse - if err = json.Unmarshal(b, &errResponse); err != nil { - return fmt.Errorf("omnivore: failed to save URL: status=%d %s", resp.StatusCode, string(b)) - } - return fmt.Errorf("omnivore: failed to save URL: status=%d %s", resp.StatusCode, errResponse.Errors[0].Message) - } - - var successReponse successResponse - if err = json.Unmarshal(b, &successReponse); err != nil { - return fmt.Errorf("omnivore: failed to parse response, however the request appears successful, is the url correct?: status=%d %s", resp.StatusCode, string(b)) - } - - return nil -} diff --git a/internal/model/integration.go b/internal/model/integration.go index 5b8d70abcba..0e86420ba07 100644 --- a/internal/model/integration.go +++ b/internal/model/integration.go @@ -90,9 +90,6 @@ type Integration struct { WebhookSecret string RSSBridgeEnabled bool RSSBridgeURL string - OmnivoreEnabled bool - OmnivoreAPIKey string - OmnivoreURL string RaindropEnabled bool RaindropToken string RaindropCollectionID string diff --git a/internal/storage/integration.go b/internal/storage/integration.go index dea3369d1bd..31498ab8054 100644 --- a/internal/storage/integration.go +++ b/internal/storage/integration.go @@ -191,9 +191,6 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) { webhook_secret, rssbridge_enabled, rssbridge_url, - omnivore_enabled, - omnivore_api_key, - omnivore_url, raindrop_enabled, raindrop_token, raindrop_collection_id, @@ -299,9 +296,6 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) { &integration.WebhookSecret, &integration.RSSBridgeEnabled, &integration.RSSBridgeURL, - &integration.OmnivoreEnabled, - &integration.OmnivoreAPIKey, - &integration.OmnivoreURL, &integration.RaindropEnabled, &integration.RaindropToken, &integration.RaindropCollectionID, @@ -413,9 +407,6 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { webhook_secret=$76, rssbridge_enabled=$77, rssbridge_url=$78, - omnivore_enabled=$79, - omnivore_api_key=$80, - omnivore_url=$81, linkwarden_enabled=$82, linkwarden_url=$83, linkwarden_api_key=$84, @@ -518,9 +509,6 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { integration.WebhookSecret, integration.RSSBridgeEnabled, integration.RSSBridgeURL, - integration.OmnivoreEnabled, - integration.OmnivoreAPIKey, - integration.OmnivoreURL, integration.LinkwardenEnabled, integration.LinkwardenURL, integration.LinkwardenAPIKey, @@ -577,7 +565,6 @@ func (s *Storage) HasSaveEntry(userID int64) (result bool) { readeck_enabled='t' OR shaarli_enabled='t' OR webhook_enabled='t' OR - omnivore_enabled='t' OR raindrop_enabled='t' OR betula_enabled='t' OR cubox_enabled='t' diff --git a/internal/template/templates/views/integrations.html b/internal/template/templates/views/integrations.html index 469abcd5e87..01e72f9bec8 100644 --- a/internal/template/templates/views/integrations.html +++ b/internal/template/templates/views/integrations.html @@ -325,25 +325,6 @@

{{ t "page.integrations.title" }}

-
- Omnivore -
- - - - - - - - -
- -
-
-
-
Pinboard
diff --git a/internal/ui/form/integration.go b/internal/ui/form/integration.go index 0852123be6a..4c62f2bab8f 100644 --- a/internal/ui/form/integration.go +++ b/internal/ui/form/integration.go @@ -93,9 +93,6 @@ type IntegrationForm struct { WebhookSecret string RSSBridgeEnabled bool RSSBridgeURL string - OmnivoreEnabled bool - OmnivoreAPIKey string - OmnivoreURL string RaindropEnabled bool RaindropToken string RaindropCollectionID string @@ -194,9 +191,6 @@ func (i IntegrationForm) Merge(integration *model.Integration) { integration.WebhookURL = i.WebhookURL integration.RSSBridgeEnabled = i.RSSBridgeEnabled integration.RSSBridgeURL = i.RSSBridgeURL - integration.OmnivoreEnabled = i.OmnivoreEnabled - integration.OmnivoreAPIKey = i.OmnivoreAPIKey - integration.OmnivoreURL = i.OmnivoreURL integration.RaindropEnabled = i.RaindropEnabled integration.RaindropToken = i.RaindropToken integration.RaindropCollectionID = i.RaindropCollectionID @@ -298,9 +292,6 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm { WebhookURL: r.FormValue("webhook_url"), RSSBridgeEnabled: r.FormValue("rssbridge_enabled") == "1", RSSBridgeURL: r.FormValue("rssbridge_url"), - OmnivoreEnabled: r.FormValue("omnivore_enabled") == "1", - OmnivoreAPIKey: r.FormValue("omnivore_api_key"), - OmnivoreURL: r.FormValue("omnivore_url"), RaindropEnabled: r.FormValue("raindrop_enabled") == "1", RaindropToken: r.FormValue("raindrop_token"), RaindropCollectionID: r.FormValue("raindrop_collection_id"), diff --git a/internal/ui/integration_show.go b/internal/ui/integration_show.go index 1395fab263c..4bdf2850eec 100644 --- a/internal/ui/integration_show.go +++ b/internal/ui/integration_show.go @@ -107,9 +107,6 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) { WebhookSecret: integration.WebhookSecret, RSSBridgeEnabled: integration.RSSBridgeEnabled, RSSBridgeURL: integration.RSSBridgeURL, - OmnivoreEnabled: integration.OmnivoreEnabled, - OmnivoreAPIKey: integration.OmnivoreAPIKey, - OmnivoreURL: integration.OmnivoreURL, RaindropEnabled: integration.RaindropEnabled, RaindropToken: integration.RaindropToken, RaindropCollectionID: integration.RaindropCollectionID,