mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
feat(integration): add LinkTaco service for saving articles
This commit is contained in:
parent
983291c78b
commit
4d656d2739
31 changed files with 939 additions and 5 deletions
|
@ -62,6 +62,11 @@ type IntegrationForm struct {
|
|||
LinkdingAPIKey string
|
||||
LinkdingTags string
|
||||
LinkdingMarkAsUnread bool
|
||||
LinktacoEnabled bool
|
||||
LinktacoAPIToken string
|
||||
LinktacoOrgSlug string
|
||||
LinktacoTags string
|
||||
LinktacoVisibility string
|
||||
LinkwardenEnabled bool
|
||||
LinkwardenURL string
|
||||
LinkwardenAPIKey string
|
||||
|
@ -175,6 +180,11 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
|
|||
integration.LinkdingAPIKey = i.LinkdingAPIKey
|
||||
integration.LinkdingTags = i.LinkdingTags
|
||||
integration.LinkdingMarkAsUnread = i.LinkdingMarkAsUnread
|
||||
integration.LinktacoEnabled = i.LinktacoEnabled
|
||||
integration.LinktacoAPIToken = i.LinktacoAPIToken
|
||||
integration.LinktacoOrgSlug = i.LinktacoOrgSlug
|
||||
integration.LinktacoTags = i.LinktacoTags
|
||||
integration.LinktacoVisibility = i.LinktacoVisibility
|
||||
integration.LinkwardenEnabled = i.LinkwardenEnabled
|
||||
integration.LinkwardenURL = i.LinkwardenURL
|
||||
integration.LinkwardenAPIKey = i.LinkwardenAPIKey
|
||||
|
@ -290,6 +300,11 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
|
|||
LinkdingAPIKey: r.FormValue("linkding_api_key"),
|
||||
LinkdingTags: r.FormValue("linkding_tags"),
|
||||
LinkdingMarkAsUnread: r.FormValue("linkding_mark_as_unread") == "1",
|
||||
LinktacoEnabled: r.FormValue("linktaco_enabled") == "1",
|
||||
LinktacoAPIToken: r.FormValue("linktaco_api_token"),
|
||||
LinktacoOrgSlug: r.FormValue("linktaco_org_slug"),
|
||||
LinktacoTags: r.FormValue("linktaco_tags"),
|
||||
LinktacoVisibility: r.FormValue("linktaco_visibility"),
|
||||
LinkwardenEnabled: r.FormValue("linkwarden_enabled") == "1",
|
||||
LinkwardenURL: r.FormValue("linkwarden_url"),
|
||||
LinkwardenAPIKey: r.FormValue("linkwarden_api_key"),
|
||||
|
|
|
@ -75,6 +75,11 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
|
|||
LinkdingAPIKey: integration.LinkdingAPIKey,
|
||||
LinkdingTags: integration.LinkdingTags,
|
||||
LinkdingMarkAsUnread: integration.LinkdingMarkAsUnread,
|
||||
LinktacoEnabled: integration.LinktacoEnabled,
|
||||
LinktacoAPIToken: integration.LinktacoAPIToken,
|
||||
LinktacoOrgSlug: integration.LinktacoOrgSlug,
|
||||
LinktacoTags: integration.LinktacoTags,
|
||||
LinktacoVisibility: integration.LinktacoVisibility,
|
||||
LinkwardenEnabled: integration.LinkwardenEnabled,
|
||||
LinkwardenURL: integration.LinkwardenURL,
|
||||
LinkwardenAPIKey: integration.LinkwardenAPIKey,
|
||||
|
|
|
@ -75,6 +75,17 @@ func (h *handler) updateIntegration(w http.ResponseWriter, r *http.Request) {
|
|||
integration.WebhookSecret = ""
|
||||
}
|
||||
|
||||
if integrationForm.LinktacoEnabled {
|
||||
if integrationForm.LinktacoAPIToken == "" || integrationForm.LinktacoOrgSlug == "" {
|
||||
sess.NewFlashErrorMessage(printer.Print("error.linktaco_missing_required_fields"))
|
||||
html.Redirect(w, r, route.Path(h.router, "integrations"))
|
||||
return
|
||||
}
|
||||
if integration.LinktacoVisibility == "" {
|
||||
integration.LinktacoVisibility = "PUBLIC"
|
||||
}
|
||||
}
|
||||
|
||||
err = h.store.UpdateIntegration(integration)
|
||||
if err != nil {
|
||||
html.ServerError(w, r, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue