Add default tag names for Linkding integration
This commit is contained in:
parent
118e18190d
commit
c4e2eaa609
26 changed files with 66 additions and 18 deletions
|
@ -653,4 +653,11 @@ 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 linkding_tags text default '';
|
||||||
|
`
|
||||||
|
_, err = tx.Exec(sql)
|
||||||
|
return err
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@ func SendEntry(entry *model.Entry, integration *model.Integration) {
|
||||||
client := linkding.NewClient(
|
client := linkding.NewClient(
|
||||||
integration.LinkdingURL,
|
integration.LinkdingURL,
|
||||||
integration.LinkdingAPIKey,
|
integration.LinkdingAPIKey,
|
||||||
|
integration.LinkdingTags,
|
||||||
)
|
)
|
||||||
if err := client.AddEntry(entry.Title, entry.URL); err != nil {
|
if err := client.AddEntry(entry.Title, entry.URL); err != nil {
|
||||||
logger.Error("[Integration] UserID #%d: %v", integration.UserID, err)
|
logger.Error("[Integration] UserID #%d: %v", integration.UserID, err)
|
||||||
|
|
|
@ -7,25 +7,28 @@ package linkding // import "miniflux.app/integration/linkding"
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"miniflux.app/http/client"
|
"miniflux.app/http/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Document structure of a Linkding document
|
// Document structure of a Linkding document
|
||||||
type Document struct {
|
type Document struct {
|
||||||
Url string `json:"url,omitempty"`
|
Url string `json:"url,omitempty"`
|
||||||
Title string `json:"title,omitempty"`
|
Title string `json:"title,omitempty"`
|
||||||
|
TagNames []string `json:"tag_names,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client represents an Linkding client.
|
// Client represents an Linkding client.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
baseURL string
|
baseURL string
|
||||||
apiKey string
|
apiKey string
|
||||||
|
tags string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient returns a new Linkding client.
|
// NewClient returns a new Linkding client.
|
||||||
func NewClient(baseURL, apiKey string) *Client {
|
func NewClient(baseURL, apiKey, tags string) *Client {
|
||||||
return &Client{baseURL: baseURL, apiKey: apiKey}
|
return &Client{baseURL: baseURL, apiKey: apiKey, tags: tags}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddEntry sends an entry to Linkding.
|
// AddEntry sends an entry to Linkding.
|
||||||
|
@ -34,9 +37,14 @@ func (c *Client) AddEntry(title, url string) error {
|
||||||
return fmt.Errorf("linkding: missing credentials")
|
return fmt.Errorf("linkding: missing credentials")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tagsSplitFn := func(c rune) bool {
|
||||||
|
return c == ',' || c == ' '
|
||||||
|
}
|
||||||
|
|
||||||
doc := &Document{
|
doc := &Document{
|
||||||
Url: url,
|
Url: url,
|
||||||
Title: title,
|
Title: title,
|
||||||
|
TagNames: strings.FieldsFunc(c.tags, tagsSplitFn),
|
||||||
}
|
}
|
||||||
|
|
||||||
apiURL, err := getAPIEndpoint(c.baseURL, "/api/bookmarks/")
|
apiURL, err := getAPIEndpoint(c.baseURL, "/api/bookmarks/")
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Neue Artikel in die Matrix übertragen",
|
"form.integration.matrix_bot_activate": "Neue Artikel in die Matrix übertragen",
|
||||||
"form.integration.matrix_bot_user": "Benutzername für Matrix",
|
"form.integration.matrix_bot_user": "Benutzername für Matrix",
|
||||||
"form.integration.matrix_bot_password": "Passwort für Matrix-Benutzer",
|
"form.integration.matrix_bot_password": "Passwort für Matrix-Benutzer",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Μεταφορά νέων άρθρων στο Matrix",
|
"form.integration.matrix_bot_activate": "Μεταφορά νέων άρθρων στο Matrix",
|
||||||
"form.integration.matrix_bot_user": "Όνομα χρήστη για το Matrix",
|
"form.integration.matrix_bot_user": "Όνομα χρήστη για το Matrix",
|
||||||
"form.integration.matrix_bot_password": "Κωδικός πρόσβασης για τον χρήστη Matrix",
|
"form.integration.matrix_bot_password": "Κωδικός πρόσβασης για τον χρήστη Matrix",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Push new entries to Matrix",
|
"form.integration.matrix_bot_activate": "Push new entries to Matrix",
|
||||||
"form.integration.matrix_bot_user": "Username for Matrix",
|
"form.integration.matrix_bot_user": "Username for Matrix",
|
||||||
"form.integration.matrix_bot_password": "Password for Matrix user",
|
"form.integration.matrix_bot_password": "Password for Matrix user",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Transferir nuevos artículos a Matrix",
|
"form.integration.matrix_bot_activate": "Transferir nuevos artículos a Matrix",
|
||||||
"form.integration.matrix_bot_user": "Nombre de usuario para Matrix",
|
"form.integration.matrix_bot_user": "Nombre de usuario para Matrix",
|
||||||
"form.integration.matrix_bot_password": "Contraseña para el usuario de Matrix",
|
"form.integration.matrix_bot_password": "Contraseña para el usuario de Matrix",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Siirrä uudet artikkelit Matrixiin",
|
"form.integration.matrix_bot_activate": "Siirrä uudet artikkelit Matrixiin",
|
||||||
"form.integration.matrix_bot_user": "Matrixin käyttäjätunnus",
|
"form.integration.matrix_bot_user": "Matrixin käyttäjätunnus",
|
||||||
"form.integration.matrix_bot_password": "Matrix-käyttäjän salasana",
|
"form.integration.matrix_bot_password": "Matrix-käyttäjän salasana",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Envoyer les nouveaux articles vers Matrix",
|
"form.integration.matrix_bot_activate": "Envoyer les nouveaux articles vers Matrix",
|
||||||
"form.integration.matrix_bot_user": "Nom de l'utilisateur Matrix",
|
"form.integration.matrix_bot_user": "Nom de l'utilisateur Matrix",
|
||||||
"form.integration.matrix_bot_password": "Mot de passe de l'utilisateur Matrix",
|
"form.integration.matrix_bot_password": "Mot de passe de l'utilisateur Matrix",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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": "लिंकिंग एपीआई कुंजी",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "नए लेखों को मैट्रिक्स में स्थानांतरित करें",
|
"form.integration.matrix_bot_activate": "नए लेखों को मैट्रिक्स में स्थानांतरित करें",
|
||||||
"form.integration.matrix_bot_user": "मैट्रिक्स के लिए उपयोगकर्ता नाम",
|
"form.integration.matrix_bot_user": "मैट्रिक्स के लिए उपयोगकर्ता नाम",
|
||||||
"form.integration.matrix_bot_password": "मैट्रिक्स उपयोगकर्ता के लिए पासवर्ड",
|
"form.integration.matrix_bot_password": "मैट्रिक्स उपयोगकर्ता के लिए पासवर्ड",
|
||||||
|
|
|
@ -358,6 +358,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Kirim entri baru ke Matrix",
|
"form.integration.matrix_bot_activate": "Kirim entri baru ke Matrix",
|
||||||
"form.integration.matrix_bot_user": "Nama Pengguna Matrix",
|
"form.integration.matrix_bot_user": "Nama Pengguna Matrix",
|
||||||
"form.integration.matrix_bot_password": "Kata Sandi Matrix",
|
"form.integration.matrix_bot_password": "Kata Sandi Matrix",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Trasferimento di nuovi articoli a Matrix",
|
"form.integration.matrix_bot_activate": "Trasferimento di nuovi articoli a Matrix",
|
||||||
"form.integration.matrix_bot_user": "Nome utente per Matrix",
|
"form.integration.matrix_bot_user": "Nome utente per Matrix",
|
||||||
"form.integration.matrix_bot_password": "Password per l'utente Matrix",
|
"form.integration.matrix_bot_password": "Password per l'utente Matrix",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "新しい記事をMatrixに転送する",
|
"form.integration.matrix_bot_activate": "新しい記事をMatrixに転送する",
|
||||||
"form.integration.matrix_bot_user": "Matrixのユーザー名",
|
"form.integration.matrix_bot_user": "Matrixのユーザー名",
|
||||||
"form.integration.matrix_bot_password": "Matrixユーザ用パスワード",
|
"form.integration.matrix_bot_password": "Matrixユーザ用パスワード",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Nieuwe artikelen overbrengen naar Matrix",
|
"form.integration.matrix_bot_activate": "Nieuwe artikelen overbrengen naar Matrix",
|
||||||
"form.integration.matrix_bot_user": "Gebruikersnaam voor Matrix",
|
"form.integration.matrix_bot_user": "Gebruikersnaam voor Matrix",
|
||||||
"form.integration.matrix_bot_password": "Wachtwoord voor Matrix-gebruiker",
|
"form.integration.matrix_bot_password": "Wachtwoord voor Matrix-gebruiker",
|
||||||
|
|
|
@ -363,6 +363,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Przenieś nowe artykuły do Matrix",
|
"form.integration.matrix_bot_activate": "Przenieś nowe artykuły do Matrix",
|
||||||
"form.integration.matrix_bot_user": "Nazwa użytkownika dla Matrix",
|
"form.integration.matrix_bot_user": "Nazwa użytkownika dla Matrix",
|
||||||
"form.integration.matrix_bot_password": "Hasło dla użytkownika Matrix",
|
"form.integration.matrix_bot_password": "Hasło dla użytkownika Matrix",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Transferir novos artigos para o Matrix",
|
"form.integration.matrix_bot_activate": "Transferir novos artigos para o Matrix",
|
||||||
"form.integration.matrix_bot_user": "Nome de utilizador para Matrix",
|
"form.integration.matrix_bot_user": "Nome de utilizador para Matrix",
|
||||||
"form.integration.matrix_bot_password": "Palavra-passe para utilizador da Matrix",
|
"form.integration.matrix_bot_password": "Palavra-passe para utilizador da Matrix",
|
||||||
|
|
|
@ -363,6 +363,7 @@
|
||||||
"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 key",
|
"form.integration.linkding_api_key": "Linkding API key",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Перенос новых статей в Матрицу",
|
"form.integration.matrix_bot_activate": "Перенос новых статей в Матрицу",
|
||||||
"form.integration.matrix_bot_user": "Имя пользователя для Matrix",
|
"form.integration.matrix_bot_user": "Имя пользователя для Matrix",
|
||||||
"form.integration.matrix_bot_password": "Пароль для пользователя Matrix",
|
"form.integration.matrix_bot_password": "Пароль для пользователя Matrix",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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ı",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Yeni makaleleri Matrix'e aktarın",
|
"form.integration.matrix_bot_activate": "Yeni makaleleri Matrix'e aktarın",
|
||||||
"form.integration.matrix_bot_user": "Matrix için Kullanıcı Adı",
|
"form.integration.matrix_bot_user": "Matrix için Kullanıcı Adı",
|
||||||
"form.integration.matrix_bot_password": "Matrix kullanıcısı için şifre",
|
"form.integration.matrix_bot_password": "Matrix kullanıcısı için şifre",
|
||||||
|
|
|
@ -360,6 +360,7 @@
|
||||||
"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",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "Перенесення нових статей в Матрицю",
|
"form.integration.matrix_bot_activate": "Перенесення нових статей в Матрицю",
|
||||||
"form.integration.matrix_bot_user": "Ім'я користувача для Matrix",
|
"form.integration.matrix_bot_user": "Ім'я користувача для Matrix",
|
||||||
"form.integration.matrix_bot_password": "Пароль для користувача Matrix",
|
"form.integration.matrix_bot_password": "Пароль для користувача Matrix",
|
||||||
|
|
|
@ -359,6 +359,7 @@
|
||||||
"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 密钥",
|
||||||
|
"form.integration.linkding_tags": "Linkding 默认标签",
|
||||||
"form.integration.matrix_bot_activate": "将新文章转移到 Matrix",
|
"form.integration.matrix_bot_activate": "将新文章转移到 Matrix",
|
||||||
"form.integration.matrix_bot_user": "矩阵的用户名",
|
"form.integration.matrix_bot_user": "矩阵的用户名",
|
||||||
"form.integration.matrix_bot_password": "矩阵用户密码",
|
"form.integration.matrix_bot_password": "矩阵用户密码",
|
||||||
|
|
|
@ -361,6 +361,7 @@
|
||||||
"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 金鑰",
|
||||||
|
"form.integration.linkding_tags": "Linkding Tags",
|
||||||
"form.integration.matrix_bot_activate": "將新文章轉移到 Matrix",
|
"form.integration.matrix_bot_activate": "將新文章轉移到 Matrix",
|
||||||
"form.integration.matrix_bot_user": "矩陣的用戶名",
|
"form.integration.matrix_bot_user": "矩陣的用戶名",
|
||||||
"form.integration.matrix_bot_password": "矩陣用戶密碼",
|
"form.integration.matrix_bot_password": "矩陣用戶密碼",
|
||||||
|
|
|
@ -43,6 +43,7 @@ type Integration struct {
|
||||||
LinkdingEnabled bool
|
LinkdingEnabled bool
|
||||||
LinkdingURL string
|
LinkdingURL string
|
||||||
LinkdingAPIKey string
|
LinkdingAPIKey string
|
||||||
|
LinkdingTags string
|
||||||
MatrixBotEnabled bool
|
MatrixBotEnabled bool
|
||||||
MatrixBotUser string
|
MatrixBotUser string
|
||||||
MatrixBotPassword string
|
MatrixBotPassword string
|
||||||
|
|
|
@ -147,6 +147,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
|
||||||
linkding_enabled,
|
linkding_enabled,
|
||||||
linkding_url,
|
linkding_url,
|
||||||
linkding_api_key,
|
linkding_api_key,
|
||||||
|
linkding_tags,
|
||||||
matrix_bot_enabled,
|
matrix_bot_enabled,
|
||||||
matrix_bot_user,
|
matrix_bot_user,
|
||||||
matrix_bot_password,
|
matrix_bot_password,
|
||||||
|
@ -196,6 +197,7 @@ func (s *Storage) Integration(userID int64) (*model.Integration, error) {
|
||||||
&integration.LinkdingEnabled,
|
&integration.LinkdingEnabled,
|
||||||
&integration.LinkdingURL,
|
&integration.LinkdingURL,
|
||||||
&integration.LinkdingAPIKey,
|
&integration.LinkdingAPIKey,
|
||||||
|
&integration.LinkdingTags,
|
||||||
&integration.MatrixBotEnabled,
|
&integration.MatrixBotEnabled,
|
||||||
&integration.MatrixBotUser,
|
&integration.MatrixBotUser,
|
||||||
&integration.MatrixBotPassword,
|
&integration.MatrixBotPassword,
|
||||||
|
@ -260,13 +262,14 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
|
||||||
linkding_enabled=$34,
|
linkding_enabled=$34,
|
||||||
linkding_url=$35,
|
linkding_url=$35,
|
||||||
linkding_api_key=$36,
|
linkding_api_key=$36,
|
||||||
matrix_bot_enabled=$37,
|
linkding_tags=$37,
|
||||||
matrix_bot_user=$38,
|
matrix_bot_enabled=$38,
|
||||||
matrix_bot_password=$39,
|
matrix_bot_user=$39,
|
||||||
matrix_bot_url=$40,
|
matrix_bot_password=$40,
|
||||||
matrix_bot_chat_id=$41
|
matrix_bot_url=$41,
|
||||||
|
matrix_bot_chat_id=$42
|
||||||
WHERE
|
WHERE
|
||||||
user_id=$42
|
user_id=$43
|
||||||
`
|
`
|
||||||
_, err = s.db.Exec(
|
_, err = s.db.Exec(
|
||||||
query,
|
query,
|
||||||
|
@ -306,6 +309,7 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
|
||||||
integration.LinkdingEnabled,
|
integration.LinkdingEnabled,
|
||||||
integration.LinkdingURL,
|
integration.LinkdingURL,
|
||||||
integration.LinkdingAPIKey,
|
integration.LinkdingAPIKey,
|
||||||
|
integration.LinkdingTags,
|
||||||
integration.MatrixBotEnabled,
|
integration.MatrixBotEnabled,
|
||||||
integration.MatrixBotUser,
|
integration.MatrixBotUser,
|
||||||
integration.MatrixBotPassword,
|
integration.MatrixBotPassword,
|
||||||
|
@ -354,13 +358,14 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
|
||||||
linkding_enabled=$34,
|
linkding_enabled=$34,
|
||||||
linkding_url=$35,
|
linkding_url=$35,
|
||||||
linkding_api_key=$36,
|
linkding_api_key=$36,
|
||||||
matrix_bot_enabled=$37,
|
linkding_tags=$37,
|
||||||
matrix_bot_user=$38,
|
matrix_bot_enabled=$38,
|
||||||
matrix_bot_password=$39,
|
matrix_bot_user=$39,
|
||||||
matrix_bot_url=$40,
|
matrix_bot_password=$40,
|
||||||
matrix_bot_chat_id=$41
|
matrix_bot_url=$41,
|
||||||
|
matrix_bot_chat_id=$42
|
||||||
WHERE
|
WHERE
|
||||||
user_id=$42
|
user_id=$43
|
||||||
`
|
`
|
||||||
_, err = s.db.Exec(
|
_, err = s.db.Exec(
|
||||||
query,
|
query,
|
||||||
|
@ -400,6 +405,7 @@ func (s *Storage) UpdateIntegration(integration *model.Integration) error {
|
||||||
integration.LinkdingEnabled,
|
integration.LinkdingEnabled,
|
||||||
integration.LinkdingURL,
|
integration.LinkdingURL,
|
||||||
integration.LinkdingAPIKey,
|
integration.LinkdingAPIKey,
|
||||||
|
integration.LinkdingTags,
|
||||||
integration.MatrixBotEnabled,
|
integration.MatrixBotEnabled,
|
||||||
integration.MatrixBotUser,
|
integration.MatrixBotUser,
|
||||||
integration.MatrixBotPassword,
|
integration.MatrixBotPassword,
|
||||||
|
|
|
@ -192,6 +192,9 @@
|
||||||
<label for="form-linkding-api-key">{{ t "form.integration.linkding_api_key" }}</label>
|
<label for="form-linkding-api-key">{{ t "form.integration.linkding_api_key" }}</label>
|
||||||
<input type="text" name="linkding_api_key" id="form-linkding-api-key" value="{{ .form.LinkdingAPIKey }}" spellcheck="false">
|
<input type="text" name="linkding_api_key" id="form-linkding-api-key" value="{{ .form.LinkdingAPIKey }}" spellcheck="false">
|
||||||
|
|
||||||
|
<label for="form-linkding-tags">{{ t "form.integration.linkding_tags" }}</label>
|
||||||
|
<input type="text" name="linkding_tags" id="form-linkding-tags" value="{{ .form.LinkdingTags }}" spellcheck="false">
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button>
|
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -48,6 +48,7 @@ type IntegrationForm struct {
|
||||||
LinkdingEnabled bool
|
LinkdingEnabled bool
|
||||||
LinkdingURL string
|
LinkdingURL string
|
||||||
LinkdingAPIKey string
|
LinkdingAPIKey string
|
||||||
|
LinkdingTags string
|
||||||
MatrixBotEnabled bool
|
MatrixBotEnabled bool
|
||||||
MatrixBotUser string
|
MatrixBotUser string
|
||||||
MatrixBotPassword string
|
MatrixBotPassword string
|
||||||
|
@ -91,6 +92,7 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
|
||||||
integration.LinkdingEnabled = i.LinkdingEnabled
|
integration.LinkdingEnabled = i.LinkdingEnabled
|
||||||
integration.LinkdingURL = i.LinkdingURL
|
integration.LinkdingURL = i.LinkdingURL
|
||||||
integration.LinkdingAPIKey = i.LinkdingAPIKey
|
integration.LinkdingAPIKey = i.LinkdingAPIKey
|
||||||
|
integration.LinkdingTags = i.LinkdingTags
|
||||||
integration.MatrixBotEnabled = i.MatrixBotEnabled
|
integration.MatrixBotEnabled = i.MatrixBotEnabled
|
||||||
integration.MatrixBotUser = i.MatrixBotUser
|
integration.MatrixBotUser = i.MatrixBotUser
|
||||||
integration.MatrixBotPassword = i.MatrixBotPassword
|
integration.MatrixBotPassword = i.MatrixBotPassword
|
||||||
|
@ -137,6 +139,7 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
|
||||||
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"),
|
||||||
|
LinkdingTags: r.FormValue("linkding_tags"),
|
||||||
MatrixBotEnabled: r.FormValue("matrix_bot_enabled") == "1",
|
MatrixBotEnabled: r.FormValue("matrix_bot_enabled") == "1",
|
||||||
MatrixBotUser: r.FormValue("matrix_bot_user"),
|
MatrixBotUser: r.FormValue("matrix_bot_user"),
|
||||||
MatrixBotPassword: r.FormValue("matrix_bot_password"),
|
MatrixBotPassword: r.FormValue("matrix_bot_password"),
|
||||||
|
|
|
@ -63,6 +63,7 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
|
||||||
LinkdingEnabled: integration.LinkdingEnabled,
|
LinkdingEnabled: integration.LinkdingEnabled,
|
||||||
LinkdingURL: integration.LinkdingURL,
|
LinkdingURL: integration.LinkdingURL,
|
||||||
LinkdingAPIKey: integration.LinkdingAPIKey,
|
LinkdingAPIKey: integration.LinkdingAPIKey,
|
||||||
|
LinkdingTags: integration.LinkdingTags,
|
||||||
MatrixBotEnabled: integration.MatrixBotEnabled,
|
MatrixBotEnabled: integration.MatrixBotEnabled,
|
||||||
MatrixBotUser: integration.MatrixBotUser,
|
MatrixBotUser: integration.MatrixBotUser,
|
||||||
MatrixBotPassword: integration.MatrixBotPassword,
|
MatrixBotPassword: integration.MatrixBotPassword,
|
||||||
|
|
Loading…
Reference in a new issue