|
|
@@ -35,12 +35,9 @@ func (c *Client) CreateBookmark(entryURL, entryTitle string) error {
|
|
|
return fmt.Errorf(`linkwarden: invalid API endpoint: %v`, err)
|
|
|
}
|
|
|
|
|
|
- requestBody, err := json.Marshal(&linkwardenBookmark{
|
|
|
- Url: entryURL,
|
|
|
- Name: entryTitle,
|
|
|
- Description: "",
|
|
|
- Tags: []string{},
|
|
|
- Collection: map[string]any{},
|
|
|
+ requestBody, err := json.Marshal(map[string]string{
|
|
|
+ "url": entryURL,
|
|
|
+ "name": entryTitle,
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
@@ -54,8 +51,7 @@ func (c *Client) CreateBookmark(entryURL, entryTitle string) error {
|
|
|
|
|
|
request.Header.Set("Content-Type", "application/json")
|
|
|
request.Header.Set("User-Agent", "Miniflux/"+version.Version)
|
|
|
- request.AddCookie(&http.Cookie{Name: "__Secure-next-auth.session-token", Value: c.apiKey})
|
|
|
- request.AddCookie(&http.Cookie{Name: "next-auth.session-token", Value: c.apiKey})
|
|
|
+ request.Header.Set("Authorization", "Bearer "+c.apiKey)
|
|
|
|
|
|
httpClient := &http.Client{Timeout: defaultClientTimeout}
|
|
|
response, err := httpClient.Do(request)
|
|
|
@@ -70,11 +66,3 @@ func (c *Client) CreateBookmark(entryURL, entryTitle string) error {
|
|
|
|
|
|
return nil
|
|
|
}
|
|
|
-
|
|
|
-type linkwardenBookmark struct {
|
|
|
- Url string `json:"url"`
|
|
|
- Name string `json:"name"`
|
|
|
- Description string `json:"description"`
|
|
|
- Tags []string `json:"tags"`
|
|
|
- Collection map[string]any `json:"collection"`
|
|
|
-}
|