diff --git a/database/migrations.go b/database/migrations.go index e89b060c..5660213c 100644 --- a/database/migrations.go +++ b/database/migrations.go @@ -610,4 +610,10 @@ var migrations = []func(tx *sql.Tx) error{ `) return }, + func(tx *sql.Tx) (err error) { + _, err = tx.Exec(` + ALTER TABLE integrations ADD COLUMN wallabag_only_url bool default 'f'; + `) + return + }, } diff --git a/integration/integration.go b/integration/integration.go index e45f2162..79e58dac 100644 --- a/integration/integration.go +++ b/integration/integration.go @@ -54,6 +54,7 @@ func SendEntry(entry *model.Entry, integration *model.Integration) { integration.WallabagClientSecret, integration.WallabagUsername, integration.WallabagPassword, + integration.WallabagOnlyURL, ) if err := client.AddEntry(entry.URL, entry.Title, entry.Content); err != nil { diff --git a/integration/wallabag/wallabag.go b/integration/wallabag/wallabag.go index 55c4ab46..4f04f586 100644 --- a/integration/wallabag/wallabag.go +++ b/integration/wallabag/wallabag.go @@ -20,11 +20,12 @@ type Client struct { clientSecret string username string password string + onlyURL bool } // NewClient returns a new Wallabag client. -func NewClient(baseURL, clientID, clientSecret, username, password string) *Client { - return &Client{baseURL, clientID, clientSecret, username, password} +func NewClient(baseURL, clientID, clientSecret, username, password string, onlyURL bool) *Client { + return &Client{baseURL, clientID, clientSecret, username, password, onlyURL} } // AddEntry sends a link to Wallabag. @@ -48,9 +49,14 @@ func (c *Client) createEntry(accessToken, link, title, content string) error { return fmt.Errorf("wallbag: unable to get entries endpoint: %v", err) } + data := map[string]string{"url": link, "title": title} + if !c.onlyURL { + data["content"] = content + } + clt := client.New(endpoint) clt.WithAuthorization("Bearer " + accessToken) - response, err := clt.PostJSON(map[string]string{"url": link, "title": title, "content": content}) + response, err := clt.PostJSON(data) if err != nil { return fmt.Errorf("wallabag: unable to post entry: %v", err) } diff --git a/locale/translations/de_DE.json b/locale/translations/de_DE.json index 43194cb8..7593a76e 100644 --- a/locale/translations/de_DE.json +++ b/locale/translations/de_DE.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket Access Token", "form.integration.pocket_connect_link": "Verbinden Sie Ihr Pocket Konto", "form.integration.wallabag_activate": "Artikel in Wallabag speichern", + "form.integration.wallabag_only_url": "Nur URL senden (anstelle des vollständigen Inhalts)", "form.integration.wallabag_endpoint": "Wallabag URL", "form.integration.wallabag_client_id": "Wallabag Client-ID", "form.integration.wallabag_client_secret": "Wallabag Client-Secret", diff --git a/locale/translations/el_EL.json b/locale/translations/el_EL.json index 18ac2076..d028be7e 100644 --- a/locale/translations/el_EL.json +++ b/locale/translations/el_EL.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket Access Token", "form.integration.pocket_connect_link": "Συνδέστε τον λογαριασμό Pocket σας", "form.integration.wallabag_activate": "Αποθήκευση άρθρων στο Wallabag", + "form.integration.wallabag_only_url": "Αποστολή μόνο URL (αντί για πλήρες περιεχόμενο)", "form.integration.wallabag_endpoint": "Τελικό σημείο Wallabag API ", "form.integration.wallabag_client_id": "Ταυτότητα πελάτη Wallabag", "form.integration.wallabag_client_secret": "Wallabag Μυστικό Πελάτη", diff --git a/locale/translations/en_US.json b/locale/translations/en_US.json index d05555bb..1225b925 100644 --- a/locale/translations/en_US.json +++ b/locale/translations/en_US.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket Access Token", "form.integration.pocket_connect_link": "Connect your Pocket account", "form.integration.wallabag_activate": "Save articles to Wallabag", + "form.integration.wallabag_only_url": "Send only URL (instead of full content)", "form.integration.wallabag_endpoint": "Wallabag API Endpoint", "form.integration.wallabag_client_id": "Wallabag Client ID", "form.integration.wallabag_client_secret": "Wallabag Client Secret", diff --git a/locale/translations/es_ES.json b/locale/translations/es_ES.json index 06e701a7..872fd347 100644 --- a/locale/translations/es_ES.json +++ b/locale/translations/es_ES.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Token de acceso de Pocket", "form.integration.pocket_connect_link": "Conectar a la cuenta de Pocket", "form.integration.wallabag_activate": "Guardar artículos a Wallabag", + "form.integration.wallabag_only_url": "Enviar solo URL (en lugar de contenido completo)", "form.integration.wallabag_endpoint": "Extremo de API de Wallabag", "form.integration.wallabag_client_id": "ID de cliente de Wallabag", "form.integration.wallabag_client_secret": "Secreto cliente de Wallabag", diff --git a/locale/translations/fi_FI.json b/locale/translations/fi_FI.json index ccdc60d3..ec9ccfde 100644 --- a/locale/translations/fi_FI.json +++ b/locale/translations/fi_FI.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket-käyttöoikeustunnus", "form.integration.pocket_connect_link": "Yhdistä Pocket-tilisi", "form.integration.wallabag_activate": "Tallenna artikkelit Wallabagiin", + "form.integration.wallabag_only_url": "Lähetä vain URL-osoite (koko sisällön sijaan)", "form.integration.wallabag_endpoint": "Wallabag API -päätepiste", "form.integration.wallabag_client_id": "Wallabag Client ID", "form.integration.wallabag_client_secret": "Wallabag Client Secret", diff --git a/locale/translations/fr_FR.json b/locale/translations/fr_FR.json index f34621fe..68fc072b 100644 --- a/locale/translations/fr_FR.json +++ b/locale/translations/fr_FR.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Jeton d'accès de l'API de Pocket", "form.integration.pocket_connect_link": "Connectez votre compte Pocket", "form.integration.wallabag_activate": "Sauvegarder les articles vers Wallabag", + "form.integration.wallabag_only_url": "Envoyer uniquement l'URL (au lieu du contenu complet)", "form.integration.wallabag_endpoint": "URL de l'API de Wallabag", "form.integration.wallabag_client_id": "Identifiant unique du client Wallabag", "form.integration.wallabag_client_secret": "Clé secrète du client Wallabag", diff --git a/locale/translations/hi_IN.json b/locale/translations/hi_IN.json index d47a93dc..33b76c6a 100644 --- a/locale/translations/hi_IN.json +++ b/locale/translations/hi_IN.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "पॉकेट एक्सेस टोकन", "form.integration.pocket_connect_link": "अपना पॉकेट खाता कनेक्ट करें", "form.integration.wallabag_activate": "विषय सहेजें वालाबाग में ", + "form.integration.wallabag_only_url": "केवल URL भेजें (पूर्ण सामग्री के बजाय)", "form.integration.wallabag_endpoint": "वालबैग एपीआई एंडपॉइंट", "form.integration.wallabag_client_id": "वालाबैग क्लाइंट आईडी", "form.integration.wallabag_client_secret": "वालाबैग क्लाइंट सीक्रेट", diff --git a/locale/translations/it_IT.json b/locale/translations/it_IT.json index 1084d814..bc1d9752 100644 --- a/locale/translations/it_IT.json +++ b/locale/translations/it_IT.json @@ -334,6 +334,7 @@ "form.integration.pocket_connect_link": "Collega il tuo account Pocket", "form.integration.wallabag_activate": "Salva gli articoli su Wallabag", "form.integration.wallabag_endpoint": "Endpoint dell'API di Wallabag", + "form.integration.wallabag_only_url": "Invia solo URL (invece del contenuto completo)", "form.integration.wallabag_client_id": "Client ID dell'account Wallabag", "form.integration.wallabag_client_secret": "Client secret dell'account Wallabag", "form.integration.wallabag_username": "Nome utente dell'account Wallabag", diff --git a/locale/translations/ja_JP.json b/locale/translations/ja_JP.json index f844ba9d..211259cf 100644 --- a/locale/translations/ja_JP.json +++ b/locale/translations/ja_JP.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket の Access Token", "form.integration.pocket_connect_link": "Pocket account に接続", "form.integration.wallabag_activate": "Wallabag に記事を保存する", + "form.integration.wallabag_only_url": "URL のみを送信 (完全なコンテンツではなく)", "form.integration.wallabag_endpoint": "Wallabag の API Endpoint", "form.integration.wallabag_client_id": "Wallabag の Client ID", "form.integration.wallabag_client_secret": "Wallabag の Client Secret", diff --git a/locale/translations/nl_NL.json b/locale/translations/nl_NL.json index b52357b1..9dc22ad7 100644 --- a/locale/translations/nl_NL.json +++ b/locale/translations/nl_NL.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket Access Token", "form.integration.pocket_connect_link": "Verbind je Pocket-account", "form.integration.wallabag_activate": "Opslaan naar Wallabag", + "form.integration.wallabag_only_url": "Alleen URL verzenden (in plaats van volledige inhoud)", "form.integration.wallabag_endpoint": "Wallabag URL", "form.integration.wallabag_client_id": "Wallabag Client-ID", "form.integration.wallabag_client_secret": "Wallabag Client-Secret", diff --git a/locale/translations/pl_PL.json b/locale/translations/pl_PL.json index 1ad01b8e..9aee96c3 100644 --- a/locale/translations/pl_PL.json +++ b/locale/translations/pl_PL.json @@ -335,6 +335,7 @@ "form.integration.pocket_access_token": "Token dostępu kieszeń", "form.integration.pocket_connect_link": "Połącz swoje konto Pocket", "form.integration.wallabag_activate": "Zapisz artykuły do Wallabag", + "form.integration.wallabag_only_url": "Wyślij tylko adres URL (zamiast pełnej treści)", "form.integration.wallabag_endpoint": "Wallabag URL", "form.integration.wallabag_client_id": "Wallabag Client-ID", "form.integration.wallabag_client_secret": "Wallabag Client Secret", diff --git a/locale/translations/pt_BR.json b/locale/translations/pt_BR.json index 2c2d34b8..69c2c829 100644 --- a/locale/translations/pt_BR.json +++ b/locale/translations/pt_BR.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Token de acesso do Pocket", "form.integration.pocket_connect_link": "Conectar a conta do Pocket", "form.integration.wallabag_activate": "Salvar itens no Wallabag", + "form.integration.wallabag_only_url": "Enviar apenas URL (em vez de conteúdo completo)", "form.integration.wallabag_endpoint": "Endpoint da API do Wallabag", "form.integration.wallabag_client_id": "ID de cliente (Client ID) do Wallabag", "form.integration.wallabag_client_secret": "Segredo do cliente (Client Secret) do Wallabag", diff --git a/locale/translations/ru_RU.json b/locale/translations/ru_RU.json index dce6fdaa..c86bcbbf 100644 --- a/locale/translations/ru_RU.json +++ b/locale/translations/ru_RU.json @@ -334,6 +334,7 @@ "form.integration.pocket_consumer_key": "Pocket Consumer Key", "form.integration.pocket_access_token": "Pocket Access Token", "form.integration.pocket_connect_link": "Подключить аккаунт Pocket", + "form.integration.wallabag_only_url": "Отправлять только URL (вместо всего содержимого)", "form.integration.wallabag_activate": "Сохранять статьи в Wallabag", "form.integration.wallabag_endpoint": "Конечная точка Wallabag API", "form.integration.wallabag_client_id": "Wallabag Client ID", diff --git a/locale/translations/tr_TR.json b/locale/translations/tr_TR.json index 0ff1ad7f..a670a160 100644 --- a/locale/translations/tr_TR.json +++ b/locale/translations/tr_TR.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket Access Token", "form.integration.pocket_connect_link": "Pocket hesabını bağla", "form.integration.wallabag_activate": "Makaleleri Wallabag'e kaydet", + "form.integration.wallabag_only_url": "Yalnızca URL gönder (tam içerik yerine)", "form.integration.wallabag_endpoint": "Wallabag API Uç Noktası", "form.integration.wallabag_client_id": "Wallabag Client ID", "form.integration.wallabag_client_secret": "Wallabag Client Secret", diff --git a/locale/translations/uk_UA.json b/locale/translations/uk_UA.json index 91993c16..516a8033 100644 --- a/locale/translations/uk_UA.json +++ b/locale/translations/uk_UA.json @@ -332,6 +332,7 @@ "form.integration.pocket_access_token": "Pocket Access Token", "form.integration.pocket_connect_link": "Підключити ваш обліковий запис Pocket", "form.integration.wallabag_activate": "Зберігати статті до Wallabag", + "form.integration.wallabag_only_url": "Надіслати лише URL (замість повного вмісту)", "form.integration.wallabag_endpoint": "Wallabag API Endpoint", "form.integration.wallabag_client_id": "Wallabag Client ID", "form.integration.wallabag_client_secret": "Wallabag Client Secret", diff --git a/locale/translations/zh_CN.json b/locale/translations/zh_CN.json index c74a28d7..43bd95be 100644 --- a/locale/translations/zh_CN.json +++ b/locale/translations/zh_CN.json @@ -331,6 +331,7 @@ "form.integration.pocket_access_token": "Pocket 访问密钥", "form.integration.pocket_connect_link": "连接您的 Pocket 帐户", "form.integration.wallabag_activate": "保存文章到 Wallabag", + "form.integration.wallabag_only_url": "仅发送 URL(而不是完整内容)", "form.integration.wallabag_endpoint": "Wallabag URL", "form.integration.wallabag_client_id": "Wallabag 客户端 ID", "form.integration.wallabag_client_secret": "Wallabag 客户端 Secret", diff --git a/locale/translations/zh_TW.json b/locale/translations/zh_TW.json index 1df594d7..52ce256d 100644 --- a/locale/translations/zh_TW.json +++ b/locale/translations/zh_TW.json @@ -333,6 +333,7 @@ "form.integration.pocket_access_token": "Pocket 訪問金鑰", "form.integration.pocket_connect_link": "連線您的 Pocket 帳戶", "form.integration.wallabag_activate": "儲存文章到 Wallabag", + "form.integration.wallabag_only_url": "仅发送 URL(而不是完整内容)", "form.integration.wallabag_endpoint": "Wallabag URL", "form.integration.wallabag_client_id": "Wallabag 客戶端 ID", "form.integration.wallabag_client_secret": "Wallabag 客戶端 Secret", diff --git a/model/integration.go b/model/integration.go index b876c3c6..794e64ef 100644 --- a/model/integration.go +++ b/model/integration.go @@ -21,6 +21,7 @@ type Integration struct { GoogleReaderUsername string GoogleReaderPassword string WallabagEnabled bool + WallabagOnlyURL bool WallabagURL string WallabagClientID string WallabagClientSecret string diff --git a/storage/integration.go b/storage/integration.go index 85a6cff0..dd391730 100644 --- a/storage/integration.go +++ b/storage/integration.go @@ -125,6 +125,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) { googlereader_username, googlereader_password, wallabag_enabled, + wallabag_only_url, wallabag_url, wallabag_client_id, wallabag_client_secret, @@ -168,6 +169,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) { &integration.GoogleReaderUsername, &integration.GoogleReaderPassword, &integration.WallabagEnabled, + &integration.WallabagOnlyURL, &integration.WallabagURL, &integration.WallabagClientID, &integration.WallabagClientSecret, @@ -223,32 +225,33 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { fever_username=$9, fever_token=$10, wallabag_enabled=$11, - wallabag_url=$12, - wallabag_client_id=$13, - wallabag_client_secret=$14, - wallabag_username=$15, - wallabag_password=$16, - nunux_keeper_enabled=$17, - nunux_keeper_url=$18, - nunux_keeper_api_key=$19, - pocket_enabled=$20, - pocket_access_token=$21, - pocket_consumer_key=$22, - googlereader_enabled=$23, - googlereader_username=$24, - googlereader_password=$25, - telegram_bot_enabled=$26, - telegram_bot_token=$27, - telegram_bot_chat_id=$28, - espial_enabled=$29, - espial_url=$30, - espial_api_key=$31, - espial_tags=$32, - linkding_enabled=$33, - linkding_url=$34, - linkding_api_key=$35 + wallabag_only_url=$12, + wallabag_url=$13, + wallabag_client_id=$14, + wallabag_client_secret=$15, + wallabag_username=$16, + wallabag_password=$17, + nunux_keeper_enabled=$18, + nunux_keeper_url=$19, + nunux_keeper_api_key=$20, + pocket_enabled=$21, + pocket_access_token=$22, + pocket_consumer_key=$23, + googlereader_enabled=$24, + googlereader_username=$25, + googlereader_password=$26, + telegram_bot_enabled=$27, + telegram_bot_token=$28, + telegram_bot_chat_id=$29, + espial_enabled=$30, + espial_url=$31, + espial_api_key=$32, + espial_tags=$33, + linkding_enabled=$34, + linkding_url=$35, + linkding_api_key=$36 WHERE - user_id=$36 + user_id=$37 ` _, err = s.db.Exec( query, @@ -263,6 +266,7 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { integration.FeverUsername, integration.FeverToken, integration.WallabagEnabled, + integration.WallabagOnlyURL, integration.WallabagURL, integration.WallabagClientID, integration.WallabagClientSecret, @@ -294,43 +298,44 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { UPDATE integrations SET - pinboard_enabled=$1, - pinboard_token=$2, - pinboard_tags=$3, - pinboard_mark_as_unread=$4, - instapaper_enabled=$5, - instapaper_username=$6, - instapaper_password=$7, - fever_enabled=$8, - fever_username=$9, - fever_token=$10, - wallabag_enabled=$11, - wallabag_url=$12, - wallabag_client_id=$13, - wallabag_client_secret=$14, - wallabag_username=$15, - wallabag_password=$16, - nunux_keeper_enabled=$17, - nunux_keeper_url=$18, - nunux_keeper_api_key=$19, - pocket_enabled=$20, - pocket_access_token=$21, - pocket_consumer_key=$22, - googlereader_enabled=$23, - googlereader_username=$24, - googlereader_password=$25, - telegram_bot_enabled=$26, - telegram_bot_token=$27, - telegram_bot_chat_id=$28, - espial_enabled=$29, - espial_url=$30, - espial_api_key=$31, - espial_tags=$32, - linkding_enabled=$33, - linkding_url=$34, - linkding_api_key=$35 - WHERE - user_id=$36 + pinboard_enabled=$1, + pinboard_token=$2, + pinboard_tags=$3, + pinboard_mark_as_unread=$4, + instapaper_enabled=$5, + instapaper_username=$6, + instapaper_password=$7, + fever_enabled=$8, + fever_username=$9, + fever_token=$10, + wallabag_enabled=$11, + wallabag_only_url=$12, + wallabag_url=$13, + wallabag_client_id=$14, + wallabag_client_secret=$15, + wallabag_username=$16, + wallabag_password=$17, + nunux_keeper_enabled=$18, + nunux_keeper_url=$19, + nunux_keeper_api_key=$20, + pocket_enabled=$21, + pocket_access_token=$22, + pocket_consumer_key=$23, + googlereader_enabled=$24, + googlereader_username=$25, + googlereader_password=$26, + telegram_bot_enabled=$27, + telegram_bot_token=$28, + telegram_bot_chat_id=$29, + espial_enabled=$30, + espial_url=$31, + espial_api_key=$32, + espial_tags=$33, + linkding_enabled=$34, + linkding_url=$35, + linkding_api_key=$36 + WHERE + user_id=$37 ` _, err = s.db.Exec( query, @@ -345,6 +350,7 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error { integration.FeverUsername, integration.FeverToken, integration.WallabagEnabled, + integration.WallabagOnlyURL, integration.WallabagURL, integration.WallabagClientID, integration.WallabagClientSecret, diff --git a/template/templates/views/integrations.html b/template/templates/views/integrations.html index 86356f83..b16cd865 100644 --- a/template/templates/views/integrations.html +++ b/template/templates/views/integrations.html @@ -119,6 +119,10 @@ {{ t "form.integration.wallabag_activate" }} + + diff --git a/ui/form/integration.go b/ui/form/integration.go index f2df691f..3efb2763 100644 --- a/ui/form/integration.go +++ b/ui/form/integration.go @@ -26,6 +26,7 @@ type IntegrationForm struct { GoogleReaderUsername string GoogleReaderPassword string WallabagEnabled bool + WallabagOnlyURL bool WallabagURL string WallabagClientID string WallabagClientSecret string @@ -63,6 +64,7 @@ func (i IntegrationForm) Merge(integration *model.Integration) { integration.GoogleReaderEnabled = i.GoogleReaderEnabled integration.GoogleReaderUsername = i.GoogleReaderUsername integration.WallabagEnabled = i.WallabagEnabled + integration.WallabagOnlyURL = i.WallabagOnlyURL integration.WallabagURL = i.WallabagURL integration.WallabagClientID = i.WallabagClientID integration.WallabagClientSecret = i.WallabagClientSecret @@ -103,6 +105,7 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm { GoogleReaderUsername: r.FormValue("googlereader_username"), GoogleReaderPassword: r.FormValue("googlereader_password"), WallabagEnabled: r.FormValue("wallabag_enabled") == "1", + WallabagOnlyURL: r.FormValue("wallabag_only_url") == "1", WallabagURL: r.FormValue("wallabag_url"), WallabagClientID: r.FormValue("wallabag_client_id"), WallabagClientSecret: r.FormValue("wallabag_client_secret"), diff --git a/ui/integration_show.go b/ui/integration_show.go index afb273ae..949ddb55 100644 --- a/ui/integration_show.go +++ b/ui/integration_show.go @@ -41,6 +41,7 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) { GoogleReaderEnabled: integration.GoogleReaderEnabled, GoogleReaderUsername: integration.GoogleReaderUsername, WallabagEnabled: integration.WallabagEnabled, + WallabagOnlyURL: integration.WallabagOnlyURL, WallabagURL: integration.WallabagURL, WallabagClientID: integration.WallabagClientID, WallabagClientSecret: integration.WallabagClientSecret,