diff --git a/internal/integration/integration.go b/internal/integration/integration.go index 2cd68ad8..bec8b436 100644 --- a/internal/integration/integration.go +++ b/internal/integration/integration.go @@ -108,6 +108,7 @@ func SendEntry(entry *model.Entry, userIntegrations *model.Integration) { if userIntegrations.WallabagEnabled { slog.Debug("Sending entry to Wallabag", slog.Int64("user_id", userIntegrations.UserID), + slog.String("user_tags", userIntegrations.WallabagTags), slog.Int64("entry_id", entry.ID), slog.String("entry_url", entry.URL), ) @@ -118,12 +119,14 @@ func SendEntry(entry *model.Entry, userIntegrations *model.Integration) { userIntegrations.WallabagClientSecret, userIntegrations.WallabagUsername, userIntegrations.WallabagPassword, + userIntegrations.WallabagTags, userIntegrations.WallabagOnlyURL, ) if err := client.CreateEntry(entry.URL, entry.Title, entry.Content); err != nil { slog.Error("Unable to send entry to Wallabag", slog.Int64("user_id", userIntegrations.UserID), + slog.String("user_tags", userIntegrations.WallabagTags), slog.Int64("entry_id", entry.ID), slog.String("entry_url", entry.URL), slog.Any("error", err), diff --git a/internal/integration/wallabag/wallabag.go b/internal/integration/wallabag/wallabag.go index 110e6561..dcc84337 100644 --- a/internal/integration/wallabag/wallabag.go +++ b/internal/integration/wallabag/wallabag.go @@ -24,11 +24,12 @@ type Client struct { clientSecret string username string password string + tags string onlyURL bool } -func NewClient(baseURL, clientID, clientSecret, username, password string, onlyURL bool) *Client { - return &Client{baseURL, clientID, clientSecret, username, password, onlyURL} +func NewClient(baseURL, clientID, clientSecret, username, password, tags string, onlyURL bool) *Client { + return &Client{baseURL, clientID, clientSecret, username, password, tags, onlyURL} } func (c *Client) CreateEntry(entryURL, entryTitle, entryContent string) error { @@ -41,10 +42,10 @@ func (c *Client) CreateEntry(entryURL, entryTitle, entryContent string) error { return err } - return c.createEntry(accessToken, entryURL, entryTitle, entryContent) + return c.createEntry(accessToken, entryURL, entryTitle, entryContent, c.tags) } -func (c *Client) createEntry(accessToken, entryURL, entryTitle, entryContent string) error { +func (c *Client) createEntry(accessToken, entryURL, entryTitle, entryContent, tags string) error { apiEndpoint, err := urllib.JoinBaseURLAndPath(c.baseURL, "/api/entries.json") if err != nil { return fmt.Errorf("wallbag: unable to generate entries endpoint: %v", err) @@ -58,6 +59,7 @@ func (c *Client) createEntry(accessToken, entryURL, entryTitle, entryContent str URL: entryURL, Title: entryTitle, Content: entryContent, + Tags: tags, }) if err != nil { return fmt.Errorf("wallbag: unable to encode request body: %v", err) @@ -140,4 +142,5 @@ type createEntryRequest struct { URL string `json:"url"` Title string `json:"title"` Content string `json:"content,omitempty"` + Tags string `json:"tags,omitempty"` } diff --git a/internal/template/templates/views/integrations.html b/internal/template/templates/views/integrations.html index 491ae12a..8ce2b933 100644 --- a/internal/template/templates/views/integrations.html +++ b/internal/template/templates/views/integrations.html @@ -664,6 +664,9 @@ + + +
diff --git a/internal/ui/form/integration.go b/internal/ui/form/integration.go index 4d4e29c3..a5b03c18 100644 --- a/internal/ui/form/integration.go +++ b/internal/ui/form/integration.go @@ -32,6 +32,7 @@ type IntegrationForm struct { WallabagClientSecret string WallabagUsername string WallabagPassword string + WallabagTags string NotionEnabled bool NotionPageID string NotionToken string @@ -150,6 +151,7 @@ func (i IntegrationForm) Merge(integration *model.Integration) { integration.WallabagClientSecret = i.WallabagClientSecret integration.WallabagUsername = i.WallabagUsername integration.WallabagPassword = i.WallabagPassword + integration.WallabagTags = i.WallabagTags integration.NotionEnabled = i.NotionEnabled integration.NotionPageID = i.NotionPageID integration.NotionToken = i.NotionToken @@ -270,6 +272,7 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm { WallabagClientSecret: r.FormValue("wallabag_client_secret"), WallabagUsername: r.FormValue("wallabag_username"), WallabagPassword: r.FormValue("wallabag_password"), + WallabagTags: r.FormValue("wallabag_tags"), NotionEnabled: r.FormValue("notion_enabled") == "1", NotionPageID: r.FormValue("notion_page_id"), NotionToken: r.FormValue("notion_token"), diff --git a/internal/ui/integration_show.go b/internal/ui/integration_show.go index d26c02cc..13cc18d3 100644 --- a/internal/ui/integration_show.go +++ b/internal/ui/integration_show.go @@ -45,6 +45,7 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) { WallabagClientSecret: integration.WallabagClientSecret, WallabagUsername: integration.WallabagUsername, WallabagPassword: integration.WallabagPassword, + WallabagTags: integration.WallabagTags, NotionEnabled: integration.NotionEnabled, NotionPageID: integration.NotionPageID, NotionToken: integration.NotionToken,