feat: add linkace service integration

This commit is contained in:
MDeLuise 2024-01-23 18:12:31 +01:00 committed by Frédéric Guillot
parent e8147f26b9
commit 1e704468a5
26 changed files with 347 additions and 34 deletions

View file

@ -834,4 +834,16 @@ var migrations = []func(tx *sql.Tx) error{
_, err = tx.Exec(sql) _, err = tx.Exec(sql)
return return
}, },
func(tx *sql.Tx) (err error) {
sql := `
ALTER TABLE integrations ADD COLUMN linkace_enabled bool default 'f';
ALTER TABLE integrations ADD COLUMN linkace_url text default '';
ALTER TABLE integrations ADD COLUMN linkace_api_key text default '';
ALTER TABLE integrations ADD COLUMN linkace_tags text default '';
ALTER TABLE integrations ADD COLUMN linkace_is_private bool default 't';
ALTER TABLE integrations ADD COLUMN linkace_check_disabled bool default 't';
`
_, err = tx.Exec(sql)
return err
},
} }

View file

@ -10,6 +10,7 @@ import (
"miniflux.app/v2/internal/integration/apprise" "miniflux.app/v2/internal/integration/apprise"
"miniflux.app/v2/internal/integration/espial" "miniflux.app/v2/internal/integration/espial"
"miniflux.app/v2/internal/integration/instapaper" "miniflux.app/v2/internal/integration/instapaper"
"miniflux.app/v2/internal/integration/linkace"
"miniflux.app/v2/internal/integration/linkding" "miniflux.app/v2/internal/integration/linkding"
"miniflux.app/v2/internal/integration/matrixbot" "miniflux.app/v2/internal/integration/matrixbot"
"miniflux.app/v2/internal/integration/notion" "miniflux.app/v2/internal/integration/notion"
@ -180,6 +181,30 @@ func SendEntry(entry *model.Entry, userIntegrations *model.Integration) {
} }
} }
if userIntegrations.LinkAceEnabled {
slog.Debug("Sending entry to LinkAce",
slog.Int64("user_id", userIntegrations.UserID),
slog.Int64("entry_id", entry.ID),
slog.String("entry_url", entry.URL),
)
client := linkace.NewClient(
userIntegrations.LinkAceURL,
userIntegrations.LinkAceAPIKey,
userIntegrations.LinkAceTags,
userIntegrations.LinkAcePrivate,
userIntegrations.LinkAceCheckDisabled,
)
if err := client.AddURL(entry.URL, entry.Title); err != nil {
slog.Error("Unable to send entry to LinkAce",
slog.Int64("user_id", userIntegrations.UserID),
slog.Int64("entry_id", entry.ID),
slog.String("entry_url", entry.URL),
slog.Any("error", err),
)
}
}
if userIntegrations.LinkdingEnabled { if userIntegrations.LinkdingEnabled {
slog.Debug("Sending entry to Linkding", slog.Debug("Sending entry to Linkding",
slog.Int64("user_id", userIntegrations.UserID), slog.Int64("user_id", userIntegrations.UserID),

View file

@ -0,0 +1,83 @@
package linkace
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
"miniflux.app/v2/internal/urllib"
"miniflux.app/v2/internal/version"
)
const defaultClientTimeout = 10 * time.Second
type Client struct {
baseURL string
apiKey string
tags string
private bool
checkDisabled bool
}
func NewClient(baseURL, apiKey, tags string, private bool, checkDisabled bool) *Client {
return &Client{baseURL: baseURL, apiKey: apiKey, tags: tags, private: private, checkDisabled: checkDisabled}
}
func (c *Client) AddURL(entryURL, entryTitle string) error {
if c.baseURL == "" || c.apiKey == "" {
return fmt.Errorf("linkace: missing base URL or API key")
}
tagsSplitFn := func(c rune) bool {
return c == ',' || c == ' '
}
apiEndpoint, err := urllib.JoinBaseURLAndPath(c.baseURL, "/api/v1/links")
if err != nil {
return fmt.Errorf("linkace: invalid API endpoint: %v", err)
}
requestBody, err := json.Marshal(&createItemRequest{
Url: entryURL,
Title: entryTitle,
Tags: strings.FieldsFunc(c.tags, tagsSplitFn),
Private: c.private,
CheckDisabled: c.checkDisabled,
})
if err != nil {
return fmt.Errorf("linkace: unable to encode request body: %v", err)
}
request, err := http.NewRequest(http.MethodPost, apiEndpoint, bytes.NewReader(requestBody))
if err != nil {
return fmt.Errorf("linkace: unable to create request: %v", err)
}
request.Header.Set("Content-Type", "application/json")
request.Header.Set("Accept", "application/json")
request.Header.Set("User-Agent", "Miniflux/"+version.Version)
request.Header.Set("Authorization", "Bearer "+c.apiKey)
httpClient := &http.Client{Timeout: defaultClientTimeout}
response, err := httpClient.Do(request)
if err != nil {
return fmt.Errorf("linkace: unable to send request: %v", err)
}
defer response.Body.Close()
if response.StatusCode >= 400 {
return fmt.Errorf("linkace: unable to create item: url=%s status=%d", apiEndpoint, response.StatusCode)
}
return nil
}
type createItemRequest struct {
Title string `json:"title,omitempty"`
Url string `json:"url"`
Tags []string `json:"tags,omitempty"`
Private bool `json:"is_private,omitempty"`
CheckDisabled bool `json:"check_disabled,omitempty"`
}

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Webseiten-Vorschau deaktivieren", "form.integration.telegram_bot_disable_web_page_preview": "Webseiten-Vorschau deaktivieren",
"form.integration.telegram_bot_disable_notification": "Benachrichtigungen deaktivieren", "form.integration.telegram_bot_disable_notification": "Benachrichtigungen deaktivieren",
"form.integration.telegram_bot_disable_buttons": "Schaltfächen deaktivieren", "form.integration.telegram_bot_disable_buttons": "Schaltfächen deaktivieren",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Artikel in Linkding speichern", "form.integration.linkding_activate": "Artikel in Linkding speichern",
"form.integration.linkding_endpoint": "Linkding API-Endpunkt", "form.integration.linkding_endpoint": "Linkding API-Endpunkt",
"form.integration.linkding_api_key": "Linkding API-Schlüssel", "form.integration.linkding_api_key": "Linkding API-Schlüssel",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Αποθήκευση άρθρων στο Linkding", "form.integration.linkding_activate": "Αποθήκευση άρθρων στο Linkding",
"form.integration.linkding_endpoint": "Τελικό σημείο Linkding API", "form.integration.linkding_endpoint": "Τελικό σημείο Linkding API",
"form.integration.linkding_api_key": "Κλειδί API Linkding", "form.integration.linkding_api_key": "Κλειδί API Linkding",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Save entries to Linkding", "form.integration.linkding_activate": "Save entries to Linkding",
"form.integration.linkding_endpoint": "Linkding API Endpoint", "form.integration.linkding_endpoint": "Linkding API Endpoint",
"form.integration.linkding_api_key": "Linkding API key", "form.integration.linkding_api_key": "Linkding API key",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Enviar artículos a Linkding", "form.integration.linkding_activate": "Enviar artículos a Linkding",
"form.integration.linkding_endpoint": "Acceso API de Linkding", "form.integration.linkding_endpoint": "Acceso API de Linkding",
"form.integration.linkding_api_key": "Clave de API de Linkding", "form.integration.linkding_api_key": "Clave de API de Linkding",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Tallenna artikkelit Linkkiin", "form.integration.linkding_activate": "Tallenna artikkelit Linkkiin",
"form.integration.linkding_endpoint": "Linkding API-päätepiste", "form.integration.linkding_endpoint": "Linkding API-päätepiste",
"form.integration.linkding_api_key": "Linkding API-avain", "form.integration.linkding_api_key": "Linkding API-avain",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Désactiver l'aperçu de la page Web", "form.integration.telegram_bot_disable_web_page_preview": "Désactiver l'aperçu de la page Web",
"form.integration.telegram_bot_disable_notification": "Désactiver les notifications", "form.integration.telegram_bot_disable_notification": "Désactiver les notifications",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Sauvegarder les articles vers Linkding", "form.integration.linkding_activate": "Sauvegarder les articles vers Linkding",
"form.integration.linkding_endpoint": "URL de l'API de Linkding", "form.integration.linkding_endpoint": "URL de l'API de Linkding",
"form.integration.linkding_api_key": "Clé d'API de Linkding", "form.integration.linkding_api_key": "Clé d'API de Linkding",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "लिंक्डिन में विषयवस्तु सहेजें", "form.integration.linkding_activate": "लिंक्डिन में विषयवस्तु सहेजें",
"form.integration.linkding_endpoint": "लिंकिंग एपीआई समापन बिंदु", "form.integration.linkding_endpoint": "लिंकिंग एपीआई समापन बिंदु",
"form.integration.linkding_api_key": "लिंकिंग एपीआई कुंजी", "form.integration.linkding_api_key": "लिंकिंग एपीआई कुंजी",

View file

@ -398,6 +398,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Simpan artikel ke Linkding", "form.integration.linkding_activate": "Simpan artikel ke Linkding",
"form.integration.linkding_endpoint": "Titik URL API Linkding", "form.integration.linkding_endpoint": "Titik URL API Linkding",
"form.integration.linkding_api_key": "Kunci API Linkding", "form.integration.linkding_api_key": "Kunci API Linkding",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Salva gli articoli su LinkAce",
"form.integration.linkace_endpoint": "Endpoint dell'API di LinkAce",
"form.integration.linkace_api_key": "API key dell'account LinkAce",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Rendi i link privati",
"form.integration.linkace_check_disabled": "Disabilita i controlli",
"form.integration.linkding_activate": "Salva gli articoli su Linkding", "form.integration.linkding_activate": "Salva gli articoli su Linkding",
"form.integration.linkding_endpoint": "Endpoint dell'API di Linkding", "form.integration.linkding_endpoint": "Endpoint dell'API di Linkding",
"form.integration.linkding_api_key": "API key dell'account Linkding", "form.integration.linkding_api_key": "API key dell'account Linkding",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Linkding に記事を保存する", "form.integration.linkding_activate": "Linkding に記事を保存する",
"form.integration.linkding_endpoint": "Linkding の API Endpoint", "form.integration.linkding_endpoint": "Linkding の API Endpoint",
"form.integration.linkding_api_key": "Linkding の API key", "form.integration.linkding_api_key": "Linkding の API key",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Opslaan naar Linkding", "form.integration.linkding_activate": "Opslaan naar Linkding",
"form.integration.linkding_endpoint": "Linkding URL", "form.integration.linkding_endpoint": "Linkding URL",
"form.integration.linkding_api_key": "Linkding API-sleutel", "form.integration.linkding_api_key": "Linkding API-sleutel",

View file

@ -404,6 +404,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Zapisz artykuły do Linkding", "form.integration.linkding_activate": "Zapisz artykuły do Linkding",
"form.integration.linkding_endpoint": "Linkding URL", "form.integration.linkding_endpoint": "Linkding URL",
"form.integration.linkding_api_key": "Linkding API key", "form.integration.linkding_api_key": "Linkding API key",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Salvar itens no Linkding", "form.integration.linkding_activate": "Salvar itens no Linkding",
"form.integration.linkding_endpoint": "Endpoint de API do Linkding", "form.integration.linkding_endpoint": "Endpoint de API do Linkding",
"form.integration.linkding_api_key": "Chave de API do Linkding", "form.integration.linkding_api_key": "Chave de API do Linkding",

View file

@ -404,6 +404,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Сохранять статьи в Linkding", "form.integration.linkding_activate": "Сохранять статьи в Linkding",
"form.integration.linkding_endpoint": "Конечная точка Linkding API", "form.integration.linkding_endpoint": "Конечная точка Linkding API",
"form.integration.linkding_api_key": "API-ключ Linkding", "form.integration.linkding_api_key": "API-ключ Linkding",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview", "form.integration.telegram_bot_disable_web_page_preview": "Disable web page preview",
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Makaleleri Linkding'e kaydet", "form.integration.linkding_activate": "Makaleleri Linkding'e kaydet",
"form.integration.linkding_endpoint": "Linkding API Uç Noktası", "form.integration.linkding_endpoint": "Linkding API Uç Noktası",
"form.integration.linkding_api_key": "Linkding API Anahtarı", "form.integration.linkding_api_key": "Linkding API Anahtarı",

View file

@ -405,6 +405,12 @@
"form.integration.telegram_bot_disable_notification": "Disable notification", "form.integration.telegram_bot_disable_notification": "Disable notification",
"form.integration.telegram_bot_disable_buttons": "Disable buttons", "form.integration.telegram_bot_disable_buttons": "Disable buttons",
"form.integration.telegram_chat_id": "ID чату", "form.integration.telegram_chat_id": "ID чату",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "Зберігати статті до Linkding", "form.integration.linkding_activate": "Зберігати статті до Linkding",
"form.integration.linkding_endpoint": "Linkding API Endpoint", "form.integration.linkding_endpoint": "Linkding API Endpoint",
"form.integration.linkding_api_key": "Ключ API Linkding", "form.integration.linkding_api_key": "Ключ API Linkding",

View file

@ -399,6 +399,12 @@
"form.integration.telegram_bot_disable_notification": "禁用通知", "form.integration.telegram_bot_disable_notification": "禁用通知",
"form.integration.telegram_bot_disable_buttons": "不展示按钮", "form.integration.telegram_bot_disable_buttons": "不展示按钮",
"form.integration.telegram_chat_id": "聊天ID", "form.integration.telegram_chat_id": "聊天ID",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "保存文章到 Linkding", "form.integration.linkding_activate": "保存文章到 Linkding",
"form.integration.linkding_endpoint": "Linkding API 端点", "form.integration.linkding_endpoint": "Linkding API 端点",
"form.integration.linkding_api_key": "Linkding API 密钥", "form.integration.linkding_api_key": "Linkding API 密钥",

View file

@ -401,6 +401,12 @@
"form.integration.telegram_bot_disable_web_page_preview": "停用網頁預覽", "form.integration.telegram_bot_disable_web_page_preview": "停用網頁預覽",
"form.integration.telegram_bot_disable_notification": "停用通知", "form.integration.telegram_bot_disable_notification": "停用通知",
"form.integration.telegram_bot_disable_buttons": "不展示按鈕", "form.integration.telegram_bot_disable_buttons": "不展示按鈕",
"form.integration.linkace_activate": "Save entries to LinkAce",
"form.integration.linkace_endpoint": "LinkAce API Endpoint",
"form.integration.linkace_api_key": "LinkAce API key",
"form.integration.linkace_tags": "LinkAce Tags",
"form.integration.linkace_is_private": "Mark link as private",
"form.integration.linkace_check_disabled": "Disable link check",
"form.integration.linkding_activate": "儲存文章到 Linkding", "form.integration.linkding_activate": "儲存文章到 Linkding",
"form.integration.linkding_endpoint": "Linkding API 端點", "form.integration.linkding_endpoint": "Linkding API 端點",
"form.integration.linkding_api_key": "Linkding API 金鑰", "form.integration.linkding_api_key": "Linkding API 金鑰",

View file

@ -48,6 +48,12 @@ type Integration struct {
TelegramBotDisableWebPagePreview bool TelegramBotDisableWebPagePreview bool
TelegramBotDisableNotification bool TelegramBotDisableNotification bool
TelegramBotDisableButtons bool TelegramBotDisableButtons bool
LinkAceEnabled bool
LinkAceURL string
LinkAceAPIKey string
LinkAceTags string
LinkAcePrivate bool
LinkAceCheckDisabled bool
LinkdingEnabled bool LinkdingEnabled bool
LinkdingURL string LinkdingURL string
LinkdingAPIKey string LinkdingAPIKey string

View file

@ -152,6 +152,12 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
telegram_bot_disable_web_page_preview, telegram_bot_disable_web_page_preview,
telegram_bot_disable_notification, telegram_bot_disable_notification,
telegram_bot_disable_buttons, telegram_bot_disable_buttons,
linkace_enabled,
linkace_url,
linkace_api_key,
linkace_tags,
linkace_is_private,
linkace_check_disabled,
linkding_enabled, linkding_enabled,
linkding_url, linkding_url,
linkding_api_key, linkding_api_key,
@ -230,6 +236,12 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
&integration.TelegramBotDisableWebPagePreview, &integration.TelegramBotDisableWebPagePreview,
&integration.TelegramBotDisableNotification, &integration.TelegramBotDisableNotification,
&integration.TelegramBotDisableButtons, &integration.TelegramBotDisableButtons,
&integration.LinkAceEnabled,
&integration.LinkAceURL,
&integration.LinkAceAPIKey,
&integration.LinkAceTags,
&integration.LinkAcePrivate,
&integration.LinkAceCheckDisabled,
&integration.LinkdingEnabled, &integration.LinkdingEnabled,
&integration.LinkdingURL, &integration.LinkdingURL,
&integration.LinkdingAPIKey, &integration.LinkdingAPIKey,
@ -312,41 +324,47 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
espial_url=$35, espial_url=$35,
espial_api_key=$36, espial_api_key=$36,
espial_tags=$37, espial_tags=$37,
linkding_enabled=$38, linkace_enabled=$38,
linkding_url=$39, linkace_url=$39,
linkding_api_key=$40, linkace_api_key=$40,
linkding_tags=$41, linkace_tags=$41,
linkding_mark_as_unread=$42, linkace_is_private=$42,
matrix_bot_enabled=$43, linkace_check_disabled=$43,
matrix_bot_user=$44, linkding_enabled=$44,
matrix_bot_password=$45, linkding_url=$45,
matrix_bot_url=$46, linkding_api_key=$46,
matrix_bot_chat_id=$47, linkding_tags=$47,
notion_enabled=$48, linkding_mark_as_unread=$48,
notion_token=$49, matrix_bot_enabled=$49,
notion_page_id=$50, matrix_bot_user=$50,
readwise_enabled=$51, matrix_bot_password=$51,
readwise_api_key=$52, matrix_bot_url=$52,
apprise_enabled=$53, matrix_bot_chat_id=$53,
apprise_url=$54, notion_enabled=$54,
apprise_services_url=$55, notion_token=$55,
shiori_enabled=$56, notion_page_id=$56,
shiori_url=$57, readwise_enabled=$57,
shiori_username=$58, readwise_api_key=$58,
shiori_password=$59, apprise_enabled=$59,
shaarli_enabled=$60, apprise_url=$60,
shaarli_url=$61, apprise_services_url=$61,
shaarli_api_secret=$62, shiori_enabled=$62,
webhook_enabled=$63, shiori_url=$63,
webhook_url=$64, shiori_username=$64,
webhook_secret=$65, shiori_password=$65,
rssbridge_enabled=$66, shaarli_enabled=$66,
rssbridge_url=$67, shaarli_url=$67,
omnivore_enabled=$68, shaarli_api_secret=$68,
omnivore_api_key=$69, webhook_enabled=$69,
omnivore_url=$70 webhook_url=$70,
webhook_secret=$71,
rssbridge_enabled=$72,
rssbridge_url=$73,
omnivore_enabled=$74,
omnivore_api_key=$75,
omnivore_url=$76
WHERE WHERE
user_id=$71 user_id=$77
` `
_, err := s.db.Exec( _, err := s.db.Exec(
query, query,
@ -387,6 +405,12 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
integration.EspialURL, integration.EspialURL,
integration.EspialAPIKey, integration.EspialAPIKey,
integration.EspialTags, integration.EspialTags,
integration.LinkAceEnabled,
integration.LinkAceURL,
integration.LinkAceAPIKey,
integration.LinkAceTags,
integration.LinkAcePrivate,
integration.LinkAceCheckDisabled,
integration.LinkdingEnabled, integration.LinkdingEnabled,
integration.LinkdingURL, integration.LinkdingURL,
integration.LinkdingAPIKey, integration.LinkdingAPIKey,
@ -449,6 +473,7 @@ func (s *Storage) HasSaveEntry(userID int64) (result bool) {
espial_enabled='t' OR espial_enabled='t' OR
readwise_enabled='t' OR readwise_enabled='t' OR
pocket_enabled='t' OR pocket_enabled='t' OR
linkace_enabled='t' OR
linkding_enabled='t' OR linkding_enabled='t' OR
apprise_enabled='t' OR apprise_enabled='t' OR
shiori_enabled='t' OR shiori_enabled='t' OR

View file

@ -119,6 +119,36 @@
</div> </div>
</details> </details>
<details {{ if .form.LinkAceEnabled }}open{{ end }}>
<summary>LinkAce</summary>
<div class="form-section">
<label>
<input type="checkbox" name="linkace_enabled" value="1" {{ if .form.LinkAceEnabled }}checked{{ end }}> {{ t "form.integration.linkace_activate" }}
</label>
<label for="form-linkace-url">{{ t "form.integration.linkace_endpoint" }}</label>
<input type="url" name="linkace_url" id="form-linkace-url" value="{{ .form.LinkAceURL }}" placeholder="http://linkace-url:port" spellcheck="false">
<label for="form-linkace-api-key">{{ t "form.integration.linkace_api_key" }}</label>
<input type="text" name="linkace_api_key" id="form-linkace-api-key" value="{{ .form.LinkAceAPIKey }}" spellcheck="false">
<label for="form-linkace-tags">{{ t "form.integration.linkace_tags" }}</label>
<input type="text" name="linkace_tags" id="form-linkace-tags" value="{{ .form.LinkAceTags }}" spellcheck="false">
<label>
<input type="checkbox" name="linkace_is_private" value="1" {{ if .form.LinkAcePrivate }}checked{{ end }}> {{ t "form.integration.linkace_is_private" }}
</label>
<label>
<input type="checkbox" name="linkace_check_disabled" value="1" {{ if .form.LinkAceCheckDisabled }}checked{{ end }}> {{ t "form.integration.linkace_check_disabled" }}
</label>
<div class="buttons">
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button>
</div>
</div>
</details>
<details {{ if .form.LinkdingEnabled }}open{{ end }}> <details {{ if .form.LinkdingEnabled }}open{{ end }}>
<summary>Linkding</summary> <summary>Linkding</summary>
<div class="form-section"> <div class="form-section">

View file

@ -54,6 +54,12 @@ type IntegrationForm struct {
TelegramBotDisableWebPagePreview bool TelegramBotDisableWebPagePreview bool
TelegramBotDisableNotification bool TelegramBotDisableNotification bool
TelegramBotDisableButtons bool TelegramBotDisableButtons bool
LinkAceEnabled bool
LinkAceURL string
LinkAceAPIKey string
LinkAceTags string
LinkAcePrivate bool
LinkAceCheckDisabled bool
LinkdingEnabled bool LinkdingEnabled bool
LinkdingURL string LinkdingURL string
LinkdingAPIKey string LinkdingAPIKey string
@ -126,6 +132,12 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
integration.TelegramBotDisableWebPagePreview = i.TelegramBotDisableWebPagePreview integration.TelegramBotDisableWebPagePreview = i.TelegramBotDisableWebPagePreview
integration.TelegramBotDisableNotification = i.TelegramBotDisableNotification integration.TelegramBotDisableNotification = i.TelegramBotDisableNotification
integration.TelegramBotDisableButtons = i.TelegramBotDisableButtons integration.TelegramBotDisableButtons = i.TelegramBotDisableButtons
integration.LinkAceEnabled = i.LinkAceEnabled
integration.LinkAceURL = i.LinkAceURL
integration.LinkAceAPIKey = i.LinkAceAPIKey
integration.LinkAceTags = i.LinkAceTags
integration.LinkAcePrivate = i.LinkAcePrivate
integration.LinkAceCheckDisabled = i.LinkAceCheckDisabled
integration.LinkdingEnabled = i.LinkdingEnabled integration.LinkdingEnabled = i.LinkdingEnabled
integration.LinkdingURL = i.LinkdingURL integration.LinkdingURL = i.LinkdingURL
integration.LinkdingAPIKey = i.LinkdingAPIKey integration.LinkdingAPIKey = i.LinkdingAPIKey
@ -200,6 +212,12 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
TelegramBotDisableWebPagePreview: r.FormValue("telegram_bot_disable_web_page_preview") == "1", TelegramBotDisableWebPagePreview: r.FormValue("telegram_bot_disable_web_page_preview") == "1",
TelegramBotDisableNotification: r.FormValue("telegram_bot_disable_notification") == "1", TelegramBotDisableNotification: r.FormValue("telegram_bot_disable_notification") == "1",
TelegramBotDisableButtons: r.FormValue("telegram_bot_disable_buttons") == "1", TelegramBotDisableButtons: r.FormValue("telegram_bot_disable_buttons") == "1",
LinkAceEnabled: r.FormValue("linkace_enabled") == "1",
LinkAceURL: r.FormValue("linkace_url"),
LinkAceAPIKey: r.FormValue("linkace_api_key"),
LinkAceTags: r.FormValue("linkace_tags"),
LinkAcePrivate: r.FormValue("linkace_is_private") == "1",
LinkAceCheckDisabled: r.FormValue("linkace_check_disabled") == "1",
LinkdingEnabled: r.FormValue("linkding_enabled") == "1", LinkdingEnabled: r.FormValue("linkding_enabled") == "1",
LinkdingURL: r.FormValue("linkding_url"), LinkdingURL: r.FormValue("linkding_url"),
LinkdingAPIKey: r.FormValue("linkding_api_key"), LinkdingAPIKey: r.FormValue("linkding_api_key"),

View file

@ -68,6 +68,12 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview, TelegramBotDisableWebPagePreview: integration.TelegramBotDisableWebPagePreview,
TelegramBotDisableNotification: integration.TelegramBotDisableNotification, TelegramBotDisableNotification: integration.TelegramBotDisableNotification,
TelegramBotDisableButtons: integration.TelegramBotDisableButtons, TelegramBotDisableButtons: integration.TelegramBotDisableButtons,
LinkAceEnabled: integration.LinkAceEnabled,
LinkAceURL: integration.LinkAceURL,
LinkAceAPIKey: integration.LinkAceAPIKey,
LinkAceTags: integration.LinkAceTags,
LinkAcePrivate: integration.LinkAcePrivate,
LinkAceCheckDisabled: integration.LinkAceCheckDisabled,
LinkdingEnabled: integration.LinkdingEnabled, LinkdingEnabled: integration.LinkdingEnabled,
LinkdingURL: integration.LinkdingURL, LinkdingURL: integration.LinkdingURL,
LinkdingAPIKey: integration.LinkdingAPIKey, LinkdingAPIKey: integration.LinkdingAPIKey,