Add RSS-Bridge integration
This commit is contained in:
parent
5e6c054345
commit
120aabfbce
29 changed files with 161 additions and 5 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
json_parser "encoding/json"
|
json_parser "encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"miniflux.app/v2/internal/http/request"
|
||||||
"miniflux.app/v2/internal/http/response/json"
|
"miniflux.app/v2/internal/http/response/json"
|
||||||
"miniflux.app/v2/internal/model"
|
"miniflux.app/v2/internal/model"
|
||||||
"miniflux.app/v2/internal/reader/subscription"
|
"miniflux.app/v2/internal/reader/subscription"
|
||||||
|
@ -25,6 +26,12 @@ func (h *handler) discoverSubscriptions(w http.ResponseWriter, r *http.Request)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rssbridgeURL string
|
||||||
|
intg, err := h.store.Integration(request.UserID(r))
|
||||||
|
if err == nil && intg != nil && intg.RSSBridgeEnabled {
|
||||||
|
rssbridgeURL = intg.RSSBridgeURL
|
||||||
|
}
|
||||||
|
|
||||||
subscriptions, finderErr := subscription.FindSubscriptions(
|
subscriptions, finderErr := subscription.FindSubscriptions(
|
||||||
subscriptionDiscoveryRequest.URL,
|
subscriptionDiscoveryRequest.URL,
|
||||||
subscriptionDiscoveryRequest.UserAgent,
|
subscriptionDiscoveryRequest.UserAgent,
|
||||||
|
@ -33,6 +40,7 @@ func (h *handler) discoverSubscriptions(w http.ResponseWriter, r *http.Request)
|
||||||
subscriptionDiscoveryRequest.Password,
|
subscriptionDiscoveryRequest.Password,
|
||||||
subscriptionDiscoveryRequest.FetchViaProxy,
|
subscriptionDiscoveryRequest.FetchViaProxy,
|
||||||
subscriptionDiscoveryRequest.AllowSelfSignedCertificates,
|
subscriptionDiscoveryRequest.AllowSelfSignedCertificates,
|
||||||
|
rssbridgeURL,
|
||||||
)
|
)
|
||||||
if finderErr != nil {
|
if finderErr != nil {
|
||||||
json.ServerError(w, r, finderErr)
|
json.ServerError(w, r, finderErr)
|
||||||
|
|
|
@ -799,4 +799,12 @@ var migrations = []func(tx *sql.Tx) error{
|
||||||
_, err = tx.Exec(sql)
|
_, err = tx.Exec(sql)
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
|
func(tx *sql.Tx) (err error) {
|
||||||
|
sql := `
|
||||||
|
ALTER TABLE integrations ADD COLUMN rssbridge_enabled bool default 'f';
|
||||||
|
ALTER TABLE integrations ADD COLUMN rssbridge_url text default '';
|
||||||
|
`
|
||||||
|
_, err = tx.Exec(sql)
|
||||||
|
return
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -673,7 +673,7 @@ func (h *handler) quickAddHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
subscriptions, s_err := mfs.FindSubscriptions(url, "", "", "", "", false, false)
|
subscriptions, s_err := mfs.FindSubscriptions(url, "", "", "", "", false, false, "")
|
||||||
if s_err != nil {
|
if s_err != nil {
|
||||||
json.ServerError(w, r, s_err)
|
json.ServerError(w, r, s_err)
|
||||||
return
|
return
|
||||||
|
|
45
internal/integration/rssbridge/rssbridge.go
Normal file
45
internal/integration/rssbridge/rssbridge.go
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package rssbridge // import "miniflux.app/integration/rssbridge"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Bridge struct {
|
||||||
|
URL string `json:"url"`
|
||||||
|
BridgeMeta BridgeMeta `json:"bridgeMeta"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BridgeMeta struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func DetectBridges(rssbridgeURL, websiteURL string) (bridgeResponse []Bridge, err error) {
|
||||||
|
u, err := url.Parse(rssbridgeURL)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
values := u.Query()
|
||||||
|
values.Add("action", "findfeed")
|
||||||
|
values.Add("format", "atom")
|
||||||
|
values.Add("url", websiteURL)
|
||||||
|
u.RawQuery = values.Encode()
|
||||||
|
|
||||||
|
response, err := http.Get(u.String())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer response.Body.Close()
|
||||||
|
if response.StatusCode == http.StatusNotFound {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if response.StatusCode > 400 {
|
||||||
|
return nil, fmt.Errorf("RSS-Bridge: server failure (%d)", response.StatusCode)
|
||||||
|
}
|
||||||
|
if err := json.NewDecoder(response.Body).Decode(&bridgeResponse); err != nil {
|
||||||
|
return nil, fmt.Errorf("RSS-Bridge: unable to decode bridge response: %w", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API-Schlüsselbezeichnung",
|
"form.api_key.label.description": "API-Schlüsselbezeichnung",
|
||||||
"form.submit.loading": "Lade...",
|
"form.submit.loading": "Lade...",
|
||||||
"form.submit.saving": "Speichern...",
|
"form.submit.saving": "Speichern...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Ετικέτα κλειδιού API",
|
"form.api_key.label.description": "Ετικέτα κλειδιού API",
|
||||||
"form.submit.loading": "Φόρτωση...",
|
"form.submit.loading": "Φόρτωση...",
|
||||||
"form.submit.saving": "Αποθήκευση...",
|
"form.submit.saving": "Αποθήκευση...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API Key Label",
|
"form.api_key.label.description": "API Key Label",
|
||||||
"form.submit.loading": "Loading…",
|
"form.submit.loading": "Loading…",
|
||||||
"form.submit.saving": "Saving…",
|
"form.submit.saving": "Saving…",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Etiqueta de clave API",
|
"form.api_key.label.description": "Etiqueta de clave API",
|
||||||
"form.submit.loading": "Cargando...",
|
"form.submit.loading": "Cargando...",
|
||||||
"form.submit.saving": "Guardando...",
|
"form.submit.saving": "Guardando...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API Key Label",
|
"form.api_key.label.description": "API Key Label",
|
||||||
"form.submit.loading": "Ladataan...",
|
"form.submit.loading": "Ladataan...",
|
||||||
"form.submit.saving": "Tallennetaan...",
|
"form.submit.saving": "Tallennetaan...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Activer le webhook",
|
"form.integration.webhook_activate": "Activer le webhook",
|
||||||
"form.integration.webhook_url": "URL du webhook",
|
"form.integration.webhook_url": "URL du webhook",
|
||||||
"form.integration.webhook_secret": "Secret du webhook",
|
"form.integration.webhook_secret": "Secret du webhook",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Libellé de la clé d'API",
|
"form.api_key.label.description": "Libellé de la clé d'API",
|
||||||
"form.submit.loading": "Chargement...",
|
"form.submit.loading": "Chargement...",
|
||||||
"form.submit.saving": "Sauvegarde en cours...",
|
"form.submit.saving": "Sauvegarde en cours...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "एपीआई कुंजी लेबल",
|
"form.api_key.label.description": "एपीआई कुंजी लेबल",
|
||||||
"form.submit.loading": "लोड हो रहा है...",
|
"form.submit.loading": "लोड हो रहा है...",
|
||||||
"form.submit.saving": "सहेजा जा रहा है...",
|
"form.submit.saving": "सहेजा जा रहा है...",
|
||||||
|
|
|
@ -401,6 +401,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Label Kunci API",
|
"form.api_key.label.description": "Label Kunci API",
|
||||||
"form.submit.loading": "Memuat...",
|
"form.submit.loading": "Memuat...",
|
||||||
"form.submit.saving": "Menyimpan...",
|
"form.submit.saving": "Menyimpan...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Etichetta chiave API",
|
"form.api_key.label.description": "Etichetta chiave API",
|
||||||
"form.submit.loading": "Caricamento in corso...",
|
"form.submit.loading": "Caricamento in corso...",
|
||||||
"form.submit.saving": "Salvataggio in corso...",
|
"form.submit.saving": "Salvataggio in corso...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API キーラベル",
|
"form.api_key.label.description": "API キーラベル",
|
||||||
"form.submit.loading": "読み込み中…",
|
"form.submit.loading": "読み込み中…",
|
||||||
"form.submit.saving": "保存中…",
|
"form.submit.saving": "保存中…",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API-sleutellabel",
|
"form.api_key.label.description": "API-sleutellabel",
|
||||||
"form.submit.loading": "Laden...",
|
"form.submit.loading": "Laden...",
|
||||||
"form.submit.saving": "Opslaag...",
|
"form.submit.saving": "Opslaag...",
|
||||||
|
|
|
@ -406,6 +406,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Etykieta klucza API",
|
"form.api_key.label.description": "Etykieta klucza API",
|
||||||
"form.submit.loading": "Ładowanie...",
|
"form.submit.loading": "Ładowanie...",
|
||||||
"form.submit.saving": "Zapisywanie...",
|
"form.submit.saving": "Zapisywanie...",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Etiqueta da chave de API",
|
"form.api_key.label.description": "Etiqueta da chave de API",
|
||||||
"form.submit.loading": "Carregando...",
|
"form.submit.loading": "Carregando...",
|
||||||
"form.submit.saving": "Salvando...",
|
"form.submit.saving": "Salvando...",
|
||||||
|
|
|
@ -406,6 +406,8 @@
|
||||||
"form.integration.webhook_activate": "Включить вебхуки",
|
"form.integration.webhook_activate": "Включить вебхуки",
|
||||||
"form.integration.webhook_url": "Адрес вебхуков",
|
"form.integration.webhook_url": "Адрес вебхуков",
|
||||||
"form.integration.webhook_secret": "Секретный ключ для вебхуков",
|
"form.integration.webhook_secret": "Секретный ключ для вебхуков",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Описание API-ключа",
|
"form.api_key.label.description": "Описание API-ключа",
|
||||||
"form.submit.loading": "Загрузка…",
|
"form.submit.loading": "Загрузка…",
|
||||||
"form.submit.saving": "Сохранение…",
|
"form.submit.saving": "Сохранение…",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API Anahtar Etiketi",
|
"form.api_key.label.description": "API Anahtar Etiketi",
|
||||||
"form.submit.loading": "Yükleniyor...",
|
"form.submit.loading": "Yükleniyor...",
|
||||||
"form.submit.saving": "Kaydediliyor...",
|
"form.submit.saving": "Kaydediliyor...",
|
||||||
|
|
|
@ -407,6 +407,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "Назва ключа API",
|
"form.api_key.label.description": "Назва ключа API",
|
||||||
"form.submit.loading": "Завантаження...",
|
"form.submit.loading": "Завантаження...",
|
||||||
"form.submit.saving": "Зберігаю...",
|
"form.submit.saving": "Зберігаю...",
|
||||||
|
|
|
@ -402,6 +402,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API密钥标签",
|
"form.api_key.label.description": "API密钥标签",
|
||||||
"form.submit.loading": "载入中…",
|
"form.submit.loading": "载入中…",
|
||||||
"form.submit.saving": "保存中…",
|
"form.submit.saving": "保存中…",
|
||||||
|
|
|
@ -404,6 +404,8 @@
|
||||||
"form.integration.webhook_activate": "Enable Webhook",
|
"form.integration.webhook_activate": "Enable Webhook",
|
||||||
"form.integration.webhook_url": "Webhook URL",
|
"form.integration.webhook_url": "Webhook URL",
|
||||||
"form.integration.webhook_secret": "Webhook Secret",
|
"form.integration.webhook_secret": "Webhook Secret",
|
||||||
|
"form.integration.rssbridge_activate": "Check RSS-Bridge when adding subscriptions",
|
||||||
|
"form.integration.rssbridge_url": "RSS-Bridge server URL",
|
||||||
"form.api_key.label.description": "API金鑰標籤",
|
"form.api_key.label.description": "API金鑰標籤",
|
||||||
"form.submit.loading": "載入中…",
|
"form.submit.loading": "載入中…",
|
||||||
"form.submit.saving": "儲存中…",
|
"form.submit.saving": "儲存中…",
|
||||||
|
|
|
@ -71,4 +71,6 @@ type Integration struct {
|
||||||
WebhookEnabled bool
|
WebhookEnabled bool
|
||||||
WebhookURL string
|
WebhookURL string
|
||||||
WebhookSecret string
|
WebhookSecret string
|
||||||
|
RSSBridgeEnabled bool
|
||||||
|
RSSBridgeURL string
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"miniflux.app/v2/internal/config"
|
"miniflux.app/v2/internal/config"
|
||||||
"miniflux.app/v2/internal/errors"
|
"miniflux.app/v2/internal/errors"
|
||||||
"miniflux.app/v2/internal/http/client"
|
"miniflux.app/v2/internal/http/client"
|
||||||
|
"miniflux.app/v2/internal/integration/rssbridge"
|
||||||
"miniflux.app/v2/internal/reader/browser"
|
"miniflux.app/v2/internal/reader/browser"
|
||||||
"miniflux.app/v2/internal/reader/parser"
|
"miniflux.app/v2/internal/reader/parser"
|
||||||
"miniflux.app/v2/internal/urllib"
|
"miniflux.app/v2/internal/urllib"
|
||||||
|
@ -26,7 +27,25 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// FindSubscriptions downloads and try to find one or more subscriptions from an URL.
|
// FindSubscriptions downloads and try to find one or more subscriptions from an URL.
|
||||||
func FindSubscriptions(websiteURL, userAgent, cookie, username, password string, fetchViaProxy, allowSelfSignedCertificates bool) (Subscriptions, *errors.LocalizedError) {
|
func FindSubscriptions(websiteURL, userAgent, cookie, username, password string, fetchViaProxy, allowSelfSignedCertificates bool, rssbridgeURL string) (Subscriptions, *errors.LocalizedError) {
|
||||||
|
if rssbridgeURL != "" {
|
||||||
|
bridges, err := rssbridge.DetectBridges(rssbridgeURL, websiteURL)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.NewLocalizedError("RSS-Bridge: %v", err)
|
||||||
|
}
|
||||||
|
if len(bridges) > 0 {
|
||||||
|
var subscriptions Subscriptions
|
||||||
|
for _, bridge := range bridges {
|
||||||
|
subscriptions = append(subscriptions, &Subscription{
|
||||||
|
Title: bridge.BridgeMeta.Name,
|
||||||
|
URL: bridge.URL,
|
||||||
|
Type: "atom",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return subscriptions, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
websiteURL = findYoutubeChannelFeed(websiteURL)
|
websiteURL = findYoutubeChannelFeed(websiteURL)
|
||||||
websiteURL = parseYoutubeVideoPage(websiteURL)
|
websiteURL = parseYoutubeVideoPage(websiteURL)
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,9 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
|
||||||
shaarli_api_secret,
|
shaarli_api_secret,
|
||||||
webhook_enabled,
|
webhook_enabled,
|
||||||
webhook_url,
|
webhook_url,
|
||||||
webhook_secret
|
webhook_secret,
|
||||||
|
rssbridge_enabled,
|
||||||
|
rssbridge_url
|
||||||
FROM
|
FROM
|
||||||
integrations
|
integrations
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -248,6 +250,8 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
|
||||||
&integration.WebhookEnabled,
|
&integration.WebhookEnabled,
|
||||||
&integration.WebhookURL,
|
&integration.WebhookURL,
|
||||||
&integration.WebhookSecret,
|
&integration.WebhookSecret,
|
||||||
|
&integration.RSSBridgeEnabled,
|
||||||
|
&integration.RSSBridgeURL,
|
||||||
)
|
)
|
||||||
switch {
|
switch {
|
||||||
case err == sql.ErrNoRows:
|
case err == sql.ErrNoRows:
|
||||||
|
@ -329,9 +333,11 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
|
||||||
shaarli_api_secret=$62,
|
shaarli_api_secret=$62,
|
||||||
webhook_enabled=$63,
|
webhook_enabled=$63,
|
||||||
webhook_url=$64,
|
webhook_url=$64,
|
||||||
webhook_secret=$65
|
webhook_secret=$65,
|
||||||
|
rssbridge_enabled=$66,
|
||||||
|
rssbridge_url=$67
|
||||||
WHERE
|
WHERE
|
||||||
user_id=$66
|
user_id=$68
|
||||||
`
|
`
|
||||||
_, err := s.db.Exec(
|
_, err := s.db.Exec(
|
||||||
query,
|
query,
|
||||||
|
@ -400,6 +406,8 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
|
||||||
integration.WebhookEnabled,
|
integration.WebhookEnabled,
|
||||||
integration.WebhookURL,
|
integration.WebhookURL,
|
||||||
integration.WebhookSecret,
|
integration.WebhookSecret,
|
||||||
|
integration.RSSBridgeEnabled,
|
||||||
|
integration.RSSBridgeURL,
|
||||||
integration.UserID,
|
integration.UserID,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -401,6 +401,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<details {{ if .form.RSSBridgeEnabled }}open{{ end }}>
|
||||||
|
<summary>RSS-Bridge</summary>
|
||||||
|
<div class="form-section">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="rssbridge_enabled" value="1" {{ if .form.RSSBridgeEnabled }}checked{{ end }}> {{ t "form.integration.rssbridge_activate" }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label for="form-rssbridge-url">{{ t "form.integration.rssbridge_url" }}</label>
|
||||||
|
<input type="url" name="rssbridge_url" id="form-rssbridge-url" value="{{ .form.RSSBridgeURL }}" spellcheck="false">
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3>{{ t "page.integration.bookmarklet" }}</h3>
|
<h3>{{ t "page.integration.bookmarklet" }}</h3>
|
||||||
|
|
|
@ -77,6 +77,8 @@ type IntegrationForm struct {
|
||||||
WebhookEnabled bool
|
WebhookEnabled bool
|
||||||
WebhookURL string
|
WebhookURL string
|
||||||
WebhookSecret string
|
WebhookSecret string
|
||||||
|
RSSBridgeEnabled bool
|
||||||
|
RSSBridgeURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge copy form values to the model.
|
// Merge copy form values to the model.
|
||||||
|
@ -143,6 +145,8 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
|
||||||
integration.ShaarliAPISecret = i.ShaarliAPISecret
|
integration.ShaarliAPISecret = i.ShaarliAPISecret
|
||||||
integration.WebhookEnabled = i.WebhookEnabled
|
integration.WebhookEnabled = i.WebhookEnabled
|
||||||
integration.WebhookURL = i.WebhookURL
|
integration.WebhookURL = i.WebhookURL
|
||||||
|
integration.RSSBridgeEnabled = i.RSSBridgeEnabled
|
||||||
|
integration.RSSBridgeURL = i.RSSBridgeURL
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewIntegrationForm returns a new IntegrationForm.
|
// NewIntegrationForm returns a new IntegrationForm.
|
||||||
|
@ -212,6 +216,8 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
|
||||||
ShaarliAPISecret: r.FormValue("shaarli_api_secret"),
|
ShaarliAPISecret: r.FormValue("shaarli_api_secret"),
|
||||||
WebhookEnabled: r.FormValue("webhook_enabled") == "1",
|
WebhookEnabled: r.FormValue("webhook_enabled") == "1",
|
||||||
WebhookURL: r.FormValue("webhook_url"),
|
WebhookURL: r.FormValue("webhook_url"),
|
||||||
|
RSSBridgeEnabled: r.FormValue("rssbridge_enabled") == "1",
|
||||||
|
RSSBridgeURL: r.FormValue("rssbridge_url"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,8 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
|
||||||
WebhookEnabled: integration.WebhookEnabled,
|
WebhookEnabled: integration.WebhookEnabled,
|
||||||
WebhookURL: integration.WebhookURL,
|
WebhookURL: integration.WebhookURL,
|
||||||
WebhookSecret: integration.WebhookSecret,
|
WebhookSecret: integration.WebhookSecret,
|
||||||
|
RSSBridgeEnabled: integration.RSSBridgeEnabled,
|
||||||
|
RSSBridgeURL: integration.RSSBridgeURL,
|
||||||
}
|
}
|
||||||
|
|
||||||
sess := session.New(h.store, request.SessionID(r))
|
sess := session.New(h.store, request.SessionID(r))
|
||||||
|
|
|
@ -50,6 +50,11 @@ func (h *handler) submitSubscription(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rssbridgeURL string
|
||||||
|
if intg, err := h.store.Integration(user.ID); err == nil && intg != nil && intg.RSSBridgeEnabled {
|
||||||
|
rssbridgeURL = intg.RSSBridgeURL
|
||||||
|
}
|
||||||
|
|
||||||
subscriptions, findErr := subscription.FindSubscriptions(
|
subscriptions, findErr := subscription.FindSubscriptions(
|
||||||
subscriptionForm.URL,
|
subscriptionForm.URL,
|
||||||
subscriptionForm.UserAgent,
|
subscriptionForm.UserAgent,
|
||||||
|
@ -58,6 +63,7 @@ func (h *handler) submitSubscription(w http.ResponseWriter, r *http.Request) {
|
||||||
subscriptionForm.Password,
|
subscriptionForm.Password,
|
||||||
subscriptionForm.FetchViaProxy,
|
subscriptionForm.FetchViaProxy,
|
||||||
subscriptionForm.AllowSelfSignedCertificates,
|
subscriptionForm.AllowSelfSignedCertificates,
|
||||||
|
rssbridgeURL,
|
||||||
)
|
)
|
||||||
if findErr != nil {
|
if findErr != nil {
|
||||||
v.Set("form", subscriptionForm)
|
v.Set("form", subscriptionForm)
|
||||||
|
|
Loading…
Reference in a new issue