Skip to content

Commit

Permalink
Apprise Service Urls per feed
Browse files Browse the repository at this point in the history
  • Loading branch information
fuchsrot committed Aug 26, 2023
1 parent 114f9f2 commit 520a803
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 8 deletions.
6 changes: 6 additions & 0 deletions internal/database/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,4 +752,10 @@ var migrations = []func(tx *sql.Tx) error{
_, err = tx.Exec(sql)
return err
},
func(tx *sql.Tx) (err error) {
_, err = tx.Exec(`
ALTER TABLE feeds ADD COLUMN apprise_service_urls text default '';
`)
return err
},
}
11 changes: 9 additions & 2 deletions internal/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func PushEntries(entries model.Entries, integration *model.Integration) {
}

// PushEntry pushes an entry to third-party providers during feed refreshes.
func PushEntry(entry *model.Entry, integration *model.Integration) {
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)

Expand All @@ -193,8 +193,15 @@ func PushEntry(entry *model.Entry, integration *model.Integration) {
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(
integration.AppriseServicesURL,
appriseServiceURLs,
integration.AppriseURL,
)

Expand Down
3 changes: 2 additions & 1 deletion internal/locale/translations/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"form.feed.label.blocklist_rules": "Blockierregeln",
"form.feed.label.keeplist_rules": "Erlaubnisregeln",
"form.feed.label.urlrewrite_rules": "Umschreibregeln für URL",
"form.feed.label.apprise_service_urls": "Kommaseparierte Liste der Apprise service URLs",
"form.feed.label.ignore_http_cache": "Ignoriere HTTP-cache",
"form.feed.label.allow_self_signed_certificates": "Erlaube selbstsignierte oder ungültige Zertifikate",
"form.feed.label.fetch_via_proxy": "Über Proxy abrufen",
Expand Down Expand Up @@ -357,7 +358,7 @@
"form.integration.notion_token": "Notion Secret Token",
"form.integration.apprise_activate": "Push entries to Apprise",
"form.integration.apprise_url": "Apprise API URL",
"form.integration.apprise_services_url": "Comma separated list of Apprise service URLs",
"form.integration.apprise_services_url": "Kommaseparierte Liste der Apprise service URLs",
"form.integration.nunux_keeper_activate": "Artikel in Nunux Keeper speichern",
"form.integration.nunux_keeper_endpoint": "Nunux Keeper API-Endpunkt",
"form.integration.nunux_keeper_api_key": "Nunux Keeper API-Schlüssel",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/el_EL.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
"error.feed_invalid_blocklist_rule": "Ο κανόνας λίστας μπλοκ δεν είναι έγκυρος.",
"error.feed_invalid_keeplist_rule": "Ο κανόνας keep list δεν είναι έγκυρος.",
"form.feed.label.urlrewrite_rules": "επανεγγραφή κανόνων για τη διεύθυνση URL.",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"error.user_mandatory_fields": "Το όνομα χρήστη είναι υποχρεωτικό.",
"error.api_key_already_exists": "Αυτό το κλειδί API υπάρχει ήδη.",
"error.unable_to_create_api_key": "Δεν είναι δυνατή η δημιουργία αυτού του κλειδιού API.",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
"form.feed.label.cookie": "Set Cookies",
"form.feed.label.scraper_rules": "Scraper Rules",
"form.feed.label.rewrite_rules": "Rewrite Rules",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.blocklist_rules": "Block Rules",
"form.feed.label.keeplist_rules": "Keep Rules",
"form.feed.label.urlrewrite_rules": "URL Rewrite Rules",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
"form.feed.label.cookie": "Configurar las cookies",
"form.feed.label.scraper_rules": "Reglas de extracción de información",
"form.feed.label.rewrite_rules": "Reglas de reescribir",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.blocklist_rules": "Reglas de Filtrado (Bloquear)",
"form.feed.label.keeplist_rules": "Reglas de Filtrado (Permitir)",
"form.feed.label.urlrewrite_rules": "Reglas de Filtrado (Reescritura)",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/fi_FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
"error.feed_invalid_blocklist_rule": "The block list rule is invalid.",
"error.feed_invalid_keeplist_rule": "The keep list rule is invalid.",
"form.feed.label.urlrewrite_rules": "URL-osoitteen uudelleenkirjoitussäännöt",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"error.user_mandatory_fields": "Käyttäjätunnus on pakollinen.",
"error.api_key_already_exists": "API-avain on jo olemassa.",
"error.unable_to_create_api_key": "API-avainta ei voi luoda.",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
"form.feed.label.cookie": "Définir les cookies",
"form.feed.label.scraper_rules": "Règles pour récupérer le contenu original",
"form.feed.label.rewrite_rules": "Règles de réécriture",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.blocklist_rules": "Règles de blocage",
"form.feed.label.keeplist_rules": "Règles d'autorisation",
"form.feed.label.urlrewrite_rules": "Règles de réécriture d'URL",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/hi_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
"form.feed.label.cookie": "कुकीज़ सेट करें",
"form.feed.label.scraper_rules": "खुरचनी नियम",
"form.feed.label.rewrite_rules": "नियम फिर से लिखें",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.blocklist_rules": "ब्लॉक नियम",
"form.feed.label.keeplist_rules": "नियम बनाए रखें",
"form.feed.label.urlrewrite_rules": " यूआरएल पुनर्लेखन नियम",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/id_ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
"form.feed.label.cookie": "Atur Kuki",
"form.feed.label.scraper_rules": "Aturan Pengambil Data",
"form.feed.label.rewrite_rules": "Aturan Tulis Ulang",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.blocklist_rules": "Aturan Blokir",
"form.feed.label.keeplist_rules": "Aturan Simpan",
"form.feed.label.urlrewrite_rules": "Aturan Tulis Ulang URL",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
"form.feed.label.cookie": "Installare i cookies",
"form.feed.label.scraper_rules": "Regole di estrazione del contenuto",
"form.feed.label.rewrite_rules": "Regole di impaginazione del contenuto",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.blocklist_rules": "Regole di blocco",
"form.feed.label.keeplist_rules": "Regole di autorizzazione",
"form.feed.label.urlrewrite_rules": "Regole di riscrittura URL",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"form.feed.label.blocklist_rules": "Block ルール",
"form.feed.label.keeplist_rules": "Keep ルール",
"form.feed.label.urlrewrite_rules": "Rewrite URL ルール",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "HTTPキャッシュを無視",
"form.feed.label.allow_self_signed_certificates": "自己署名証明書または無効な証明書を許可する",
"form.feed.label.fetch_via_proxy": "プロキシ経由で取得",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/nl_NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"form.feed.label.blocklist_rules": "Blokkeer regels",
"form.feed.label.keeplist_rules": "toestemmingsregels",
"form.feed.label.urlrewrite_rules": "Regels voor het herschrijven van URL's",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "Negeer HTTP-cache",
"form.feed.label.allow_self_signed_certificates": "Sta zelfondertekende of ongeldige certificaten toe",
"form.feed.label.fetch_via_proxy": "Ophalen via proxy",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
"form.feed.label.blocklist_rules": "Zasady blokowania",
"form.feed.label.keeplist_rules": "Zasady zezwoleń",
"form.feed.label.urlrewrite_rules": "Zasady przepisywania adresów URL",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "Zignoruj ​​pamięć podręczną HTTP",
"form.feed.label.allow_self_signed_certificates": "Zezwalaj na certyfikaty z podpisem własnym lub nieprawidłowe certyfikaty",
"form.feed.label.fetch_via_proxy": "Pobierz przez proxy",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"form.feed.label.blocklist_rules": "Regras de bloqueio",
"form.feed.label.keeplist_rules": "Regras de permissão",
"form.feed.label.urlrewrite_rules": "Regras de reescrita de URL",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "Ignorar cache HTTP",
"form.feed.label.allow_self_signed_certificates": "Permitir certificados autoassinados ou inválidos",
"form.feed.label.disabled": "Não atualizar esta fonte",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
"form.feed.label.blocklist_rules": "Правила черного списка",
"form.feed.label.keeplist_rules": "Правила белого списка",
"form.feed.label.urlrewrite_rules": "Правила перезаписи URL",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "Игнорировать HTTP кеш",
"form.feed.label.allow_self_signed_certificates": "Разрешить самоподписанные или недействительные сертификаты",
"form.feed.label.fetch_via_proxy": "Использовать прокси",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/tr_TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"form.feed.label.blocklist_rules": "Engelleme Kuralları",
"form.feed.label.keeplist_rules": "Saklama Kuralları",
"form.feed.label.urlrewrite_rules": "URL Yeniden Yazma Kuralları",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "HTTP önbelleğini yoksay",
"form.feed.label.allow_self_signed_certificates": "Kendinden imzalı veya geçersiz sertifikalara izin ver",
"form.feed.label.fetch_via_proxy": "Proxy ile çek",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/uk_UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
"form.feed.label.blocklist_rules": "Правила блокування",
"form.feed.label.keeplist_rules": "Правила дозволення",
"form.feed.label.urlrewrite_rules": "Правила перезапису URL-адрес",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "Ігнорувати кеш HTTP",
"form.feed.label.allow_self_signed_certificates": "Дозволити сертифікати з власним підписом або недійсні",
"form.feed.label.fetch_via_proxy": "Використати проксі-сервер",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
"form.feed.label.blocklist_rules": "阻止规则",
"form.feed.label.keeplist_rules": "保留规则",
"form.feed.label.urlrewrite_rules": "URL 重写规则",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "忽略 HTTP 缓存",
"form.feed.label.allow_self_signed_certificates": "允许自签名证书或无效证书",
"form.feed.label.fetch_via_proxy": "通过代理获取",
Expand Down
1 change: 1 addition & 0 deletions internal/locale/translations/zh_TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"form.feed.label.blocklist_rules": "過濾規則",
"form.feed.label.keeplist_rules": "保留規則",
"form.feed.label.urlrewrite_rules": "URL 重写规则",
"form.feed.label.apprise_service_urls": "Comma separated list of Apprise service URLs",
"form.feed.label.ignore_http_cache": "忽略 HTTP 快取",
"form.feed.label.allow_self_signed_certificates": "允許自簽章憑證或無效憑證",
"form.feed.label.fetch_via_proxy": "透過代理獲取",
Expand Down
1 change: 1 addition & 0 deletions internal/model/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Feed struct {
HideGlobally bool `json:"hide_globally"`
UnreadCount int `json:"-"`
ReadCount int `json:"-"`
AppriseServiceURLs string `json:"apprise_service_urls"`
}

type FeedCounters struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/reader/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func ProcessFeedEntries(store *storage.Storage, feed *model.Feed, user *model.Us
} else if intg != nil {
localEntry := entry
go func() {
integration.PushEntry(localEntry, intg)
integration.PushEntry(localEntry, feed, intg)
}()
entriesToPush = append(entriesToPush, localEntry)
}
Expand Down
10 changes: 7 additions & 3 deletions internal/storage/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,11 @@ func (s *Storage) CreateFeed(feed *model.Feed) error {
fetch_via_proxy,
hide_globally,
url_rewrite_rules,
no_media_player
no_media_player,
apprise_service_urls
)
VALUES
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23)
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24)
RETURNING
id
`
Expand Down Expand Up @@ -272,6 +273,7 @@ func (s *Storage) CreateFeed(feed *model.Feed) error {
feed.HideGlobally,
feed.UrlRewriteRules,
feed.NoMediaPlayer,
feed.AppriseServiceURLs,
).Scan(&feed.ID)
if err != nil {
return fmt.Errorf(`store: unable to create feed %q: %v`, feed.FeedURL, err)
Expand Down Expand Up @@ -342,7 +344,8 @@ func (s *Storage) UpdateFeed(feed *model.Feed) (err error) {
fetch_via_proxy=$23,
hide_globally=$24,
url_rewrite_rules=$25,
no_media_player=$26
no_media_player=$26,
apprise_service_urls=$29
WHERE
id=$27 AND user_id=$28
`
Expand Down Expand Up @@ -375,6 +378,7 @@ func (s *Storage) UpdateFeed(feed *model.Feed) (err error) {
feed.NoMediaPlayer,
feed.ID,
feed.UserID,
feed.AppriseServiceURLs,
)

if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion internal/storage/feed_query_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ func (f *FeedQueryBuilder) GetFeeds() (model.Feeds, error) {
c.title as category_title,
c.hide_globally as category_hidden,
fi.icon_id,
u.timezone
u.timezone,
f.apprise_service_urls
FROM
feeds f
LEFT JOIN
Expand Down Expand Up @@ -226,6 +227,7 @@ func (f *FeedQueryBuilder) GetFeeds() (model.Feeds, error) {
&feed.Category.HideGlobally,
&iconID,
&tz,
&feed.AppriseServiceURLs,
)

if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions internal/template/templates/views/edit_feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ <h3>{{ t "page.edit_feed.last_parsing_error" }}</h3>
</div>
<input type="text" name="urlrewrite_rules" id="form-urlrewrite-rules" value="{{ .form.UrlRewriteRules }}" spellcheck="false">

<div class="form-label-row">
<label for="form-apprise-service-urls">
{{ t "form.feed.label.apprise_service_urls" }}
</label>
&nbsp;
</div>
<input type="text" name="apprise_service_urls" id="form-apprise-service-urls" value="{{ .form.AppriseServiceURLs }}" spellcheck="false">

<label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "form.feed.label.crawler" }}</label>
<label><input type="checkbox" name="ignore_http_cache" value="1" {{ if .form.IgnoreHTTPCache }}checked{{ end }}> {{ t "form.feed.label.ignore_http_cache" }}</label>
<label><input type="checkbox" name="allow_self_signed_certificates" value="1" {{ if .form.AllowSelfSignedCertificates }}checked{{ end }}> {{ t "form.feed.label.allow_self_signed_certificates" }}</label>
Expand Down
1 change: 1 addition & 0 deletions internal/ui/feed_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (h *handler) showEditFeedPage(w http.ResponseWriter, r *http.Request) {
NoMediaPlayer: feed.NoMediaPlayer,
HideGlobally: feed.HideGlobally,
CategoryHidden: feed.Category.HideGlobally,
AppriseServiceURLs: feed.AppriseServiceURLs,
}

sess := session.New(h.store, request.SessionID(r))
Expand Down
3 changes: 3 additions & 0 deletions internal/ui/form/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type FeedForm struct {
NoMediaPlayer bool
HideGlobally bool
CategoryHidden bool // Category has "hide_globally"
AppriseServiceURLs string
}

// Merge updates the fields of the given feed.
Expand All @@ -59,6 +60,7 @@ func (f FeedForm) Merge(feed *model.Feed) *model.Feed {
feed.Disabled = f.Disabled
feed.NoMediaPlayer = f.NoMediaPlayer
feed.HideGlobally = f.HideGlobally
feed.AppriseServiceURLs = f.AppriseServiceURLs
return feed
}

Expand Down Expand Up @@ -89,5 +91,6 @@ func NewFeedForm(r *http.Request) *FeedForm {
Disabled: r.FormValue("disabled") == "1",
NoMediaPlayer: r.FormValue("no_media_player") == "1",
HideGlobally: r.FormValue("hide_globally") == "1",
AppriseServiceURLs: r.FormValue("apprise_service_urls"),
}
}

0 comments on commit 520a803

Please sign in to comment.